"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6216],{63014:function(t,e,i){i.r(e),i.d(e,{default:function(){return b}});var s=i(2265);let n="https://player.twitch.tv",a=/(?:www\.|go\.)?twitch\.tv\/(?:videos?\/|\?video=)(\d+)($|\?)/,r=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,o={IDLE:"Idle",ENDED:"Ended"};function l(t,e={}){let i={src:u(t,e),frameborder:"0",width:"100%",height:"100%",allow:"accelerometer; fullscreen; autoplay; encrypted-media; picture-in-picture;",sandbox:"allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",scrolling:"no"};return e.config&&(i["data-config"]=JSON.stringify(e.config)),`
    <style>
      :host {
        display: inline-block;
        min-width: 300px;
        min-height: 150px;
        position: relative;
      }
      iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }
      :host(:not([controls])) {
        pointer-events: none;
      }
    </style>
    <iframe${function(t){let e="";for(let i in t){let s=t[i];""===s?e+=` ${h(i)}`:e+=` ${h(i)}="${h(`${s}`)}"`}return e}(i)}></iframe>
  `}function u(t,e){var i;if(!t.src)return;let s=t.src.match(a),o=t.src.match(r),l={parent:null==(i=globalThis.location)?void 0:i.hostname,controls:""===t.controls&&null,autoplay:""===t.autoplay&&null,muted:t.muted,preload:t.preload,...e.config};if(s){let t=s[1];return`${n}/?video=v${t}&${c(l)}`}if(o){let t=o[1];return`${n}/?channel=${t}&${c(l)}`}return""}class d extends(globalThis.HTMLElement??class{}){static getTemplateHTML=l;static shadowRootOptions={mode:"open"};static observedAttributes=["autoplay","controls","loop","muted","playsinline","preload","src"];loadComplete=new p;#t;#e;#i;#s={};#n=0;#a=!1;#r=1;#o=!this.autoplay;#l=!1;#u=0;#d=null;constructor(){super(),this.#h("config")}get config(){return this.#d}set config(t){this.#d=t}async load(){if(this.#t)return;this.shadowRoot||this.attachShadow({mode:"open"});let t=!this.#e;if(this.#e&&(this.loadComplete=new p),this.#e=!0,await (this.#t=Promise.resolve()),this.#t=null,this.#u=0,this.dispatchEvent(new Event("emptied")),!this.src){this.shadowRoot.innerHTML="",globalThis.removeEventListener("message",this.#c);return}this.dispatchEvent(new Event("loadstart"));let e=this.shadowRoot.querySelector("iframe"),i=function(t){let e={};for(let i of t)e[i.name]=i.value;return e}(this.attributes);t&&e&&(this.#d=JSON.parse(e.getAttribute("data-config")||"{}")),(null==e?void 0:e.src)&&e.src===u(i,this)||(this.shadowRoot.innerHTML=l(i,this),e=this.shadowRoot.querySelector("iframe")),this.#i=e,globalThis.addEventListener("message",this.#c)}attributeChangedCallback(t,e,i){if(e!==i)switch(t){case"src":case"controls":this.load()}}getVideoPlaybackQuality(){return this.#s.stats.videoStats}get src(){return this.getAttribute("src")}set src(t){this.setAttribute("src",t)}get readyState(){return this.#u}get seeking(){return this.#l}get buffered(){var t,e,i;return i=(null==(e=null==(t=this.#s.stats)?void 0:t.videoStats)?void 0:e.bufferSize)??0,Array.isArray(0)?m(0):null==i||0===i?m([[0,0]]):m([[0,i]])}get paused(){return this.#s.playback?this.#s.playback===o.IDLE:this.#o}get ended(){return!!this.#s.playback&&this.#s.playback===o.ENDED}get duration(){return this.#s.duration??NaN}get autoplay(){return this.hasAttribute("autoplay")}set autoplay(t){this.autoplay!=t&&this.toggleAttribute("autoplay",!!t)}get controls(){return this.hasAttribute("controls")}set controls(t){this.controls!=t&&this.toggleAttribute("controls",!!t)}get currentTime(){return this.#s.currentTime?this.#s.currentTime:this.#n}set currentTime(t){this.#n=t,this.loadComplete.then(()=>{this.#p(4,t)})}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(t){this.toggleAttribute("muted",!!t)}get loop(){return this.hasAttribute("loop")}set loop(t){this.toggleAttribute("loop",!!t)}get muted(){return this.#a}set muted(t){this.#a=t,this.loadComplete.then(()=>{this.#p(10,t)})}get volume(){return this.#r}set volume(t){this.#r=t,this.loadComplete.then(()=>{this.#p(11,t)})}get playsInline(){return this.hasAttribute("playsinline")}set playsInline(t){this.toggleAttribute("playsinline",!!t)}play(){this.#o=!1,this.#p(3)}pause(){this.#o=!0,this.#p(2)}#c=async t=>{var e,i,s,n;if(!this.#i.contentWindow)return;let{data:a,source:r}=t;if(!(r!==this.#i.contentWindow)){if("twitch-embed"===a.namespace)await new Promise(t=>setTimeout(t,10)),"ready"===a.eventName?(this.dispatchEvent(new Event("loadcomplete")),this.loadComplete.resolve(),this.#u=1,this.dispatchEvent(new Event("loadedmetadata"))):"seek"===a.eventName?(this.#l=!0,this.dispatchEvent(new Event("seeking"))):"playing"===a.eventName?(this.#l&&(this.#l=!1,this.dispatchEvent(new Event("seeked"))),this.#u=3,this.dispatchEvent(new Event("playing"))):this.dispatchEvent(new Event(a.eventName));else if("twitch-embed-player-proxy"===a.namespace&&"UPDATE_STATE"===a.eventName){let t=this.#s.duration,r=this.#s.currentTime,o=this.#s.volume,l=this.#s.muted,u=null==(i=null==(e=this.#s.stats)?void 0:e.videoStats)?void 0:i.bufferSize;this.#s={...this.#s,...a.params},t!==this.#s.duration&&this.dispatchEvent(new Event("durationchange")),r!==this.#s.currentTime&&this.dispatchEvent(new Event("timeupdate")),(o!==this.#s.volume||l!==this.#s.muted)&&(void 0!==this.#s.volume&&(this.#r=this.#s.volume),void 0!==this.#s.muted&&(this.#a=this.#s.muted),this.dispatchEvent(new Event("volumechange"))),u!==(null==(n=null==(s=this.#s.stats)?void 0:s.videoStats)?void 0:n.bufferSize)&&this.dispatchEvent(new Event("progress"))}}};#p(t,e){this.#i.contentWindow&&this.#i.contentWindow.postMessage({eventName:t,params:e,namespace:"twitch-embed-player-proxy"},n)}#h(t){if(Object.prototype.hasOwnProperty.call(this,t)){let e=this[t];delete this[t],this[t]=e}}}function h(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/`/g,"&#x60;")}function c(t){return String(new URLSearchParams(function(t){let e={};for(let i in t){let s=t[i];!0===s||""===s?e[i]=!0:!1===s?e[i]=!1:null!=s&&(e[i]=s)}return e}(t)))}class p extends Promise{constructor(t=()=>{}){let e,i;super((s,n)=>{t(s,n),e=s,i=n}),this.resolve=e,this.reject=i}}function m(t){return Object.defineProperties(t,{start:{value:e=>t[e][0]},end:{value:e=>t[e][1]}}),t}globalThis.customElements&&!globalThis.customElements.get("twitch-video")&&globalThis.customElements.define("twitch-video",d);var f=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),v={className:"class",htmlFor:"for"};function g(t){return t.toLowerCase()}function y(t){return"boolean"==typeof t?t?"":void 0:"function"==typeof t?void 0:"object"!=typeof t||null===t?t:void 0}function w(t,e,i){var s,n;t[e]=i,null==i&&e in(null!==(n=null==(s=globalThis.HTMLElement)?void 0:s.prototype)&&void 0!==n?n:{})&&t.removeAttribute(e)}var b=function(t){let{react:e,tagName:i,elementClass:s,events:n,displayName:a,defaultProps:r,toAttributeName:o=g,toAttributeValue:l=y}=t,u=Number.parseInt(e.version)>=19,d=e.forwardRef((t,a)=>{var d,h,c,p,m;let g=e.useRef(null),b=e.useRef(new Map),E={},S={},T={},L={};for(let[e,i]of Object.entries(t)){if(f.has(e)){T[e]=i;continue}let t=o(null!==(c=v[e])&&void 0!==c?c:e);if(s.prototype&&e in s.prototype&&!(e in(null!==(p=null==(d=globalThis.HTMLElement)?void 0:d.prototype)&&void 0!==p?p:{}))&&!(null==(h=s.observedAttributes)?void 0:h.some(e=>e===t))){L[e]=i;continue}if(e.startsWith("on")){E[e]=i;continue}let n=l(i);t&&null!=n&&(S[t]=String(n),u||(T[t]=n)),t&&u&&(n!==y(i)?T[t]=n:T[t]=i)}if("undefined"!=typeof window){for(let t in E){let i=E[t],s=t.endsWith("Capture"),a=(null!==(m=null==n?void 0:n[t])&&void 0!==m?m:t.slice(2).toLowerCase()).slice(0,s?-7:void 0);e.useLayoutEffect(()=>{let t=null==g?void 0:g.current;if(t&&"function"==typeof i)return t.addEventListener(a,i,s),()=>{t.removeEventListener(a,i,s)}},[null==g?void 0:g.current,i])}e.useLayoutEffect(()=>{if(null===g.current)return;let t=new Map;for(let e in L)w(g.current,e,L[e]),b.current.delete(e),t.set(e,L[e]);for(let[t,e]of b.current)w(g.current,t,void 0);b.current=t})}if("undefined"==typeof window&&(null==s?void 0:s.getTemplateHTML)&&(null==s?void 0:s.shadowRootOptions)){let{mode:i,delegatesFocus:n}=s.shadowRootOptions,a=e.createElement("template",{shadowrootmode:i,shadowrootdelegatesfocus:n,dangerouslySetInnerHTML:{__html:s.getTemplateHTML(S,t)},key:"ce-la-react-ssr-template-shadow-root"});T.children=[a,T.children]}return e.createElement(i,{...r,...T,ref:e.useCallback(t=>{g.current=t,"function"==typeof a?a(t):null!==a&&(a.current=t)},[a])},T.children)});return d.displayName=null!=a?a:s.name,d}({react:s,tagName:"twitch-video",elementClass:d,toAttributeName:t=>"muted"===t?"":"defaultMuted"===t?"muted":g(t)})}}]);