@mux/mux-video 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +4 -4
- package/dist/mux-video.js +28 -28
- package/dist/mux-video.js.map +4 -4
- package/dist/mux-video.mjs +28 -28
- package/dist/mux-video.mjs.map +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +8 -2
- package/dist/types-ts3.4/index.d.ts +8 -3
- package/package.json +10 -13
- package/LICENSE +0 -9
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var fi=Object.defineProperty;var mi=Object.getPrototypeOf;var pi=Reflect.get;var gi=(e,r,t)=>r in e?fi(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var E=(e,r,t)=>(gi(e,typeof r!="symbol"?r+"":r,t),t),Ee=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)};var i=(e,r,t)=>(Ee(e,r,"read from private field"),t?t.call(e):r.get(e)),u=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},h=(e,r,t,s)=>(Ee(e,r,"write to private field"),s?s.call(e,t):r.set(e,t),t);var y=(e,r,t)=>(Ee(e,r,"access private method"),t),Qt=(e,r,t)=>pi(mi(e),t,r);var gt=class{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}};if(typeof DocumentFragment=="undefined"){class e extends gt{}globalThis.DocumentFragment=e}var Lt=class extends gt{},Te=class extends gt{},Ei={get(e){},define(e,r,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(Lt)}},Mt,be=class{constructor(r,t={}){u(this,Mt,void 0);h(this,Mt,t==null?void 0:t.detail)}get detail(){return i(this,Mt)}initCustomEvent(){}};Mt=new WeakMap;function Ti(e,r){return new Lt}var Oe={document:{createElement:Ti},DocumentFragment,customElements:Ei,CustomEvent:be,EventTarget:gt,HTMLElement:Lt,HTMLVideoElement:Te},Le=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Zt=Le?Oe:globalThis,Ji=Le?Oe.document:globalThis.document;import{initialize as Ii,teardown as Pi,generatePlayerInitTime as Oi,PlaybackTypes as pe,toMuxVideoURL as Li,MediaError as ks,getError as Mi,CmcdTypeValues as ci,addCuePoints as Ni,getCuePoints as wi,getActiveCuePoint as xi,addChapters as Di,getActiveChapter as Vi,getStartDate as Gi,getCurrentPdt as Bi,getStreamType as Ki,getTargetLiveWindow as qi,getLiveEdgeStart as Fi,getSeekable as Yi,getEnded as Ui,getChapters as ji,toPlaybackIdFromSrc as Wi,toPlaybackIdParts as $i}from"@mux/playback-core";var bi=()=>{try{return"0.23.0"}catch{}return"UNKNOWN"},vi=bi(),Me=()=>vi;var Ae=["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"];function yi(e){return`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
display: inline-flex;
|
|
@@ -12,10 +12,10 @@ var di=Object.defineProperty;var ui=Object.getPrototypeOf;var ci=Reflect.get;var
|
|
|
12
12
|
}
|
|
13
13
|
</style>
|
|
14
14
|
<slot name="media">
|
|
15
|
-
<audio${
|
|
15
|
+
<audio${Ke(e)}></audio>
|
|
16
16
|
</slot>
|
|
17
17
|
<slot></slot>
|
|
18
|
-
`}function
|
|
18
|
+
`}function Ai(e){return`
|
|
19
19
|
<style>
|
|
20
20
|
:host {
|
|
21
21
|
display: inline-block;
|
|
@@ -37,8 +37,8 @@ var di=Object.defineProperty;var ui=Object.getPrototypeOf;var ci=Reflect.get;var
|
|
|
37
37
|
}
|
|
38
38
|
</style>
|
|
39
39
|
<slot name="media">
|
|
40
|
-
<video${
|
|
40
|
+
<video${Ke(e)}></video>
|
|
41
41
|
</slot>
|
|
42
42
|
<slot></slot>
|
|
43
|
-
`}var we=(e,{tag:r,is:t})=>{var l,f,d,T,C,xe,mt,x,a,m,nt,w,be,L,Ne,O,De;let s=(f=(l=globalThis.document)==null?void 0:l.createElement)==null?void 0:f.call(l,r,{is:t}),n=s?Ti(s):[];return d=class extends e{constructor(){super();u(this,m);u(this,w);u(this,L);u(this,O);u(this,mt,void 0);u(this,x,void 0);u(this,a,new Map)}static get observedAttributes(){var g,v,P;return A(g=d,C,xe).call(g),[...(P=(v=s==null?void 0:s.constructor)==null?void 0:v.observedAttributes)!=null?P:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var p,g,v;return A(this,m,nt).call(this),(v=(g=(p=i(this,x))!=null?p:this.shadowRoot.querySelector(r))!=null?g:this.querySelector(":scope > [slot=media]"))!=null?v:this.querySelector(r)}set nativeEl(p){h(this,x,p)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(p){this.toggleAttribute("muted",!!p)}get src(){return this.getAttribute("src")}set src(p){this.setAttribute("src",`${p}`)}get preload(){var p,g;return(g=this.getAttribute("preload"))!=null?g:(p=this.nativeEl)==null?void 0:p.preload}set preload(p){this.setAttribute("preload",`${p}`)}init(){var p,g;if(!this.shadowRoot){this.attachShadow({mode:"open"});let v=bi(this.attributes);t&&(v.is=t),r&&(v.part=r),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(v)}this.nativeEl.muted=this.hasAttribute("muted");for(let v of n)A(this,L,Ne).call(this,v);this.shadowRoot.addEventListener("slotchange",this),A(this,w,be).call(this);for(let v of this.constructor.Events)(g=(p=this.shadowRoot).addEventListener)==null||g.call(p,v,this,!0)}handleEvent(p){if(p.type==="slotchange"){A(this,w,be).call(this);return}p.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(p.type,{detail:p.detail}))}attributeChangedCallback(p,g,v){A(this,m,nt).call(this),A(this,O,De).call(this,p,g,v)}connectedCallback(){A(this,m,nt).call(this)}},T=new WeakMap,C=new WeakSet,xe=function(){if(i(this,T))return;h(this,T,!0);let p=new Set(this.observedAttributes);p.delete("muted");for(let g of n){if(g in this.prototype)continue;if(typeof s[g]=="function")this.prototype[g]=function(...P){return A(this,m,nt).call(this),this.call?this.call(g,...P):this.nativeEl[g].apply(this.nativeEl,P)};else{let P={get(){var D,Lt,Mt;A(this,m,nt).call(this);let _=g.toLowerCase();if(p.has(_)){let gt=this.getAttribute(_);return gt===null?!1:gt===""?!0:gt}return(Mt=(D=this.get)==null?void 0:D.call(this,g))!=null?Mt:(Lt=this.nativeEl)==null?void 0:Lt[g]}};g!==g.toUpperCase()&&(P.set=function(_){A(this,m,nt).call(this);let D=g.toLowerCase();if(p.has(D)){_===!0||_===!1||_==null?this.toggleAttribute(D,!!_):this.setAttribute(D,_);return}if(this.set){this.set(g,_);return}this.nativeEl[g]=_}),Object.defineProperty(this.prototype,g,P)}}},mt=new WeakMap,x=new WeakMap,a=new WeakMap,m=new WeakSet,nt=function(){i(this,mt)||(h(this,mt,!0),this.init())},w=new WeakSet,be=function(){let p=new Map(i(this,a));this.shadowRoot.querySelector("slot:not([name])").assignedElements({flatten:!0}).filter(g=>["track","source"].includes(g.localName)).forEach(g=>{var P,_;p.delete(g);let v=i(this,a).get(g);v||(v=g.cloneNode(),i(this,a).set(g,v)),(_=(P=this.nativeEl).append)==null||_.call(P,v),v.localName==="track"&&v.default&&(v.kind==="chapters"||v.kind==="metadata")&&v.track.mode==="disabled"&&(v.track.mode="hidden")}),p.forEach(g=>g.remove())},L=new WeakSet,Ne=function(p){if(Object.prototype.hasOwnProperty.call(this,p)){let g=this[p];delete this[p],this[p]=g}},O=new WeakSet,De=function(p,g,v){var P,_,D,Lt,Mt,gt;["id","class"].includes(p)||!d.observedAttributes.includes(p)&&this.constructor.observedAttributes.includes(p)||(v===null?(_=(P=this.nativeEl).removeAttribute)==null||_.call(P,p):((Lt=(D=this.nativeEl).getAttribute)==null?void 0:Lt.call(D,p))!=v&&((gt=(Mt=this.nativeEl).setAttribute)==null||gt.call(Mt,p,v)))},u(d,C),E(d,"getTemplateHTML",r.endsWith("audio")?gi:Ei),E(d,"shadowRootOptions",{mode:"open"}),E(d,"Events",ve),u(d,T,void 0),d};function Ti(e){let r=[];for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))r.push(...Object.getOwnPropertyNames(t));return r}function Ve(e){let r="";for(let t in e){let s=e[t];s===""?r+=` ${t}`:r+=` ${t}="${s}"`}return r}function bi(e){let r={};for(let t of e)r[t.name]=t.value;return r}var Le,Zt=we((Le=globalThis.HTMLElement)!=null?Le:class{},{tag:"video"}),Me,Qi=we((Me=globalThis.HTMLElement)!=null?Me:class{},{tag:"audio"});var V=new WeakMap,Tt=class extends Error{},te=class extends Error{};var Ge=globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(r=>{let t=r.deref();t&&e(t)})}}:Set;function Be(e){var r,t,s;(t=(r=globalThis.chrome)==null?void 0:r.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 Ke(){return globalThis.chrome}function qe(){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 r=document.createElement("script");r.src=e,document.head.append(r)}function U(){var e,r;return(r=(e=globalThis.cast)==null?void 0:e.framework)==null?void 0:r.CastContext.getInstance()}function Nt(){var e;return(e=U())==null?void 0:e.getCurrentSession()}function ee(){var e;return(e=Nt())==null?void 0:e.getSessionObj().media[0]}function Fe(e){return new Promise((r,t)=>{ee().editTracksInfo(e,r,t)})}function Ue(e){return new Promise((r,t)=>{ee().getStatus(e,r,t)})}function ye(e){return U().setOptions({...Ae(),...e})}function Ae(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}var ie=new Ge,Y=new WeakSet,R;Be(()=>{var e,r,t,s;if(!((r=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&r.isAvailable)){console.debug("chrome.cast.isAvailable",(s=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:s.isAvailable);return}R||(R=cast.framework,U().addEventListener(R.CastContextEventType.CAST_STATE_CHANGED,n=>{ie.forEach(l=>{var f,d;return(d=(f=V.get(l)).onCastStateChanged)==null?void 0:d.call(f,n)})}),U().addEventListener(R.CastContextEventType.SESSION_STATE_CHANGED,n=>{ie.forEach(l=>{var f,d;return(d=(f=V.get(l)).onSessionStateChanged)==null?void 0:d.call(f,n)})}),ie.forEach(n=>{var l,f;return(f=(l=V.get(n)).init)==null?void 0:f.call(l)}))});var Ye=0,y,Dt,I,G,at,dt,j,se,B,ot,ne,je,Vt,ke,oe,We,Gt,Se,ae,He,Bt,Re,re=class extends EventTarget{constructor(t){super();u(this,B);u(this,ne);u(this,Vt);u(this,oe);u(this,Gt);u(this,ae);u(this,Bt);u(this,y,void 0);u(this,Dt,void 0);u(this,I,void 0);u(this,G,void 0);u(this,at,"disconnected");u(this,dt,!1);u(this,j,new Set);u(this,se,new WeakMap);h(this,y,t),ie.add(this),V.set(this,{init:()=>A(this,Gt,Se).call(this),onCastStateChanged:()=>A(this,Vt,ke).call(this),onSessionStateChanged:()=>A(this,oe,We).call(this),getCastPlayer:()=>i(this,B,ot)}),A(this,Gt,Se).call(this)}get state(){return i(this,at)}async watchAvailability(t){if(i(this,y).disableRemotePlayback)throw new Tt("disableRemotePlayback attribute is present.");return i(this,se).set(t,++Ye),i(this,j).add(t),Ye}async cancelWatchAvailability(t){if(i(this,y).disableRemotePlayback)throw new Tt("disableRemotePlayback attribute is present.");t?i(this,j).delete(t):i(this,j).clear()}async prompt(){var s,n,l,f;if(i(this,y).disableRemotePlayback)throw new Tt("disableRemotePlayback attribute is present.");if(!((n=(s=globalThis.chrome)==null?void 0:s.cast)!=null&&n.isAvailable))throw new te("The RemotePlayback API is disabled on this platform.");let t=Y.has(i(this,y));Y.add(i(this,y)),ye(i(this,y).castOptions),Object.entries(i(this,G)).forEach(([d,T])=>{i(this,I).controller.addEventListener(d,T)});try{await U().requestSession()}catch(d){if(d==="cancel"){t||Y.delete(i(this,y));return}throw new Error(d)}(f=(l=V.get(i(this,y)))==null?void 0:l.loadOnPrompt)==null||f.call(l)}};y=new WeakMap,Dt=new WeakMap,I=new WeakMap,G=new WeakMap,at=new WeakMap,dt=new WeakMap,j=new WeakMap,se=new WeakMap,B=new WeakSet,ot=function(){if(Y.has(i(this,y)))return i(this,I)},ne=new WeakSet,je=function(){Y.has(i(this,y))&&(Object.entries(i(this,G)).forEach(([t,s])=>{i(this,I).controller.removeEventListener(t,s)}),Y.delete(i(this,y)),i(this,y).muted=i(this,I).isMuted,i(this,y).currentTime=i(this,I).savedPlayerState.currentTime,i(this,I).savedPlayerState.isPaused===!1&&i(this,y).play())},Vt=new WeakSet,ke=function(){let t=U().getCastState();if(Y.has(i(this,y))&&t==="CONNECTING"&&(h(this,at,"connecting"),this.dispatchEvent(new Event("connecting"))),!i(this,dt)&&(t!=null&&t.includes("CONNECT"))){h(this,dt,!0);for(let s of i(this,j))s(!0)}else if(i(this,dt)&&(!t||t==="NO_DEVICES_AVAILABLE")){h(this,dt,!1);for(let s of i(this,j))s(!1)}},oe=new WeakSet,We=async function(){var s;let{SESSION_RESUMED:t}=R.SessionState;if(U().getSessionState()===t&&i(this,y).castSrc===((s=ee())==null?void 0:s.media.contentId)){Y.add(i(this,y)),Object.entries(i(this,G)).forEach(([n,l])=>{i(this,I).controller.addEventListener(n,l)});try{await Ue(new chrome.cast.media.GetStatusRequest)}catch(n){console.error(n)}i(this,G)[R.RemotePlayerEventType.IS_PAUSED_CHANGED](),i(this,G)[R.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Gt=new WeakSet,Se=function(){!R||i(this,Dt)||(h(this,Dt,!0),ye(i(this,y).castOptions),i(this,y).textTracks.addEventListener("change",()=>A(this,Bt,Re).call(this)),A(this,Vt,ke).call(this),h(this,I,new R.RemotePlayer),new R.RemotePlayerController(i(this,I)),h(this,G,{[R.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:t})=>{t===!0?(h(this,at,"connected"),this.dispatchEvent(new Event("connect"))):(A(this,ne,je).call(this),h(this,at,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[R.RemotePlayerEventType.DURATION_CHANGED]:()=>{i(this,y).dispatchEvent(new Event("durationchange"))},[R.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{i(this,y).dispatchEvent(new Event("volumechange"))},[R.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{i(this,y).dispatchEvent(new Event("volumechange"))},[R.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var t;(t=i(this,B,ot))!=null&&t.isMediaLoaded&&i(this,y).dispatchEvent(new Event("timeupdate"))},[R.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{i(this,y).dispatchEvent(new Event("resize"))},[R.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{i(this,y).dispatchEvent(new Event(this.paused?"pause":"play"))},[R.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var t,s;((t=i(this,B,ot))==null?void 0:t.playerState)!==chrome.cast.media.PlayerState.PAUSED&&i(this,y).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(s=i(this,B,ot))==null?void 0:s.playerState]))},[R.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var t;(t=i(this,B,ot))!=null&&t.isMediaLoaded&&(await Promise.resolve(),A(this,ae,He).call(this))}}))},ae=new WeakSet,He=function(){A(this,Bt,Re).call(this)},Bt=new WeakSet,Re=async function(){var x,a,m,S,w;if(!i(this,B,ot))return;let s=((a=(x=i(this,I).mediaInfo)==null?void 0:x.tracks)!=null?a:[]).filter(({type:k})=>k===chrome.cast.media.TrackType.TEXT),n=[...i(this,y).textTracks].filter(({kind:k})=>k==="subtitles"||k==="captions"),l=s.map(({language:k,name:L,trackId:pt})=>{var st;let{mode:O}=(st=n.find(N=>N.language===k&&N.label===L))!=null?st:{};return O?{mode:O,trackId:pt}:!1}).filter(Boolean),d=l.filter(({mode:k})=>k!=="showing").map(({trackId:k})=>k),T=l.find(({mode:k})=>k==="showing"),C=(w=(S=(m=Nt())==null?void 0:m.getSessionObj().media[0])==null?void 0:S.activeTrackIds)!=null?w:[],F=C;if(C.length&&(F=F.filter(k=>!d.includes(k))),T!=null&&T.trackId&&(F=[...F,T.trackId]),F=[...new Set(F)],!((k,L)=>k.length===L.length&&k.every(pt=>L.includes(pt)))(C,F))try{let k=new chrome.cast.media.EditTracksInfoRequest(F);await Fe(k)}catch(k){console.error(k)}};var $e=e=>{var r,t,s,n,l,f,d,b,C,ze;return t=class extends e{constructor(){super(...arguments);u(this,d);u(this,C);u(this,s,{paused:!1});u(this,n,Ae());u(this,l,void 0);u(this,f,void 0)}get remote(){return i(this,f)?i(this,f):Ke()?(qe(),V.set(this,{loadOnPrompt:()=>A(this,C,ze).call(this)}),h(this,f,new re(this))):super.remote}attributeChangedCallback(a,m,S){if(super.attributeChangedCallback(a,m,S),a==="cast-receiver"&&S){i(this,n).receiverApplicationId=S;return}if(i(this,d,b))switch(a){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var L,pt;if(!i(this,d,b))return super.load();let a=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);a.customData=this.castCustomData;let m=[...this.querySelectorAll("track")].filter(({kind:O,src:st})=>st&&(O==="subtitles"||O==="captions")),S=[],w=0;m.length&&(a.tracks=m.map(O=>{let st=++w;S.length===0&&O.track.mode==="showing"&&S.push(st);let N=new chrome.cast.media.Track(st,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}];let k=new chrome.cast.media.LoadRequest(a);k.currentTime=(L=super.currentTime)!=null?L:0,k.autoplay=!i(this,s).paused,k.activeTrackIds=S,await((pt=Nt())==null?void 0:pt.loadMedia(k)),this.dispatchEvent(new Event("volumechange"))}play(){var a;if(i(this,d,b)){i(this,d,b).isPaused&&((a=i(this,d,b).controller)==null||a.playOrPause());return}return super.play()}pause(){var a;if(i(this,d,b)){i(this,d,b).isPaused||(a=i(this,d,b).controller)==null||a.playOrPause();return}super.pause()}get castOptions(){return i(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,m,S;return(S=(m=this.getAttribute("cast-src"))!=null?m:(a=this.querySelector("source"))==null?void 0:a.src)!=null?S: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,m;return(m=(a=this.getAttribute("cast-stream-type"))!=null?a:this.streamType)!=null?m:void 0}set castStreamType(a){this.setAttribute("cast-stream-type",`${a}`)}get castCustomData(){return i(this,l)}set castCustomData(a){let m=typeof a;if(!["object","undefined"].includes(m)){console.error(`castCustomData must be nullish or an object but value was of type ${m}`);return}h(this,l,a)}get readyState(){if(i(this,d,b))switch(i(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 i(this,d,b)?i(this,d,b).isPaused:super.paused}get muted(){var a;return i(this,d,b)?(a=i(this,d,b))==null?void 0:a.isMuted:super.muted}set muted(a){var m;if(i(this,d,b)){(a&&!i(this,d,b).isMuted||!a&&i(this,d,b).isMuted)&&((m=i(this,d,b).controller)==null||m.muteOrUnmute());return}super.muted=a}get volume(){var a,m;return i(this,d,b)?(m=(a=i(this,d,b))==null?void 0:a.volumeLevel)!=null?m:1:super.volume}set volume(a){var m;if(i(this,d,b)){i(this,d,b).volumeLevel=+a,(m=i(this,d,b).controller)==null||m.setVolumeLevel();return}super.volume=a}get duration(){var a,m,S;return i(this,d,b)&&((a=i(this,d,b))!=null&&a.isMediaLoaded)?(S=(m=i(this,d,b))==null?void 0:m.duration)!=null?S:NaN:super.duration}get currentTime(){var a,m,S;return i(this,d,b)&&((a=i(this,d,b))!=null&&a.isMediaLoaded)?(S=(m=i(this,d,b))==null?void 0:m.currentTime)!=null?S:0:super.currentTime}set currentTime(a){var m;if(i(this,d,b)){i(this,d,b).currentTime=a,(m=i(this,d,b).controller)==null||m.seek();return}super.currentTime=a}},s=new WeakMap,n=new WeakMap,l=new WeakMap,f=new WeakMap,d=new WeakSet,b=function(){var a,m;return(m=(a=V.get(this.remote))==null?void 0:a.getCastPlayer)==null?void 0:m.call(a)},C=new WeakSet,ze=async function(){i(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",[...(r=e.observedAttributes)!=null?r:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t};var K=class extends Event{constructor(t,s){super(t);E(this,"track");this.track=s.track}};var Ce=new WeakMap;function c(e){var r;return(r=Ce.get(e))!=null?r:vi(e,{})}function vi(e,r){let t=Ce.get(e);return t||Ce.set(e,t={}),Object.assign(t,r)}function de(e,r){let t=e.videoTracks;c(r).media=e,c(r).renditionSet||(c(r).renditionSet=new Set);let s=c(t).trackSet;s.add(r);let n=s.size-1;n in ct.prototype||Object.defineProperty(ct.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new K("addtrack",{track:r}))})}function ue(e){var s;let r=(s=c(e).media)==null?void 0:s.videoTracks;if(!r)return;c(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new K("removetrack",{track:e}))})}function Xe(e){var s;let r=(s=c(e).media.videoTracks)!=null?s:[],t=!1;for(let n of r)n!==e&&(n.selected=!1,t=!0);if(t){if(c(r).changeRequested)return;c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,r.dispatchEvent(new Event("change"))})}}var W,H,$,ut,Kt,ct=class extends EventTarget{constructor(){super();u(this,ut);u(this,W,void 0);u(this,H,void 0);u(this,$,void 0);c(this).trackSet=new Set}[Symbol.iterator](){return i(this,ut,Kt).values()}get length(){return i(this,ut,Kt).size}getTrackById(t){var s;return(s=[...i(this,ut,Kt)].find(n=>n.id===t))!=null?s:null}get selectedIndex(){return[...i(this,ut,Kt)].findIndex(t=>t.selected)}get onaddtrack(){return i(this,W)}set onaddtrack(t){i(this,W)&&(this.removeEventListener("addtrack",i(this,W)),h(this,W,void 0)),typeof t=="function"&&(h(this,W,t),this.addEventListener("addtrack",t))}get onremovetrack(){return i(this,H)}set onremovetrack(t){i(this,H)&&(this.removeEventListener("removetrack",i(this,H)),h(this,H,void 0)),typeof t=="function"&&(h(this,H,t),this.addEventListener("removetrack",t))}get onchange(){return i(this,$)}set onchange(t){i(this,$)&&(this.removeEventListener("change",i(this,$)),h(this,$,void 0)),typeof t=="function"&&(h(this,$,t),this.addEventListener("change",t))}};W=new WeakMap,H=new WeakMap,$=new WeakMap,ut=new WeakSet,Kt=function(){return c(this).trackSet};var q=class extends Event{constructor(t,s){super(t);E(this,"rendition");this.rendition=s.rendition}};function Je(e,r){let t=c(e).media.videoRenditions;c(r).media=c(e).media,c(r).track=e;let s=c(e).renditionSet;s.add(r);let n=s.size-1;n in ht.prototype||Object.defineProperty(ht.prototype,n,{get(){return bt(this)[n]}}),queueMicrotask(()=>{e.selected&&t.dispatchEvent(new q("addrendition",{rendition:r}))})}function Qe(e){let r=c(e).media.videoRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.selected&&r.dispatchEvent(new q("removerendition",{rendition:e}))})}function Ze(e){let r=c(e).media.videoRenditions;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,c(e).track.selected&&r.dispatchEvent(new Event("change"))}))}function bt(e){return[...c(e).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...c(t).renditionSet])}var z,X,J,ht=class extends EventTarget{constructor(){super(...arguments);u(this,z,void 0);u(this,X,void 0);u(this,J,void 0)}[Symbol.iterator](){return bt(this).values()}get length(){return bt(this).length}getRenditionById(t){var s;return(s=bt(this).find(n=>`${n.id}`==`${t}`))!=null?s:null}get selectedIndex(){return bt(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[s,n]of bt(this).entries())n.selected=s===t}get onaddrendition(){return i(this,z)}set onaddrendition(t){i(this,z)&&(this.removeEventListener("addrendition",i(this,z)),h(this,z,void 0)),typeof t=="function"&&(h(this,z,t),this.addEventListener("addrendition",t))}get onremoverendition(){return i(this,X)}set onremoverendition(t){i(this,X)&&(this.removeEventListener("removerendition",i(this,X)),h(this,X,void 0)),typeof t=="function"&&(h(this,X,t),this.addEventListener("removerendition",t))}get onchange(){return i(this,J)}set onchange(t){i(this,J)&&(this.removeEventListener("change",i(this,J)),h(this,J,void 0)),typeof t=="function"&&(h(this,J,t),this.addEventListener("change",t))}};z=new WeakMap,X=new WeakMap,J=new WeakMap;var vt,qt=class{constructor(){E(this,"src");E(this,"id");E(this,"width");E(this,"height");E(this,"bitrate");E(this,"frameRate");E(this,"codec");u(this,vt,!1)}get selected(){return i(this,vt)}set selected(r){i(this,vt)!==r&&(h(this,vt,r),Ze(this))}};vt=new WeakMap;var yt,At=class{constructor(){E(this,"id");E(this,"kind");E(this,"label","");E(this,"language","");E(this,"sourceBuffer");u(this,yt,!1)}addRendition(r,t,s,n,l,f){let d=new qt;return d.src=r,d.width=t,d.height=s,d.frameRate=f,d.bitrate=l,d.codec=n,Je(this,d),d}removeRendition(r){Qe(r)}get selected(){return i(this,yt)}set selected(r){i(this,yt)!==r&&(h(this,yt,r),r===!0&&Xe(this))}};yt=new WeakMap;function ti(e,r){let t=c(e).media.audioRenditions;c(r).media=c(e).media,c(r).track=e;let s=c(e).renditionSet;s.add(r);let n=s.size-1;n in lt.prototype||Object.defineProperty(lt.prototype,n,{get(){return kt(this)[n]}}),queueMicrotask(()=>{e.enabled&&t.dispatchEvent(new q("addrendition",{rendition:r}))})}function ei(e){let r=c(e).media.audioRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.enabled&&r.dispatchEvent(new q("removerendition",{rendition:e}))})}function ii(e){let r=c(e).media.audioRenditions;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,c(e).track.enabled&&r.dispatchEvent(new Event("change"))}))}function kt(e){return[...c(e).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...c(t).renditionSet])}var Q,Z,tt,lt=class extends EventTarget{constructor(){super(...arguments);u(this,Q,void 0);u(this,Z,void 0);u(this,tt,void 0)}[Symbol.iterator](){return kt(this).values()}get length(){return kt(this).length}getRenditionById(t){var s;return(s=kt(this).find(n=>`${n.id}`==`${t}`))!=null?s:null}get selectedIndex(){return kt(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[s,n]of kt(this).entries())n.selected=s===t}get onaddrendition(){return i(this,Q)}set onaddrendition(t){i(this,Q)&&(this.removeEventListener("addrendition",i(this,Q)),h(this,Q,void 0)),typeof t=="function"&&(h(this,Q,t),this.addEventListener("addrendition",t))}get onremoverendition(){return i(this,Z)}set onremoverendition(t){i(this,Z)&&(this.removeEventListener("removerendition",i(this,Z)),h(this,Z,void 0)),typeof t=="function"&&(h(this,Z,t),this.addEventListener("removerendition",t))}get onchange(){return i(this,tt)}set onchange(t){i(this,tt)&&(this.removeEventListener("change",i(this,tt)),h(this,tt,void 0)),typeof t=="function"&&(h(this,tt,t),this.addEventListener("change",t))}};Q=new WeakMap,Z=new WeakMap,tt=new WeakMap;var St,Ft=class{constructor(){E(this,"src");E(this,"id");E(this,"bitrate");E(this,"codec");u(this,St,!1)}get selected(){return i(this,St)}set selected(r){i(this,St)!==r&&(h(this,St,r),ii(this))}};St=new WeakMap;function he(e,r){let t=e.audioTracks;c(r).media=e,c(r).renditionSet||(c(r).renditionSet=new Set);let s=c(t).trackSet;s.add(r);let n=s.size-1;n in ft.prototype||Object.defineProperty(ft.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new K("addtrack",{track:r}))})}function le(e){var s;let r=(s=c(e).media)==null?void 0:s.audioTracks;if(!r)return;c(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new K("removetrack",{track:e}))})}function ri(e){let r=c(e).media.audioTracks;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,r.dispatchEvent(new Event("change"))}))}var et,it,rt,Rt,ce,ft=class extends EventTarget{constructor(){super();u(this,Rt);u(this,et,void 0);u(this,it,void 0);u(this,rt,void 0);c(this).trackSet=new Set}[Symbol.iterator](){return i(this,Rt,ce).values()}get length(){return i(this,Rt,ce).size}getTrackById(t){var s;return(s=[...i(this,Rt,ce)].find(n=>n.id===t))!=null?s:null}get onaddtrack(){return i(this,et)}set onaddtrack(t){i(this,et)&&(this.removeEventListener("addtrack",i(this,et)),h(this,et,void 0)),typeof t=="function"&&(h(this,et,t),this.addEventListener("addtrack",t))}get onremovetrack(){return i(this,it)}set onremovetrack(t){i(this,it)&&(this.removeEventListener("removetrack",i(this,it)),h(this,it,void 0)),typeof t=="function"&&(h(this,it,t),this.addEventListener("removetrack",t))}get onchange(){return i(this,rt)}set onchange(t){i(this,rt)&&(this.removeEventListener("change",i(this,rt)),h(this,rt,void 0)),typeof t=="function"&&(h(this,rt,t),this.addEventListener("change",t))}};et=new WeakMap,it=new WeakMap,rt=new WeakMap,Rt=new WeakSet,ce=function(){return c(this).trackSet};var Ct,_t=class{constructor(){E(this,"id");E(this,"kind");E(this,"label","");E(this,"language","");E(this,"sourceBuffer");u(this,Ct,!1)}addRendition(r,t,s){let n=new Ft;return n.src=r,n.codec=t,n.bitrate=s,ti(this,n),n}removeRendition(r){ei(r)}get enabled(){return i(this,Ct)}set enabled(r){i(this,Ct)!==r&&(h(this,Ct,r),ri(this))}};Ct=new WeakMap;var si=fe(globalThis.HTMLMediaElement,"video"),ni=fe(globalThis.HTMLMediaElement,"audio");function oi(e){if(!(e!=null&&e.prototype))return e;let r=fe(e,"video");(!r||`${r}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){return yi(this)}});let t=fe(e,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){return Ai(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(l,f="",d=""){let T=new At;return T.kind=l,T.label=f,T.language=d,de(this,T),T}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=ue),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(l,f="",d=""){let T=new _t;return T.kind=l,T.label=f,T.language=d,he(this,T),T}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=le),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return s(this)}});let s=l=>{let f=c(l).videoRenditions;return f||(f=new ht,c(f).media=l,c(l).videoRenditions=f),f};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return n(this)}});let n=l=>{let f=c(l).audioRenditions;return f||(f=new lt,c(f).media=l,c(l).audioRenditions=f),f};return e}function fe(e,r){var t;if(e!=null&&e.prototype)return(t=Object.getOwnPropertyDescriptor(e.prototype,`${r}Tracks`))==null?void 0:t.get}function yi(e){var t;let r=c(e).videoTracks;if(!r&&(r=new ct,c(e).videoTracks=r,si)){let s=si.call((t=e.nativeEl)!=null?t:e);for(let n of s)de(e,n);s.addEventListener("change",()=>{r.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...r].some(l=>l instanceof At)){for(let l of s)ue(l);return}de(e,n.track)}),s.addEventListener("removetrack",n=>{ue(n.track)})}return r}function Ai(e){var t;let r=c(e).audioTracks;if(!r&&(r=new ft,c(e).audioTracks=r,ni)){let s=ni.call((t=e.nativeEl)!=null?t:e);for(let n of s)he(e,n);s.addEventListener("change",()=>{r.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...r].some(l=>l instanceof _t)){for(let l of s)le(l);return}he(e,n.track)}),s.addEventListener("removetrack",n=>{le(n.track)})}return r}ve.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",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"},Ui=Object.values(o),Yi=Ie(),ji="mux-video",M,Ot,Yt,Pt,jt,Wt,Ht,$t,zt,It,pe,_e=class extends Zt{constructor(){super();u(this,It);u(this,M,void 0);u(this,Ot,void 0);u(this,Yt,void 0);u(this,Pt,{});u(this,jt,{});u(this,Wt,void 0);u(this,Ht,void 0);u(this,$t,void 0);u(this,zt,void 0);h(this,Yt,Ri())}static get observedAttributes(){var t;return[...Ui,...(t=Zt.observedAttributes)!=null?t:[]]}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 i(this,Yt)}get playerSoftwareName(){var t;return(t=i(this,$t))!=null?t:ji}set playerSoftwareName(t){h(this,$t,t)}get playerSoftwareVersion(){var t;return(t=i(this,Ht))!=null?t:Yi}set playerSoftwareVersion(t){h(this,Ht,t)}get _hls(){var t;return(t=i(this,M))==null?void 0:t.engine}get mux(){var t;return(t=this.nativeEl)==null?void 0:t.mux}get error(){var t;return(t=_i(this.nativeEl))!=null?t:null}get errorTranslator(){return i(this,zt)}set errorTranslator(t){h(this,zt,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=qi(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,l;if(this.hasAttribute(o.PLAYBACK_TOKEN))return(t=this.getAttribute(o.PLAYBACK_TOKEN))!=null?t:void 0;if(this.hasAttribute(o.PLAYBACK_ID)){let[,f]=Fi((s=this.playbackId)!=null?s:"");return(n=new URLSearchParams(f).get("token"))!=null?n:void 0}if(this.src)return(l=new URLSearchParams(this.src).get("token"))!=null?l: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{...i(this,jt),...t!=null?{playback:t}:{},...s!=null?{drm:s}:{}}}set tokens(t){h(this,jt,t!=null?t:{})}get ended(){return Bi(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:Ni(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):Di(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,l=(t=this.nativeEl.seekable.end(0))!=null?t:0,f=(s=this.nativeEl.seekable.start(0))!=null?s:0;return Math.max(f,l-n)}return Vi(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(o.LIVE_EDGE_OFFSET))return+this.getAttribute(o.LIVE_EDGE_OFFSET)}set liveEdgeOffset(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(o.LIVE_EDGE_OFFSET):this.setAttribute(o.LIVE_EDGE_OFFSET,`${+t}`))}get seekable(){return Gi(this.nativeEl)}async addCuePoints(t){return Oi(this.nativeEl,t)}get activeCuePoint(){return Ii(this.nativeEl)}get cuePoints(){return Pi(this.nativeEl)}async addChapters(t){return Li(this.nativeEl,t)}get activeChapter(){return Mi(this.nativeEl)}get chapters(){return Ki(this.nativeEl)}getStartDate(){return wi(this.nativeEl,this._hls)}get currentPdt(){return xi(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(o.PREFER_PLAYBACK);if(t===me.MSE||t===me.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===me.MSE||t===me.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 l=this.getAttribute(n);return l!=null&&(s[n.replace(/^metadata-/,"").replace(/-/g,"_")]=l),s},{}),...i(this,Pt)}}set metadata(t){h(this,Pt,t!=null?t:{}),this.mux&&this.mux.emit("hb",i(this,Pt))}get _hlsConfig(){return i(this,Wt)}set _hlsConfig(t){h(this,Wt,t)}load(){h(this,M,ki(this,this.nativeEl,i(this,M)))}unload(){Si(this.nativeEl,i(this,M)),h(this,M,void 0)}attributeChangedCallback(t,s,n){var f,d;switch(Zt.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,C=!!n;!T&&C?A(this,It,pe).call(this):T&&!C?this.unload():T&&C&&(this.unload(),A(this,It,pe).call(this));break}case"autoplay":if(n===s)break;(f=i(this,M))==null||f.setAutoplay(this.autoplay);break;case"preload":if(n===s)break;(d=i(this,M))==null||d.setPreload(n);break;case o.PLAYBACK_ID:this.src=Ci(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&&!i(this,M)&&A(this,It,pe).call(this)}disconnectedCallback(){this.unload()}};M=new WeakMap,Ot=new WeakMap,Yt=new WeakMap,Pt=new WeakMap,jt=new WeakMap,Wt=new WeakMap,Ht=new WeakMap,$t=new WeakMap,zt=new WeakMap,It=new WeakSet,pe=async function(){i(this,Ot)||(await h(this,Ot,Promise.resolve()),h(this,Ot,null),this.load())};var Xt,Ut=class extends $e(oi(_e)){constructor(){super(...arguments);u(this,Xt,void 0)}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=i(this,Xt))!=null?t:this.muxCastCustomData}set castCustomData(t){h(this,Xt,t)}};Xt=new WeakMap;Qt.customElements.get("mux-video")||(Qt.customElements.define("mux-video",Ut),Qt.MuxVideoElement=Ut);var Cs=Ut;export{o as Attributes,vs as MediaError,ve as VideoEvents,Cs as default};
|
|
43
|
+
`}function Be(e,{tag:r,is:t}){var l,m,d,T,P,xe,mt,x,a,p,S,nt,v,ve,M,De,O,ye,Xt,Ve,Jt,Ge;let s=(m=(l=globalThis.document)==null?void 0:l.createElement)==null?void 0:m.call(l,r,{is:t}),n=s?ki(s):[];return d=class extends e{constructor(){super(...arguments);u(this,S);u(this,v);u(this,M);u(this,O);u(this,Xt);u(this,Jt);u(this,mt,!1);u(this,x,null);u(this,a,new Map);u(this,p,void 0);E(this,"get");E(this,"set");E(this,"call")}static get observedAttributes(){var g,C,R;return y(g=d,P,xe).call(g),[...(R=(C=s==null?void 0:s.constructor)==null?void 0:C.observedAttributes)!=null?R:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var f,g,C,R,k;return y(this,S,nt).call(this),(k=(R=(g=(f=i(this,x))!=null?f:this.querySelector(":scope > [slot=media]"))!=null?g:this.querySelector(r))!=null?R:(C=this.shadowRoot)==null?void 0:C.querySelector(r))!=null?k:null}set nativeEl(f){h(this,x,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=Si(this.attributes);t&&(g.is=t),r&&(g.part=r),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(g)}this.nativeEl.muted=this.hasAttribute("muted");for(let g of n)y(this,Xt,Ve).call(this,g);h(this,p,new MutationObserver(y(this,M,De).bind(this))),this.shadowRoot.addEventListener("slotchange",this),y(this,v,ve).call(this);for(let g of this.constructor.Events)(f=this.shadowRoot)==null||f.addEventListener(g,this,!0)}handleEvent(f){if(f.type==="slotchange"){y(this,v,ve).call(this);return}f.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(f.type,{detail:f.detail}))}attributeChangedCallback(f,g,C){y(this,S,nt).call(this),y(this,Jt,Ge).call(this,f,g,C)}connectedCallback(){y(this,S,nt).call(this)}},T=new WeakMap,P=new WeakSet,xe=function(){if(i(this,T))return;h(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(...C){return y(this,S,nt).call(this),(()=>{var _;if(this.call)return this.call(g,...C);let k=(_=this.nativeEl)==null?void 0:_[g];return k==null?void 0:k.apply(this.nativeEl,C)})()};else{let C={get(){var k,_,Ot;y(this,S,nt).call(this);let R=g.toLowerCase();if(f.has(R)){let pt=this.getAttribute(R);return pt===null?!1:pt===""?!0:pt}return(Ot=(k=this.get)==null?void 0:k.call(this,g))!=null?Ot:(_=this.nativeEl)==null?void 0:_[g]}};g!==g.toUpperCase()&&(C.set=function(R){y(this,S,nt).call(this);let k=g.toLowerCase();if(f.has(k)){R===!0||R===!1||R==null?this.toggleAttribute(k,!!R):this.setAttribute(k,R);return}if(this.set){this.set(g,R);return}this.nativeEl&&(this.nativeEl[g]=R)}),Object.defineProperty(this.prototype,g,C)}},mt=new WeakMap,x=new WeakMap,a=new WeakMap,p=new WeakMap,S=new WeakSet,nt=function(){i(this,mt)||(h(this,mt,!0),this.init())},v=new WeakSet,ve=function(){var R;let f=new Map(i(this,a)),g=(R=this.shadowRoot)==null?void 0:R.querySelector("slot:not([name])");(g==null?void 0:g.assignedElements({flatten:!0}).filter(k=>["track","source"].includes(k.localName))).forEach(k=>{var Ot,pt;f.delete(k);let _=i(this,a).get(k);_||(_=k.cloneNode(),i(this,a).set(k,_),(Ot=i(this,p))==null||Ot.observe(k,{attributes:!0})),(pt=this.nativeEl)==null||pt.append(_),y(this,O,ye).call(this,_)}),f.forEach((k,_)=>{k.remove(),i(this,a).delete(_)})},M=new WeakSet,De=function(f){var g;for(let C of f)if(C.type==="attributes"){let{target:R,attributeName:k}=C,_=i(this,a).get(R);_&&k&&(_.setAttribute(k,(g=R.getAttribute(k))!=null?g:""),y(this,O,ye).call(this,_))}},O=new WeakSet,ye=function(f){f&&f.localName==="track"&&f.default&&(f.kind==="chapters"||f.kind==="metadata")&&f.track.mode==="disabled"&&(f.track.mode="hidden")},Xt=new WeakSet,Ve=function(f){if(Object.prototype.hasOwnProperty.call(this,f)){let g=this[f];delete this[f],this[f]=g}},Jt=new WeakSet,Ge=function(f,g,C){var R,k,_;["id","class"].includes(f)||!d.observedAttributes.includes(f)&&this.constructor.observedAttributes.includes(f)||(C===null?(R=this.nativeEl)==null||R.removeAttribute(f):((k=this.nativeEl)==null?void 0:k.getAttribute(f))!==C&&((_=this.nativeEl)==null||_.setAttribute(f,C)))},u(d,P),E(d,"getTemplateHTML",r.endsWith("audio")?yi:Ai),E(d,"shadowRootOptions",{mode:"open"}),E(d,"Events",Ae),u(d,T,!1),d}function ki(e){let r=[];for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let s=Object.getOwnPropertyNames(t);r.push(...s)}return r}function Ke(e){let r="";for(let t in e){let s=e[t];s===""?r+=` ${t}`:r+=` ${t}="${s}"`}return r}function Si(e){let r={};for(let t of e)r[t.name]=t.value;return r}var Ne,te=Be((Ne=globalThis.HTMLElement)!=null?Ne:class{},{tag:"video"}),we,er=Be((we=globalThis.HTMLElement)!=null?we:class{},{tag:"audio"});var V=new WeakMap,Et=class extends Error{},ee=class extends Error{};var qe=globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(r=>{let t=r.deref();t&&e(t)})}}:Set;function Fe(e){var r,t,s;(t=(r=globalThis.chrome)==null?void 0:r.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 Ye(){return globalThis.chrome}function Ue(){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 r=document.createElement("script");r.src=e,document.head.append(r)}function Y(){var e,r;return(r=(e=globalThis.cast)==null?void 0:e.framework)==null?void 0:r.CastContext.getInstance()}function Nt(){var e;return(e=Y())==null?void 0:e.getCurrentSession()}function ie(){var e;return(e=Nt())==null?void 0:e.getSessionObj().media[0]}function je(e){return new Promise((r,t)=>{ie().editTracksInfo(e,r,t)})}function We(e){return new Promise((r,t)=>{ie().getStatus(e,r,t)})}function ke(e){return Y().setOptions({...Se(),...e})}function Se(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}var re=new qe,U=new WeakSet,I;Fe(()=>{var e,r,t,s;if(!((r=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&r.isAvailable)){console.debug("chrome.cast.isAvailable",(s=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:s.isAvailable);return}I||(I=cast.framework,Y().addEventListener(I.CastContextEventType.CAST_STATE_CHANGED,n=>{re.forEach(l=>{var m,d;return(d=(m=V.get(l)).onCastStateChanged)==null?void 0:d.call(m,n)})}),Y().addEventListener(I.CastContextEventType.SESSION_STATE_CHANGED,n=>{re.forEach(l=>{var m,d;return(d=(m=V.get(l)).onSessionStateChanged)==null?void 0:d.call(m,n)})}),re.forEach(n=>{var l,m;return(m=(l=V.get(n)).init)==null?void 0:m.call(l)}))});var $e=0,A,wt,L,G,at,dt,j,ne,B,ot,oe,He,xt,Re,ae,ze,Dt,Ce,de,Xe,Vt,_e,se=class extends EventTarget{constructor(t){super();u(this,B);u(this,oe);u(this,xt);u(this,ae);u(this,Dt);u(this,de);u(this,Vt);u(this,A,void 0);u(this,wt,void 0);u(this,L,void 0);u(this,G,void 0);u(this,at,"disconnected");u(this,dt,!1);u(this,j,new Set);u(this,ne,new WeakMap);h(this,A,t),re.add(this),V.set(this,{init:()=>y(this,Dt,Ce).call(this),onCastStateChanged:()=>y(this,xt,Re).call(this),onSessionStateChanged:()=>y(this,ae,ze).call(this),getCastPlayer:()=>i(this,B,ot)}),y(this,Dt,Ce).call(this)}get state(){return i(this,at)}async watchAvailability(t){if(i(this,A).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");return i(this,ne).set(t,++$e),i(this,j).add(t),$e}async cancelWatchAvailability(t){if(i(this,A).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");t?i(this,j).delete(t):i(this,j).clear()}async prompt(){var s,n,l,m;if(i(this,A).disableRemotePlayback)throw new Et("disableRemotePlayback attribute is present.");if(!((n=(s=globalThis.chrome)==null?void 0:s.cast)!=null&&n.isAvailable))throw new ee("The RemotePlayback API is disabled on this platform.");let t=U.has(i(this,A));U.add(i(this,A)),ke(i(this,A).castOptions),Object.entries(i(this,G)).forEach(([d,T])=>{i(this,L).controller.addEventListener(d,T)});try{await Y().requestSession()}catch(d){if(d==="cancel"){t||U.delete(i(this,A));return}throw new Error(d)}(m=(l=V.get(i(this,A)))==null?void 0:l.loadOnPrompt)==null||m.call(l)}};A=new WeakMap,wt=new WeakMap,L=new WeakMap,G=new WeakMap,at=new WeakMap,dt=new WeakMap,j=new WeakMap,ne=new WeakMap,B=new WeakSet,ot=function(){if(U.has(i(this,A)))return i(this,L)},oe=new WeakSet,He=function(){U.has(i(this,A))&&(Object.entries(i(this,G)).forEach(([t,s])=>{i(this,L).controller.removeEventListener(t,s)}),U.delete(i(this,A)),i(this,A).muted=i(this,L).isMuted,i(this,A).currentTime=i(this,L).savedPlayerState.currentTime,i(this,L).savedPlayerState.isPaused===!1&&i(this,A).play())},xt=new WeakSet,Re=function(){let t=Y().getCastState();if(U.has(i(this,A))&&t==="CONNECTING"&&(h(this,at,"connecting"),this.dispatchEvent(new Event("connecting"))),!i(this,dt)&&(t!=null&&t.includes("CONNECT"))){h(this,dt,!0);for(let s of i(this,j))s(!0)}else if(i(this,dt)&&(!t||t==="NO_DEVICES_AVAILABLE")){h(this,dt,!1);for(let s of i(this,j))s(!1)}},ae=new WeakSet,ze=async function(){var s;let{SESSION_RESUMED:t}=I.SessionState;if(Y().getSessionState()===t&&i(this,A).castSrc===((s=ie())==null?void 0:s.media.contentId)){U.add(i(this,A)),Object.entries(i(this,G)).forEach(([n,l])=>{i(this,L).controller.addEventListener(n,l)});try{await We(new chrome.cast.media.GetStatusRequest)}catch(n){console.error(n)}i(this,G)[I.RemotePlayerEventType.IS_PAUSED_CHANGED](),i(this,G)[I.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Dt=new WeakSet,Ce=function(){!I||i(this,wt)||(h(this,wt,!0),ke(i(this,A).castOptions),i(this,A).textTracks.addEventListener("change",()=>y(this,Vt,_e).call(this)),y(this,xt,Re).call(this),h(this,L,new I.RemotePlayer),new I.RemotePlayerController(i(this,L)),h(this,G,{[I.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:t})=>{t===!0?(h(this,at,"connected"),this.dispatchEvent(new Event("connect"))):(y(this,oe,He).call(this),h(this,at,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[I.RemotePlayerEventType.DURATION_CHANGED]:()=>{i(this,A).dispatchEvent(new Event("durationchange"))},[I.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{i(this,A).dispatchEvent(new Event("volumechange"))},[I.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{i(this,A).dispatchEvent(new Event("volumechange"))},[I.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var t;(t=i(this,B,ot))!=null&&t.isMediaLoaded&&i(this,A).dispatchEvent(new Event("timeupdate"))},[I.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{i(this,A).dispatchEvent(new Event("resize"))},[I.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{i(this,A).dispatchEvent(new Event(this.paused?"pause":"play"))},[I.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var t,s;((t=i(this,B,ot))==null?void 0:t.playerState)!==chrome.cast.media.PlayerState.PAUSED&&i(this,A).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(s=i(this,B,ot))==null?void 0:s.playerState]))},[I.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var t;(t=i(this,B,ot))!=null&&t.isMediaLoaded&&(await Promise.resolve(),y(this,de,Xe).call(this))}}))},de=new WeakSet,Xe=function(){y(this,Vt,_e).call(this)},Vt=new WeakSet,_e=async function(){var x,a,p,S,zt;if(!i(this,B,ot))return;let s=((a=(x=i(this,L).mediaInfo)==null?void 0:x.tracks)!=null?a:[]).filter(({type:v})=>v===chrome.cast.media.TrackType.TEXT),n=[...i(this,A).textTracks].filter(({kind:v})=>v==="subtitles"||v==="captions"),l=s.map(({language:v,name:st,trackId:M})=>{var O;let{mode:N}=(O=n.find(D=>D.language===v&&D.label===st))!=null?O:{};return N?{mode:N,trackId:M}:!1}).filter(Boolean),d=l.filter(({mode:v})=>v!=="showing").map(({trackId:v})=>v),T=l.find(({mode:v})=>v==="showing"),P=(zt=(S=(p=Nt())==null?void 0:p.getSessionObj().media[0])==null?void 0:S.activeTrackIds)!=null?zt:[],F=P;if(P.length&&(F=F.filter(v=>!d.includes(v))),T!=null&&T.trackId&&(F=[...F,T.trackId]),F=[...new Set(F)],!((v,st)=>v.length===st.length&&v.every(M=>st.includes(M)))(P,F))try{let v=new chrome.cast.media.EditTracksInfoRequest(F);await je(v)}catch(v){console.error(v)}};var Je=e=>{var r,t,s,n,l,m,d,b,P,Qe;return t=class extends e{constructor(){super(...arguments);u(this,d);u(this,P);u(this,s,{paused:!1});u(this,n,Se());u(this,l,void 0);u(this,m,void 0)}get remote(){return i(this,m)?i(this,m):Ye()?(Ue(),V.set(this,{loadOnPrompt:()=>y(this,P,Qe).call(this)}),h(this,m,new se(this))):super.remote}attributeChangedCallback(a,p,S){if(super.attributeChangedCallback(a,p,S),a==="cast-receiver"&&S){i(this,n).receiverApplicationId=S;return}if(i(this,d,b))switch(a){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var st,M;if(!i(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:N,src:O})=>O&&(N==="subtitles"||N==="captions")),S=[],zt=0;p.length&&(a.tracks=p.map(N=>{let O=++zt;S.length===0&&N.track.mode==="showing"&&S.push(O);let D=new chrome.cast.media.Track(O,chrome.cast.media.TrackType.TEXT);return D.trackContentId=N.src,D.trackContentType="text/vtt",D.subtype=N.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,D.name=N.label,D.language=N.srclang,D})),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}];let v=new chrome.cast.media.LoadRequest(a);v.currentTime=(st=super.currentTime)!=null?st:0,v.autoplay=!i(this,s).paused,v.activeTrackIds=S,await((M=Nt())==null?void 0:M.loadMedia(v)),this.dispatchEvent(new Event("volumechange"))}play(){var a;if(i(this,d,b)){i(this,d,b).isPaused&&((a=i(this,d,b).controller)==null||a.playOrPause());return}return super.play()}pause(){var a;if(i(this,d,b)){i(this,d,b).isPaused||(a=i(this,d,b).controller)==null||a.playOrPause();return}super.pause()}get castOptions(){return i(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,S;return(S=(p=this.getAttribute("cast-src"))!=null?p:(a=this.querySelector("source"))==null?void 0:a.src)!=null?S: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 i(this,l)}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}h(this,l,a)}get readyState(){if(i(this,d,b))switch(i(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 i(this,d,b)?i(this,d,b).isPaused:super.paused}get muted(){var a;return i(this,d,b)?(a=i(this,d,b))==null?void 0:a.isMuted:super.muted}set muted(a){var p;if(i(this,d,b)){(a&&!i(this,d,b).isMuted||!a&&i(this,d,b).isMuted)&&((p=i(this,d,b).controller)==null||p.muteOrUnmute());return}super.muted=a}get volume(){var a,p;return i(this,d,b)?(p=(a=i(this,d,b))==null?void 0:a.volumeLevel)!=null?p:1:super.volume}set volume(a){var p;if(i(this,d,b)){i(this,d,b).volumeLevel=+a,(p=i(this,d,b).controller)==null||p.setVolumeLevel();return}super.volume=a}get duration(){var a,p,S;return i(this,d,b)&&((a=i(this,d,b))!=null&&a.isMediaLoaded)?(S=(p=i(this,d,b))==null?void 0:p.duration)!=null?S:NaN:super.duration}get currentTime(){var a,p,S;return i(this,d,b)&&((a=i(this,d,b))!=null&&a.isMediaLoaded)?(S=(p=i(this,d,b))==null?void 0:p.currentTime)!=null?S:0:super.currentTime}set currentTime(a){var p;if(i(this,d,b)){i(this,d,b).currentTime=a,(p=i(this,d,b).controller)==null||p.seek();return}super.currentTime=a}},s=new WeakMap,n=new WeakMap,l=new WeakMap,m=new WeakMap,d=new WeakSet,b=function(){var a,p;return(p=(a=V.get(this.remote))==null?void 0:a.getCastPlayer)==null?void 0:p.call(a)},P=new WeakSet,Qe=async function(){i(this,s).paused=Qt(t.prototype,this,"paused"),Qt(t.prototype,this,"pause").call(this),this.muted=Qt(t.prototype,this,"muted");try{await this.load()}catch(a){console.error(a)}},E(t,"observedAttributes",[...(r=e.observedAttributes)!=null?r:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t};var K=class extends Event{constructor(t,s){super(t);E(this,"track");this.track=s.track}};var Ie=new WeakMap;function c(e){var r;return(r=Ie.get(e))!=null?r:Ri(e,{})}function Ri(e,r){let t=Ie.get(e);return t||Ie.set(e,t={}),Object.assign(t,r)}function ue(e,r){let t=e.videoTracks;c(r).media=e,c(r).renditionSet||(c(r).renditionSet=new Set);let s=c(t).trackSet;s.add(r);let n=s.size-1;n in ct.prototype||Object.defineProperty(ct.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new K("addtrack",{track:r}))})}function ce(e){var s;let r=(s=c(e).media)==null?void 0:s.videoTracks;if(!r)return;c(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new K("removetrack",{track:e}))})}function Ze(e){var s;let r=(s=c(e).media.videoTracks)!=null?s:[],t=!1;for(let n of r)n!==e&&(n.selected=!1,t=!0);if(t){if(c(r).changeRequested)return;c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,r.dispatchEvent(new Event("change"))})}}var W,$,H,ut,Gt,ct=class extends EventTarget{constructor(){super();u(this,ut);u(this,W,void 0);u(this,$,void 0);u(this,H,void 0);c(this).trackSet=new Set}[Symbol.iterator](){return i(this,ut,Gt).values()}get length(){return i(this,ut,Gt).size}getTrackById(t){var s;return(s=[...i(this,ut,Gt)].find(n=>n.id===t))!=null?s:null}get selectedIndex(){return[...i(this,ut,Gt)].findIndex(t=>t.selected)}get onaddtrack(){return i(this,W)}set onaddtrack(t){i(this,W)&&(this.removeEventListener("addtrack",i(this,W)),h(this,W,void 0)),typeof t=="function"&&(h(this,W,t),this.addEventListener("addtrack",t))}get onremovetrack(){return i(this,$)}set onremovetrack(t){i(this,$)&&(this.removeEventListener("removetrack",i(this,$)),h(this,$,void 0)),typeof t=="function"&&(h(this,$,t),this.addEventListener("removetrack",t))}get onchange(){return i(this,H)}set onchange(t){i(this,H)&&(this.removeEventListener("change",i(this,H)),h(this,H,void 0)),typeof t=="function"&&(h(this,H,t),this.addEventListener("change",t))}};W=new WeakMap,$=new WeakMap,H=new WeakMap,ut=new WeakSet,Gt=function(){return c(this).trackSet};var q=class extends Event{constructor(t,s){super(t);E(this,"rendition");this.rendition=s.rendition}};function ti(e,r){let t=c(e).media.videoRenditions;c(r).media=c(e).media,c(r).track=e;let s=c(e).renditionSet;s.add(r);let n=s.size-1;n in ht.prototype||Object.defineProperty(ht.prototype,n,{get(){return Tt(this)[n]}}),queueMicrotask(()=>{e.selected&&t.dispatchEvent(new q("addrendition",{rendition:r}))})}function ei(e){let r=c(e).media.videoRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.selected&&r.dispatchEvent(new q("removerendition",{rendition:e}))})}function ii(e){let r=c(e).media.videoRenditions;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,c(e).track.selected&&r.dispatchEvent(new Event("change"))}))}function Tt(e){return[...c(e).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...c(t).renditionSet])}var z,X,J,ht=class extends EventTarget{constructor(){super(...arguments);u(this,z,void 0);u(this,X,void 0);u(this,J,void 0)}[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 i(this,z)}set onaddrendition(t){i(this,z)&&(this.removeEventListener("addrendition",i(this,z)),h(this,z,void 0)),typeof t=="function"&&(h(this,z,t),this.addEventListener("addrendition",t))}get onremoverendition(){return i(this,X)}set onremoverendition(t){i(this,X)&&(this.removeEventListener("removerendition",i(this,X)),h(this,X,void 0)),typeof t=="function"&&(h(this,X,t),this.addEventListener("removerendition",t))}get onchange(){return i(this,J)}set onchange(t){i(this,J)&&(this.removeEventListener("change",i(this,J)),h(this,J,void 0)),typeof t=="function"&&(h(this,J,t),this.addEventListener("change",t))}};z=new WeakMap,X=new WeakMap,J=new WeakMap;var bt,Bt=class{constructor(){E(this,"src");E(this,"id");E(this,"width");E(this,"height");E(this,"bitrate");E(this,"frameRate");E(this,"codec");u(this,bt,!1)}get selected(){return i(this,bt)}set selected(r){i(this,bt)!==r&&(h(this,bt,r),ii(this))}};bt=new WeakMap;var vt,yt=class{constructor(){E(this,"id");E(this,"kind");E(this,"label","");E(this,"language","");E(this,"sourceBuffer");u(this,vt,!1)}addRendition(r,t,s,n,l,m){let d=new Bt;return d.src=r,d.width=t,d.height=s,d.frameRate=m,d.bitrate=l,d.codec=n,ti(this,d),d}removeRendition(r){ei(r)}get selected(){return i(this,vt)}set selected(r){i(this,vt)!==r&&(h(this,vt,r),r===!0&&Ze(this))}};vt=new WeakMap;function ri(e,r){let t=c(e).media.audioRenditions;c(r).media=c(e).media,c(r).track=e;let s=c(e).renditionSet;s.add(r);let n=s.size-1;n in lt.prototype||Object.defineProperty(lt.prototype,n,{get(){return At(this)[n]}}),queueMicrotask(()=>{e.enabled&&t.dispatchEvent(new q("addrendition",{rendition:r}))})}function si(e){let r=c(e).media.audioRenditions,t=c(e).track;c(t).renditionSet.delete(e),queueMicrotask(()=>{c(e).track.enabled&&r.dispatchEvent(new q("removerendition",{rendition:e}))})}function ni(e){let r=c(e).media.audioRenditions;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,c(e).track.enabled&&r.dispatchEvent(new Event("change"))}))}function At(e){return[...c(e).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...c(t).renditionSet])}var Q,Z,tt,lt=class extends EventTarget{constructor(){super(...arguments);u(this,Q,void 0);u(this,Z,void 0);u(this,tt,void 0)}[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 i(this,Q)}set onaddrendition(t){i(this,Q)&&(this.removeEventListener("addrendition",i(this,Q)),h(this,Q,void 0)),typeof t=="function"&&(h(this,Q,t),this.addEventListener("addrendition",t))}get onremoverendition(){return i(this,Z)}set onremoverendition(t){i(this,Z)&&(this.removeEventListener("removerendition",i(this,Z)),h(this,Z,void 0)),typeof t=="function"&&(h(this,Z,t),this.addEventListener("removerendition",t))}get onchange(){return i(this,tt)}set onchange(t){i(this,tt)&&(this.removeEventListener("change",i(this,tt)),h(this,tt,void 0)),typeof t=="function"&&(h(this,tt,t),this.addEventListener("change",t))}};Q=new WeakMap,Z=new WeakMap,tt=new WeakMap;var kt,Kt=class{constructor(){E(this,"src");E(this,"id");E(this,"bitrate");E(this,"codec");u(this,kt,!1)}get selected(){return i(this,kt)}set selected(r){i(this,kt)!==r&&(h(this,kt,r),ni(this))}};kt=new WeakMap;function le(e,r){let t=e.audioTracks;c(r).media=e,c(r).renditionSet||(c(r).renditionSet=new Set);let s=c(t).trackSet;s.add(r);let n=s.size-1;n in ft.prototype||Object.defineProperty(ft.prototype,n,{get(){return[...c(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new K("addtrack",{track:r}))})}function fe(e){var s;let r=(s=c(e).media)==null?void 0:s.audioTracks;if(!r)return;c(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new K("removetrack",{track:e}))})}function oi(e){let r=c(e).media.audioTracks;!r||c(r).changeRequested||(c(r).changeRequested=!0,queueMicrotask(()=>{delete c(r).changeRequested,r.dispatchEvent(new Event("change"))}))}var et,it,rt,St,he,ft=class extends EventTarget{constructor(){super();u(this,St);u(this,et,void 0);u(this,it,void 0);u(this,rt,void 0);c(this).trackSet=new Set}[Symbol.iterator](){return i(this,St,he).values()}get length(){return i(this,St,he).size}getTrackById(t){var s;return(s=[...i(this,St,he)].find(n=>n.id===t))!=null?s:null}get onaddtrack(){return i(this,et)}set onaddtrack(t){i(this,et)&&(this.removeEventListener("addtrack",i(this,et)),h(this,et,void 0)),typeof t=="function"&&(h(this,et,t),this.addEventListener("addtrack",t))}get onremovetrack(){return i(this,it)}set onremovetrack(t){i(this,it)&&(this.removeEventListener("removetrack",i(this,it)),h(this,it,void 0)),typeof t=="function"&&(h(this,it,t),this.addEventListener("removetrack",t))}get onchange(){return i(this,rt)}set onchange(t){i(this,rt)&&(this.removeEventListener("change",i(this,rt)),h(this,rt,void 0)),typeof t=="function"&&(h(this,rt,t),this.addEventListener("change",t))}};et=new WeakMap,it=new WeakMap,rt=new WeakMap,St=new WeakSet,he=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");u(this,Rt,!1)}addRendition(r,t,s){let n=new Kt;return n.src=r,n.codec=t,n.bitrate=s,ri(this,n),n}removeRendition(r){si(r)}get enabled(){return i(this,Rt)}set enabled(r){i(this,Rt)!==r&&(h(this,Rt,r),oi(this))}};Rt=new WeakMap;var ai=me(globalThis.HTMLMediaElement,"video"),di=me(globalThis.HTMLMediaElement,"audio");function ui(e){if(!(e!=null&&e.prototype))return e;let r=me(e,"video");(!r||`${r}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){return Ci(this)}});let t=me(e,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){return _i(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(l,m="",d=""){let T=new yt;return T.kind=l,T.label=m,T.language=d,ue(this,T),T}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=ce),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(l,m="",d=""){let T=new Ct;return T.kind=l,T.label=m,T.language=d,le(this,T),T}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=fe),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return s(this)}});let s=l=>{let m=c(l).videoRenditions;return m||(m=new ht,c(m).media=l,c(l).videoRenditions=m),m};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return n(this)}});let n=l=>{let m=c(l).audioRenditions;return m||(m=new lt,c(m).media=l,c(l).audioRenditions=m),m};return e}function me(e,r){var t;if(e!=null&&e.prototype)return(t=Object.getOwnPropertyDescriptor(e.prototype,`${r}Tracks`))==null?void 0:t.get}function Ci(e){var t;let r=c(e).videoTracks;if(!r&&(r=new ct,c(e).videoTracks=r,ai)){let s=ai.call((t=e.nativeEl)!=null?t:e);for(let n of s)ue(e,n);s.addEventListener("change",()=>{r.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...r].some(l=>l instanceof yt)){for(let l of s)ce(l);return}ue(e,n.track)}),s.addEventListener("removetrack",n=>{ce(n.track)})}return r}function _i(e){var t;let r=c(e).audioTracks;if(!r&&(r=new ft,c(e).audioTracks=r,di)){let s=di.call((t=e.nativeEl)!=null?t:e);for(let n of s)le(e,n);s.addEventListener("change",()=>{r.dispatchEvent(new Event("change"))}),s.addEventListener("addtrack",n=>{if([...r].some(l=>l instanceof Ct)){for(let l of s)fe(l);return}le(e,n.track)}),s.addEventListener("removetrack",n=>{fe(n.track)})}return r}Ae.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"},Hi=Object.values(o),hi=Me(),li="mux-video",w,_t,Ft,It,Yt,Ut,jt,Wt,$t,Pt,ge,Pe=class extends te{constructor(){super();u(this,Pt);u(this,w,void 0);u(this,_t,void 0);u(this,Ft,void 0);u(this,It,{});u(this,Yt,{});u(this,Ut,void 0);u(this,jt,void 0);u(this,Wt,void 0);u(this,$t,void 0);h(this,Ft,Oi())}static get NAME(){return li}static get VERSION(){return hi}static get observedAttributes(){var t;return[...Hi,...(t=te.observedAttributes)!=null?t:[]]}get preferCmcd(){var t;return(t=this.getAttribute(o.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?ci.includes(t)?this.setAttribute(o.PREFER_CMCD,t):console.warn(`Invalid value for preferCmcd. Must be one of ${ci.join()}`):this.removeAttribute(o.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(o.PLAYER_INIT_TIME)?+this.getAttribute(o.PLAYER_INIT_TIME):i(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=i(this,Wt))!=null?t:li}set playerSoftwareName(t){h(this,Wt,t)}get playerSoftwareVersion(){var t;return(t=i(this,jt))!=null?t:hi}set playerSoftwareVersion(t){h(this,jt,t)}get _hls(){var t;return(t=i(this,w))==null?void 0:t.engine}get mux(){var t;return(t=this.nativeEl)==null?void 0:t.mux}get error(){var t;return(t=Mi(this.nativeEl))!=null?t:null}get errorTranslator(){return i(this,$t)}set errorTranslator(t){h(this,$t,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,l;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(l=new URLSearchParams(this.src).get("token"))!=null?l: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{...i(this,Yt),...t!=null?{playback:t}:{},...s!=null?{drm:s}:{}}}set tokens(t){h(this,Yt,t!=null?t:{})}get ended(){return Ui(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):qi(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,l=(t=this.nativeEl.seekable.end(0))!=null?t:0,m=(s=this.nativeEl.seekable.start(0))!=null?s:0;return Math.max(m,l-n)}return Fi(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 Ni(this.nativeEl,t)}get activeCuePoint(){return xi(this.nativeEl)}get cuePoints(){return wi(this.nativeEl)}async addChapters(t){return Di(this.nativeEl,t)}get activeChapter(){return Vi(this.nativeEl)}get chapters(){return ji(this.nativeEl)}getStartDate(){return Gi(this.nativeEl,this._hls)}get currentPdt(){return Bi(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(o.PREFER_PLAYBACK);if(t===pe.MSE||t===pe.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===pe.MSE||t===pe.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 l=this.getAttribute(n);return l!=null&&(s[n.replace(/^metadata-/,"").replace(/-/g,"_")]=l),s},{}),...i(this,It)}}set metadata(t){h(this,It,t!=null?t:{}),this.mux&&this.mux.emit("hb",i(this,It))}get _hlsConfig(){return i(this,Ut)}set _hlsConfig(t){h(this,Ut,t)}load(){h(this,w,Ii(this,this.nativeEl,i(this,w)))}unload(){Pi(this.nativeEl,i(this,w)),h(this,w,void 0)}attributeChangedCallback(t,s,n){var m,d;switch(te.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,P=!!n;!T&&P?y(this,Pt,ge).call(this):T&&!P?this.unload():T&&P&&(this.unload(),y(this,Pt,ge).call(this));break}case"autoplay":if(n===s)break;(m=i(this,w))==null||m.setAutoplay(this.autoplay);break;case"preload":if(n===s)break;(d=i(this,w))==null||d.setPreload(n);break;case o.PLAYBACK_ID:this.src=Li(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&&!i(this,w)&&y(this,Pt,ge).call(this)}disconnectedCallback(){this.unload()}};w=new WeakMap,_t=new WeakMap,Ft=new WeakMap,It=new WeakMap,Yt=new WeakMap,Ut=new WeakMap,jt=new WeakMap,Wt=new WeakMap,$t=new WeakMap,Pt=new WeakSet,ge=async function(){i(this,_t)||(await h(this,_t,Promise.resolve()),h(this,_t,null),this.load())};var Ht,qt=class extends Je(ui(Pe)){constructor(){super(...arguments);u(this,Ht,void 0)}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=i(this,Ht))!=null?t:this.muxCastCustomData}set castCustomData(t){h(this,Ht,t)}};Ht=new WeakMap;Zt.customElements.get("mux-video")||(Zt.customElements.define("mux-video",qt),Zt.MuxVideoElement=qt);var Ps=qt;export{o as Attributes,ks as MediaError,Ae as VideoEvents,Ps as default,Oi as generatePlayerInitTime,li as playerSoftwareName,hi as playerSoftwareVersion};
|
|
44
44
|
//# sourceMappingURL=index.mjs.map
|