@vkontakte/videoplayer-core 2.0.99-dev.49004322.0 → 2.0.99-dev.8e8ba4ac.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/es2015.cjs.js +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +2 -2
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-core v2.0.99-dev.
|
|
3
|
-
* Wed, 13 Mar 2024 12:
|
|
2
|
+
* @vkontakte/videoplayer-core v2.0.99-dev.8e8ba4ac.0
|
|
3
|
+
* Wed, 13 Mar 2024 12:42:15 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/2-0-99/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var qu=Object.create;var Ja=Object.defineProperty;var zu=Object.getOwnPropertyDescriptor;var Wu=Object.getOwnPropertyNames;var Qu=Object.getPrototypeOf,Ku=Object.prototype.hasOwnProperty;var Ju=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Wu(e))!Ku.call(s,r)&&r!==t&&Ja(s,r,{get:()=>e[r],enumerable:!(i=zu(e,r))||i.enumerable});return s};var Xa=(s,e,t)=>(t=s!=null?qu(Qu(s)):{},Ju(e||!s||!s.__esModule?Ja(t,"default",{value:s,enumerable:!0}):t,s));var a=require("@vkontakte/videoplayer-shared/es2015.cjs.js");const qo="2.0.99-dev.49004322.0";exports.PlaybackState=void 0;(function(s){s.STOPPED="stopped",s.READY="ready",s.PLAYING="playing",s.PAUSED="paused"})(exports.PlaybackState||(exports.PlaybackState={}));exports.VideoFormat=void 0;(function(s){s.MPEG="MPEG",s.DASH="DASH",s.DASH_SEP="DASH_SEP",s.DASH_SEP_VK="DASH_SEP",s.DASH_WEBM="DASH_WEBM",s.DASH_WEBM_AV1="DASH_WEBM_AV1",s.DASH_WEBM_VK="DASH_WEBM",s.DASH_ONDEMAND="DASH_ONDEMAND",s.DASH_ONDEMAND_VK="DASH_ONDEMAND",s.DASH_LIVE="DASH_LIVE",s.DASH_LIVE_CMAF="DASH_LIVE_CMAF",s.DASH_LIVE_WEBM="DASH_LIVE_WEBM",s.HLS="HLS",s.HLS_ONDEMAND="HLS_ONDEMAND",s.HLS_JS="HLS",s.HLS_LIVE="HLS_LIVE",s.HLS_LIVE_CMAF="HLS_LIVE_CMAF",s.WEB_RTC_LIVE="WEB_RTC_LIVE"})(exports.VideoFormat||(exports.VideoFormat={}));var ue;(function(s){s.SCREEN="SCREEN",s.CHROMECAST="CHROMECAST"})(ue||(ue={}));exports.ChromecastState=void 0;(function(s){s.NOT_AVAILABLE="NOT_AVAILABLE",s.AVAILABLE="AVAILABLE",s.CONNECTING="CONNECTING",s.CONNECTED="CONNECTED"})(exports.ChromecastState||(exports.ChromecastState={}));exports.HttpConnectionType=void 0;(function(s){s.HTTP1="http1",s.HTTP2="http2",s.QUIC="quic"})(exports.HttpConnectionType||(exports.HttpConnectionType={}));var F;(function(s){s.None="none",s.Requested="requested",s.Applying="applying"})(F||(F={}));exports.Surface=void 0;(function(s){s.NONE="none",s.INLINE="inline",s.FULLSCREEN="fullscreen",s.SECOND_SCREEN="second_screen",s.PIP="pip"})(exports.Surface||(exports.Surface={}));function z(s,e,t,i){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(c){try{u(i.next(c))}catch(h){o(h)}}function d(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?n(c.value):r(c.value).then(l,d)}u((i=i.apply(s,e||[])).next())})}function L(s){return this instanceof L?(this.v=s,this):new L(s)}function fe(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(s,e||[]),r,n=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){i[f]&&(r[f]=function(p){return new Promise(function(b,m){n.push([f,p,b,m])>1||l(f,p)})})}function l(f,p){try{d(i[f](p))}catch(b){h(n[0][3],b)}}function d(f){f.value instanceof L?Promise.resolve(f.value.v).then(u,c):h(n[0][2],f)}function u(f){l("next",f)}function c(f){l("throw",f)}function h(f,p){f(p),n.shift(),n.length&&l(n[0][0],n[0][1])}}var Xu=s=>new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",s),i.onload=()=>e,i.onerror=()=>t,document.body.appendChild(i)});class Zu{constructor(e){var t;this.connection$=new a.ValueSubject(void 0),this.castState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.errorEvent$=new a.Subject,this.realCastState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.subscription=new a.Subscription,this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");const i="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${i}`}),e.isDisabled||!i)return;const r=a.isNonNullable((t=window.chrome)===null||t===void 0?void 0:t.cast),n=!!window.__onGCastApiAvailable;r?this.initializeCastApi():(window.__onGCastApiAvailable=o=>{delete window.__onGCastApiAvailable,o&&this.initializeCastApi()},n||Xu("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:a.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())===null||e===void 0||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())===null||e===void 0?void 0:e.getCurrentSession())===null||t===void 0||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var i,r,n;(n=(r=(i=cast.framework.CastContext.getInstance())===null||i===void 0?void 0:i.getCurrentSession())===null||r===void 0?void 0:r.getMediaSession())===null||n===void 0||n.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){a.isNonNullable(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){const t=this.connection$.getValue();a.isNullable(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){const t=this.connection$.getValue();a.isNullable(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.subscription.unsubscribe()}initListeners(){const e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),i=cast.framework.CastContext.getInstance();this.subscription.add(a.fromEvent(i,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=i.getCurrentSession())===null||n===void 0?void 0:n.getMediaSession())===null||o===void 0?void 0:o.media.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return a.assertNever(r.sessionState)}})).add(a.merge(a.fromEvent(i,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe(a.tap(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),a.map(r=>r.castState)),a.observableFrom([i.getCastState()])).pipe(a.filterChanged(),a.map(ed),a.tap(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var n;const o=r===exports.ChromecastState.CONNECTED,l=a.isNonNullable(this.connection$.getValue());if(o&&!l){const d=i.getCurrentSession();a.assertNonNullable(d);const u=d.getCastDevice(),c=(n=d.getMediaSession())===null||n===void 0?void 0:n.media.contentId;(a.isNullable(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:d,castDevice:u}))}else!o&&l&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r===exports.ChromecastState.CONNECTED?a.isNonNullable(this.connection$.getValue())?exports.ChromecastState.CONNECTED:exports.ChromecastState.AVAILABLE:r)}))}initializeCastApi(){var e;let t,i,r;try{t=cast.framework.CastContext.getInstance(),i=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,r=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(n){return}try{t.setOptions({receiverApplicationId:(e=this.params.receiverApplicationId)!==null&&e!==void 0?e:i,autoJoinPolicy:r}),this.initListeners()}catch(n){this.errorEvent$.next({id:"ChromecastInitializer",category:a.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:n})}}}const ed=s=>{switch(s){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return exports.ChromecastState.NOT_AVAILABLE;case cast.framework.CastState.NOT_CONNECTED:return exports.ChromecastState.AVAILABLE;case cast.framework.CastState.CONNECTING:return exports.ChromecastState.CONNECTING;case cast.framework.CastState.CONNECTED:return exports.ChromecastState.CONNECTED;default:return a.assertNever(s)}};var Gs=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function vs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ke=function(s){try{return!!s()}catch(e){return!0}},td=ke,bs=!td(function(){var s=function(){}.bind();return typeof s!="function"||s.hasOwnProperty("prototype")}),zo=bs,Wo=Function.prototype,Vr=Wo.call,id=zo&&Wo.bind.bind(Vr,Vr),Pe=zo?id:function(s){return function(){return Vr.apply(s,arguments)}},Qo=Pe,sd=Qo({}.toString),rd=Qo("".slice),Si=function(s){return rd(sd(s),8,-1)},ad=Pe,nd=ke,od=Si,Ys=Object,ld=ad("".split),ud=nd(function(){return!Ys("z").propertyIsEnumerable(0)})?function(s){return od(s)=="String"?ld(s,""):Ys(s)}:Ys,gi=function(s){return s==null},dd=gi,cd=TypeError,ha=function(s){if(dd(s))throw cd("Can't call method on "+s);return s},hd=ud,fd=ha,yi=function(s){return hd(fd(s))},Zt={},xi=function(s){return s&&s.Math==Math&&s},le=xi(typeof globalThis=="object"&&globalThis)||xi(typeof window=="object"&&window)||xi(typeof self=="object"&&self)||xi(typeof Gs=="object"&&Gs)||function(){return this}()||Gs||Function("return this")(),Fr=typeof document=="object"&&document.all,pd=typeof Fr=="undefined"&&Fr!==void 0,Ko={all:Fr,IS_HTMLDDA:pd},Jo=Ko,md=Jo.all,ne=Jo.IS_HTMLDDA?function(s){return typeof s=="function"||s===md}:function(s){return typeof s=="function"},vd=le,bd=ne,Za=vd.WeakMap,Sd=bd(Za)&&/native code/.test(String(Za)),en=ne,Xo=Ko,gd=Xo.all,We=Xo.IS_HTMLDDA?function(s){return typeof s=="object"?s!==null:en(s)||s===gd}:function(s){return typeof s=="object"?s!==null:en(s)},yd=ke,ut=!yd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Pt={},Td=le,tn=We,Ur=Td.document,Ed=tn(Ur)&&tn(Ur.createElement),fa=function(s){return Ed?Ur.createElement(s):{}},$d=ut,kd=ke,Pd=fa,Zo=!$d&&!kd(function(){return Object.defineProperty(Pd("div"),"a",{get:function(){return 7}}).a!=7}),Ad=ut,wd=ke,el=Ad&&wd(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),_d=We,Cd=String,Dd=TypeError,Qe=function(s){if(_d(s))return s;throw Dd(Cd(s)+" is not an object")},Rd=bs,Ni=Function.prototype.call,ge=Rd?Ni.bind(Ni):function(){return Ni.apply(Ni,arguments)},pa={},qs=pa,zs=le,Id=ne,sn=function(s){return Id(s)?s:void 0},At=function(s,e){return arguments.length<2?sn(qs[s])||sn(zs[s]):qs[s]&&qs[s][e]||zs[s]&&zs[s][e]},Ld=Pe,Ss=Ld({}.isPrototypeOf),gs=typeof navigator!="undefined"&&String(navigator.userAgent)||"",tl=le,Ws=gs,rn=tl.process,an=tl.Deno,nn=rn&&rn.versions||an&&an.version,on=nn&&nn.v8,Ce,ns;on&&(Ce=on.split("."),ns=Ce[0]>0&&Ce[0]<4?1:+(Ce[0]+Ce[1]));!ns&&Ws&&(Ce=Ws.match(/Edge\/(\d+)/),(!Ce||Ce[1]>=74)&&(Ce=Ws.match(/Chrome\/(\d+)/),Ce&&(ns=+Ce[1])));var il=ns,ln=il,xd=ke,Nd=le,Od=Nd.String,sl=!!Object.getOwnPropertySymbols&&!xd(function(){var s=Symbol();return!Od(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&ln&&ln<41}),Md=sl,rl=Md&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Bd=At,Vd=ne,Fd=Ss,Ud=rl,jd=Object,al=Ud?function(s){return typeof s=="symbol"}:function(s){var e=Bd("Symbol");return Vd(e)&&Fd(e.prototype,jd(s))},Hd=String,ys=function(s){try{return Hd(s)}catch(e){return"Object"}},Gd=ne,Yd=ys,qd=TypeError,wt=function(s){if(Gd(s))return s;throw qd(Yd(s)+" is not a function")},zd=wt,Wd=gi,Ts=function(s,e){var t=s[e];return Wd(t)?void 0:zd(t)},Qs=ge,Ks=ne,Js=We,Qd=TypeError,Kd=function(s,e){var t,i;if(e==="string"&&Ks(t=s.toString)&&!Js(i=Qs(t,s))||Ks(t=s.valueOf)&&!Js(i=Qs(t,s))||e!=="string"&&Ks(t=s.toString)&&!Js(i=Qs(t,s)))return i;throw Qd("Can't convert object to primitive value")},nl={exports:{}},Jd=!0,un=le,Xd=Object.defineProperty,Zd=function(s,e){try{Xd(un,s,{value:e,configurable:!0,writable:!0})}catch(t){un[s]=e}return e},ec=le,tc=Zd,dn="__core-js_shared__",ic=ec[dn]||tc(dn,{}),ma=ic,cn=ma;(nl.exports=function(s,e){return cn[s]||(cn[s]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ol=nl.exports,sc=ha,rc=Object,Es=function(s){return rc(sc(s))},ac=Pe,nc=Es,oc=ac({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return oc(nc(e),t)},lc=Pe,uc=0,dc=Math.random(),cc=lc(1 .toString),ll=function(s){return"Symbol("+(s===void 0?"":s)+")_"+cc(++uc+dc,36)},hc=le,fc=ol,hn=Ue,pc=ll,mc=sl,vc=rl,Ht=hc.Symbol,Xs=fc("wks"),bc=vc?Ht.for||Ht:Ht&&Ht.withoutSetter||pc,ce=function(s){return hn(Xs,s)||(Xs[s]=mc&&hn(Ht,s)?Ht[s]:bc("Symbol."+s)),Xs[s]},Sc=ge,fn=We,pn=al,gc=Ts,yc=Kd,Tc=ce,Ec=TypeError,$c=Tc("toPrimitive"),kc=function(s,e){if(!fn(s)||pn(s))return s;var t=gc(s,$c),i;if(t){if(e===void 0&&(e="default"),i=Sc(t,s,e),!fn(i)||pn(i))return i;throw Ec("Can't convert object to primitive value")}return e===void 0&&(e="number"),yc(s,e)},Pc=kc,Ac=al,va=function(s){var e=Pc(s,"string");return Ac(e)?e:e+""},wc=ut,_c=Zo,Cc=el,Oi=Qe,mn=va,Dc=TypeError,Zs=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,er="enumerable",tr="configurable",ir="writable";Pt.f=wc?Cc?function(e,t,i){if(Oi(e),t=mn(t),Oi(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ir in i&&!i[ir]){var r=Rc(e,t);r&&r[ir]&&(e[t]=i.value,i={configurable:tr in i?i[tr]:r[tr],enumerable:er in i?i[er]:r[er],writable:!1})}return Zs(e,t,i)}:Zs:function(e,t,i){if(Oi(e),t=mn(t),Oi(i),_c)try{return Zs(e,t,i)}catch(r){}if("get"in i||"set"in i)throw Dc("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var $s=function(s,e){return{enumerable:!(s&1),configurable:!(s&2),writable:!(s&4),value:e}},Ic=ut,Lc=Pt,xc=$s,Ti=Ic?function(s,e,t){return Lc.f(s,e,xc(1,t))}:function(s,e,t){return s[e]=t,s},Nc=ol,Oc=ll,vn=Nc("keys"),ba=function(s){return vn[s]||(vn[s]=Oc(s))},Sa={},Mc=Sd,ul=le,Bc=We,Vc=Ti,sr=Ue,rr=ma,Fc=ba,Uc=Sa,bn="Object already initialized",jr=ul.TypeError,jc=ul.WeakMap,os,pi,ls,Hc=function(s){return ls(s)?pi(s):os(s,{})},Gc=function(s){return function(e){var t;if(!Bc(e)||(t=pi(e)).type!==s)throw jr("Incompatible receiver, "+s+" required");return t}};if(Mc||rr.state){var Ne=rr.state||(rr.state=new jc);Ne.get=Ne.get,Ne.has=Ne.has,Ne.set=Ne.set,os=function(s,e){if(Ne.has(s))throw jr(bn);return e.facade=s,Ne.set(s,e),e},pi=function(s){return Ne.get(s)||{}},ls=function(s){return Ne.has(s)}}else{var Nt=Fc("state");Uc[Nt]=!0,os=function(s,e){if(sr(s,Nt))throw jr(bn);return e.facade=s,Vc(s,Nt,e),e},pi=function(s){return sr(s,Nt)?s[Nt]:{}},ls=function(s){return sr(s,Nt)}}var dl={set:os,get:pi,has:ls,enforce:Hc,getterFor:Gc},Yc=bs,cl=Function.prototype,Sn=cl.apply,gn=cl.call,hl=typeof Reflect=="object"&&Reflect.apply||(Yc?gn.bind(Sn):function(){return gn.apply(Sn,arguments)}),qc=Si,zc=Pe,fl=function(s){if(qc(s)==="Function")return zc(s)},ga={},pl={},ml={}.propertyIsEnumerable,vl=Object.getOwnPropertyDescriptor,Wc=vl&&!ml.call({1:2},1);pl.f=Wc?function(e){var t=vl(this,e);return!!t&&t.enumerable}:ml;var Qc=ut,Kc=ge,Jc=pl,Xc=$s,Zc=yi,eh=va,th=Ue,ih=Zo,yn=Object.getOwnPropertyDescriptor;ga.f=Qc?yn:function(e,t){if(e=Zc(e),t=eh(t),ih)try{return yn(e,t)}catch(i){}if(th(e,t))return Xc(!Kc(Jc.f,e,t),e[t])};var sh=ke,rh=ne,ah=/#|\.prototype\./,Ei=function(s,e){var t=oh[nh(s)];return t==uh?!0:t==lh?!1:rh(e)?sh(e):!!e},nh=Ei.normalize=function(s){return String(s).replace(ah,".").toLowerCase()},oh=Ei.data={},lh=Ei.NATIVE="N",uh=Ei.POLYFILL="P",bl=Ei,Tn=fl,dh=wt,ch=bs,hh=Tn(Tn.bind),ks=function(s,e){return dh(s),e===void 0?s:ch?hh(s,e):function(){return s.apply(e,arguments)}},Mi=le,fh=hl,ph=fl,mh=ne,vh=ga.f,bh=bl,Ot=pa,Sh=ks,Mt=Ti,En=Ue,gh=function(s){var e=function(t,i,r){if(this instanceof e){switch(arguments.length){case 0:return new s;case 1:return new s(t);case 2:return new s(t,i)}return new s(t,i,r)}return fh(s,this,arguments)};return e.prototype=s.prototype,e},Ie=function(s,e){var t=s.target,i=s.global,r=s.stat,n=s.proto,o=i?Mi:r?Mi[t]:(Mi[t]||{}).prototype,l=i?Ot:Ot[t]||Mt(Ot,t,{})[t],d=l.prototype,u,c,h,f,p,b,m,S,g;for(f in e)u=bh(i?f:t+(r?".":"#")+f,s.forced),c=!u&&o&&En(o,f),b=l[f],c&&(s.dontCallGetSet?(g=vh(o,f),m=g&&g.value):m=o[f]),p=c&&m?m:e[f],!(c&&typeof b==typeof p)&&(s.bind&&c?S=Sh(p,Mi):s.wrap&&c?S=gh(p):n&&mh(p)?S=ph(p):S=p,(s.sham||p&&p.sham||b&&b.sham)&&Mt(S,"sham",!0),Mt(l,f,S),n&&(h=t+"Prototype",En(Ot,h)||Mt(Ot,h,{}),Mt(Ot[h],f,p),s.real&&d&&(u||!d[f])&&Mt(d,f,p)))},Hr=ut,yh=Ue,Sl=Function.prototype,Th=Hr&&Object.getOwnPropertyDescriptor,ya=yh(Sl,"name"),Eh=ya&&function(){}.name==="something",$h=ya&&(!Hr||Hr&&Th(Sl,"name").configurable),kh={EXISTS:ya,PROPER:Eh,CONFIGURABLE:$h},gl={},Ph=Math.ceil,Ah=Math.floor,wh=Math.trunc||function(e){var t=+e;return(t>0?Ah:Ph)(t)},_h=wh,Ta=function(s){var e=+s;return e!==e||e===0?0:_h(e)},Ch=Ta,Dh=Math.max,Rh=Math.min,Ih=function(s,e){var t=Ch(s);return t<0?Dh(t+e,0):Rh(t,e)},Lh=Ta,xh=Math.min,Nh=function(s){return s>0?xh(Lh(s),9007199254740991):0},Oh=Nh,Ea=function(s){return Oh(s.length)},Mh=yi,Bh=Ih,Vh=Ea,$n=function(s){return function(e,t,i){var r=Mh(e),n=Vh(r),o=Bh(i,n),l;if(s&&t!=t){for(;n>o;)if(l=r[o++],l!=l)return!0}else for(;n>o;o++)if((s||o in r)&&r[o]===t)return s||o||0;return!s&&-1}},Fh={includes:$n(!0),indexOf:$n(!1)},Uh=Pe,ar=Ue,jh=yi,Hh=Fh.indexOf,Gh=Sa,kn=Uh([].push),Yh=function(s,e){var t=jh(s),i=0,r=[],n;for(n in t)!ar(Gh,n)&&ar(t,n)&&kn(r,n);for(;e.length>i;)ar(t,n=e[i++])&&(~Hh(r,n)||kn(r,n));return r},yl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qh=Yh,zh=yl,Wh=Object.keys||function(e){return qh(e,zh)},Qh=ut,Kh=el,Jh=Pt,Xh=Qe,Zh=yi,ef=Wh;gl.f=Qh&&!Kh?Object.defineProperties:function(e,t){Xh(e);for(var i=Zh(t),r=ef(t),n=r.length,o=0,l;n>o;)Jh.f(e,l=r[o++],i[l]);return e};var tf=At,Tl=tf("document","documentElement"),sf=Qe,rf=gl,Pn=yl,af=Sa,nf=Tl,of=fa,lf=ba,An=">",wn="<",Gr="prototype",Yr="script",El=lf("IE_PROTO"),nr=function(){},$l=function(s){return wn+Yr+An+s+wn+"/"+Yr+An},_n=function(s){s.write($l("")),s.close();var e=s.parentWindow.Object;return s=null,e},uf=function(){var s=of("iframe"),e="java"+Yr+":",t;return s.style.display="none",nf.appendChild(s),s.src=String(e),t=s.contentWindow.document,t.open(),t.write($l("document.F=Object")),t.close(),t.F},Bi,is=function(){try{Bi=new ActiveXObject("htmlfile")}catch(e){}is=typeof document!="undefined"?document.domain&&Bi?_n(Bi):uf():_n(Bi);for(var s=Pn.length;s--;)delete is[Gr][Pn[s]];return is()};af[El]=!0;var kl=Object.create||function(e,t){var i;return e!==null?(nr[Gr]=sf(e),i=new nr,nr[Gr]=null,i[El]=e):i=is(),t===void 0?i:rf.f(i,t)},df=ke,cf=!df(function(){function s(){}return s.prototype.constructor=null,Object.getPrototypeOf(new s)!==s.prototype}),hf=Ue,ff=ne,pf=Es,mf=ba,vf=cf,Cn=mf("IE_PROTO"),qr=Object,bf=qr.prototype,Pl=vf?qr.getPrototypeOf:function(s){var e=pf(s);if(hf(e,Cn))return e[Cn];var t=e.constructor;return ff(t)&&e instanceof t?t.prototype:e instanceof qr?bf:null},Sf=Ti,$a=function(s,e,t,i){return i&&i.enumerable?s[e]=t:Sf(s,e,t),s},gf=ke,yf=ne,Tf=We,Ef=kl,Dn=Pl,$f=$a,kf=ce,zr=kf("iterator"),Al=!1,Ye,or,lr;[].keys&&(lr=[].keys(),"next"in lr?(or=Dn(Dn(lr)),or!==Object.prototype&&(Ye=or)):Al=!0);var Pf=!Tf(Ye)||gf(function(){var s={};return Ye[zr].call(s)!==s});Pf?Ye={}:Ye=Ef(Ye);yf(Ye[zr])||$f(Ye,zr,function(){return this});var wl={IteratorPrototype:Ye,BUGGY_SAFARI_ITERATORS:Al},Af=ce,wf=Af("toStringTag"),_l={};_l[wf]="z";var ka=String(_l)==="[object z]",_f=ka,Cf=ne,ss=Si,Df=ce,Rf=Df("toStringTag"),If=Object,Lf=ss(function(){return arguments}())=="Arguments",xf=function(s,e){try{return s[e]}catch(t){}},$i=_f?ss:function(s){var e,t,i;return s===void 0?"Undefined":s===null?"Null":typeof(t=xf(e=If(s),Rf))=="string"?t:Lf?ss(e):(i=ss(e))=="Object"&&Cf(e.callee)?"Arguments":i},Nf=ka,Of=$i,Mf=Nf?{}.toString:function(){return"[object "+Of(this)+"]"},Bf=ka,Vf=Pt.f,Ff=Ti,Uf=Ue,jf=Mf,Hf=ce,Rn=Hf("toStringTag"),Pa=function(s,e,t,i){if(s){var r=t?s:s.prototype;Uf(r,Rn)||Vf(r,Rn,{configurable:!0,value:e}),i&&!Bf&&Ff(r,"toString",jf)}},Gf=wl.IteratorPrototype,Yf=kl,qf=$s,zf=Pa,Wf=Zt,Qf=function(){return this},Kf=function(s,e,t,i){var r=e+" Iterator";return s.prototype=Yf(Gf,{next:qf(+!i,t)}),zf(s,r,!1,!0),Wf[r]=Qf,s},Jf=Ie,Xf=ge,Cl=kh,Zf=Kf,ep=Pl,tp=Pa,In=$a,ip=ce,Ln=Zt,Dl=wl,sp=Cl.PROPER;Cl.CONFIGURABLE;Dl.IteratorPrototype;var Vi=Dl.BUGGY_SAFARI_ITERATORS,ur=ip("iterator"),xn="keys",Fi="values",Nn="entries",rp=function(){return this},ap=function(s,e,t,i,r,n,o){Zf(t,e,i);var l=function(g){if(g===r&&f)return f;if(!Vi&&g in c)return c[g];switch(g){case xn:return function(){return new t(this,g)};case Fi:return function(){return new t(this,g)};case Nn:return function(){return new t(this,g)}}return function(){return new t(this)}},d=e+" Iterator",u=!1,c=s.prototype,h=c[ur]||c["@@iterator"]||r&&c[r],f=!Vi&&h||l(r),p=e=="Array"&&c.entries||h,b,m,S;if(p&&(b=ep(p.call(new s)),b!==Object.prototype&&b.next&&(tp(b,d,!0,!0),Ln[d]=rp)),sp&&r==Fi&&h&&h.name!==Fi&&(u=!0,f=function(){return Xf(h,this)}),r)if(m={values:l(Fi),keys:n?f:l(xn),entries:l(Nn)},o)for(S in m)(Vi||u||!(S in c))&&In(c,S,m[S]);else Jf({target:e,proto:!0,forced:Vi||u},m);return o&&c[ur]!==f&&In(c,ur,f,{name:r}),Ln[e]=f,m},np=function(s,e){return{value:s,done:e}},op=yi,On=Zt,Rl=dl;Pt.f;var lp=ap,Ui=np,Il="Array Iterator",up=Rl.set,dp=Rl.getterFor(Il);lp(Array,"Array",function(s,e){up(this,{type:Il,target:op(s),index:0,kind:e})},function(){var s=dp(this),e=s.target,t=s.kind,i=s.index++;return!e||i>=e.length?(s.target=void 0,Ui(void 0,!0)):t=="keys"?Ui(i,!1):t=="values"?Ui(e[i],!1):Ui([i,e[i]],!1)},"values");On.Arguments=On.Array;var cp=ce,hp=Zt,fp=cp("iterator"),pp=Array.prototype,mp=function(s){return s!==void 0&&(hp.Array===s||pp[fp]===s)},vp=$i,Mn=Ts,bp=gi,Sp=Zt,gp=ce,yp=gp("iterator"),Ll=function(s){if(!bp(s))return Mn(s,yp)||Mn(s,"@@iterator")||Sp[vp(s)]},Tp=ge,Ep=wt,$p=Qe,kp=ys,Pp=Ll,Ap=TypeError,wp=function(s,e){var t=arguments.length<2?Pp(s):e;if(Ep(t))return $p(Tp(t,s));throw Ap(kp(s)+" is not iterable")},_p=ge,Bn=Qe,Cp=Ts,Dp=function(s,e,t){var i,r;Bn(s);try{if(i=Cp(s,"return"),!i){if(e==="throw")throw t;return t}i=_p(i,s)}catch(n){r=!0,i=n}if(e==="throw")throw t;if(r)throw i;return Bn(i),t},Rp=ks,Ip=ge,Lp=Qe,xp=ys,Np=mp,Op=Ea,Vn=Ss,Mp=wp,Bp=Ll,Fn=Dp,Vp=TypeError,rs=function(s,e){this.stopped=s,this.result=e},Un=rs.prototype,Aa=function(s,e,t){var i=t&&t.that,r=!!(t&&t.AS_ENTRIES),n=!!(t&&t.IS_RECORD),o=!!(t&&t.IS_ITERATOR),l=!!(t&&t.INTERRUPTED),d=Rp(e,i),u,c,h,f,p,b,m,S=function(E){return u&&Fn(u,"normal",E),new rs(!0,E)},g=function(E){return r?(Lp(E),l?d(E[0],E[1],S):d(E[0],E[1])):l?d(E,S):d(E)};if(n)u=s.iterator;else if(o)u=s;else{if(c=Bp(s),!c)throw Vp(xp(s)+" is not iterable");if(Np(c)){for(h=0,f=Op(s);f>h;h++)if(p=g(s[h]),p&&Vn(Un,p))return p;return new rs(!1)}u=Mp(s,c)}for(b=n?s.next:u.next;!(m=Ip(b,u)).done;){try{p=g(m.value)}catch(E){Fn(u,"throw",E)}if(typeof p=="object"&&p&&Vn(Un,p))return p}return new rs(!1)},Fp=va,Up=Pt,jp=$s,Hp=function(s,e,t){var i=Fp(e);i in s?Up.f(s,i,jp(0,t)):s[i]=t},Gp=Ie,Yp=Aa,qp=Hp;Gp({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Yp(e,function(i,r){qp(t,i,r)},{AS_ENTRIES:!0}),t}});var zp=pa,Wp=zp.Object.fromEntries,Qp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Kp=Qp,Jp=le,Xp=$i,Zp=Ti,jn=Zt,em=ce,Hn=em("toStringTag");for(var dr in Kp){var Gn=Jp[dr],cr=Gn&&Gn.prototype;cr&&Xp(cr)!==Hn&&Zp(cr,Hn,dr),jn[dr]=jn.Array}var tm=Wp,im=tm,sm=im,rm=sm,Qt=vs(rm),am=Si,Ps=typeof process!="undefined"&&am(process)=="process",nm=Pt,om=function(s,e,t){return nm.f(s,e,t)},lm=At,um=om,dm=ce,cm=ut,Yn=dm("species"),hm=function(s){var e=lm(s);cm&&e&&!e[Yn]&&um(e,Yn,{configurable:!0,get:function(){return this}})},fm=Ss,pm=TypeError,mm=function(s,e){if(fm(e,s))return s;throw pm("Incorrect invocation")},vm=Pe,bm=ne,Wr=ma,Sm=vm(Function.toString);bm(Wr.inspectSource)||(Wr.inspectSource=function(s){return Sm(s)});var xl=Wr.inspectSource,gm=Pe,ym=ke,Nl=ne,Tm=$i,Em=At,$m=xl,Ol=function(){},km=[],Ml=Em("Reflect","construct"),wa=/^\s*(?:class|function)\b/,Pm=gm(wa.exec),Am=!wa.exec(Ol),ai=function(e){if(!Nl(e))return!1;try{return Ml(Ol,km,e),!0}catch(t){return!1}},Bl=function(e){if(!Nl(e))return!1;switch(Tm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Am||!!Pm(wa,$m(e))}catch(t){return!0}};Bl.sham=!0;var wm=!Ml||ym(function(){var s;return ai(ai.call)||!ai(Object)||!ai(function(){s=!0})||s})?Bl:ai,_m=wm,Cm=ys,Dm=TypeError,Rm=function(s){if(_m(s))return s;throw Dm(Cm(s)+" is not a constructor")},qn=Qe,Im=Rm,Lm=gi,xm=ce,Nm=xm("species"),Vl=function(s,e){var t=qn(s).constructor,i;return t===void 0||Lm(i=qn(t)[Nm])?e:Im(i)},Om=Pe,Mm=Om([].slice),Bm=TypeError,Vm=function(s,e){if(s<e)throw Bm("Not enough arguments");return s},Fm=gs,Fl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Fm),Se=le,Um=hl,jm=ks,zn=ne,Hm=Ue,Ul=ke,Wn=Tl,Gm=Mm,Qn=fa,Ym=Vm,qm=Fl,zm=Ps,Qr=Se.setImmediate,Kr=Se.clearImmediate,Wm=Se.process,hr=Se.Dispatch,Qm=Se.Function,Kn=Se.MessageChannel,Km=Se.String,fr=0,ci={},Jn="onreadystatechange",mi,gt,pr,mr;Ul(function(){mi=Se.location});var _a=function(s){if(Hm(ci,s)){var e=ci[s];delete ci[s],e()}},vr=function(s){return function(){_a(s)}},Xn=function(s){_a(s.data)},Zn=function(s){Se.postMessage(Km(s),mi.protocol+"//"+mi.host)};(!Qr||!Kr)&&(Qr=function(e){Ym(arguments.length,1);var t=zn(e)?e:Qm(e),i=Gm(arguments,1);return ci[++fr]=function(){Um(t,void 0,i)},gt(fr),fr},Kr=function(e){delete ci[e]},zm?gt=function(s){Wm.nextTick(vr(s))}:hr&&hr.now?gt=function(s){hr.now(vr(s))}:Kn&&!qm?(pr=new Kn,mr=pr.port2,pr.port1.onmessage=Xn,gt=jm(mr.postMessage,mr)):Se.addEventListener&&zn(Se.postMessage)&&!Se.importScripts&&mi&&mi.protocol!=="file:"&&!Ul(Zn)?(gt=Zn,Se.addEventListener("message",Xn,!1)):Jn in Qn("script")?gt=function(s){Wn.appendChild(Qn("script"))[Jn]=function(){Wn.removeChild(this),_a(s)}}:gt=function(s){setTimeout(vr(s),0)});var jl={set:Qr,clear:Kr},Hl=function(){this.head=null,this.tail=null};Hl.prototype={add:function(s){var e={item:s,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var s=this.head;if(s){var e=this.head=s.next;return e===null&&(this.tail=null),s.item}}};var Gl=Hl,Jm=gs,Xm=/ipad|iphone|ipod/i.test(Jm)&&typeof Pebble!="undefined",Zm=gs,ev=/web0s(?!.*chrome)/i.test(Zm),kt=le,eo=ks,tv=ga.f,br=jl.set,iv=Gl,sv=Fl,rv=Xm,av=ev,Sr=Ps,to=kt.MutationObserver||kt.WebKitMutationObserver,io=kt.document,so=kt.process,ji=kt.Promise,ro=tv(kt,"queueMicrotask"),Jr=ro&&ro.value,Bt,gr,yr,Hi,ao;if(!Jr){var Gi=new iv,Yi=function(){var s,e;for(Sr&&(s=so.domain)&&s.exit();e=Gi.get();)try{e()}catch(t){throw Gi.head&&Bt(),t}s&&s.enter()};!sv&&!Sr&&!av&&to&&io?(gr=!0,yr=io.createTextNode(""),new to(Yi).observe(yr,{characterData:!0}),Bt=function(){yr.data=gr=!gr}):!rv&&ji&&ji.resolve?(Hi=ji.resolve(void 0),Hi.constructor=ji,ao=eo(Hi.then,Hi),Bt=function(){ao(Yi)}):Sr?Bt=function(){so.nextTick(Yi)}:(br=eo(br,kt),Bt=function(){br(Yi)}),Jr=function(s){Gi.head||Bt(),Gi.add(s)}}var nv=Jr,ov=function(s,e){try{arguments.length==1?console.error(s):console.error(s,e)}catch(t){}},Ca=function(s){try{return{error:!1,value:s()}}catch(e){return{error:!0,value:e}}},lv=le,ei=lv.Promise,Yl=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",uv=Yl,dv=Ps,cv=!uv&&!dv&&typeof window=="object"&&typeof document=="object",hv=le,hi=ei,fv=ne,pv=bl,mv=xl,vv=ce,bv=cv,Sv=Yl,Tr=il,no=hi&&hi.prototype,gv=vv("species"),Xr=!1,ql=fv(hv.PromiseRejectionEvent),yv=pv("Promise",function(){var s=mv(hi),e=s!==String(hi);if(!e&&Tr===66||!(no.catch&&no.finally))return!0;if(!Tr||Tr<51||!/native code/.test(s)){var t=new hi(function(n){n(1)}),i=function(n){n(function(){},function(){})},r=t.constructor={};if(r[gv]=i,Xr=t.then(function(){})instanceof i,!Xr)return!0}return!e&&(bv||Sv)&&!ql}),ki={CONSTRUCTOR:yv,REJECTION_EVENT:ql,SUBCLASSING:Xr},ti={},oo=wt,Tv=TypeError,Ev=function(s){var e,t;this.promise=new s(function(i,r){if(e!==void 0||t!==void 0)throw Tv("Bad Promise constructor");e=i,t=r}),this.resolve=oo(e),this.reject=oo(t)};ti.f=function(s){return new Ev(s)};var $v=Ie,us=Ps,lt=le,Pi=ge,kv=$a,Pv=Pa,Av=hm,wv=wt,Zr=ne,_v=We,Cv=mm,Dv=Vl,zl=jl.set,Da=nv,Rv=ov,Iv=Ca,Lv=Gl,Wl=dl,ea=ei,Ra=ki,Ql=ti,As="Promise",Kl=Ra.CONSTRUCTOR,xv=Ra.REJECTION_EVENT;Ra.SUBCLASSING;var Er=Wl.getterFor(As),Nv=Wl.set,Ov=ea&&ea.prototype,Gt=ea,$r=Ov,Jl=lt.TypeError,ta=lt.document,Ia=lt.process,ia=Ql.f,Mv=ia,Bv=!!(ta&&ta.createEvent&<.dispatchEvent),Xl="unhandledrejection",Vv="rejectionhandled",lo=0,Zl=1,Fv=2,La=1,eu=2,qi,uo,Uv,tu=function(s){var e;return _v(s)&&Zr(e=s.then)?e:!1},iu=function(s,e){var t=e.value,i=e.state==Zl,r=i?s.ok:s.fail,n=s.resolve,o=s.reject,l=s.domain,d,u,c;try{r?(i||(e.rejection===eu&&Hv(e),e.rejection=La),r===!0?d=t:(l&&l.enter(),d=r(t),l&&(l.exit(),c=!0)),d===s.promise?o(Jl("Promise-chain cycle")):(u=tu(d))?Pi(u,d,n,o):n(d)):o(t)}catch(h){l&&!c&&l.exit(),o(h)}},su=function(s,e){s.notified||(s.notified=!0,Da(function(){for(var t=s.reactions,i;i=t.get();)iu(i,s);s.notified=!1,e&&!s.rejection&&jv(s)}))},ru=function(s,e,t){var i,r;Bv?(i=ta.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(s,!1,!0),lt.dispatchEvent(i)):i={promise:e,reason:t},!xv&&(r=lt["on"+s])?r(i):s===Xl&&Rv("Unhandled promise rejection",t)},jv=function(s){Pi(zl,lt,function(){var e=s.facade,t=s.value,i=co(s),r;if(i&&(r=Iv(function(){us?Ia.emit("unhandledRejection",t,e):ru(Xl,e,t)}),s.rejection=us||co(s)?eu:La,r.error))throw r.value})},co=function(s){return s.rejection!==La&&!s.parent},Hv=function(s){Pi(zl,lt,function(){var e=s.facade;us?Ia.emit("rejectionHandled",e):ru(Vv,e,s.value)})},Yt=function(s,e,t){return function(i){s(e,i,t)}},zt=function(s,e,t){s.done||(s.done=!0,t&&(s=t),s.value=e,s.state=Fv,su(s,!0))},sa=function(s,e,t){if(!s.done){s.done=!0,t&&(s=t);try{if(s.facade===e)throw Jl("Promise can't be resolved itself");var i=tu(e);i?Da(function(){var r={done:!1};try{Pi(i,e,Yt(sa,r,s),Yt(zt,r,s))}catch(n){zt(r,n,s)}}):(s.value=e,s.state=Zl,su(s,!1))}catch(r){zt({done:!1},r,s)}}};Kl&&(Gt=function(e){Cv(this,$r),wv(e),Pi(qi,this);var t=Er(this);try{e(Yt(sa,t),Yt(zt,t))}catch(i){zt(t,i)}},$r=Gt.prototype,qi=function(e){Nv(this,{type:As,done:!1,notified:!1,parent:!1,reactions:new Lv,rejection:!1,state:lo,value:void 0})},qi.prototype=kv($r,"then",function(e,t){var i=Er(this),r=ia(Dv(this,Gt));return i.parent=!0,r.ok=Zr(e)?e:!0,r.fail=Zr(t)&&t,r.domain=us?Ia.domain:void 0,i.state==lo?i.reactions.add(r):Da(function(){iu(r,i)}),r.promise}),uo=function(){var s=new qi,e=Er(s);this.promise=s,this.resolve=Yt(sa,e),this.reject=Yt(zt,e)},Ql.f=ia=function(s){return s===Gt||s===Uv?new uo(s):Mv(s)});$v({global:!0,constructor:!0,wrap:!0,forced:Kl},{Promise:Gt});Pv(Gt,As,!1,!0);Av(As);var Gv=ce,au=Gv("iterator"),nu=!1;try{var Yv=0,ho={next:function(){return{done:!!Yv++}},return:function(){nu=!0}};ho[au]=function(){return this},Array.from(ho,function(){throw 2})}catch(s){}var qv=function(s,e){if(!e&&!nu)return!1;var t=!1;try{var i={};i[au]=function(){return{next:function(){return{done:t=!0}}}},s(i)}catch(r){}return t},zv=ei,Wv=qv,Qv=ki.CONSTRUCTOR,ou=Qv||!Wv(function(s){zv.all(s).then(void 0,function(){})}),Kv=Ie,Jv=ge,Xv=wt,Zv=ti,eb=Ca,tb=Aa,ib=ou;Kv({target:"Promise",stat:!0,forced:ib},{all:function(e){var t=this,i=Zv.f(t),r=i.resolve,n=i.reject,o=eb(function(){var l=Xv(t.resolve),d=[],u=0,c=1;tb(e,function(h){var f=u++,p=!1;c++,Jv(l,t,h).then(function(b){p||(p=!0,d[f]=b,--c||r(d))},n)}),--c||r(d)});return o.error&&n(o.value),i.promise}});var sb=Ie,rb=ki.CONSTRUCTOR,fo=ei;fo&&fo.prototype;sb({target:"Promise",proto:!0,forced:rb,real:!0},{catch:function(s){return this.then(void 0,s)}});var ab=Ie,nb=ge,ob=wt,lb=ti,ub=Ca,db=Aa,cb=ou;ab({target:"Promise",stat:!0,forced:cb},{race:function(e){var t=this,i=lb.f(t),r=i.reject,n=ub(function(){var o=ob(t.resolve);db(e,function(l){nb(o,t,l).then(i.resolve,r)})});return n.error&&r(n.value),i.promise}});var hb=Ie,fb=ge,pb=ti,mb=ki.CONSTRUCTOR;hb({target:"Promise",stat:!0,forced:mb},{reject:function(e){var t=pb.f(this);return fb(t.reject,void 0,e),t.promise}});var vb=Qe,bb=We,Sb=ti,lu=function(s,e){if(vb(s),bb(e)&&e.constructor===s)return e;var t=Sb.f(s),i=t.resolve;return i(e),t.promise},gb=Ie,yb=At,Tb=Jd,Eb=ei,$b=ki.CONSTRUCTOR,kb=lu,Pb=yb("Promise"),Ab=!$b;gb({target:"Promise",stat:!0,forced:Tb},{resolve:function(e){return kb(Ab&&this===Pb?Eb:this,e)}});var wb=Ie,ra=ei,_b=ke,Cb=At,Db=ne,Rb=Vl,po=lu,Ib=ra&&ra.prototype,Lb=!!ra&&_b(function(){Ib.finally.call({then:function(){}},function(){})});wb({target:"Promise",proto:!0,real:!0,forced:Lb},{finally:function(s){var e=Rb(this,Cb("Promise")),t=Db(s);return this.then(t?function(i){return po(e,s()).then(function(){return i})}:s,t?function(i){return po(e,s()).then(function(){throw i})}:s)}});var xb=At,xa=xb,Nb=xa,Ob=Nb("Promise","finally"),Mb=Ob,Bb=Mb,Vb=Bb,Fb=Vb,ws=vs(Fb),ae;(function(s){s[s.OFFSET_P=0]="OFFSET_P",s[s.PLAYBACK_SHIFT=1]="PLAYBACK_SHIFT",s[s.DASH_CMAF_OFFSET_P=2]="DASH_CMAF_OFFSET_P"})(ae||(ae={}));var De=(s,e=0,t=ae.OFFSET_P)=>{switch(t){case ae.OFFSET_P:return s.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case ae.PLAYBACK_SHIFT:{if(e===0)return s;const i=new URL(s);return i.searchParams.append("playback_shift",e.toFixed(0)),i.toString()}case ae.DASH_CMAF_OFFSET_P:{const i=new URL(s);return!i.searchParams.get("offset_p")&&e===0?s:(i.searchParams.set("offset_p",e.toFixed(0)),i.toString())}default:a.assertNever(t)}return s};const mo=(s,e)=>{var t;switch(e){case ae.OFFSET_P:return NaN;case ae.PLAYBACK_SHIFT:{const i=new URL(s);return Number(i.searchParams.get("playback_shift"))}case ae.DASH_CMAF_OFFSET_P:{const i=new URL(s);return Number((t=i.searchParams.get("offset_p"))!==null&&t!==void 0?t:0)}default:a.assertNever(e)}};var P=(s,e,t=!1)=>{const i=s.getTransition();(t||!i||i.to===e)&&s.setState(e)};class X{constructor(e){this.transitionStarted$=new a.Subject,this.transitionEnded$=new a.Subject,this.transitionUpdated$=new a.Subject,this.forceChanged$=new a.Subject,this.stateChangeStarted$=a.merge(this.transitionStarted$,this.transitionUpdated$),this.stateChangeEnded$=a.merge(this.transitionEnded$,this.forceChanged$),this.state=e,this.prevState=void 0}setState(e){const t=this.transition,i=this.state;this.transition=void 0,this.prevState=i,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:i,to:e,canceledTransition:t})}startTransitionTo(e){const t=this.transition,i=this.state;i===e||a.isNonNullable(t)&&t.to===e||(this.prevState=i,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:i,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}}const Ub=s=>{switch(s){case exports.VideoFormat.MPEG:case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:return!1;case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.DASH_LIVE_CMAF:case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:case exports.VideoFormat.DASH_LIVE_WEBM:case exports.VideoFormat.WEB_RTC_LIVE:return!0;default:return a.assertNever(s)}};var M;(function(s){s.STOPPED="stopped",s.READY="ready",s.PLAYING="playing",s.PAUSED="paused"})(M||(M={}));const jb=5,Hb=5,Gb=500,vo=7e3;class Yb{constructor(e){this.subscription=new a.Subscription,this.loadMediaTimeoutSubscription=new a.Subscription,this.videoState=new X(M.STOPPED),this.syncPlayback=()=>{const i=this.videoState.getState(),r=this.videoState.getTransition(),n=this.params.desiredState.playbackState.getState(),o=this.params.desiredState.playbackState.getTransition(),l=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${i}; videoTransition: ${JSON.stringify(r)}; desiredPlaybackState: ${n}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(l)};`}),n===exports.PlaybackState.STOPPED){i!==M.STOPPED&&(this.videoState.startTransitionTo(M.STOPPED),this.stop());return}if(!r){if((o==null?void 0:o.to)!==exports.PlaybackState.PAUSED&&l.state===F.Requested&&i!==M.STOPPED){this.seek(l.position/1e3);return}switch(n){case exports.PlaybackState.READY:{switch(i){case M.PLAYING:case M.PAUSED:case M.READY:break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}case exports.PlaybackState.PLAYING:{switch(i){case M.PLAYING:break;case M.PAUSED:this.videoState.startTransitionTo(M.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case M.READY:this.videoState.startTransitionTo(M.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}case exports.PlaybackState.PAUSED:{switch(i){case M.PLAYING:this.videoState.startTransitionTo(M.PAUSED),this.params.connection.remotePlayerController.playOrPause();break;case M.PAUSED:break;case M.READY:this.videoState.startTransitionTo(M.PAUSED),this.videoState.setState(M.PAUSED);break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}default:a.assertNever(n)}}},this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Ub(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});const t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);const e=new a.Subscription;this.subscription.add(e),this.subscription.add(a.merge(this.videoState.stateChangeStarted$.pipe(a.map(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe(a.map(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));const t=(r,n)=>this.subscription.add(r.subscribe(n));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{const r=new a.Subject;e.add(r.pipe(a.debounce(Gb)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let n=NaN;e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(o=>{this.logRemoteEvent(o);const l=o.value;this.params.output.position$.next(l),(this.params.desiredState.seekState.getState().state===F.Applying||Math.abs(l-n)>jb)&&r.next(l),n=l})),e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(o=>{this.logRemoteEvent(o),this.params.output.duration$.next(o.value)}))}t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);const{remotePlayer:n}=this.params.connection,o=r.value,l=this.params.output.isBuffering$.getValue(),d=o===chrome.cast.media.PlayerState.BUFFERING;switch(l!==d&&this.params.output.isBuffering$.next(d),o){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&n.duration-n.currentTime<Hb&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),P(this.params.desiredState.playbackState,exports.PlaybackState.STOPPED);break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:a.assertNever(o)}}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});const i=a.merge(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,a.observableFrom(["init"])).pipe(a.debounce(0));t(i,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});const{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState(M.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED)):(this.videoState.setState(M.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING));const i=this.params.output.isLive$.getValue();this.params.output.duration$.next(i?0:t.duration),this.params.output.position$.next(i?0:t.currentTime),this.params.desiredState.seekState.setState({state:F.None})}}prepare(){const e=this.params.format;this.log({message:`[prepare] format: ${e}`});const t=this.createMediaInfo(e),i=this.createLoadRequest(t);this.loadMedia(i)}handleRemotePause(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===M.PAUSED||e===M.PLAYING)&&(this.videoState.setState(M.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED))}handleRemotePlay(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===M.PLAYING||e===M.PAUSED)&&(this.videoState.setState(M.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING))}handleRemoteReady(){var e;const t=this.videoState.getTransition();(t==null?void 0:t.to)===M.READY&&this.videoState.setState(M.READY),((e=this.params.desiredState.playbackState.getTransition())===null||e===void 0?void 0:e.to)===exports.PlaybackState.READY&&P(this.params.desiredState.playbackState,exports.PlaybackState.READY)}handleRemoteStop(){this.videoState.getState()!==M.STOPPED&&this.videoState.setState(M.STOPPED)}handleRemoteVolumeChange(e){var t,i;const r=this.params.output.volume$.getValue(),n={volume:(t=e.volume)!==null&&t!==void 0?t:r.volume,muted:(i=e.muted)!==null&&i!==void 0?i:r.muted};(n.volume!==r.volume||n.muted!==n.muted)&&this.params.output.volume$.next(n)}seek(e){this.params.output.willSeekEvent$.next();const{remotePlayer:t,remotePlayerController:i}=this.params.connection;t.currentTime=e,i.seek()}stop(){const{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var t;const i=this.params.source;let r,n,o;switch(e){case exports.VideoFormat.MPEG:{const c=i[e];a.assertNonNullable(c);const h=a.getHighestQuality(Object.keys(c));a.assertNonNullable(h);const f=c[h];a.assertNonNullable(f),r=f,n="video/mp4",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/x-mpegurl",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_LIVE_CMAF:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:{const c=i[e];a.assertNonNullable(c),r=De(c.url),n="application/x-mpegurl",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.WEB_RTC_LIVE:{const c="Unsupported format for Chromecast",h=new Error(c);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:a.ErrorCategory.VIDEO_PIPELINE,message:c,thrown:h}),h}case exports.VideoFormat.DASH_LIVE_WEBM:throw new Error("DASH_LIVE_WEBM is no longer supported");default:return a.assertNever(e)}const l=new chrome.cast.media.MediaInfo((t=this.params.meta.videoId)!==null&&t!==void 0?t:r,n);l.contentUrl=r,l.streamType=o,l.metadata=new chrome.cast.media.GenericMediaMetadata;const{title:d,subtitle:u}=this.params.meta;return a.isNonNullable(d)&&(l.metadata.title=d),a.isNonNullable(u)&&(l.metadata.subtitle=u),l}createLoadRequest(e){const t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;const i=this.params.desiredState.seekState.getState();return i.state===F.Applying||i.state===F.Requested?t.currentTime=this.params.output.isLive$.getValue()?0:i.position/1e3:t.currentTime=0,t}loadMedia(e){const t=this.params.connection.session.loadMedia(e),i=new Promise((r,n)=>{this.loadMediaTimeoutSubscription.add(a.timeout(vo).subscribe(()=>n(`timeout(${vo})`)))});ws(Promise.race([t,i]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state===F.Applying&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{const n=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:n}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:a.ErrorCategory.VIDEO_PIPELINE,message:n,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}}var qb=s=>{let e,t=!1,i=!1;s.on("playbackTimeUpdated",({timeToEnd:r})=>{i=r<=3,t&&i&&(e==null||e())}),s.extend("MediaSourceController",function(){const{parent:r}=this,n=r.signalEndOfStream;return{signalEndOfStream:o=>{t=!0,e=()=>n(o),t&&i&&(e==null||e())}}},!0)},zb=s=>{const e=new a.ValueSubject(1/0),t=new a.Subject,i=new a.ValueSubject(void 0),r=new a.ValueSubject(void 0);let n=NaN,o=!1;const l=()=>{n=Date.now(),o=!1},d=c=>{var h,f,p,b,m;const S=Qt(c.getAllResponseHeaders().trim().split(/[\n\r]+/).map(v=>v.split(": ")));if("x-playback-duration"in S||"x-playback-duration-millis"in S){const v=parseInt((h=c.getResponseHeader("X-Playback-Duration"))!==null&&h!==void 0?h:"",10),y=parseInt((f=c.getResponseHeader("X-Playback-Duration-Millis"))!==null&&f!==void 0?f:"",10),T=(p=y!=null?y:v*1e3)!==null&&p!==void 0?p:NaN;a.isNonNullable(T)&&!isNaN(T)&&e.next(T)}const g=(b=S["x-delivery-type"])!==null&&b!==void 0?b:exports.HttpConnectionType.HTTP1,E=(m={1:!0,0:!1}[S["x-reused"]])!==null&&m!==void 0?m:void 0;i.next(g),r.next(E)},u=c=>{c.readyState>=2&&!o&&(o=!0,t.next(Date.now()-n))};return s.extend("XHRLoader",function(){const{parent:c}=this,h=c.load.bind(c);return{load:function(f){if(f.request.type==="MPD"){const p=f.onload,b=f.progress;f.onload=function(...m){return d(this),p(...m)},f.progress=function(...m){return u(this),b(...m)},l()}return h(f)}}},!0),{playbackDuration$:e,ping$:t,connectionReused$:r,connectionType$:i}},Kt=s=>{const e=new URL(s);return e.searchParams.set("quic","1"),e.toString()},Wb=s=>s.extend("RequestModifier",()=>({modifyRequestURL:Kt}),!0),Qb=s=>{s.extend("HTTPLoader",function(){const{parent:e}=this,t=e.load;return{load:i=>{if(i.request&&i.request.range){const[r,n]=i.request.range.split("-").map(l=>parseInt(l,10)),o=new URL(i.request.url,location.href);o.searchParams.append("bytes",`${r}-${n}`),i.request.url=o.toString(),i.request.range=void 0}t(i)}}},!0)};const Re=(s,e,t,{equal:i=(o,l)=>o===l,changed$:r,onError:n}={})=>{const o=s.getState(),l=e(),d=a.isNullable(r),u=new a.Subscription;return r&&u.add(r.subscribe(c=>{const h=s.getState();i(c,h)&&s.setState(c)},n)),i(l,o)||(t(o),d&&s.setState(o)),u.add(s.stateChangeStarted$.subscribe(c=>{t(c.to),d&&s.setState(c.to)},n)),u},_t=(s,e,t)=>Re(e,()=>s.loop,i=>{a.isNonNullable(i)&&(s.loop=i)},{onError:t}),Ke=(s,e,t,i)=>Re(e,()=>({muted:s.muted,volume:s.volume}),r=>{a.isNonNullable(r)&&(s.muted=r.muted,s.volume=r.volume)},{equal:(r,n)=>r===n||(r==null?void 0:r.muted)===(n==null?void 0:n.muted)&&(r==null?void 0:r.volume)===(n==null?void 0:n.volume),changed$:t,onError:i}),dt=(s,e,t,i)=>Re(e,()=>s.playbackRate,r=>{a.isNonNullable(r)&&(s.playbackRate=r)},{changed$:t,onError:i}),Kb=s=>["__",s.language,s.label].join("|"),Jb=(s,e)=>{if(s.id===e)return!0;const[t,i,r]=e.split("|");return s.language===i&&s.label===r};class je{constructor(){this.available$=new a.Subject,this.current$=new a.ValueSubject(void 0),this.error$=new a.Subject,this.subscription=new a.Subscription,this.externalTracks=new Map,this.internalTracks=new Map}connect(e,t,i){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();const r=n=>{this.error$.next({id:"TextTracksManager",category:a.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:n})};this.subscription.add(this.available$.subscribe(i.availableTextTracks$)),this.subscription.add(this.current$.subscribe(i.currentTextTrack$)),this.subscription.add(this.error$.subscribe(i.error$)),this.subscription.add(Re(t.internalTextTracks,()=>Object.values(this.internalTracks),n=>{a.isNonNullable(n)&&this.setInternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="internal"))),onError:r})),this.subscription.add(Re(t.externalTextTracks,()=>Object.values(this.externalTracks),n=>{a.isNonNullable(n)&&this.setExternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="external"))),onError:r})),this.subscription.add(Re(t.currentTextTrack,()=>{if(this.video)return;const n=this.htmlTextTracksAsArray().find(({mode:o})=>o==="showing");return n&&this.htmlTextTrackToITextTrack(n).id},n=>this.select(n),{changed$:this.current$,onError:r})),this.subscription.add(Re(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(const n of this.htmlTextTracksAsArray())this.applyCueSettings(n.cues),this.applyCueSettings(n.activeCues)}))}subscribe(){a.assertNonNullable(this.video);const{textTracks:e}=this.video;this.subscription.add(a.fromEvent(e,"addtrack").subscribe(()=>{const i=this.current$.getValue();i&&this.select(i)})),this.subscription.add(a.merge(a.fromEvent(e,"addtrack"),a.fromEvent(e,"removetrack"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().map(i=>this.htmlTextTrackToITextTrack(i))),a.filterChanged((i,r)=>i.length===r.length&&i.every(({id:n},o)=>n===r[o].id))).subscribe(this.available$)),this.subscription.add(a.merge(a.fromEvent(e,"change"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().find(({mode:i})=>i==="showing")),a.map(i=>i&&this.htmlTextTrackToITextTrack(i).id),a.filterChanged()).subscribe(this.current$));const t=i=>{var r,n;return this.applyCueSettings((n=(r=i.target)===null||r===void 0?void 0:r.activeCues)!==null&&n!==void 0?n:null)};this.subscription.add(a.fromEvent(e,"addtrack").subscribe(i=>{var r,n;(r=i.track)===null||r===void 0||r.addEventListener("cuechange",t);const o=l=>{var d,u,c,h,f;const p=(u=(d=l.target)===null||d===void 0?void 0:d.cues)!==null&&u!==void 0?u:null;p&&p.length&&(this.applyCueSettings((h=(c=l.target)===null||c===void 0?void 0:c.cues)!==null&&h!==void 0?h:null),(f=l.target)===null||f===void 0||f.removeEventListener("cuechange",o))};(n=i.track)===null||n===void 0||n.addEventListener("cuechange",o)})),this.subscription.add(a.fromEvent(e,"removetrack").subscribe(i=>{var r;(r=i.track)===null||r===void 0||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;const t=this.cueSettings.getState();for(const i of Array.from(e)){const r=i;a.isNonNullable(t.align)&&(r.align=t.align),a.isNonNullable(t.position)&&(r.position=t.position),a.isNonNullable(t.size)&&(r.size=t.size),a.isNonNullable(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){a.assertNonNullable(this.video);const t=[...this.video.textTracks];return e?t:t.filter(je.isHealthyTrack)}htmlTextTrackToITextTrack(e){var t,i;const{language:r,label:n}=e,o=e.id?e.id:Kb(e),l=this.externalTracks.has(o),d=o.includes("auto");return l?{id:o,type:"external",isAuto:d,language:r,label:n,url:(t=this.externalTracks.get(o))===null||t===void 0?void 0:t.url}:{id:o,type:"internal",isAuto:d,language:r,label:n,url:(i=this.internalTracks.get(o))===null||i===void 0?void 0:i.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(i=>i.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){const t=[...this.externalTracks];e.filter(({id:i,language:r,isAuto:n})=>!this.internalTracks.has(i)&&!t.some(([,o])=>o.language===r&&o.isAuto===n)).forEach(i=>this.attach(i)),Array.from(this.internalTracks).filter(([i])=>!e.find(r=>r.id===i)).forEach(([,i])=>this.detach(i))}select(e){a.assertNonNullable(this.video);for(const t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(const t of this.htmlTextTracksAsArray(!0))(a.isNullable(e)||!Jb(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(const e of Array.from(this.video.getElementsByTagName("track"))){const t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){a.assertNonNullable(this.video);const t=document.createElement("track");t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){a.assertNonNullable(this.video);const t=Array.prototype.find.call(this.video.getElementsByTagName("track"),i=>i.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}}const Na=s=>{s.removeAttribute("src"),s.load()},Xb=s=>{try{s.pause(),s.playbackRate=0,Na(s),s.remove()}catch(e){console.error(e)}};class Zb{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}}const aa=window.WeakMap?new WeakMap:new Zb,Je=s=>{let e=s.querySelector("video");const t=!!e;return e?Na(e):(e=document.createElement("video"),s.appendChild(e)),aa.set(e,t),e.setAttribute("crossorigin","anonymous"),e.setAttribute("playsinline","playsinline"),e.controls=!1,e.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e},Xe=s=>{const e=aa.get(s);aa.delete(s),e?Na(s):Xb(s)};class _s{constructor(){this.pausedTime=0,this.streamOffset=0,this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}}const uu=s=>{var e;let t=s;for(;!(t instanceof Document)&&!(t instanceof ShadowRoot)&&t!==null;)t=t==null?void 0:t.parentNode;return(e=t)!==null&&e!==void 0?e:void 0},bo=s=>{const e=uu(s);return!!(e&&e.fullscreenElement&&e.fullscreenElement===s)},eS=s=>{const e=uu(s);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===s)},na=3;class tS{constructor(e){this._buffer=[],this._source=e}fill(){this._buffer=[];const e=this._source.currentTime;for(let t=0,i=this._source.buffered.length;t<i;t++){let r=this._source.buffered.start(t);const n=this._source.buffered.end(t);r>e&&r-e<na&&(r=e),this._buffer.push({from:r,to:n,i:t})}return this._buffer.sort(function(t,i){return t.from-i.from}),this._buffer}getByTime(e){return this._buffer.find(t=>e>=t.from&&e<t.to)}getNextWithGap(e,t){const i=this.getNext(e);if(i&&i.from-e.to<(t||na))return i}getNext(e){let t=this._buffer.indexOf(e);if(~t&&this._buffer.length-1>t)return this._buffer[++t]}smartRemove(e,t,i){this._buffer.forEach(({from:r,to:n})=>{const o=r>=e&&r<t,l=n>=e&&n<t;o&&l||(o?i(t,n):l?i(r,e):r<e&&n>t?(i(t,n),i(r,e)):i(r,n))})}destroy(){this._buffer=[]}}var du=(s,e,t=na)=>{let i=0,r=0;for(let n=0;n<s.length;n++){const o=s.start(n),l=s.end(n);if(o<=e&&e<=l){if(i=o,r=l,!t)return{from:i,to:r};for(let d=n-1;d>=0;d--)s.end(d)+t>=i&&(i=s.start(d));for(let d=n+1;d<s.length;d++)s.start(d)-t<=r&&(r=s.end(d))}}return{from:i,to:r}};const Ze=s=>{const e=v=>a.fromEvent(s,v).pipe(a.mapTo(void 0)),t=["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"],i=a.merge(...t.map(v=>a.fromEvent(s,v))).pipe(a.map(v=>v.type==="ended"?s.readyState<2:s.readyState<3),a.filterChanged()),r=a.merge(a.fromEvent(s,"progress"),a.fromEvent(s,"timeupdate")).pipe(a.map(()=>du(s.buffered,s.currentTime))),o=a.getCurrentBrowser().browser===a.CurrentClientBrowser.Safari?a.combine({play:e("play").pipe(a.once()),playing:e("playing")}).pipe(a.mapTo(void 0)):e("playing"),l=a.fromEvent(s,"volumechange").pipe(a.map(()=>({muted:s.muted,volume:s.volume}))),d=a.fromEvent(s,"ratechange").pipe(a.map(()=>s.playbackRate)),u=a.fromEvent(s,"error").pipe(a.filter(()=>!!(s.error||s.played.length)),a.map(()=>{var v;const y=s.error;return{id:y?`MediaError#${y.code}`:"HtmlVideoError",category:a.ErrorCategory.VIDEO_PIPELINE,message:y?y.message:"Error event from HTML video element",thrown:(v=s.error)!==null&&v!==void 0?v:void 0}})),c=a.fromEvent(s,"timeupdate").pipe(a.map(()=>s.currentTime)),h=new a.Subject,f=.3;let p;c.subscribe(v=>{s.loop&&a.isNonNullable(p)&&a.isNonNullable(v)&&p>=s.duration-f&&v<=f&&h.next(p),p=v});const b=a.fromEvent(s,"enterpictureinpicture"),m=a.fromEvent(s,"leavepictureinpicture"),S=new a.ValueSubject(eS(s));b.subscribe(()=>S.next(!0)),m.subscribe(()=>S.next(!1));const g=new a.ValueSubject(bo(s));return a.fromEvent(s,"fullscreenchange").pipe(a.map(()=>bo(s))).subscribe(g),{playing$:o,pause$:e("pause").pipe(a.filter(()=>!s.error)),canplay$:e("canplay"),ended$:e("ended"),looped$:h,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:c,durationChange$:a.fromEvent(s,"durationchange").pipe(a.map(()=>s.duration)),isBuffering$:i,currentBuffer$:r,volumeState$:l,playbackRateState$:d,inPiP$:S,inFullscreen$:g}},Oa=s=>{if(s.includes("/")){const e=s.split("/");return parseInt(e[0])/parseInt(e[1])}else return parseFloat(s)};var iS=Ie,sS=Es,rS=Ea,aS=Ta;iS({target:"Array",proto:!0},{at:function(e){var t=sS(this),i=rS(t),r=aS(e),n=r>=0?r:i+r;return n<0||n>=i?void 0:t[n]}});var nS=xa,oS=nS("Array","at"),lS=oS,uS=lS,dS=uS,cS=dS,He=vs(cS);let Ma=!1,Ge={};const hS=s=>{Ma=s},fS=()=>{Ge={}},pS=s=>{s(Ge)},zi=(s,e)=>{var t;Ma&&(Ge.meta=(t=Ge.meta)!==null&&t!==void 0?t:{},Ge.meta[s]=e)};class Be{constructor(e){this.name=e}next(e){var t,i;if(!Ma)return;Ge.series=(t=Ge.series)!==null&&t!==void 0?t:{};const r=(i=Ge.series[this.name])!==null&&i!==void 0?i:[];r.push([Date.now(),e]),Ge.series[this.name]=r}}var Et;(function(s){s.FitsContainer="FitsContainer",s.FitsThroughput="FitsThroughput",s.Buffer="Buffer",s.DroppedFramesLimit="DroppedFramesLimit",s.FitsQualityLimits="FitsQualityLimits"})(Et||(Et={}));const mS=new Be("best_bitrate"),vS=(s,e,t)=>(e-t)*Math.pow(2,-10*s)+t;class bS{constructor(){this.history={}}recordSelection(e){this.history[e.id]=a.now()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}}const SS='Assertion "ABR Tracks is empty array" failed',ii=(s,{container:e,throughput:t,tuning:i,limits:r,reserve:n=0,forwardBufferHealth:o,playbackRate:l,current:d,history:u,droppedVideoMaxQualityLimit:c,abrLogger:h})=>{var f,p,b,m,S;a.assertNotEmptyArray(s,SS);const g=i.usePixelRatio&&(f=window.devicePixelRatio)!==null&&f!==void 0?f:1,E=i.limitByContainer&&e&&e.width>0&&e.height>0&&{width:e.width*g*i.containerSizeFactor,height:e.height*g*i.containerSizeFactor},v=E&&a.videoSizeToQuality(E),y=i.considerPlaybackRate&&a.isNonNullable(l)?l:1,T=s.filter(I=>!a.isInvariantQuality(I.quality)).sort((I,w)=>a.isHigher(I.quality,w.quality)?-1:1),k=(p=He(T,-1))===null||p===void 0?void 0:p.quality,R=(b=He(T,0))===null||b===void 0?void 0:b.quality,x=a.isNullable(r)||a.isNonNullable(r.min)&&a.isNonNullable(r.max)&&a.isLower(r.max,r.min)||a.isNonNullable(r.min)&&R&&a.isHigher(r.min,R)||a.isNonNullable(r.max)&&k&&a.isLower(r.max,k),D=y*vS(o!=null?o:.5,i.bitrateFactorAtEmptyBuffer,i.bitrateFactorAtFullBuffer),N={},C=T.filter(I=>(v?a.isLower(I.quality,v):!0)?(a.isNonNullable(t)&&isFinite(t)&&a.isNonNullable(I.bitrate)?t-n>=I.bitrate*D:!0)?i.lazyQualitySwitch&&a.isNonNullable(i.minBufferToSwitchUp)&&d&&!a.isInvariantQuality(d.quality)&&(o!=null?o:0)<i.minBufferToSwitchUp&&a.isHigher(I.quality,d.quality)?(N[I.quality]=Et.Buffer,!1):!!c&&a.isHigherOrEqual(I.quality,c)?(N[I.quality]=Et.DroppedFramesLimit,!1):x||(a.isNullable(r.max)||a.isLowerOrEqual(I.quality,r.max))&&(a.isNullable(r.min)||a.isHigherOrEqual(I.quality,r.min))?!0:(N[I.quality]=Et.FitsQualityLimits,!1):(N[I.quality]=Et.FitsThroughput,!1):(N[I.quality]=Et.FitsContainer,!1))[0];C&&C.bitrate&&mS.next(C.bitrate);const A=(m=C!=null?C:T[Math.ceil((T.length-1)/2)])!==null&&m!==void 0?m:s[0];A.quality!==((S=u==null?void 0:u.last)===null||S===void 0?void 0:S.quality)&&h({message:`
|
|
6
|
+
"use strict";var qu=Object.create;var Ja=Object.defineProperty;var zu=Object.getOwnPropertyDescriptor;var Wu=Object.getOwnPropertyNames;var Qu=Object.getPrototypeOf,Ku=Object.prototype.hasOwnProperty;var Ju=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Wu(e))!Ku.call(s,r)&&r!==t&&Ja(s,r,{get:()=>e[r],enumerable:!(i=zu(e,r))||i.enumerable});return s};var Xa=(s,e,t)=>(t=s!=null?qu(Qu(s)):{},Ju(e||!s||!s.__esModule?Ja(t,"default",{value:s,enumerable:!0}):t,s));var a=require("@vkontakte/videoplayer-shared/es2015.cjs.js");const qo="2.0.99-dev.8e8ba4ac.0";exports.PlaybackState=void 0;(function(s){s.STOPPED="stopped",s.READY="ready",s.PLAYING="playing",s.PAUSED="paused"})(exports.PlaybackState||(exports.PlaybackState={}));exports.VideoFormat=void 0;(function(s){s.MPEG="MPEG",s.DASH="DASH",s.DASH_SEP="DASH_SEP",s.DASH_SEP_VK="DASH_SEP",s.DASH_WEBM="DASH_WEBM",s.DASH_WEBM_AV1="DASH_WEBM_AV1",s.DASH_WEBM_VK="DASH_WEBM",s.DASH_ONDEMAND="DASH_ONDEMAND",s.DASH_ONDEMAND_VK="DASH_ONDEMAND",s.DASH_LIVE="DASH_LIVE",s.DASH_LIVE_CMAF="DASH_LIVE_CMAF",s.DASH_LIVE_WEBM="DASH_LIVE_WEBM",s.HLS="HLS",s.HLS_ONDEMAND="HLS_ONDEMAND",s.HLS_JS="HLS",s.HLS_LIVE="HLS_LIVE",s.HLS_LIVE_CMAF="HLS_LIVE_CMAF",s.WEB_RTC_LIVE="WEB_RTC_LIVE"})(exports.VideoFormat||(exports.VideoFormat={}));var ue;(function(s){s.SCREEN="SCREEN",s.CHROMECAST="CHROMECAST"})(ue||(ue={}));exports.ChromecastState=void 0;(function(s){s.NOT_AVAILABLE="NOT_AVAILABLE",s.AVAILABLE="AVAILABLE",s.CONNECTING="CONNECTING",s.CONNECTED="CONNECTED"})(exports.ChromecastState||(exports.ChromecastState={}));exports.HttpConnectionType=void 0;(function(s){s.HTTP1="http1",s.HTTP2="http2",s.QUIC="quic"})(exports.HttpConnectionType||(exports.HttpConnectionType={}));var F;(function(s){s.None="none",s.Requested="requested",s.Applying="applying"})(F||(F={}));exports.Surface=void 0;(function(s){s.NONE="none",s.INLINE="inline",s.FULLSCREEN="fullscreen",s.SECOND_SCREEN="second_screen",s.PIP="pip"})(exports.Surface||(exports.Surface={}));function z(s,e,t,i){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(c){try{u(i.next(c))}catch(h){o(h)}}function d(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?n(c.value):r(c.value).then(l,d)}u((i=i.apply(s,e||[])).next())})}function L(s){return this instanceof L?(this.v=s,this):new L(s)}function fe(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(s,e||[]),r,n=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){i[f]&&(r[f]=function(p){return new Promise(function(b,m){n.push([f,p,b,m])>1||l(f,p)})})}function l(f,p){try{d(i[f](p))}catch(b){h(n[0][3],b)}}function d(f){f.value instanceof L?Promise.resolve(f.value.v).then(u,c):h(n[0][2],f)}function u(f){l("next",f)}function c(f){l("throw",f)}function h(f,p){f(p),n.shift(),n.length&&l(n[0][0],n[0][1])}}var Xu=s=>new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",s),i.onload=()=>e,i.onerror=()=>t,document.body.appendChild(i)});class Zu{constructor(e){var t;this.connection$=new a.ValueSubject(void 0),this.castState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.errorEvent$=new a.Subject,this.realCastState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.subscription=new a.Subscription,this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");const i="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${i}`}),e.isDisabled||!i)return;const r=a.isNonNullable((t=window.chrome)===null||t===void 0?void 0:t.cast),n=!!window.__onGCastApiAvailable;r?this.initializeCastApi():(window.__onGCastApiAvailable=o=>{delete window.__onGCastApiAvailable,o&&this.initializeCastApi()},n||Xu("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:a.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())===null||e===void 0||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())===null||e===void 0?void 0:e.getCurrentSession())===null||t===void 0||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var i,r,n;(n=(r=(i=cast.framework.CastContext.getInstance())===null||i===void 0?void 0:i.getCurrentSession())===null||r===void 0?void 0:r.getMediaSession())===null||n===void 0||n.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){a.isNonNullable(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){const t=this.connection$.getValue();a.isNullable(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){const t=this.connection$.getValue();a.isNullable(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.subscription.unsubscribe()}initListeners(){const e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),i=cast.framework.CastContext.getInstance();this.subscription.add(a.fromEvent(i,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=i.getCurrentSession())===null||n===void 0?void 0:n.getMediaSession())===null||o===void 0?void 0:o.media.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return a.assertNever(r.sessionState)}})).add(a.merge(a.fromEvent(i,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe(a.tap(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),a.map(r=>r.castState)),a.observableFrom([i.getCastState()])).pipe(a.filterChanged(),a.map(ed),a.tap(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var n;const o=r===exports.ChromecastState.CONNECTED,l=a.isNonNullable(this.connection$.getValue());if(o&&!l){const d=i.getCurrentSession();a.assertNonNullable(d);const u=d.getCastDevice(),c=(n=d.getMediaSession())===null||n===void 0?void 0:n.media.contentId;(a.isNullable(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:d,castDevice:u}))}else!o&&l&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r===exports.ChromecastState.CONNECTED?a.isNonNullable(this.connection$.getValue())?exports.ChromecastState.CONNECTED:exports.ChromecastState.AVAILABLE:r)}))}initializeCastApi(){var e;let t,i,r;try{t=cast.framework.CastContext.getInstance(),i=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,r=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(n){return}try{t.setOptions({receiverApplicationId:(e=this.params.receiverApplicationId)!==null&&e!==void 0?e:i,autoJoinPolicy:r}),this.initListeners()}catch(n){this.errorEvent$.next({id:"ChromecastInitializer",category:a.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:n})}}}const ed=s=>{switch(s){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return exports.ChromecastState.NOT_AVAILABLE;case cast.framework.CastState.NOT_CONNECTED:return exports.ChromecastState.AVAILABLE;case cast.framework.CastState.CONNECTING:return exports.ChromecastState.CONNECTING;case cast.framework.CastState.CONNECTED:return exports.ChromecastState.CONNECTED;default:return a.assertNever(s)}};var Gs=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function vs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ke=function(s){try{return!!s()}catch(e){return!0}},td=ke,bs=!td(function(){var s=function(){}.bind();return typeof s!="function"||s.hasOwnProperty("prototype")}),zo=bs,Wo=Function.prototype,Vr=Wo.call,id=zo&&Wo.bind.bind(Vr,Vr),Pe=zo?id:function(s){return function(){return Vr.apply(s,arguments)}},Qo=Pe,sd=Qo({}.toString),rd=Qo("".slice),Si=function(s){return rd(sd(s),8,-1)},ad=Pe,nd=ke,od=Si,Ys=Object,ld=ad("".split),ud=nd(function(){return!Ys("z").propertyIsEnumerable(0)})?function(s){return od(s)=="String"?ld(s,""):Ys(s)}:Ys,gi=function(s){return s==null},dd=gi,cd=TypeError,ha=function(s){if(dd(s))throw cd("Can't call method on "+s);return s},hd=ud,fd=ha,yi=function(s){return hd(fd(s))},Zt={},xi=function(s){return s&&s.Math==Math&&s},le=xi(typeof globalThis=="object"&&globalThis)||xi(typeof window=="object"&&window)||xi(typeof self=="object"&&self)||xi(typeof Gs=="object"&&Gs)||function(){return this}()||Gs||Function("return this")(),Fr=typeof document=="object"&&document.all,pd=typeof Fr=="undefined"&&Fr!==void 0,Ko={all:Fr,IS_HTMLDDA:pd},Jo=Ko,md=Jo.all,ne=Jo.IS_HTMLDDA?function(s){return typeof s=="function"||s===md}:function(s){return typeof s=="function"},vd=le,bd=ne,Za=vd.WeakMap,Sd=bd(Za)&&/native code/.test(String(Za)),en=ne,Xo=Ko,gd=Xo.all,We=Xo.IS_HTMLDDA?function(s){return typeof s=="object"?s!==null:en(s)||s===gd}:function(s){return typeof s=="object"?s!==null:en(s)},yd=ke,ut=!yd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Pt={},Td=le,tn=We,Ur=Td.document,Ed=tn(Ur)&&tn(Ur.createElement),fa=function(s){return Ed?Ur.createElement(s):{}},$d=ut,kd=ke,Pd=fa,Zo=!$d&&!kd(function(){return Object.defineProperty(Pd("div"),"a",{get:function(){return 7}}).a!=7}),Ad=ut,wd=ke,el=Ad&&wd(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),_d=We,Cd=String,Dd=TypeError,Qe=function(s){if(_d(s))return s;throw Dd(Cd(s)+" is not an object")},Rd=bs,Ni=Function.prototype.call,ge=Rd?Ni.bind(Ni):function(){return Ni.apply(Ni,arguments)},pa={},qs=pa,zs=le,Id=ne,sn=function(s){return Id(s)?s:void 0},At=function(s,e){return arguments.length<2?sn(qs[s])||sn(zs[s]):qs[s]&&qs[s][e]||zs[s]&&zs[s][e]},Ld=Pe,Ss=Ld({}.isPrototypeOf),gs=typeof navigator!="undefined"&&String(navigator.userAgent)||"",tl=le,Ws=gs,rn=tl.process,an=tl.Deno,nn=rn&&rn.versions||an&&an.version,on=nn&&nn.v8,Ce,ns;on&&(Ce=on.split("."),ns=Ce[0]>0&&Ce[0]<4?1:+(Ce[0]+Ce[1]));!ns&&Ws&&(Ce=Ws.match(/Edge\/(\d+)/),(!Ce||Ce[1]>=74)&&(Ce=Ws.match(/Chrome\/(\d+)/),Ce&&(ns=+Ce[1])));var il=ns,ln=il,xd=ke,Nd=le,Od=Nd.String,sl=!!Object.getOwnPropertySymbols&&!xd(function(){var s=Symbol();return!Od(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&ln&&ln<41}),Md=sl,rl=Md&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Bd=At,Vd=ne,Fd=Ss,Ud=rl,jd=Object,al=Ud?function(s){return typeof s=="symbol"}:function(s){var e=Bd("Symbol");return Vd(e)&&Fd(e.prototype,jd(s))},Hd=String,ys=function(s){try{return Hd(s)}catch(e){return"Object"}},Gd=ne,Yd=ys,qd=TypeError,wt=function(s){if(Gd(s))return s;throw qd(Yd(s)+" is not a function")},zd=wt,Wd=gi,Ts=function(s,e){var t=s[e];return Wd(t)?void 0:zd(t)},Qs=ge,Ks=ne,Js=We,Qd=TypeError,Kd=function(s,e){var t,i;if(e==="string"&&Ks(t=s.toString)&&!Js(i=Qs(t,s))||Ks(t=s.valueOf)&&!Js(i=Qs(t,s))||e!=="string"&&Ks(t=s.toString)&&!Js(i=Qs(t,s)))return i;throw Qd("Can't convert object to primitive value")},nl={exports:{}},Jd=!0,un=le,Xd=Object.defineProperty,Zd=function(s,e){try{Xd(un,s,{value:e,configurable:!0,writable:!0})}catch(t){un[s]=e}return e},ec=le,tc=Zd,dn="__core-js_shared__",ic=ec[dn]||tc(dn,{}),ma=ic,cn=ma;(nl.exports=function(s,e){return cn[s]||(cn[s]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ol=nl.exports,sc=ha,rc=Object,Es=function(s){return rc(sc(s))},ac=Pe,nc=Es,oc=ac({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return oc(nc(e),t)},lc=Pe,uc=0,dc=Math.random(),cc=lc(1 .toString),ll=function(s){return"Symbol("+(s===void 0?"":s)+")_"+cc(++uc+dc,36)},hc=le,fc=ol,hn=Ue,pc=ll,mc=sl,vc=rl,Ht=hc.Symbol,Xs=fc("wks"),bc=vc?Ht.for||Ht:Ht&&Ht.withoutSetter||pc,ce=function(s){return hn(Xs,s)||(Xs[s]=mc&&hn(Ht,s)?Ht[s]:bc("Symbol."+s)),Xs[s]},Sc=ge,fn=We,pn=al,gc=Ts,yc=Kd,Tc=ce,Ec=TypeError,$c=Tc("toPrimitive"),kc=function(s,e){if(!fn(s)||pn(s))return s;var t=gc(s,$c),i;if(t){if(e===void 0&&(e="default"),i=Sc(t,s,e),!fn(i)||pn(i))return i;throw Ec("Can't convert object to primitive value")}return e===void 0&&(e="number"),yc(s,e)},Pc=kc,Ac=al,va=function(s){var e=Pc(s,"string");return Ac(e)?e:e+""},wc=ut,_c=Zo,Cc=el,Oi=Qe,mn=va,Dc=TypeError,Zs=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,er="enumerable",tr="configurable",ir="writable";Pt.f=wc?Cc?function(e,t,i){if(Oi(e),t=mn(t),Oi(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ir in i&&!i[ir]){var r=Rc(e,t);r&&r[ir]&&(e[t]=i.value,i={configurable:tr in i?i[tr]:r[tr],enumerable:er in i?i[er]:r[er],writable:!1})}return Zs(e,t,i)}:Zs:function(e,t,i){if(Oi(e),t=mn(t),Oi(i),_c)try{return Zs(e,t,i)}catch(r){}if("get"in i||"set"in i)throw Dc("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var $s=function(s,e){return{enumerable:!(s&1),configurable:!(s&2),writable:!(s&4),value:e}},Ic=ut,Lc=Pt,xc=$s,Ti=Ic?function(s,e,t){return Lc.f(s,e,xc(1,t))}:function(s,e,t){return s[e]=t,s},Nc=ol,Oc=ll,vn=Nc("keys"),ba=function(s){return vn[s]||(vn[s]=Oc(s))},Sa={},Mc=Sd,ul=le,Bc=We,Vc=Ti,sr=Ue,rr=ma,Fc=ba,Uc=Sa,bn="Object already initialized",jr=ul.TypeError,jc=ul.WeakMap,os,pi,ls,Hc=function(s){return ls(s)?pi(s):os(s,{})},Gc=function(s){return function(e){var t;if(!Bc(e)||(t=pi(e)).type!==s)throw jr("Incompatible receiver, "+s+" required");return t}};if(Mc||rr.state){var Ne=rr.state||(rr.state=new jc);Ne.get=Ne.get,Ne.has=Ne.has,Ne.set=Ne.set,os=function(s,e){if(Ne.has(s))throw jr(bn);return e.facade=s,Ne.set(s,e),e},pi=function(s){return Ne.get(s)||{}},ls=function(s){return Ne.has(s)}}else{var Nt=Fc("state");Uc[Nt]=!0,os=function(s,e){if(sr(s,Nt))throw jr(bn);return e.facade=s,Vc(s,Nt,e),e},pi=function(s){return sr(s,Nt)?s[Nt]:{}},ls=function(s){return sr(s,Nt)}}var dl={set:os,get:pi,has:ls,enforce:Hc,getterFor:Gc},Yc=bs,cl=Function.prototype,Sn=cl.apply,gn=cl.call,hl=typeof Reflect=="object"&&Reflect.apply||(Yc?gn.bind(Sn):function(){return gn.apply(Sn,arguments)}),qc=Si,zc=Pe,fl=function(s){if(qc(s)==="Function")return zc(s)},ga={},pl={},ml={}.propertyIsEnumerable,vl=Object.getOwnPropertyDescriptor,Wc=vl&&!ml.call({1:2},1);pl.f=Wc?function(e){var t=vl(this,e);return!!t&&t.enumerable}:ml;var Qc=ut,Kc=ge,Jc=pl,Xc=$s,Zc=yi,eh=va,th=Ue,ih=Zo,yn=Object.getOwnPropertyDescriptor;ga.f=Qc?yn:function(e,t){if(e=Zc(e),t=eh(t),ih)try{return yn(e,t)}catch(i){}if(th(e,t))return Xc(!Kc(Jc.f,e,t),e[t])};var sh=ke,rh=ne,ah=/#|\.prototype\./,Ei=function(s,e){var t=oh[nh(s)];return t==uh?!0:t==lh?!1:rh(e)?sh(e):!!e},nh=Ei.normalize=function(s){return String(s).replace(ah,".").toLowerCase()},oh=Ei.data={},lh=Ei.NATIVE="N",uh=Ei.POLYFILL="P",bl=Ei,Tn=fl,dh=wt,ch=bs,hh=Tn(Tn.bind),ks=function(s,e){return dh(s),e===void 0?s:ch?hh(s,e):function(){return s.apply(e,arguments)}},Mi=le,fh=hl,ph=fl,mh=ne,vh=ga.f,bh=bl,Ot=pa,Sh=ks,Mt=Ti,En=Ue,gh=function(s){var e=function(t,i,r){if(this instanceof e){switch(arguments.length){case 0:return new s;case 1:return new s(t);case 2:return new s(t,i)}return new s(t,i,r)}return fh(s,this,arguments)};return e.prototype=s.prototype,e},Ie=function(s,e){var t=s.target,i=s.global,r=s.stat,n=s.proto,o=i?Mi:r?Mi[t]:(Mi[t]||{}).prototype,l=i?Ot:Ot[t]||Mt(Ot,t,{})[t],d=l.prototype,u,c,h,f,p,b,m,S,g;for(f in e)u=bh(i?f:t+(r?".":"#")+f,s.forced),c=!u&&o&&En(o,f),b=l[f],c&&(s.dontCallGetSet?(g=vh(o,f),m=g&&g.value):m=o[f]),p=c&&m?m:e[f],!(c&&typeof b==typeof p)&&(s.bind&&c?S=Sh(p,Mi):s.wrap&&c?S=gh(p):n&&mh(p)?S=ph(p):S=p,(s.sham||p&&p.sham||b&&b.sham)&&Mt(S,"sham",!0),Mt(l,f,S),n&&(h=t+"Prototype",En(Ot,h)||Mt(Ot,h,{}),Mt(Ot[h],f,p),s.real&&d&&(u||!d[f])&&Mt(d,f,p)))},Hr=ut,yh=Ue,Sl=Function.prototype,Th=Hr&&Object.getOwnPropertyDescriptor,ya=yh(Sl,"name"),Eh=ya&&function(){}.name==="something",$h=ya&&(!Hr||Hr&&Th(Sl,"name").configurable),kh={EXISTS:ya,PROPER:Eh,CONFIGURABLE:$h},gl={},Ph=Math.ceil,Ah=Math.floor,wh=Math.trunc||function(e){var t=+e;return(t>0?Ah:Ph)(t)},_h=wh,Ta=function(s){var e=+s;return e!==e||e===0?0:_h(e)},Ch=Ta,Dh=Math.max,Rh=Math.min,Ih=function(s,e){var t=Ch(s);return t<0?Dh(t+e,0):Rh(t,e)},Lh=Ta,xh=Math.min,Nh=function(s){return s>0?xh(Lh(s),9007199254740991):0},Oh=Nh,Ea=function(s){return Oh(s.length)},Mh=yi,Bh=Ih,Vh=Ea,$n=function(s){return function(e,t,i){var r=Mh(e),n=Vh(r),o=Bh(i,n),l;if(s&&t!=t){for(;n>o;)if(l=r[o++],l!=l)return!0}else for(;n>o;o++)if((s||o in r)&&r[o]===t)return s||o||0;return!s&&-1}},Fh={includes:$n(!0),indexOf:$n(!1)},Uh=Pe,ar=Ue,jh=yi,Hh=Fh.indexOf,Gh=Sa,kn=Uh([].push),Yh=function(s,e){var t=jh(s),i=0,r=[],n;for(n in t)!ar(Gh,n)&&ar(t,n)&&kn(r,n);for(;e.length>i;)ar(t,n=e[i++])&&(~Hh(r,n)||kn(r,n));return r},yl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qh=Yh,zh=yl,Wh=Object.keys||function(e){return qh(e,zh)},Qh=ut,Kh=el,Jh=Pt,Xh=Qe,Zh=yi,ef=Wh;gl.f=Qh&&!Kh?Object.defineProperties:function(e,t){Xh(e);for(var i=Zh(t),r=ef(t),n=r.length,o=0,l;n>o;)Jh.f(e,l=r[o++],i[l]);return e};var tf=At,Tl=tf("document","documentElement"),sf=Qe,rf=gl,Pn=yl,af=Sa,nf=Tl,of=fa,lf=ba,An=">",wn="<",Gr="prototype",Yr="script",El=lf("IE_PROTO"),nr=function(){},$l=function(s){return wn+Yr+An+s+wn+"/"+Yr+An},_n=function(s){s.write($l("")),s.close();var e=s.parentWindow.Object;return s=null,e},uf=function(){var s=of("iframe"),e="java"+Yr+":",t;return s.style.display="none",nf.appendChild(s),s.src=String(e),t=s.contentWindow.document,t.open(),t.write($l("document.F=Object")),t.close(),t.F},Bi,is=function(){try{Bi=new ActiveXObject("htmlfile")}catch(e){}is=typeof document!="undefined"?document.domain&&Bi?_n(Bi):uf():_n(Bi);for(var s=Pn.length;s--;)delete is[Gr][Pn[s]];return is()};af[El]=!0;var kl=Object.create||function(e,t){var i;return e!==null?(nr[Gr]=sf(e),i=new nr,nr[Gr]=null,i[El]=e):i=is(),t===void 0?i:rf.f(i,t)},df=ke,cf=!df(function(){function s(){}return s.prototype.constructor=null,Object.getPrototypeOf(new s)!==s.prototype}),hf=Ue,ff=ne,pf=Es,mf=ba,vf=cf,Cn=mf("IE_PROTO"),qr=Object,bf=qr.prototype,Pl=vf?qr.getPrototypeOf:function(s){var e=pf(s);if(hf(e,Cn))return e[Cn];var t=e.constructor;return ff(t)&&e instanceof t?t.prototype:e instanceof qr?bf:null},Sf=Ti,$a=function(s,e,t,i){return i&&i.enumerable?s[e]=t:Sf(s,e,t),s},gf=ke,yf=ne,Tf=We,Ef=kl,Dn=Pl,$f=$a,kf=ce,zr=kf("iterator"),Al=!1,Ye,or,lr;[].keys&&(lr=[].keys(),"next"in lr?(or=Dn(Dn(lr)),or!==Object.prototype&&(Ye=or)):Al=!0);var Pf=!Tf(Ye)||gf(function(){var s={};return Ye[zr].call(s)!==s});Pf?Ye={}:Ye=Ef(Ye);yf(Ye[zr])||$f(Ye,zr,function(){return this});var wl={IteratorPrototype:Ye,BUGGY_SAFARI_ITERATORS:Al},Af=ce,wf=Af("toStringTag"),_l={};_l[wf]="z";var ka=String(_l)==="[object z]",_f=ka,Cf=ne,ss=Si,Df=ce,Rf=Df("toStringTag"),If=Object,Lf=ss(function(){return arguments}())=="Arguments",xf=function(s,e){try{return s[e]}catch(t){}},$i=_f?ss:function(s){var e,t,i;return s===void 0?"Undefined":s===null?"Null":typeof(t=xf(e=If(s),Rf))=="string"?t:Lf?ss(e):(i=ss(e))=="Object"&&Cf(e.callee)?"Arguments":i},Nf=ka,Of=$i,Mf=Nf?{}.toString:function(){return"[object "+Of(this)+"]"},Bf=ka,Vf=Pt.f,Ff=Ti,Uf=Ue,jf=Mf,Hf=ce,Rn=Hf("toStringTag"),Pa=function(s,e,t,i){if(s){var r=t?s:s.prototype;Uf(r,Rn)||Vf(r,Rn,{configurable:!0,value:e}),i&&!Bf&&Ff(r,"toString",jf)}},Gf=wl.IteratorPrototype,Yf=kl,qf=$s,zf=Pa,Wf=Zt,Qf=function(){return this},Kf=function(s,e,t,i){var r=e+" Iterator";return s.prototype=Yf(Gf,{next:qf(+!i,t)}),zf(s,r,!1,!0),Wf[r]=Qf,s},Jf=Ie,Xf=ge,Cl=kh,Zf=Kf,ep=Pl,tp=Pa,In=$a,ip=ce,Ln=Zt,Dl=wl,sp=Cl.PROPER;Cl.CONFIGURABLE;Dl.IteratorPrototype;var Vi=Dl.BUGGY_SAFARI_ITERATORS,ur=ip("iterator"),xn="keys",Fi="values",Nn="entries",rp=function(){return this},ap=function(s,e,t,i,r,n,o){Zf(t,e,i);var l=function(g){if(g===r&&f)return f;if(!Vi&&g in c)return c[g];switch(g){case xn:return function(){return new t(this,g)};case Fi:return function(){return new t(this,g)};case Nn:return function(){return new t(this,g)}}return function(){return new t(this)}},d=e+" Iterator",u=!1,c=s.prototype,h=c[ur]||c["@@iterator"]||r&&c[r],f=!Vi&&h||l(r),p=e=="Array"&&c.entries||h,b,m,S;if(p&&(b=ep(p.call(new s)),b!==Object.prototype&&b.next&&(tp(b,d,!0,!0),Ln[d]=rp)),sp&&r==Fi&&h&&h.name!==Fi&&(u=!0,f=function(){return Xf(h,this)}),r)if(m={values:l(Fi),keys:n?f:l(xn),entries:l(Nn)},o)for(S in m)(Vi||u||!(S in c))&&In(c,S,m[S]);else Jf({target:e,proto:!0,forced:Vi||u},m);return o&&c[ur]!==f&&In(c,ur,f,{name:r}),Ln[e]=f,m},np=function(s,e){return{value:s,done:e}},op=yi,On=Zt,Rl=dl;Pt.f;var lp=ap,Ui=np,Il="Array Iterator",up=Rl.set,dp=Rl.getterFor(Il);lp(Array,"Array",function(s,e){up(this,{type:Il,target:op(s),index:0,kind:e})},function(){var s=dp(this),e=s.target,t=s.kind,i=s.index++;return!e||i>=e.length?(s.target=void 0,Ui(void 0,!0)):t=="keys"?Ui(i,!1):t=="values"?Ui(e[i],!1):Ui([i,e[i]],!1)},"values");On.Arguments=On.Array;var cp=ce,hp=Zt,fp=cp("iterator"),pp=Array.prototype,mp=function(s){return s!==void 0&&(hp.Array===s||pp[fp]===s)},vp=$i,Mn=Ts,bp=gi,Sp=Zt,gp=ce,yp=gp("iterator"),Ll=function(s){if(!bp(s))return Mn(s,yp)||Mn(s,"@@iterator")||Sp[vp(s)]},Tp=ge,Ep=wt,$p=Qe,kp=ys,Pp=Ll,Ap=TypeError,wp=function(s,e){var t=arguments.length<2?Pp(s):e;if(Ep(t))return $p(Tp(t,s));throw Ap(kp(s)+" is not iterable")},_p=ge,Bn=Qe,Cp=Ts,Dp=function(s,e,t){var i,r;Bn(s);try{if(i=Cp(s,"return"),!i){if(e==="throw")throw t;return t}i=_p(i,s)}catch(n){r=!0,i=n}if(e==="throw")throw t;if(r)throw i;return Bn(i),t},Rp=ks,Ip=ge,Lp=Qe,xp=ys,Np=mp,Op=Ea,Vn=Ss,Mp=wp,Bp=Ll,Fn=Dp,Vp=TypeError,rs=function(s,e){this.stopped=s,this.result=e},Un=rs.prototype,Aa=function(s,e,t){var i=t&&t.that,r=!!(t&&t.AS_ENTRIES),n=!!(t&&t.IS_RECORD),o=!!(t&&t.IS_ITERATOR),l=!!(t&&t.INTERRUPTED),d=Rp(e,i),u,c,h,f,p,b,m,S=function(E){return u&&Fn(u,"normal",E),new rs(!0,E)},g=function(E){return r?(Lp(E),l?d(E[0],E[1],S):d(E[0],E[1])):l?d(E,S):d(E)};if(n)u=s.iterator;else if(o)u=s;else{if(c=Bp(s),!c)throw Vp(xp(s)+" is not iterable");if(Np(c)){for(h=0,f=Op(s);f>h;h++)if(p=g(s[h]),p&&Vn(Un,p))return p;return new rs(!1)}u=Mp(s,c)}for(b=n?s.next:u.next;!(m=Ip(b,u)).done;){try{p=g(m.value)}catch(E){Fn(u,"throw",E)}if(typeof p=="object"&&p&&Vn(Un,p))return p}return new rs(!1)},Fp=va,Up=Pt,jp=$s,Hp=function(s,e,t){var i=Fp(e);i in s?Up.f(s,i,jp(0,t)):s[i]=t},Gp=Ie,Yp=Aa,qp=Hp;Gp({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Yp(e,function(i,r){qp(t,i,r)},{AS_ENTRIES:!0}),t}});var zp=pa,Wp=zp.Object.fromEntries,Qp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Kp=Qp,Jp=le,Xp=$i,Zp=Ti,jn=Zt,em=ce,Hn=em("toStringTag");for(var dr in Kp){var Gn=Jp[dr],cr=Gn&&Gn.prototype;cr&&Xp(cr)!==Hn&&Zp(cr,Hn,dr),jn[dr]=jn.Array}var tm=Wp,im=tm,sm=im,rm=sm,Qt=vs(rm),am=Si,Ps=typeof process!="undefined"&&am(process)=="process",nm=Pt,om=function(s,e,t){return nm.f(s,e,t)},lm=At,um=om,dm=ce,cm=ut,Yn=dm("species"),hm=function(s){var e=lm(s);cm&&e&&!e[Yn]&&um(e,Yn,{configurable:!0,get:function(){return this}})},fm=Ss,pm=TypeError,mm=function(s,e){if(fm(e,s))return s;throw pm("Incorrect invocation")},vm=Pe,bm=ne,Wr=ma,Sm=vm(Function.toString);bm(Wr.inspectSource)||(Wr.inspectSource=function(s){return Sm(s)});var xl=Wr.inspectSource,gm=Pe,ym=ke,Nl=ne,Tm=$i,Em=At,$m=xl,Ol=function(){},km=[],Ml=Em("Reflect","construct"),wa=/^\s*(?:class|function)\b/,Pm=gm(wa.exec),Am=!wa.exec(Ol),ai=function(e){if(!Nl(e))return!1;try{return Ml(Ol,km,e),!0}catch(t){return!1}},Bl=function(e){if(!Nl(e))return!1;switch(Tm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Am||!!Pm(wa,$m(e))}catch(t){return!0}};Bl.sham=!0;var wm=!Ml||ym(function(){var s;return ai(ai.call)||!ai(Object)||!ai(function(){s=!0})||s})?Bl:ai,_m=wm,Cm=ys,Dm=TypeError,Rm=function(s){if(_m(s))return s;throw Dm(Cm(s)+" is not a constructor")},qn=Qe,Im=Rm,Lm=gi,xm=ce,Nm=xm("species"),Vl=function(s,e){var t=qn(s).constructor,i;return t===void 0||Lm(i=qn(t)[Nm])?e:Im(i)},Om=Pe,Mm=Om([].slice),Bm=TypeError,Vm=function(s,e){if(s<e)throw Bm("Not enough arguments");return s},Fm=gs,Fl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Fm),Se=le,Um=hl,jm=ks,zn=ne,Hm=Ue,Ul=ke,Wn=Tl,Gm=Mm,Qn=fa,Ym=Vm,qm=Fl,zm=Ps,Qr=Se.setImmediate,Kr=Se.clearImmediate,Wm=Se.process,hr=Se.Dispatch,Qm=Se.Function,Kn=Se.MessageChannel,Km=Se.String,fr=0,ci={},Jn="onreadystatechange",mi,gt,pr,mr;Ul(function(){mi=Se.location});var _a=function(s){if(Hm(ci,s)){var e=ci[s];delete ci[s],e()}},vr=function(s){return function(){_a(s)}},Xn=function(s){_a(s.data)},Zn=function(s){Se.postMessage(Km(s),mi.protocol+"//"+mi.host)};(!Qr||!Kr)&&(Qr=function(e){Ym(arguments.length,1);var t=zn(e)?e:Qm(e),i=Gm(arguments,1);return ci[++fr]=function(){Um(t,void 0,i)},gt(fr),fr},Kr=function(e){delete ci[e]},zm?gt=function(s){Wm.nextTick(vr(s))}:hr&&hr.now?gt=function(s){hr.now(vr(s))}:Kn&&!qm?(pr=new Kn,mr=pr.port2,pr.port1.onmessage=Xn,gt=jm(mr.postMessage,mr)):Se.addEventListener&&zn(Se.postMessage)&&!Se.importScripts&&mi&&mi.protocol!=="file:"&&!Ul(Zn)?(gt=Zn,Se.addEventListener("message",Xn,!1)):Jn in Qn("script")?gt=function(s){Wn.appendChild(Qn("script"))[Jn]=function(){Wn.removeChild(this),_a(s)}}:gt=function(s){setTimeout(vr(s),0)});var jl={set:Qr,clear:Kr},Hl=function(){this.head=null,this.tail=null};Hl.prototype={add:function(s){var e={item:s,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var s=this.head;if(s){var e=this.head=s.next;return e===null&&(this.tail=null),s.item}}};var Gl=Hl,Jm=gs,Xm=/ipad|iphone|ipod/i.test(Jm)&&typeof Pebble!="undefined",Zm=gs,ev=/web0s(?!.*chrome)/i.test(Zm),kt=le,eo=ks,tv=ga.f,br=jl.set,iv=Gl,sv=Fl,rv=Xm,av=ev,Sr=Ps,to=kt.MutationObserver||kt.WebKitMutationObserver,io=kt.document,so=kt.process,ji=kt.Promise,ro=tv(kt,"queueMicrotask"),Jr=ro&&ro.value,Bt,gr,yr,Hi,ao;if(!Jr){var Gi=new iv,Yi=function(){var s,e;for(Sr&&(s=so.domain)&&s.exit();e=Gi.get();)try{e()}catch(t){throw Gi.head&&Bt(),t}s&&s.enter()};!sv&&!Sr&&!av&&to&&io?(gr=!0,yr=io.createTextNode(""),new to(Yi).observe(yr,{characterData:!0}),Bt=function(){yr.data=gr=!gr}):!rv&&ji&&ji.resolve?(Hi=ji.resolve(void 0),Hi.constructor=ji,ao=eo(Hi.then,Hi),Bt=function(){ao(Yi)}):Sr?Bt=function(){so.nextTick(Yi)}:(br=eo(br,kt),Bt=function(){br(Yi)}),Jr=function(s){Gi.head||Bt(),Gi.add(s)}}var nv=Jr,ov=function(s,e){try{arguments.length==1?console.error(s):console.error(s,e)}catch(t){}},Ca=function(s){try{return{error:!1,value:s()}}catch(e){return{error:!0,value:e}}},lv=le,ei=lv.Promise,Yl=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",uv=Yl,dv=Ps,cv=!uv&&!dv&&typeof window=="object"&&typeof document=="object",hv=le,hi=ei,fv=ne,pv=bl,mv=xl,vv=ce,bv=cv,Sv=Yl,Tr=il,no=hi&&hi.prototype,gv=vv("species"),Xr=!1,ql=fv(hv.PromiseRejectionEvent),yv=pv("Promise",function(){var s=mv(hi),e=s!==String(hi);if(!e&&Tr===66||!(no.catch&&no.finally))return!0;if(!Tr||Tr<51||!/native code/.test(s)){var t=new hi(function(n){n(1)}),i=function(n){n(function(){},function(){})},r=t.constructor={};if(r[gv]=i,Xr=t.then(function(){})instanceof i,!Xr)return!0}return!e&&(bv||Sv)&&!ql}),ki={CONSTRUCTOR:yv,REJECTION_EVENT:ql,SUBCLASSING:Xr},ti={},oo=wt,Tv=TypeError,Ev=function(s){var e,t;this.promise=new s(function(i,r){if(e!==void 0||t!==void 0)throw Tv("Bad Promise constructor");e=i,t=r}),this.resolve=oo(e),this.reject=oo(t)};ti.f=function(s){return new Ev(s)};var $v=Ie,us=Ps,lt=le,Pi=ge,kv=$a,Pv=Pa,Av=hm,wv=wt,Zr=ne,_v=We,Cv=mm,Dv=Vl,zl=jl.set,Da=nv,Rv=ov,Iv=Ca,Lv=Gl,Wl=dl,ea=ei,Ra=ki,Ql=ti,As="Promise",Kl=Ra.CONSTRUCTOR,xv=Ra.REJECTION_EVENT;Ra.SUBCLASSING;var Er=Wl.getterFor(As),Nv=Wl.set,Ov=ea&&ea.prototype,Gt=ea,$r=Ov,Jl=lt.TypeError,ta=lt.document,Ia=lt.process,ia=Ql.f,Mv=ia,Bv=!!(ta&&ta.createEvent&<.dispatchEvent),Xl="unhandledrejection",Vv="rejectionhandled",lo=0,Zl=1,Fv=2,La=1,eu=2,qi,uo,Uv,tu=function(s){var e;return _v(s)&&Zr(e=s.then)?e:!1},iu=function(s,e){var t=e.value,i=e.state==Zl,r=i?s.ok:s.fail,n=s.resolve,o=s.reject,l=s.domain,d,u,c;try{r?(i||(e.rejection===eu&&Hv(e),e.rejection=La),r===!0?d=t:(l&&l.enter(),d=r(t),l&&(l.exit(),c=!0)),d===s.promise?o(Jl("Promise-chain cycle")):(u=tu(d))?Pi(u,d,n,o):n(d)):o(t)}catch(h){l&&!c&&l.exit(),o(h)}},su=function(s,e){s.notified||(s.notified=!0,Da(function(){for(var t=s.reactions,i;i=t.get();)iu(i,s);s.notified=!1,e&&!s.rejection&&jv(s)}))},ru=function(s,e,t){var i,r;Bv?(i=ta.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(s,!1,!0),lt.dispatchEvent(i)):i={promise:e,reason:t},!xv&&(r=lt["on"+s])?r(i):s===Xl&&Rv("Unhandled promise rejection",t)},jv=function(s){Pi(zl,lt,function(){var e=s.facade,t=s.value,i=co(s),r;if(i&&(r=Iv(function(){us?Ia.emit("unhandledRejection",t,e):ru(Xl,e,t)}),s.rejection=us||co(s)?eu:La,r.error))throw r.value})},co=function(s){return s.rejection!==La&&!s.parent},Hv=function(s){Pi(zl,lt,function(){var e=s.facade;us?Ia.emit("rejectionHandled",e):ru(Vv,e,s.value)})},Yt=function(s,e,t){return function(i){s(e,i,t)}},zt=function(s,e,t){s.done||(s.done=!0,t&&(s=t),s.value=e,s.state=Fv,su(s,!0))},sa=function(s,e,t){if(!s.done){s.done=!0,t&&(s=t);try{if(s.facade===e)throw Jl("Promise can't be resolved itself");var i=tu(e);i?Da(function(){var r={done:!1};try{Pi(i,e,Yt(sa,r,s),Yt(zt,r,s))}catch(n){zt(r,n,s)}}):(s.value=e,s.state=Zl,su(s,!1))}catch(r){zt({done:!1},r,s)}}};Kl&&(Gt=function(e){Cv(this,$r),wv(e),Pi(qi,this);var t=Er(this);try{e(Yt(sa,t),Yt(zt,t))}catch(i){zt(t,i)}},$r=Gt.prototype,qi=function(e){Nv(this,{type:As,done:!1,notified:!1,parent:!1,reactions:new Lv,rejection:!1,state:lo,value:void 0})},qi.prototype=kv($r,"then",function(e,t){var i=Er(this),r=ia(Dv(this,Gt));return i.parent=!0,r.ok=Zr(e)?e:!0,r.fail=Zr(t)&&t,r.domain=us?Ia.domain:void 0,i.state==lo?i.reactions.add(r):Da(function(){iu(r,i)}),r.promise}),uo=function(){var s=new qi,e=Er(s);this.promise=s,this.resolve=Yt(sa,e),this.reject=Yt(zt,e)},Ql.f=ia=function(s){return s===Gt||s===Uv?new uo(s):Mv(s)});$v({global:!0,constructor:!0,wrap:!0,forced:Kl},{Promise:Gt});Pv(Gt,As,!1,!0);Av(As);var Gv=ce,au=Gv("iterator"),nu=!1;try{var Yv=0,ho={next:function(){return{done:!!Yv++}},return:function(){nu=!0}};ho[au]=function(){return this},Array.from(ho,function(){throw 2})}catch(s){}var qv=function(s,e){if(!e&&!nu)return!1;var t=!1;try{var i={};i[au]=function(){return{next:function(){return{done:t=!0}}}},s(i)}catch(r){}return t},zv=ei,Wv=qv,Qv=ki.CONSTRUCTOR,ou=Qv||!Wv(function(s){zv.all(s).then(void 0,function(){})}),Kv=Ie,Jv=ge,Xv=wt,Zv=ti,eb=Ca,tb=Aa,ib=ou;Kv({target:"Promise",stat:!0,forced:ib},{all:function(e){var t=this,i=Zv.f(t),r=i.resolve,n=i.reject,o=eb(function(){var l=Xv(t.resolve),d=[],u=0,c=1;tb(e,function(h){var f=u++,p=!1;c++,Jv(l,t,h).then(function(b){p||(p=!0,d[f]=b,--c||r(d))},n)}),--c||r(d)});return o.error&&n(o.value),i.promise}});var sb=Ie,rb=ki.CONSTRUCTOR,fo=ei;fo&&fo.prototype;sb({target:"Promise",proto:!0,forced:rb,real:!0},{catch:function(s){return this.then(void 0,s)}});var ab=Ie,nb=ge,ob=wt,lb=ti,ub=Ca,db=Aa,cb=ou;ab({target:"Promise",stat:!0,forced:cb},{race:function(e){var t=this,i=lb.f(t),r=i.reject,n=ub(function(){var o=ob(t.resolve);db(e,function(l){nb(o,t,l).then(i.resolve,r)})});return n.error&&r(n.value),i.promise}});var hb=Ie,fb=ge,pb=ti,mb=ki.CONSTRUCTOR;hb({target:"Promise",stat:!0,forced:mb},{reject:function(e){var t=pb.f(this);return fb(t.reject,void 0,e),t.promise}});var vb=Qe,bb=We,Sb=ti,lu=function(s,e){if(vb(s),bb(e)&&e.constructor===s)return e;var t=Sb.f(s),i=t.resolve;return i(e),t.promise},gb=Ie,yb=At,Tb=Jd,Eb=ei,$b=ki.CONSTRUCTOR,kb=lu,Pb=yb("Promise"),Ab=!$b;gb({target:"Promise",stat:!0,forced:Tb},{resolve:function(e){return kb(Ab&&this===Pb?Eb:this,e)}});var wb=Ie,ra=ei,_b=ke,Cb=At,Db=ne,Rb=Vl,po=lu,Ib=ra&&ra.prototype,Lb=!!ra&&_b(function(){Ib.finally.call({then:function(){}},function(){})});wb({target:"Promise",proto:!0,real:!0,forced:Lb},{finally:function(s){var e=Rb(this,Cb("Promise")),t=Db(s);return this.then(t?function(i){return po(e,s()).then(function(){return i})}:s,t?function(i){return po(e,s()).then(function(){throw i})}:s)}});var xb=At,xa=xb,Nb=xa,Ob=Nb("Promise","finally"),Mb=Ob,Bb=Mb,Vb=Bb,Fb=Vb,ws=vs(Fb),ae;(function(s){s[s.OFFSET_P=0]="OFFSET_P",s[s.PLAYBACK_SHIFT=1]="PLAYBACK_SHIFT",s[s.DASH_CMAF_OFFSET_P=2]="DASH_CMAF_OFFSET_P"})(ae||(ae={}));var De=(s,e=0,t=ae.OFFSET_P)=>{switch(t){case ae.OFFSET_P:return s.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case ae.PLAYBACK_SHIFT:{if(e===0)return s;const i=new URL(s);return i.searchParams.append("playback_shift",e.toFixed(0)),i.toString()}case ae.DASH_CMAF_OFFSET_P:{const i=new URL(s);return!i.searchParams.get("offset_p")&&e===0?s:(i.searchParams.set("offset_p",e.toFixed(0)),i.toString())}default:a.assertNever(t)}return s};const mo=(s,e)=>{var t;switch(e){case ae.OFFSET_P:return NaN;case ae.PLAYBACK_SHIFT:{const i=new URL(s);return Number(i.searchParams.get("playback_shift"))}case ae.DASH_CMAF_OFFSET_P:{const i=new URL(s);return Number((t=i.searchParams.get("offset_p"))!==null&&t!==void 0?t:0)}default:a.assertNever(e)}};var P=(s,e,t=!1)=>{const i=s.getTransition();(t||!i||i.to===e)&&s.setState(e)};class X{constructor(e){this.transitionStarted$=new a.Subject,this.transitionEnded$=new a.Subject,this.transitionUpdated$=new a.Subject,this.forceChanged$=new a.Subject,this.stateChangeStarted$=a.merge(this.transitionStarted$,this.transitionUpdated$),this.stateChangeEnded$=a.merge(this.transitionEnded$,this.forceChanged$),this.state=e,this.prevState=void 0}setState(e){const t=this.transition,i=this.state;this.transition=void 0,this.prevState=i,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:i,to:e,canceledTransition:t})}startTransitionTo(e){const t=this.transition,i=this.state;i===e||a.isNonNullable(t)&&t.to===e||(this.prevState=i,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:i,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}}const Ub=s=>{switch(s){case exports.VideoFormat.MPEG:case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:return!1;case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.DASH_LIVE_CMAF:case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:case exports.VideoFormat.DASH_LIVE_WEBM:case exports.VideoFormat.WEB_RTC_LIVE:return!0;default:return a.assertNever(s)}};var M;(function(s){s.STOPPED="stopped",s.READY="ready",s.PLAYING="playing",s.PAUSED="paused"})(M||(M={}));const jb=5,Hb=5,Gb=500,vo=7e3;class Yb{constructor(e){this.subscription=new a.Subscription,this.loadMediaTimeoutSubscription=new a.Subscription,this.videoState=new X(M.STOPPED),this.syncPlayback=()=>{const i=this.videoState.getState(),r=this.videoState.getTransition(),n=this.params.desiredState.playbackState.getState(),o=this.params.desiredState.playbackState.getTransition(),l=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${i}; videoTransition: ${JSON.stringify(r)}; desiredPlaybackState: ${n}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(l)};`}),n===exports.PlaybackState.STOPPED){i!==M.STOPPED&&(this.videoState.startTransitionTo(M.STOPPED),this.stop());return}if(!r){if((o==null?void 0:o.to)!==exports.PlaybackState.PAUSED&&l.state===F.Requested&&i!==M.STOPPED){this.seek(l.position/1e3);return}switch(n){case exports.PlaybackState.READY:{switch(i){case M.PLAYING:case M.PAUSED:case M.READY:break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}case exports.PlaybackState.PLAYING:{switch(i){case M.PLAYING:break;case M.PAUSED:this.videoState.startTransitionTo(M.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case M.READY:this.videoState.startTransitionTo(M.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}case exports.PlaybackState.PAUSED:{switch(i){case M.PLAYING:this.videoState.startTransitionTo(M.PAUSED),this.params.connection.remotePlayerController.playOrPause();break;case M.PAUSED:break;case M.READY:this.videoState.startTransitionTo(M.PAUSED),this.videoState.setState(M.PAUSED);break;case M.STOPPED:this.videoState.startTransitionTo(M.READY),this.prepare();break;default:a.assertNever(i)}break}default:a.assertNever(n)}}},this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Ub(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});const t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);const e=new a.Subscription;this.subscription.add(e),this.subscription.add(a.merge(this.videoState.stateChangeStarted$.pipe(a.map(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe(a.map(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));const t=(r,n)=>this.subscription.add(r.subscribe(n));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{const r=new a.Subject;e.add(r.pipe(a.debounce(Gb)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let n=NaN;e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(o=>{this.logRemoteEvent(o);const l=o.value;this.params.output.position$.next(l),(this.params.desiredState.seekState.getState().state===F.Applying||Math.abs(l-n)>jb)&&r.next(l),n=l})),e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(o=>{this.logRemoteEvent(o),this.params.output.duration$.next(o.value)}))}t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);const{remotePlayer:n}=this.params.connection,o=r.value,l=this.params.output.isBuffering$.getValue(),d=o===chrome.cast.media.PlayerState.BUFFERING;switch(l!==d&&this.params.output.isBuffering$.next(d),o){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&n.duration-n.currentTime<Hb&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),P(this.params.desiredState.playbackState,exports.PlaybackState.STOPPED);break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:a.assertNever(o)}}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});const i=a.merge(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,a.observableFrom(["init"])).pipe(a.debounce(0));t(i,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});const{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState(M.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED)):(this.videoState.setState(M.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING));const i=this.params.output.isLive$.getValue();this.params.output.duration$.next(i?0:t.duration),this.params.output.position$.next(i?0:t.currentTime),this.params.desiredState.seekState.setState({state:F.None})}}prepare(){const e=this.params.format;this.log({message:`[prepare] format: ${e}`});const t=this.createMediaInfo(e),i=this.createLoadRequest(t);this.loadMedia(i)}handleRemotePause(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===M.PAUSED||e===M.PLAYING)&&(this.videoState.setState(M.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED))}handleRemotePlay(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===M.PLAYING||e===M.PAUSED)&&(this.videoState.setState(M.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING))}handleRemoteReady(){var e;const t=this.videoState.getTransition();(t==null?void 0:t.to)===M.READY&&this.videoState.setState(M.READY),((e=this.params.desiredState.playbackState.getTransition())===null||e===void 0?void 0:e.to)===exports.PlaybackState.READY&&P(this.params.desiredState.playbackState,exports.PlaybackState.READY)}handleRemoteStop(){this.videoState.getState()!==M.STOPPED&&this.videoState.setState(M.STOPPED)}handleRemoteVolumeChange(e){var t,i;const r=this.params.output.volume$.getValue(),n={volume:(t=e.volume)!==null&&t!==void 0?t:r.volume,muted:(i=e.muted)!==null&&i!==void 0?i:r.muted};(n.volume!==r.volume||n.muted!==n.muted)&&this.params.output.volume$.next(n)}seek(e){this.params.output.willSeekEvent$.next();const{remotePlayer:t,remotePlayerController:i}=this.params.connection;t.currentTime=e,i.seek()}stop(){const{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var t;const i=this.params.source;let r,n,o;switch(e){case exports.VideoFormat.MPEG:{const c=i[e];a.assertNonNullable(c);const h=a.getHighestQuality(Object.keys(c));a.assertNonNullable(h);const f=c[h];a.assertNonNullable(f),r=f,n="video/mp4",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/x-mpegurl",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_LIVE_CMAF:{const c=i[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:{const c=i[e];a.assertNonNullable(c),r=De(c.url),n="application/x-mpegurl",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.WEB_RTC_LIVE:{const c="Unsupported format for Chromecast",h=new Error(c);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:a.ErrorCategory.VIDEO_PIPELINE,message:c,thrown:h}),h}case exports.VideoFormat.DASH_LIVE_WEBM:throw new Error("DASH_LIVE_WEBM is no longer supported");default:return a.assertNever(e)}const l=new chrome.cast.media.MediaInfo((t=this.params.meta.videoId)!==null&&t!==void 0?t:r,n);l.contentUrl=r,l.streamType=o,l.metadata=new chrome.cast.media.GenericMediaMetadata;const{title:d,subtitle:u}=this.params.meta;return a.isNonNullable(d)&&(l.metadata.title=d),a.isNonNullable(u)&&(l.metadata.subtitle=u),l}createLoadRequest(e){const t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;const i=this.params.desiredState.seekState.getState();return i.state===F.Applying||i.state===F.Requested?t.currentTime=this.params.output.isLive$.getValue()?0:i.position/1e3:t.currentTime=0,t}loadMedia(e){const t=this.params.connection.session.loadMedia(e),i=new Promise((r,n)=>{this.loadMediaTimeoutSubscription.add(a.timeout(vo).subscribe(()=>n(`timeout(${vo})`)))});ws(Promise.race([t,i]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state===F.Applying&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{const n=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:n}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:a.ErrorCategory.VIDEO_PIPELINE,message:n,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}}var qb=s=>{let e,t=!1,i=!1;s.on("playbackTimeUpdated",({timeToEnd:r})=>{i=r<=3,t&&i&&(e==null||e())}),s.extend("MediaSourceController",function(){const{parent:r}=this,n=r.signalEndOfStream;return{signalEndOfStream:o=>{t=!0,e=()=>n(o),t&&i&&(e==null||e())}}},!0)},zb=s=>{const e=new a.ValueSubject(1/0),t=new a.Subject,i=new a.ValueSubject(void 0),r=new a.ValueSubject(void 0);let n=NaN,o=!1;const l=()=>{n=Date.now(),o=!1},d=c=>{var h,f,p,b,m;const S=Qt(c.getAllResponseHeaders().trim().split(/[\n\r]+/).map(v=>v.split(": ")));if("x-playback-duration"in S||"x-playback-duration-millis"in S){const v=parseInt((h=c.getResponseHeader("X-Playback-Duration"))!==null&&h!==void 0?h:"",10),y=parseInt((f=c.getResponseHeader("X-Playback-Duration-Millis"))!==null&&f!==void 0?f:"",10),T=(p=y!=null?y:v*1e3)!==null&&p!==void 0?p:NaN;a.isNonNullable(T)&&!isNaN(T)&&e.next(T)}const g=(b=S["x-delivery-type"])!==null&&b!==void 0?b:exports.HttpConnectionType.HTTP1,E=(m={1:!0,0:!1}[S["x-reused"]])!==null&&m!==void 0?m:void 0;i.next(g),r.next(E)},u=c=>{c.readyState>=2&&!o&&(o=!0,t.next(Date.now()-n))};return s.extend("XHRLoader",function(){const{parent:c}=this,h=c.load.bind(c);return{load:function(f){if(f.request.type==="MPD"){const p=f.onload,b=f.progress;f.onload=function(...m){return d(this),p(...m)},f.progress=function(...m){return u(this),b(...m)},l()}return h(f)}}},!0),{playbackDuration$:e,ping$:t,connectionReused$:r,connectionType$:i}},Kt=s=>{const e=new URL(s);return e.searchParams.set("quic","1"),e.toString()},Wb=s=>s.extend("RequestModifier",()=>({modifyRequestURL:Kt}),!0),Qb=s=>{s.extend("HTTPLoader",function(){const{parent:e}=this,t=e.load;return{load:i=>{if(i.request&&i.request.range){const[r,n]=i.request.range.split("-").map(l=>parseInt(l,10)),o=new URL(i.request.url,location.href);o.searchParams.append("bytes",`${r}-${n}`),i.request.url=o.toString(),i.request.range=void 0}t(i)}}},!0)};const Re=(s,e,t,{equal:i=(o,l)=>o===l,changed$:r,onError:n}={})=>{const o=s.getState(),l=e(),d=a.isNullable(r),u=new a.Subscription;return r&&u.add(r.subscribe(c=>{const h=s.getState();i(c,h)&&s.setState(c)},n)),i(l,o)||(t(o),d&&s.setState(o)),u.add(s.stateChangeStarted$.subscribe(c=>{t(c.to),d&&s.setState(c.to)},n)),u},_t=(s,e,t)=>Re(e,()=>s.loop,i=>{a.isNonNullable(i)&&(s.loop=i)},{onError:t}),Ke=(s,e,t,i)=>Re(e,()=>({muted:s.muted,volume:s.volume}),r=>{a.isNonNullable(r)&&(s.muted=r.muted,s.volume=r.volume)},{equal:(r,n)=>r===n||(r==null?void 0:r.muted)===(n==null?void 0:n.muted)&&(r==null?void 0:r.volume)===(n==null?void 0:n.volume),changed$:t,onError:i}),dt=(s,e,t,i)=>Re(e,()=>s.playbackRate,r=>{a.isNonNullable(r)&&(s.playbackRate=r)},{changed$:t,onError:i}),Kb=s=>["__",s.language,s.label].join("|"),Jb=(s,e)=>{if(s.id===e)return!0;const[t,i,r]=e.split("|");return s.language===i&&s.label===r};class je{constructor(){this.available$=new a.Subject,this.current$=new a.ValueSubject(void 0),this.error$=new a.Subject,this.subscription=new a.Subscription,this.externalTracks=new Map,this.internalTracks=new Map}connect(e,t,i){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();const r=n=>{this.error$.next({id:"TextTracksManager",category:a.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:n})};this.subscription.add(this.available$.subscribe(i.availableTextTracks$)),this.subscription.add(this.current$.subscribe(i.currentTextTrack$)),this.subscription.add(this.error$.subscribe(i.error$)),this.subscription.add(Re(t.internalTextTracks,()=>Object.values(this.internalTracks),n=>{a.isNonNullable(n)&&this.setInternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="internal"))),onError:r})),this.subscription.add(Re(t.externalTextTracks,()=>Object.values(this.externalTracks),n=>{a.isNonNullable(n)&&this.setExternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="external"))),onError:r})),this.subscription.add(Re(t.currentTextTrack,()=>{if(this.video)return;const n=this.htmlTextTracksAsArray().find(({mode:o})=>o==="showing");return n&&this.htmlTextTrackToITextTrack(n).id},n=>this.select(n),{changed$:this.current$,onError:r})),this.subscription.add(Re(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(const n of this.htmlTextTracksAsArray())this.applyCueSettings(n.cues),this.applyCueSettings(n.activeCues)}))}subscribe(){a.assertNonNullable(this.video);const{textTracks:e}=this.video;this.subscription.add(a.fromEvent(e,"addtrack").subscribe(()=>{const i=this.current$.getValue();i&&this.select(i)})),this.subscription.add(a.merge(a.fromEvent(e,"addtrack"),a.fromEvent(e,"removetrack"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().map(i=>this.htmlTextTrackToITextTrack(i))),a.filterChanged((i,r)=>i.length===r.length&&i.every(({id:n},o)=>n===r[o].id))).subscribe(this.available$)),this.subscription.add(a.merge(a.fromEvent(e,"change"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().find(({mode:i})=>i==="showing")),a.map(i=>i&&this.htmlTextTrackToITextTrack(i).id),a.filterChanged()).subscribe(this.current$));const t=i=>{var r,n;return this.applyCueSettings((n=(r=i.target)===null||r===void 0?void 0:r.activeCues)!==null&&n!==void 0?n:null)};this.subscription.add(a.fromEvent(e,"addtrack").subscribe(i=>{var r,n;(r=i.track)===null||r===void 0||r.addEventListener("cuechange",t);const o=l=>{var d,u,c,h,f;const p=(u=(d=l.target)===null||d===void 0?void 0:d.cues)!==null&&u!==void 0?u:null;p&&p.length&&(this.applyCueSettings((h=(c=l.target)===null||c===void 0?void 0:c.cues)!==null&&h!==void 0?h:null),(f=l.target)===null||f===void 0||f.removeEventListener("cuechange",o))};(n=i.track)===null||n===void 0||n.addEventListener("cuechange",o)})),this.subscription.add(a.fromEvent(e,"removetrack").subscribe(i=>{var r;(r=i.track)===null||r===void 0||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;const t=this.cueSettings.getState();for(const i of Array.from(e)){const r=i;a.isNonNullable(t.align)&&(r.align=t.align),a.isNonNullable(t.position)&&(r.position=t.position),a.isNonNullable(t.size)&&(r.size=t.size),a.isNonNullable(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){a.assertNonNullable(this.video);const t=[...this.video.textTracks];return e?t:t.filter(je.isHealthyTrack)}htmlTextTrackToITextTrack(e){var t,i;const{language:r,label:n}=e,o=e.id?e.id:Kb(e),l=this.externalTracks.has(o),d=o.includes("auto");return l?{id:o,type:"external",isAuto:d,language:r,label:n,url:(t=this.externalTracks.get(o))===null||t===void 0?void 0:t.url}:{id:o,type:"internal",isAuto:d,language:r,label:n,url:(i=this.internalTracks.get(o))===null||i===void 0?void 0:i.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(i=>i.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){const t=[...this.externalTracks];e.filter(({id:i,language:r,isAuto:n})=>!this.internalTracks.has(i)&&!t.some(([,o])=>o.language===r&&o.isAuto===n)).forEach(i=>this.attach(i)),Array.from(this.internalTracks).filter(([i])=>!e.find(r=>r.id===i)).forEach(([,i])=>this.detach(i))}select(e){a.assertNonNullable(this.video);for(const t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(const t of this.htmlTextTracksAsArray(!0))(a.isNullable(e)||!Jb(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(const e of Array.from(this.video.getElementsByTagName("track"))){const t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){a.assertNonNullable(this.video);const t=document.createElement("track");t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){a.assertNonNullable(this.video);const t=Array.prototype.find.call(this.video.getElementsByTagName("track"),i=>i.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}}const Na=s=>{s.removeAttribute("src"),s.load()},Xb=s=>{try{s.pause(),s.playbackRate=0,Na(s),s.remove()}catch(e){console.error(e)}};class Zb{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}}const aa=window.WeakMap?new WeakMap:new Zb,Je=s=>{let e=s.querySelector("video");const t=!!e;return e?Na(e):(e=document.createElement("video"),s.appendChild(e)),aa.set(e,t),e.setAttribute("crossorigin","anonymous"),e.setAttribute("playsinline","playsinline"),e.controls=!1,e.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e},Xe=s=>{const e=aa.get(s);aa.delete(s),e?Na(s):Xb(s)};class _s{constructor(){this.pausedTime=0,this.streamOffset=0,this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}}const uu=s=>{var e;let t=s;for(;!(t instanceof Document)&&!(t instanceof ShadowRoot)&&t!==null;)t=t==null?void 0:t.parentNode;return(e=t)!==null&&e!==void 0?e:void 0},bo=s=>{const e=uu(s);return!!(e&&e.fullscreenElement&&e.fullscreenElement===s)},eS=s=>{const e=uu(s);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===s)},na=3;class tS{constructor(e){this._buffer=[],this._source=e}fill(){this._buffer=[];const e=this._source.currentTime;for(let t=0,i=this._source.buffered.length;t<i;t++){let r=this._source.buffered.start(t);const n=this._source.buffered.end(t);r>e&&r-e<na&&(r=e),this._buffer.push({from:r,to:n,i:t})}return this._buffer.sort(function(t,i){return t.from-i.from}),this._buffer}getByTime(e){return this._buffer.find(t=>e>=t.from&&e<t.to)}getNextWithGap(e,t){const i=this.getNext(e);if(i&&i.from-e.to<(t||na))return i}getNext(e){let t=this._buffer.indexOf(e);if(~t&&this._buffer.length-1>t)return this._buffer[++t]}smartRemove(e,t,i){this._buffer.forEach(({from:r,to:n})=>{const o=r>=e&&r<t,l=n>=e&&n<t;o&&l||(o?i(t,n):l?i(r,e):r<e&&n>t?(i(t,n),i(r,e)):i(r,n))})}destroy(){this._buffer=[]}}var du=(s,e,t=na)=>{let i=0,r=0;for(let n=0;n<s.length;n++){const o=s.start(n),l=s.end(n);if(o<=e&&e<=l){if(i=o,r=l,!t)return{from:i,to:r};for(let d=n-1;d>=0;d--)s.end(d)+t>=i&&(i=s.start(d));for(let d=n+1;d<s.length;d++)s.start(d)-t<=r&&(r=s.end(d))}}return{from:i,to:r}};const Ze=s=>{const e=v=>a.fromEvent(s,v).pipe(a.mapTo(void 0)),t=["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"],i=a.merge(...t.map(v=>a.fromEvent(s,v))).pipe(a.map(v=>v.type==="ended"?s.readyState<2:s.readyState<3),a.filterChanged()),r=a.merge(a.fromEvent(s,"progress"),a.fromEvent(s,"timeupdate")).pipe(a.map(()=>du(s.buffered,s.currentTime))),o=a.getCurrentBrowser().browser===a.CurrentClientBrowser.Safari?a.combine({play:e("play").pipe(a.once()),playing:e("playing")}).pipe(a.mapTo(void 0)):e("playing"),l=a.fromEvent(s,"volumechange").pipe(a.map(()=>({muted:s.muted,volume:s.volume}))),d=a.fromEvent(s,"ratechange").pipe(a.map(()=>s.playbackRate)),u=a.fromEvent(s,"error").pipe(a.filter(()=>!!(s.error||s.played.length)),a.map(()=>{var v;const y=s.error;return{id:y?`MediaError#${y.code}`:"HtmlVideoError",category:a.ErrorCategory.VIDEO_PIPELINE,message:y?y.message:"Error event from HTML video element",thrown:(v=s.error)!==null&&v!==void 0?v:void 0}})),c=a.fromEvent(s,"timeupdate").pipe(a.map(()=>s.currentTime)),h=new a.Subject,f=.3;let p;c.subscribe(v=>{s.loop&&a.isNonNullable(p)&&a.isNonNullable(v)&&p>=s.duration-f&&v<=f&&h.next(p),p=v});const b=a.fromEvent(s,"enterpictureinpicture"),m=a.fromEvent(s,"leavepictureinpicture"),S=new a.ValueSubject(eS(s));b.subscribe(()=>S.next(!0)),m.subscribe(()=>S.next(!1));const g=new a.ValueSubject(bo(s));return a.fromEvent(s,"fullscreenchange").pipe(a.map(()=>bo(s))).subscribe(g),{playing$:o,pause$:e("pause").pipe(a.filter(()=>!s.error)),canplay$:e("canplay"),ended$:e("ended"),looped$:h,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:c,durationChange$:a.fromEvent(s,"durationchange").pipe(a.map(()=>s.duration)),isBuffering$:i,currentBuffer$:r,volumeState$:l,playbackRateState$:d,inPiP$:S,inFullscreen$:g}},Oa=s=>{if(s.includes("/")){const e=s.split("/");return parseInt(e[0])/parseInt(e[1])}else return parseFloat(s)};var iS=Ie,sS=Es,rS=Ea,aS=Ta;iS({target:"Array",proto:!0},{at:function(e){var t=sS(this),i=rS(t),r=aS(e),n=r>=0?r:i+r;return n<0||n>=i?void 0:t[n]}});var nS=xa,oS=nS("Array","at"),lS=oS,uS=lS,dS=uS,cS=dS,He=vs(cS);let Ma=!1,Ge={};const hS=s=>{Ma=s},fS=()=>{Ge={}},pS=s=>{s(Ge)},zi=(s,e)=>{var t;Ma&&(Ge.meta=(t=Ge.meta)!==null&&t!==void 0?t:{},Ge.meta[s]=e)};class Be{constructor(e){this.name=e}next(e){var t,i;if(!Ma)return;Ge.series=(t=Ge.series)!==null&&t!==void 0?t:{};const r=(i=Ge.series[this.name])!==null&&i!==void 0?i:[];r.push([Date.now(),e]),Ge.series[this.name]=r}}var Et;(function(s){s.FitsContainer="FitsContainer",s.FitsThroughput="FitsThroughput",s.Buffer="Buffer",s.DroppedFramesLimit="DroppedFramesLimit",s.FitsQualityLimits="FitsQualityLimits"})(Et||(Et={}));const mS=new Be("best_bitrate"),vS=(s,e,t)=>(e-t)*Math.pow(2,-10*s)+t;class bS{constructor(){this.history={}}recordSelection(e){this.history[e.id]=a.now()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}}const SS='Assertion "ABR Tracks is empty array" failed',ii=(s,{container:e,throughput:t,tuning:i,limits:r,reserve:n=0,forwardBufferHealth:o,playbackRate:l,current:d,history:u,droppedVideoMaxQualityLimit:c,abrLogger:h})=>{var f,p,b,m,S;a.assertNotEmptyArray(s,SS);const g=i.usePixelRatio&&(f=window.devicePixelRatio)!==null&&f!==void 0?f:1,E=i.limitByContainer&&e&&e.width>0&&e.height>0&&{width:e.width*g*i.containerSizeFactor,height:e.height*g*i.containerSizeFactor},v=E&&a.videoSizeToQuality(E),y=i.considerPlaybackRate&&a.isNonNullable(l)?l:1,T=s.filter(I=>!a.isInvariantQuality(I.quality)).sort((I,w)=>a.isHigher(I.quality,w.quality)?-1:1),k=(p=He(T,-1))===null||p===void 0?void 0:p.quality,R=(b=He(T,0))===null||b===void 0?void 0:b.quality,x=a.isNullable(r)||a.isNonNullable(r.min)&&a.isNonNullable(r.max)&&a.isLower(r.max,r.min)||a.isNonNullable(r.min)&&R&&a.isHigher(r.min,R)||a.isNonNullable(r.max)&&k&&a.isLower(r.max,k),D=y*vS(o!=null?o:.5,i.bitrateFactorAtEmptyBuffer,i.bitrateFactorAtFullBuffer),N={},C=T.filter(I=>(v?a.isLower(I.quality,v):!0)?(a.isNonNullable(t)&&isFinite(t)&&a.isNonNullable(I.bitrate)?t-n>=I.bitrate*D:!0)?i.lazyQualitySwitch&&a.isNonNullable(i.minBufferToSwitchUp)&&d&&!a.isInvariantQuality(d.quality)&&(o!=null?o:0)<i.minBufferToSwitchUp&&a.isHigher(I.quality,d.quality)?(N[I.quality]=Et.Buffer,!1):!!c&&a.isHigherOrEqual(I.quality,c)?(N[I.quality]=Et.DroppedFramesLimit,!1):x||(a.isNullable(r.max)||a.isLowerOrEqual(I.quality,r.max))&&(a.isNullable(r.min)||a.isHigherOrEqual(I.quality,r.min))?!0:(N[I.quality]=Et.FitsQualityLimits,!1):(N[I.quality]=Et.FitsThroughput,!1):(N[I.quality]=Et.FitsContainer,!1))[0];C&&C.bitrate&&mS.next(C.bitrate);const A=(m=C!=null?C:T[Math.ceil((T.length-1)/2)])!==null&&m!==void 0?m:s[0];A.quality!==((S=u==null?void 0:u.last)===null||S===void 0?void 0:S.quality)&&h({message:`
|
|
7
7
|
[available tracks]
|
|
8
8
|
${s.map(I=>`{ id: ${I.id}, quality: ${I.quality}, bitrate: ${I.bitrate} }`).join(`
|
|
9
9
|
`)}
|