var ui=Object.defineProperty;var hi=Object.getPrototypeOf;var li=Reflect.get;var Ae=e=>{throw TypeError(e)};var fi=(e,i,t)=>i in e?ui(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var E=(e,i,t)=>fi(e,typeof i!="symbol"?i+"":i,t),de=(e,i,t)=>i.has(e)||Ae("Cannot "+t);var r=(e,i,t)=>(de(e,i,"read from private field"),t?t.call(e):i.get(e)),l=(e,i,t)=>i.has(e)?Ae("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,t),u=(e,i,t,s)=>(de(e,i,"write to private field"),s?s.call(e,t):i.set(e,t),t),v=(e,i,t)=>(de(e,i,"access private method"),t);var jt=(e,i,t)=>li(hi(e),t,i);var gt=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class e extends gt{}globalThis.DocumentFragment=e}var Lt=class extends gt{},ce=class extends gt{},mi={get(e){},define(e,i,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(Lt)}},Mt,ue=class{constructor(i,t={}){l(this,Mt);u(this,Mt,t==null?void 0:t.detail)}get detail(){return r(this,Mt)}initCustomEvent(){}};Mt=new WeakMap;function pi(e,i){return new Lt}var ke={document:{createElement:pi},DocumentFragment,customElements:mi,CustomEvent:ue,EventTarget:gt,HTMLElement:Lt,HTMLVideoElement:ce},Se=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Wt=Se?ke:globalThis,Zi=Se?ke.document:globalThis.document;import{initialize as Ii,teardown as Oi,generatePlayerInitTime as Li,PlaybackTypes as oe,toMuxVideoURL as Mi,MediaError as Rs,getError as wi,CmcdTypeValues as ai,addCuePoints as xi,getCuePoints as Ni,getActiveCuePoint as Di,addChapters as Vi,getActiveChapter as Gi,getStartDate as Fi,getCurrentPdt as Bi,getStreamType as Ki,getTargetLiveWindow as Ui,getLiveEdgeStart as qi,getSeekable as Yi,getEnded as Hi,getChapters as ji,toPlaybackIdFromSrc as Wi,toPlaybackIdParts as $i}from"@mux/playback-core";var gi=()=>{try{return"0.25.0"}catch{}return"UNKNOWN"},Ei=gi(),Re=()=>Ei;var fe=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Pe=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function Ti(e){return`
    <style>
      :host {
        display: inline-flex;
        line-height: 0;
        flex-direction: column;
        justify-content: end;
      }

      audio {
        width: 100%;
      }
    </style>
    <slot name="media">
      <audio${xe(e)}></audio>
    </slot>
    <slot></slot>
  `}function bi(e){return`
    <style>
      :host {
        display: inline-block;
        line-height: 0;
      }

      video {
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
        min-height: 100%;
        object-fit: var(--media-object-fit, contain);
        object-position: var(--media-object-position, 50% 50%);
      }

      video::-webkit-media-text-track-container {
        transform: var(--media-webkit-text-track-transform);
        transition: var(--media-webkit-text-track-transition);
      }
    </style>
    <slot name="media">
      <video${xe(e)}></video>
    </slot>
    <slot></slot>
  `}function we(e,{tag:i,is:t}){var h,m,d,T,w,Ie,rt,a,p,R,k,ot,he,Oe,le,Le,Me;let s=(m=(h=globalThis.document)==null?void 0:h.createElement)==null?void 0:m.call(h,i,{is:t}),n=s?vi(s):[];return d=class extends e{constructor(){super(...arguments);l(this,k);l(this,rt,!1);l(this,a,null);l(this,p,new Map);l(this,R);E(this,"get");E(this,"set");E(this,"call")}static get observedAttributes(){var g,P,S;return v(g=d,w,Ie).call(g),[...(S=(P=s==null?void 0:s.constructor)==null?void 0:P.observedAttributes)!=null?S:[],...Pe]}get nativeEl(){var f,g,P,S,A;return v(this,k,ot).call(this),(A=(S=(g=(f=r(this,a))!=null?f:this.querySelector(":scope > [slot=media]"))!=null?g:this.querySelector(i))!=null?S:(P=this.shadowRoot)==null?void 0:P.querySelector(i))!=null?A:null}set nativeEl(f){u(this,a,f)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(f){this.toggleAttribute("muted",f)}get src(){return this.getAttribute("src")}set src(f){this.setAttribute("src",`${f}`)}get preload(){var f,g;return(g=this.getAttribute("preload"))!=null?g:(f=this.nativeEl)==null?void 0:f.preload}set preload(f){this.setAttribute("preload",`${f}`)}init(){var f;if(!this.shadowRoot){this.attachShadow({mode:"open"});let g=yi(this.attributes);t&&(g.is=t),i&&(g.part=i),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(g)}this.nativeEl.muted=this.hasAttribute("muted");for(let g of n)v(this,k,Le).call(this,g);u(this,R,new MutationObserver(v(this,k,Oe).bind(this))),this.shadowRoot.addEventListener("slotchange",this),v(this,k,he).call(this);for(let g of this.constructor.Events)(f=this.shadowRoot)==null||f.addEventListener(g,this,!0)}handleEvent(f){if(f.type==="slotchange"){v(this,k,he).call(this);return}f.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(f.type,{detail:f.detail}))}attributeChangedCallback(f,g,P){v(this,k,ot).call(this),v(this,k,Me).call(this,f,g,P)}connectedCallback(){v(this,k,ot).call(this)}},T=new WeakMap,w=new WeakSet,Ie=function(){if(r(this,T))return;u(this,T,!0);let f=new Set(this.observedAttributes);f.delete("muted");for(let g of n)if(!(g in this.prototype))if(typeof s[g]=="function")this.prototype[g]=function(...P){return v(this,k,ot).call(this),(()=>{var I;if(this.call)return this.call(g,...P);let A=(I=this.nativeEl)==null?void 0:I[g];return A==null?void 0:A.apply(this.nativeEl,P)})()};else{let P={get(){var A,I,Ot;v(this,k,ot).call(this);let S=g.toLowerCase();if(f.has(S)){let pt=this.getAttribute(S);return pt===null?!1:pt===""?!0:pt}return(Ot=(A=this.get)==null?void 0:A.call(this,g))!=null?Ot:(I=this.nativeEl)==null?void 0:I[g]}};g!==g.toUpperCase()&&(P.set=function(S){v(this,k,ot).call(this);let A=g.toLowerCase();if(f.has(A)){S===!0||S===!1||S==null?this.toggleAttribute(A,!!S):this.setAttribute(A,S);return}if(this.set){this.set(g,S);return}this.nativeEl&&(this.nativeEl[g]=S)}),Object.defineProperty(this.prototype,g,P)}},rt=new WeakMap,a=new WeakMap,p=new WeakMap,R=new WeakMap,k=new WeakSet,ot=function(){r(this,rt)||(u(this,rt,!0),this.init())},he=function(){var S;let f=new Map(r(this,p)),g=(S=this.shadowRoot)==null?void 0:S.querySelector("slot:not([name])");(g==null?void 0:g.assignedElements({flatten:!0}).filter(A=>["track","source"].includes(A.localName))).forEach(A=>{var Ot,pt;f.delete(A);let I=r(this,p).get(A);I||(I=A.cloneNode(),r(this,p).set(A,I),(Ot=r(this,R))==null||Ot.observe(A,{attributes:!0})),(pt=this.nativeEl)==null||pt.append(I),v(this,k,le).call(this,I)}),f.forEach((A,I)=>{A.remove(),r(this,p).delete(I)})},Oe=function(f){var g;for(let P of f)if(P.type==="attributes"){let{target:S,attributeName:A}=P,I=r(this,p).get(S);I&&A&&(I.setAttribute(A,(g=S.getAttribute(A))!=null?g:""),v(this,k,le).call(this,I))}},le=function(f){f&&f.localName==="track"&&f.default&&(f.kind==="chapters"||f.kind==="metadata")&&f.track.mode==="disabled"&&(f.track.mode="hidden")},Le=function(f){if(Object.prototype.hasOwnProperty.call(this,f)){let g=this[f];delete this[f],this[f]=g}},Me=function(f,g,P){var S,A,I;["id","class"].includes(f)||!d.observedAttributes.includes(f)&&this.constructor.observedAttributes.includes(f)||(P===null?(S=this.nativeEl)==null||S.removeAttribute(f):((A=this.nativeEl)==null?void 0:A.getAttribute(f))!==P&&((I=this.nativeEl)==null||I.setAttribute(f,P)))},l(d,w),E(d,"getTemplateHTML",i.endsWith("audio")?Ti:bi),E(d,"shadowRootOptions",{mode:"open"}),E(d,"Events",fe),l(d,T,!1),d}function vi(e){let i=[];for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let s=Object.getOwnPropertyNames(t);i.push(...s)}return i}function xe(e){let i="";for(let t in e){if(!Pe.includes(t))continue;let s=e[t];s===""?i+=` ${t}`:i+=` ${t}="${s}"`}return i}function yi(e){let i={};for(let t of e)i[t.name]=t.value;return i}var Ce,$t=we((Ce=globalThis.HTMLElement)!=null?Ce:class{},{tag:"video"}),_e,ir=we((_e=globalThis.HTMLElement)!=null?_e:class{},{tag:"audio"});var D=new WeakMap,Et=class extends Error{},zt=class extends Error{};var Ai=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],Ne=globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(i=>{let t=i.deref();t&&e(t)})}}:Set;function De(e){var i,t,s;(t=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&t.isAvailable?(s=globalThis.cast)!=null&&s.framework?e():customElements.whenDefined("google-cast-button").then(e):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(e)}}function Ve(){return globalThis.chrome}function Ge(){var t;let e="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((t=globalThis.chrome)!=null&&t.cast||document.querySelector(`script[src="${e}"]`))return;let i=document.createElement("script");i.src=e,document.head.append(i)}function U(){var e,i;return(i=(e=globalThis.cast)==null?void 0:e.framework)==null?void 0:i.CastContext.getInstance()}function wt(){var e;return(e=U())==null?void 0:e.getCurrentSession()}function Xt(){var e;return(e=wt())==null?void 0:e.getSessionObj().media[0]}function Fe(e){return new Promise((i,t)=>{Xt().editTracksInfo(e,i,t)})}function Be(e){return new Promise((i,t)=>{Xt().getStatus(e,i,t)})}function me(e){return U().setOptions({...pe(),...e})}function pe(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function ki(e){if(!e)return;let i=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=e.match(i);return t?t[1]:null}function Si(e){let i=e.split(`
`),t=[];for(let s=0;s<i.length;s++)if(i[s].trim().startsWith("#EXT-X-STREAM-INF")){let h=i[s+1]?i[s+1].trim():"";h&&!h.startsWith("#")&&t.push(h)}return t}function Ri(e){return e.split(`
`).find(s=>!s.trim().startsWith("#")&&s.trim()!=="")}async function Ke(e){try{let t=(await fetch(e,{method:"HEAD"})).headers.get("Content-Type");return Ai.some(s=>t===s)}catch(i){return console.error("Error while trying to get the Content-Type of the manifest",i),!1}}async function Ue(e){try{let i=await(await fetch(e)).text(),t=i,s=Si(i);if(s.length>0){let m=new URL(s[0],e).toString();t=await(await fetch(m)).text()}let n=Ri(t);return ki(n)}catch(i){console.error("Error while trying to parse the manifest playlist",i);return}}var Jt=new Ne,q=new WeakSet,L;De(()=>{var e,i,t,s;if(!((i=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&i.isAvailable)){console.debug("chrome.cast.isAvailable",(s=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:s.isAvailable);return}L||(L=cast.framework,U().addEventListener(L.CastContextEventType.CAST_STATE_CHANGED,n=>{Jt.forEach(h=>{var m,d;return(d=(m=D.get(h)).onCastStateChanged)==null?void 0:d.call(m,n)})}),U().addEventListener(L.CastContextEventType.SESSION_STATE_CHANGED,n=>{Jt.forEach(h=>{var m,d;return(d=(m=D.get(h)).onSessionStateChanged)==null?void 0:d.call(m,n)})}),Jt.forEach(n=>{var h,m;return(m=(h=D.get(n)).init)==null?void 0:m.call(h)}))});var qe=0,y,xt,M,V,dt,ct,Y,Qt,_,at,Ye,ge,He,Ee,je,Te,Zt=class extends EventTarget{constructor(t){super();l(this,_);l(this,y);l(this,xt);l(this,M);l(this,V);l(this,dt,"disconnected");l(this,ct,!1);l(this,Y,new Set);l(this,Qt,new WeakMap);u(this,y,t),Jt.add(this),D.set(this,{init:()=>v(this,_,Ee).call(this),onCastStateChanged:()=>v(this,_,ge).call(this),onSessionStateChanged:()=>v(this,_,He).call(this),getCastPlayer:()=>r(this,_,at)}),v(this,_,Ee).call(this)}get state(){return r(this,dt)}async watchAvailability(t){if(r(this,y).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");return r(this,Qt).set(t,++qe),r(this,Y).add(t),qe}async cancelWatchAvailability(t){if(r(this,y).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");t?r(this,Y).delete(t):r(this,Y).clear()}async prompt(){var s,n,h,m;if(r(this,y).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");if(!((n=(s=globalThis.chrome)==null?void 0:s.cast)!=null&&n.isAvailable))throw new zt("The RemotePlayback API is disabled on this platform.");let t=q.has(r(this,y));q.add(r(this,y)),me(r(this,y).castOptions),Object.entries(r(this,V)).forEach(([d,T])=>{r(this,M).controller.addEventListener(d,T)});try{await U().requestSession()}catch(d){if(d==="cancel"){t||q.delete(r(this,y));return}throw new Error(d)}(m=(h=D.get(r(this,y)))==null?void 0:h.loadOnPrompt)==null||m.call(h)}};y=new WeakMap,xt=new WeakMap,M=new WeakMap,V=new WeakMap,dt=new WeakMap,ct=new WeakMap,Y=new WeakMap,Qt=new WeakMap,_=new WeakSet,at=function(){if(q.has(r(this,y)))return r(this,M)},Ye=function(){q.has(r(this,y))&&(Object.entries(r(this,V)).forEach(([t,s])=>{r(this,M).controller.removeEventListener(t,s)}),q.delete(r(this,y)),r(this,y).muted=r(this,M).isMuted,r(this,y).currentTime=r(this,M).savedPlayerState.currentTime,r(this,M).savedPlayerState.isPaused===!1&&r(this,y).play())},ge=function(){let t=U().getCastState();if(q.has(r(this,y))&&t==="CONNECTING"&&(u(this,dt,"connecting"),this.dispatchEvent(new Event("connecting"))),!r(this,ct)&&(t!=null&&t.includes("CONNECT"))){u(this,ct,!0);for(let s of r(this,Y))s(!0)}else if(r(this,ct)&&(!t||t==="NO_DEVICES_AVAILABLE")){u(this,ct,!1);for(let s of r(this,Y))s(!1)}},He=async function(){var s;let{SESSION_RESUMED:t}=L.SessionState;if(U().getSessionState()===t&&r(this,y).castSrc===((s=Xt())==null?void 0:s.media.contentId)){q.add(r(this,y)),Object.entries(r(this,V)).forEach(([n,h])=>{r(this,M).controller.addEventListener(n,h)});try{await Be(new chrome.cast.media.GetStatusRequest)}catch(n){console.error(n)}r(this,V)[L.RemotePlayerEventType.IS_PAUSED_CHANGED](),r(this,V)[L.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Ee=function(){!L||r(this,xt)||(u(this,xt,!0),me(r(this,y).castOptions),r(this,y).textTracks.addEventListener("change",()=>v(this,_,Te).call(this)),v(this,_,ge).call(this),u(this,M,new L.RemotePlayer),new L.RemotePlayerController(r(this,M)),u(this,V,{[L.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:t})=>{t===!0?(u(this,dt,"connected"),this.dispatchEvent(new Event("connect"))):(v(this,_,Ye).call(this),u(this,dt,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[L.RemotePlayerEventType.DURATION_CHANGED]:()=>{r(this,y).dispatchEvent(new Event("durationchange"))},[L.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{r(this,y).dispatchEvent(new Event("volumechange"))},[L.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{r(this,y).dispatchEvent(new Event("volumechange"))},[L.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var t;(t=r(this,_,at))!=null&&t.isMediaLoaded&&r(this,y).dispatchEvent(new Event("timeupdate"))},[L.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{r(this,y).dispatchEvent(new Event("resize"))},[L.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{r(this,y).dispatchEvent(new Event(this.paused?"pause":"play"))},[L.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var t,s;((t=r(this,_,at))==null?void 0:t.playerState)!==chrome.cast.media.PlayerState.PAUSED&&r(this,y).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(s=r(this,_,at))==null?void 0:s.playerState]))},[L.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var t;(t=r(this,_,at))!=null&&t.isMediaLoaded&&(await Promise.resolve(),v(this,_,je).call(this))}}))},je=function(){v(this,_,Te).call(this)},Te=async function(){var a,p,R,k,st;if(!r(this,_,at))return;let s=((p=(a=r(this,M).mediaInfo)==null?void 0:a.tracks)!=null?p:[]).filter(({type:C})=>C===chrome.cast.media.TrackType.TEXT),n=[...r(this,y).textTracks].filter(({kind:C})=>C==="subtitles"||C==="captions"),h=s.map(({language:C,name:nt,trackId:O})=>{var N;let{mode:K}=(N=n.find(ye=>ye.language===C&&ye.label===nt))!=null?N:{};return K?{mode:K,trackId:O}:!1}).filter(Boolean),d=h.filter(({mode:C})=>C!=="showing").map(({trackId:C})=>C),T=h.find(({mode:C})=>C==="showing"),w=(st=(k=(R=wt())==null?void 0:R.getSessionObj().media[0])==null?void 0:k.activeTrackIds)!=null?st:[],B=w;if(w.length&&(B=B.filter(C=>!d.includes(C))),T!=null&&T.trackId&&(B=[...B,T.trackId]),B=[...new Set(B)],!((C,nt)=>C.length===nt.length&&C.every(O=>nt.includes(O)))(w,B))try{let C=new chrome.cast.media.EditTracksInfoRequest(B);await Fe(C)}catch(C){console.error(C)}};var We=e=>{var i,t,s,n,h,m,d,b,$e;return t=class extends e{constructor(){super(...arguments);l(this,d);l(this,s,{paused:!1});l(this,n,pe());l(this,h);l(this,m)}get remote(){return r(this,m)?r(this,m):Ve()?(this.disableRemotePlayback||Ge(),D.set(this,{loadOnPrompt:()=>v(this,d,$e).call(this)}),u(this,m,new Zt(this))):super.remote}attributeChangedCallback(a,p,R){if(super.attributeChangedCallback(a,p,R),a==="cast-receiver"&&R){r(this,n).receiverApplicationId=R;return}if(r(this,d,b))switch(a){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var C,nt;if(!r(this,d,b))return super.load();let a=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);a.customData=this.castCustomData;let p=[...this.querySelectorAll("track")].filter(({kind:O,src:K})=>K&&(O==="subtitles"||O==="captions")),R=[],k=0;if(p.length&&(a.tracks=p.map(O=>{let K=++k;R.length===0&&O.track.mode==="showing"&&R.push(K);let N=new chrome.cast.media.Track(K,chrome.cast.media.TrackType.TEXT);return N.trackContentId=O.src,N.trackContentType="text/vtt",N.subtype=O.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,N.name=O.label,N.language=O.srclang,N})),this.castStreamType==="live"?a.streamType=chrome.cast.media.StreamType.LIVE:a.streamType=chrome.cast.media.StreamType.BUFFERED,a.metadata=new chrome.cast.media.GenericMediaMetadata,a.metadata.title=this.title,a.metadata.images=[{url:this.poster}],Ke(this.castSrc)){let O=await Ue(this.castSrc);((O==null?void 0:O.includes("m4s"))||(O==null?void 0:O.includes("mp4")))&&(a.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,a.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4)}let st=new chrome.cast.media.LoadRequest(a);st.currentTime=(C=super.currentTime)!=null?C:0,st.autoplay=!r(this,s).paused,st.activeTrackIds=R,await((nt=wt())==null?void 0:nt.loadMedia(st)),this.dispatchEvent(new Event("volumechange"))}play(){var a;if(r(this,d,b)){r(this,d,b).isPaused&&((a=r(this,d,b).controller)==null||a.playOrPause());return}return super.play()}pause(){var a;if(r(this,d,b)){r(this,d,b).isPaused||(a=r(this,d,b).controller)==null||a.playOrPause();return}super.pause()}get castOptions(){return r(this,n)}get castReceiver(){var a;return(a=this.getAttribute("cast-receiver"))!=null?a:void 0}set castReceiver(a){this.castReceiver!=a&&this.setAttribute("cast-receiver",`${a}`)}get castSrc(){var a,p,R;return(R=(p=this.getAttribute("cast-src"))!=null?p:(a=this.querySelector("source"))==null?void 0:a.src)!=null?R:this.currentSrc}set castSrc(a){this.castSrc!=a&&this.setAttribute("cast-src",`${a}`)}get castContentType(){var a;return(a=this.getAttribute("cast-content-type"))!=null?a:void 0}set castContentType(a){this.setAttribute("cast-content-type",`${a}`)}get castStreamType(){var a,p;return(p=(a=this.getAttribute("cast-stream-type"))!=null?a:this.streamType)!=null?p:void 0}set castStreamType(a){this.setAttribute("cast-stream-type",`${a}`)}get castCustomData(){return r(this,h)}set castCustomData(a){let p=typeof a;if(!["object","undefined"].includes(p)){console.error(`castCustomData must be nullish or an object but value was of type ${p}`);return}u(this,h,a)}get readyState(){if(r(this,d,b))switch(r(this,d,b).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return r(this,d,b)?r(this,d,b).isPaused:super.paused}get muted(){var a;return r(this,d,b)?(a=r(this,d,b))==null?void 0:a.isMuted:super.muted}set muted(a){var p;if(r(this,d,b)){(a&&!r(this,d,b).isMuted||!a&&r(this,d,b).isMuted)&&((p=r(this,d,b).controller)==null||p.muteOrUnmute());return}super.muted=a}get volume(){var a,p;return r(this,d,b)?(p=(a=r(this,d,b))==null?void 0:a.volumeLevel)!=null?p:1:super.volume}set volume(a){var p;if(r(this,d,b)){r(this,d,b).volumeLevel=+a,(p=r(this,d,b).controller)==null||p.setVolumeLevel();return}super.volume=a}get duration(){var a,p,R;return r(this,d,b)&&((a=r(this,d,b))!=null&&a.isMediaLoaded)?(R=(p=r(this,d,b))==null?void 0:p.duration)!=null?R:NaN:super.duration}get currentTime(){var a,p,R;return r(this,d,b)&&((a=r(this,d,b))!=null&&a.isMediaLoaded)?(R=(p=r(this,d,b))==null?void 0:p.currentTime)!=null?R:0:super.currentTime}set currentTime(a){var p;if(r(this,d,b)){r(this,d,b).currentTime=a,(p=r(this,d,b).controller)==null||p.seek();return}super.currentTime=a}},s=new WeakMap,n=new WeakMap,h=new WeakMap,m=new WeakMap,d=new WeakSet,b=function(){var a,p;return(p=(a=D.get(this.remote))==null?void 0:a.getCastPlayer)==null?void 0:p.call(a)},$e=async function(){r(this,s).paused=jt(t.prototype,this,"paused"),jt(t.prototype,this,"pause").call(this),this.muted=jt(t.prototype,this,"muted");try{await this.load()}catch(a){console.error(a)}},E(t,"observedAttributes",[...(i=e.observedAttributes)!=null?i:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t};var G=class extends Event{constructor(t,s){super(t);E(this,"track");this.track=s.track}};var be=new WeakMap;function c(e){var i;return(i=be.get(e))!=null?i:Ci(e,{})}function Ci(e,i){let t=be.get(e);return t||be.set(e,t={}),Object.assign(t,i)}function te(e,i){let t=e.videoTracks;c(i).media=e,c(i).renditionSet||(c(i).renditionSet=new Set);let s=c(t).trackSet;s.add(i);let n=s.size-1;n in ht.prototype||Object.defineProperty(ht.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new G("addtrack",{track:i}))})}function ee(e){var s;let i=(s=c(e).media)==null?void 0:s.videoTracks;if(!i)return;c(i).trackSet.delete(e),queueMicrotask(()=>{i.dispatchEvent(new G("removetrack",{track:e}))})}function ze(e){var s;let i=(s=c(e).media.videoTracks)!=null?s:[],t=!1;for(let n of i)n!==e&&(n.selected=!1,t=!0);if(t){if(c(i).changeRequested)return;c(i).changeRequested=!0,queueMicrotask(()=>{delete c(i).changeRequested,i.dispatchEvent(new Event("change"))})}}var H,j,W,ut,Nt,ht=class extends EventTarget{constructor(){super();l(this,ut);l(this,H);l(this,j);l(this,W);c(this).trackSet=new Set}[Symbol.iterator](){return r(this,ut,Nt).values()}get length(){return r(this,ut,Nt).size}getTrackById(t){var s;return(s=[...r(this,ut,Nt)].find(n=>n.id===t))!=null?s:null}get selectedIndex(){return[...r(this,ut,Nt)].findIndex(t=>t.selected)}get onaddtrack(){return r(this,H)}set onaddtrack(t){r(this,H)&&(this.removeEventListener("addtrack",r(this,H)),u(this,H,void 0)),typeof t=="function"&&(u(this,H,t),this.addEventListener("addtrack",t))}get onremovetrack(){return r(this,j)}set onremovetrack(t){r(this,j)&&(this.removeEventListener("removetrack",r(this,j)),u(this,j,void 0)),typeof t=="function"&&(u(this,j,t),this.addEventListener("removetrack",t))}get onchange(){return r(this,W)}set onchange(t){r(this,W)&&(this.removeEventListener("change",r(this,W)),u(this,W,void 0)),typeof t=="function"&&(u(this,W,t),this.addEventListener("change",t))}};H=new WeakMap,j=new WeakMap,W=new WeakMap,ut=new WeakSet,Nt=function(){return c(this).trackSet};var F=class extends Event{constructor(t,s){super(t);E(this,"rendition");this.rendition=s.rendition}};function Xe(e,i){let t=c(e).media.videoRenditions;c(i).media=c(e).media,c(i).track=e;let s=c(e).renditionSet;s.add(i);let n=s.size-1;n in lt.prototype||Object.defineProperty(lt.prototype,n,{get(){return Tt(this)[n]}}),queueMicrotask(()=>{e.selected&&t.dispatchEvent(new F("addrendition",{rendition:i}))})}function Je(e){let i=c(e).media.videoRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.selected&&i.dispatchEvent(new F("removerendition",{rendition:e}))})}function Ze(e){let i=c(e).media.videoRenditions;!i||c(i).changeRequested||(c(i).changeRequested=!0,queueMicrotask(()=>{delete c(i).changeRequested,c(e).track.selected&&i.dispatchEvent(new Event("change"))}))}function Tt(e){return[...c(e).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...c(t).renditionSet])}var $,z,X,lt=class extends EventTarget{constructor(){super(...arguments);l(this,$);l(this,z);l(this,X)}[Symbol.iterator](){return Tt(this).values()}get length(){return Tt(this).length}getRenditionById(t){var s;return(s=Tt(this).find(n=>`${n.id}`==`${t}`))!=null?s:null}get selectedIndex(){return Tt(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[s,n]of Tt(this).entries())n.selected=s===t}get onaddrendition(){return r(this,$)}set onaddrendition(t){r(this,$)&&(this.removeEventListener("addrendition",r(this,$)),u(this,$,void 0)),typeof t=="function"&&(u(this,$,t),this.addEventListener("addrendition",t))}get onremoverendition(){return r(this,z)}set onremoverendition(t){r(this,z)&&(this.removeEventListener("removerendition",r(this,z)),u(this,z,void 0)),typeof t=="function"&&(u(this,z,t),this.addEventListener("removerendition",t))}get onchange(){return r(this,X)}set onchange(t){r(this,X)&&(this.removeEventListener("change",r(this,X)),u(this,X,void 0)),typeof t=="function"&&(u(this,X,t),this.addEventListener("change",t))}};$=new WeakMap,z=new WeakMap,X=new WeakMap;var bt,Dt=class{constructor(){E(this,"src");E(this,"id");E(this,"width");E(this,"height");E(this,"bitrate");E(this,"frameRate");E(this,"codec");l(this,bt,!1)}get selected(){return r(this,bt)}set selected(i){r(this,bt)!==i&&(u(this,bt,i),Ze(this))}};bt=new WeakMap;var vt,yt=class{constructor(){E(this,"id");E(this,"kind");E(this,"label","");E(this,"language","");E(this,"sourceBuffer");l(this,vt,!1)}addRendition(i,t,s,n,h,m){let d=new Dt;return d.src=i,d.width=t,d.height=s,d.frameRate=m,d.bitrate=h,d.codec=n,Xe(this,d),d}removeRendition(i){Je(i)}get selected(){return r(this,vt)}set selected(i){r(this,vt)!==i&&(u(this,vt,i),i===!0&&ze(this))}};vt=new WeakMap;function Qe(e,i){let t=c(e).media.audioRenditions;c(i).media=c(e).media,c(i).track=e;let s=c(e).renditionSet;s.add(i);let n=s.size-1;n in ft.prototype||Object.defineProperty(ft.prototype,n,{get(){return At(this)[n]}}),queueMicrotask(()=>{e.enabled&&t.dispatchEvent(new F("addrendition",{rendition:i}))})}function ti(e){let i=c(e).media.audioRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.enabled&&i.dispatchEvent(new F("removerendition",{rendition:e}))})}function ei(e){let i=c(e).media.audioRenditions;!i||c(i).changeRequested||(c(i).changeRequested=!0,queueMicrotask(()=>{delete c(i).changeRequested,c(e).track.enabled&&i.dispatchEvent(new Event("change"))}))}function At(e){return[...c(e).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...c(t).renditionSet])}var J,Z,Q,ft=class extends EventTarget{constructor(){super(...arguments);l(this,J);l(this,Z);l(this,Q)}[Symbol.iterator](){return At(this).values()}get length(){return At(this).length}getRenditionById(t){var s;return(s=At(this).find(n=>`${n.id}`==`${t}`))!=null?s:null}get selectedIndex(){return At(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[s,n]of At(this).entries())n.selected=s===t}get onaddrendition(){return r(this,J)}set onaddrendition(t){r(this,J)&&(this.removeEventListener("addrendition",r(this,J)),u(this,J,void 0)),typeof t=="function"&&(u(this,J,t),this.addEventListener("addrendition",t))}get onremoverendition(){return r(this,Z)}set onremoverendition(t){r(this,Z)&&(this.removeEventListener("removerendition",r(this,Z)),u(this,Z,void 0)),typeof t=="function"&&(u(this,Z,t),this.addEventListener("removerendition",t))}get onchange(){return r(this,Q)}set onchange(t){r(this,Q)&&(this.removeEventListener("change",r(this,Q)),u(this,Q,void 0)),typeof t=="function"&&(u(this,Q,t),this.addEventListener("change",t))}};J=new WeakMap,Z=new WeakMap,Q=new WeakMap;var kt,Vt=class{constructor(){E(this,"src");E(this,"id");E(this,"bitrate");E(this,"codec");l(this,kt,!1)}get selected(){return r(this,kt)}set selected(i){r(this,kt)!==i&&(u(this,kt,i),ei(this))}};kt=new WeakMap;function re(e,i){let t=e.audioTracks;c(i).media=e,c(i).renditionSet||(c(i).renditionSet=new Set);let s=c(t).trackSet;s.add(i);let n=s.size-1;n in mt.prototype||Object.defineProperty(mt.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new G("addtrack",{track:i}))})}function se(e){var s;let i=(s=c(e).media)==null?void 0:s.audioTracks;if(!i)return;c(i).trackSet.delete(e),queueMicrotask(()=>{i.dispatchEvent(new G("removetrack",{track:e}))})}function ii(e){let i=c(e).media.audioTracks;!i||c(i).changeRequested||(c(i).changeRequested=!0,queueMicrotask(()=>{delete c(i).changeRequested,i.dispatchEvent(new Event("change"))}))}var tt,et,it,St,ie,mt=class extends EventTarget{constructor(){super();l(this,St);l(this,tt);l(this,et);l(this,it);c(this).trackSet=new Set}[Symbol.iterator](){return r(this,St,ie).values()}get length(){return r(this,St,ie).size}getTrackById(t){var s;return(s=[...r(this,St,ie)].find(n=>n.id===t))!=null?s:null}get onaddtrack(){return r(this,tt)}set onaddtrack(t){r(this,tt)&&(this.removeEventListener("addtrack",r(this,tt)),u(this,tt,void 0)),typeof t=="function"&&(u(this,tt,t),this.addEventListener("addtrack",t))}get onremovetrack(){return r(this,et)}set onremovetrack(t){r(this,et)&&(this.removeEventListener("removetrack",r(this,et)),u(this,et,void 0)),typeof t=="function"&&(u(this,et,t),this.addEventListener("removetrack",t))}get onchange(){return r(this,it)}set onchange(t){r(this,it)&&(this.removeEventListener("change",r(this,it)),u(this,it,void 0)),typeof t=="function"&&(u(this,it,t),this.addEventListener("change",t))}};tt=new WeakMap,et=new WeakMap,it=new WeakMap,St=new WeakSet,ie=function(){return c(this).trackSet};var Rt,Ct=class{constructor(){E(this,"id");E(this,"kind");E(this,"label","");E(this,"language","");E(this,"sourceBuffer");l(this,Rt,!1)}addRendition(i,t,s){let n=new Vt;return n.src=i,n.codec=t,n.bitrate=s,Qe(this,n),n}removeRendition(i){ti(i)}get enabled(){return r(this,Rt)}set enabled(i){r(this,Rt)!==i&&(u(this,Rt,i),ii(this))}};Rt=new WeakMap;var ri=ne(globalThis.HTMLMediaElement,"video"),si=ne(globalThis.HTMLMediaElement,"audio");function ni(e){if(!(e!=null&&e.prototype))return e;let i=ne(e,"video");(!i||`${i}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){return _i(this)}});let t=ne(e,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){return Pi(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(h,m="",d=""){let T=new yt;return T.kind=h,T.label=m,T.language=d,te(this,T),T}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=ee),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(h,m="",d=""){let T=new Ct;return T.kind=h,T.label=m,T.language=d,re(this,T),T}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=se),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return s(this)}});let s=h=>{let m=c(h).videoRenditions;return m||(m=new lt,c(m).media=h,c(h).videoRenditions=m),m};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return n(this)}});let n=h=>{let m=c(h).audioRenditions;return m||(m=new ft,c(m).media=h,c(h).audioRenditions=m),m};return e}function ne(e,i){var t;if(e!=null&&e.prototype)return(t=Object.getOwnPropertyDescriptor(e.prototype,`${i}Tracks`))==null?void 0:t.get}function _i(e){var t;let i=c(e).videoTracks;if(!i&&(i=new ht,c(e).videoTracks=i,ri)){let s=ri.call((t=e.nativeEl)!=null?t:e);for(let n of s)te(e,n);s.addEventListener("change",()=>{i.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...i].some(h=>h instanceof yt)){for(let h of s)ee(h);return}te(e,n.track)}),s.addEventListener("removetrack",n=>{ee(n.track)})}return i}function Pi(e){var t;let i=c(e).audioTracks;if(!i&&(i=new mt,c(e).audioTracks=i,si)){let s=si.call((t=e.nativeEl)!=null?t:e);for(let n of s)re(e,n);s.addEventListener("change",()=>{i.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...i].some(h=>h instanceof Ct)){for(let h of s)se(h);return}re(e,n.track)}),s.addEventListener("removetrack",n=>{se(n.track)})}return i}var oi=`
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" class="logo" part="logo" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1600 500"><g fill="#fff"><path d="M994.287 93.486c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m0-93.486c-34.509 0-62.484 27.976-62.484 62.486v187.511c0 68.943-56.09 125.033-125.032 125.033s-125.03-56.09-125.03-125.033V62.486C681.741 27.976 653.765 0 619.256 0s-62.484 27.976-62.484 62.486v187.511C556.772 387.85 668.921 500 806.771 500c137.851 0 250.001-112.15 250.001-250.003V62.486c0-34.51-27.976-62.486-62.485-62.486M1537.51 468.511c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m-275.883-218.509-143.33 143.329c-24.402 24.402-24.402 63.966 0 88.368 24.402 24.402 63.967 24.402 88.369 0l143.33-143.329 143.328 143.329c24.402 24.4 63.967 24.402 88.369 0 24.403-24.402 24.403-63.966.001-88.368l-143.33-143.329.001-.004 143.329-143.329c24.402-24.402 24.402-63.965 0-88.367s-63.967-24.402-88.369 0L1349.996 161.63 1206.667 18.302c-24.402-24.401-63.967-24.402-88.369 0s-24.402 63.965 0 88.367l143.329 143.329v.004ZM437.511 468.521c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31M461.426 4.759C438.078-4.913 411.2.432 393.33 18.303L249.999 161.632 106.669 18.303C88.798.432 61.922-4.913 38.573 4.759 15.224 14.43-.001 37.214-.001 62.488v375.026c0 34.51 27.977 62.486 62.487 62.486 34.51 0 62.486-27.976 62.486-62.486V213.341l80.843 80.844c24.404 24.402 63.965 24.402 88.369 0l80.843-80.844v224.173c0 34.51 27.976 62.486 62.486 62.486s62.486-27.976 62.486-62.486V62.488c0-25.274-15.224-48.058-38.573-57.729" style="fill-rule:nonzero"/></g></svg>`;fe.push("castchange","entercast","leavecast");var o={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo"},zi=Object.values(o),di=Re(),ci="mux-video",x,_t,Ft,Pt,Bt,Kt,Ut,qt,Yt,It,ae,ve=class extends $t{constructor(){super();l(this,It);l(this,x);l(this,_t);l(this,Ft);l(this,Pt,{});l(this,Bt,{});l(this,Kt);l(this,Ut);l(this,qt);l(this,Yt);u(this,Ft,Li())}static get NAME(){return ci}static get VERSION(){return di}static get observedAttributes(){var t;return[...zi,...(t=$t.observedAttributes)!=null?t:[]]}static getTemplateHTML(t={}){let s=super.getTemplateHTML(t),n=t.logo!=="false"&&t.logo!==void 0,h=t.logo&&t.logo!=="",m=t.logo,d=n?`
      <style>
        :host {
          position: relative;
        }
        :host slot[name="logo"] {
          display: flex;
          justify-content: end;
          position: absolute;
          top: 1rem;
          right: 1rem;

        }
         :host slot[name="logo"] .logo{
          width: 5rem;
          pointer-events: none;
          user-select: none;
         }
      </style>
      <slot name="logo">
        ${h?`<img class="logo" part="logo" src="${m}" />`:oi}
      </slot>
    `:"";return`
      ${s}
      ${d}
    `}get preferCmcd(){var t;return(t=this.getAttribute(o.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?ai.includes(t)?this.setAttribute(o.PREFER_CMCD,t):console.warn(`Invalid value for preferCmcd. Must be one of ${ai.join()}`):this.removeAttribute(o.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(o.PLAYER_INIT_TIME)?+this.getAttribute(o.PLAYER_INIT_TIME):r(this,Ft)}set playerInitTime(t){t!=this.playerInitTime&&(t==null?this.removeAttribute(o.PLAYER_INIT_TIME):this.setAttribute(o.PLAYER_INIT_TIME,`${+t}`))}get playerSoftwareName(){var t;return(t=r(this,qt))!=null?t:ci}set playerSoftwareName(t){u(this,qt,t)}get playerSoftwareVersion(){var t;return(t=r(this,Ut))!=null?t:di}set playerSoftwareVersion(t){u(this,Ut,t)}get _hls(){var t;return(t=r(this,x))==null?void 0:t.engine}get mux(){var t;return(t=this.nativeEl)==null?void 0:t.mux}get error(){var t;return(t=wi(this.nativeEl))!=null?t:null}get errorTranslator(){return r(this,Yt)}set errorTranslator(t){u(this,Yt,t)}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get type(){var t;return(t=this.getAttribute(o.TYPE))!=null?t:void 0}set type(t){t!==this.type&&(t?this.setAttribute(o.TYPE,t):this.removeAttribute(o.TYPE))}get autoplay(){let t=this.getAttribute("autoplay");return t===null?!1:t===""?!0:t}set autoplay(t){let s=this.autoplay;t!==s&&(t?this.setAttribute("autoplay",typeof t=="string"?t:""):this.removeAttribute("autoplay"))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(o.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(o.DEBUG,""):this.removeAttribute(o.DEBUG))}get disableTracking(){return this.hasAttribute(o.DISABLE_TRACKING)}set disableTracking(t){t!==this.disableTracking&&this.toggleAttribute(o.DISABLE_TRACKING,!!t)}get disableCookies(){return this.hasAttribute(o.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(o.DISABLE_COOKIES,""):this.removeAttribute(o.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(o.START_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(o.START_TIME):this.setAttribute(o.START_TIME,`${t}`))}get playbackId(){var t;return this.hasAttribute(o.PLAYBACK_ID)?this.getAttribute(o.PLAYBACK_ID):(t=Wi(this.src))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(o.PLAYBACK_ID,t):this.removeAttribute(o.PLAYBACK_ID))}get maxResolution(){var t;return(t=this.getAttribute(o.MAX_RESOLUTION))!=null?t:void 0}set maxResolution(t){t!==this.maxResolution&&(t?this.setAttribute(o.MAX_RESOLUTION,t):this.removeAttribute(o.MAX_RESOLUTION))}get minResolution(){var t;return(t=this.getAttribute(o.MIN_RESOLUTION))!=null?t:void 0}set minResolution(t){t!==this.minResolution&&(t?this.setAttribute(o.MIN_RESOLUTION,t):this.removeAttribute(o.MIN_RESOLUTION))}get renditionOrder(){var t;return(t=this.getAttribute(o.RENDITION_ORDER))!=null?t:void 0}set renditionOrder(t){t!==this.renditionOrder&&(t?this.setAttribute(o.RENDITION_ORDER,t):this.removeAttribute(o.RENDITION_ORDER))}get programStartTime(){let t=this.getAttribute(o.PROGRAM_START_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set programStartTime(t){t==null?this.removeAttribute(o.PROGRAM_START_TIME):this.setAttribute(o.PROGRAM_START_TIME,`${t}`)}get programEndTime(){let t=this.getAttribute(o.PROGRAM_END_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set programEndTime(t){t==null?this.removeAttribute(o.PROGRAM_END_TIME):this.setAttribute(o.PROGRAM_END_TIME,`${t}`)}get assetStartTime(){let t=this.getAttribute(o.ASSET_START_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set assetStartTime(t){t==null?this.removeAttribute(o.ASSET_START_TIME):this.setAttribute(o.ASSET_START_TIME,`${t}`)}get assetEndTime(){let t=this.getAttribute(o.ASSET_END_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set assetEndTime(t){t==null?this.removeAttribute(o.ASSET_END_TIME):this.setAttribute(o.ASSET_END_TIME,`${t}`)}get customDomain(){var t;return(t=this.getAttribute(o.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(o.CUSTOM_DOMAIN,t):this.removeAttribute(o.CUSTOM_DOMAIN))}get drmToken(){var t;return(t=this.getAttribute(o.DRM_TOKEN))!=null?t:void 0}set drmToken(t){t!==this.drmToken&&(t?this.setAttribute(o.DRM_TOKEN,t):this.removeAttribute(o.DRM_TOKEN))}get playbackToken(){var t,s,n,h;if(this.hasAttribute(o.PLAYBACK_TOKEN))return(t=this.getAttribute(o.PLAYBACK_TOKEN))!=null?t:void 0;if(this.hasAttribute(o.PLAYBACK_ID)){let[,m]=$i((s=this.playbackId)!=null?s:"");return(n=new URLSearchParams(m).get("token"))!=null?n:void 0}if(this.src)return(h=new URLSearchParams(this.src).get("token"))!=null?h:void 0}set playbackToken(t){t!==this.playbackToken&&(t?this.setAttribute(o.PLAYBACK_TOKEN,t):this.removeAttribute(o.PLAYBACK_TOKEN))}get tokens(){let t=this.getAttribute(o.PLAYBACK_TOKEN),s=this.getAttribute(o.DRM_TOKEN);return{...r(this,Bt),...t!=null?{playback:t}:{},...s!=null?{drm:s}:{}}}set tokens(t){u(this,Bt,t!=null?t:{})}get ended(){return Hi(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(o.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(o.ENV_KEY,t):this.removeAttribute(o.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(o.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(o.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(o.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(o.STREAM_TYPE))!=null?t:Ki(this.nativeEl)}set streamType(t){t!==this.streamType&&(t?this.setAttribute(o.STREAM_TYPE,t):this.removeAttribute(o.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):Ui(this.nativeEl)}set targetLiveWindow(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+t}`))}get liveEdgeStart(){var t,s;if(this.hasAttribute(o.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:n}=this,h=(t=this.nativeEl.seekable.end(0))!=null?t:0,m=(s=this.nativeEl.seekable.start(0))!=null?s:0;return Math.max(m,h-n)}return qi(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(o.LIVE_EDGE_OFFSET))return+this.getAttribute(o.LIVE_EDGE_OFFSET)}set liveEdgeOffset(t){t!=this.liveEdgeOffset&&(t==null?this.removeAttribute(o.LIVE_EDGE_OFFSET):this.setAttribute(o.LIVE_EDGE_OFFSET,`${+t}`))}get seekable(){return Yi(this.nativeEl)}async addCuePoints(t){return xi(this.nativeEl,t)}get activeCuePoint(){return Di(this.nativeEl)}get cuePoints(){return Ni(this.nativeEl)}async addChapters(t){return Vi(this.nativeEl,t)}get activeChapter(){return Gi(this.nativeEl)}get chapters(){return ji(this.nativeEl)}getStartDate(){return Fi(this.nativeEl,this._hls)}get currentPdt(){return Bi(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(o.PREFER_PLAYBACK);if(t===oe.MSE||t===oe.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===oe.MSE||t===oe.NATIVE?this.setAttribute(o.PREFER_PLAYBACK,t):this.removeAttribute(o.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(s=>s.startsWith("metadata-")&&![o.METADATA_URL].includes(s)).reduce((s,n)=>{let h=this.getAttribute(n);return h!=null&&(s[n.replace(/^metadata-/,"").replace(/-/g,"_")]=h),s},{}),...r(this,Pt)}}set metadata(t){u(this,Pt,t!=null?t:{}),this.mux&&this.mux.emit("hb",r(this,Pt))}get _hlsConfig(){return r(this,Kt)}set _hlsConfig(t){u(this,Kt,t)}get logo(){return this.getAttribute(o.LOGO)}set logo(t){t?this.setAttribute(o.LOGO,t):this.removeAttribute(o.LOGO)}load(){u(this,x,Ii(this,this.nativeEl,r(this,x)))}unload(){Oi(this.nativeEl,r(this,x)),u(this,x,void 0)}attributeChangedCallback(t,s,n){var m,d;switch($t.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,s,n),t){case o.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=n!=null?n:void 0;break;case o.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=n!=null?n:void 0;break;case"src":{let T=!!s,w=!!n;!T&&w?v(this,It,ae).call(this):T&&!w?this.unload():T&&w&&(this.unload(),v(this,It,ae).call(this));break}case"autoplay":if(n===s)break;(m=r(this,x))==null||m.setAutoplay(this.autoplay);break;case"preload":if(n===s)break;(d=r(this,x))==null||d.setPreload(n);break;case o.PLAYBACK_ID:this.src=Mi(this);break;case o.DEBUG:{let T=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=T);break}case o.METADATA_URL:n&&fetch(n).then(T=>T.json()).then(T=>this.metadata=T).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${n}!`));break;case o.STREAM_TYPE:(n==null||n!==s)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case o.TARGET_LIVE_WINDOW:(n==null||n!==s)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!r(this,x)&&v(this,It,ae).call(this)}disconnectedCallback(){this.unload()}};x=new WeakMap,_t=new WeakMap,Ft=new WeakMap,Pt=new WeakMap,Bt=new WeakMap,Kt=new WeakMap,Ut=new WeakMap,qt=new WeakMap,Yt=new WeakMap,It=new WeakSet,ae=async function(){r(this,_t)||(await u(this,_t,Promise.resolve()),u(this,_t,null),this.load())};var Ht,Gt=class extends We(ni(ve)){constructor(){super(...arguments);l(this,Ht)}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var t;return(t=r(this,Ht))!=null?t:this.muxCastCustomData}set castCustomData(t){u(this,Ht,t)}};Ht=new WeakMap;Wt.customElements.get("mux-video")||(Wt.customElements.define("mux-video",Gt),Wt.MuxVideoElement=Gt);var Ms=Gt;export{o as Attributes,Rs as MediaError,fe as VideoEvents,Ms as default,Li as generatePlayerInitTime,ci as playerSoftwareName,di as playerSoftwareVersion};
//# sourceMappingURL=index.mjs.map
