UNPKG

rx-player

Version:
1 lines 335 kB
"use strict";(()=>{var vu=Object.defineProperty,Cu=Object.defineProperties;var Au=Object.getOwnPropertyDescriptors;var ao=Object.getOwnPropertySymbols;var ku=Object.prototype.hasOwnProperty,xu=Object.prototype.propertyIsEnumerable;var oo=(n,e,t)=>e in n?vu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ee=(n,e)=>{for(var t in e||(e={}))ku.call(e,t)&&oo(n,t,e[t]);if(ao)for(var t of ao(e))xu.call(e,t)&&oo(n,t,e[t]);return n},se=(n,e)=>Cu(n,Au(e));var I={PRODUCTION:0,DEV:1,CURRENT_ENV:0};var so={DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_CONNECTION_TIMEOUT:15e3,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_ENABLE_FAST_SWITCHING:!0,DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:0,video:0,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUDIO_TRACKS_NOT_PLAYABLE_BEHAVIOR:"error",DEFAULT_VIDEO_TRACKS_NOT_PLAYABLE_BEHAVIOR:"error",DEFAULT_AUTO_PLAY:!1,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MINIMUM_MAX_BUFFER_AHEAD:{text:120},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_BASE_BANDWIDTH:0,INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_VIDEO_RESOLUTION_LIMIT:"none",DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,BITRATE_REBUFFERING_RATIO:1.5,DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:500,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,FREEZING_FLUSH_FAILURE_DELAY:{MAXIMUM:2e4,MINIMUM:4e3,POSITION_DELTA:1},SEGMENT_SYNCHRONIZATION_DELAY:1500,MISSING_DATA_TRIGGER_SYNC_DELAY:.1,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.001,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/mp4;codecs="hvc1.1.6.L93.B0"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"','audio/webm;codecs="opus"','audio/mp4;codecs="ec-3"'],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAP_REP_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5,DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_VIDEO_TRACK_SWITCHING_MODE:"reload",DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DEFAULT_MAX_THUMBNAIL_REQUESTS_RETRY_ON_ERROR:1,DEFAULT_THUMBNAIL_REQUEST_TIMEOUT:1e4,DEFAULT_THUMBNAIL_CONNECTION_TIMEOUT:7e3,FORCE_CANNOT_RELY_ON_REQUEST_MEDIA_KEY_SYSTEM_ACCESS:!1,FORCE_CANNOT_REUSE_MEDIA_KEYS:!1,FORCE_HAS_ISSUES_WITH_HIGH_MEDIA_SOURCE_DURATION:!1,FORCE_IS_SEEKING_APPROXIMATE:!1,FORCE_MEDIA_ELEMENT_FAIL_ON_UNDECIPHERABLE_DATA:!1,FORCE_SHOULD_AWAIT_SET_MEDIA_KEYS:!1,FORCE_SHOULD_FAVOUR_CUSTOM_SAFARI_EME:!1,FORCE_SHOULD_RELOAD_MEDIA_SOURCE_ON_DECIPHERABILITY_UPDATE:!1,FORCE_SHOULD_RENEW_MEDIA_KEY_SYSTEM_ACCESS:!1,FORCE_SHOULD_UNSET_MEDIA_KEYS:!1,FORCE_SHOULD_VALIDATE_METADATA:!1,FORCE_DONT_WAIT_FOR_DATA_BEFORE_LOADED:!1,FORCE_WAIT_FOR_HAVE_ENOUGH_DATA:!1},uo=so;function Ou(n,...e){if(n==null)throw new TypeError("Cannot convert undefined or null to object");let t=Object(n);for(let r of e)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}var H=typeof Object.assign=="function"?Object.assign:Ou;function ai(n){return n!=null&&!Array.isArray(n)&&typeof n=="object"}function en(n,...e){if(e.length===0)return n;let t=e.shift();if(ai(n)&&ai(t))for(let r in t)if(ai(t[r])){let i=n[r];i===void 0&&(i={},n[r]=i),en(i,t[r])}else H(n,{[r]:t[r]});return en(n,...e)}function v(n){return n==null}var fe=class{constructor(){this._listeners={}}addEventListener(e,t,r){let i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],r!==void 0&&r.register(()=>{this.removeEventListener(e,t)})}removeEventListener(e,t){if(v(e)){this._listeners={};return}let r=this._listeners[e];if(!Array.isArray(r))return;if(v(t)){delete this._listeners[e];return}let i=r.indexOf(t);i!==-1&&r.splice(i,1),r.length===0&&delete this._listeners[e]}trigger(e,t){let r=this._listeners[e];Array.isArray(r)&&r.slice().forEach(i=>{try{i(t)}catch(a){if(I.CURRENT_ENV===I.DEV)throw a instanceof Error?a:new Error("EventEmitter: listener error");console.error("RxPlayer: EventEmitter error",a instanceof Error?a:null)}})}};var oi=class extends fe{constructor(){super(...arguments);this.updated=!1;this._config=uo}update(t){let r=en(this._config,t);this._config=r,this.updated=!0,this.trigger("update",t)}getCurrent(){return this._config}},wu=new oi,U=wu;var Xe=class n extends Error{constructor(e,t,r){super(e),Object.setPrototypeOf(this,n.prototype),this.name="CustomLoaderError",this.canRetry=t,this.xhr=r}};function re(n,e,t){if(typeof Array.prototype.findIndex=="function")return n.findIndex(e,t);let r=n.length>>>0;for(let i=0;i<r;i++)if(e.call(t,n[i],i,n))return i;return-1}function D(){}var lr=class{constructor(e,t){this._value=e,this._listeners=[],this._isFinished=!1,this._onFinishCbs=[],t!==void 0&&(this._deregisterCancellation=t.register(()=>this.finish()))}getValue(){return this._value}setValue(e){if(this._isFinished){I.CURRENT_ENV===I.DEV&&console.error("Finished shared references cannot be updated");return}if(this._value=e,this._listeners.length===0)return;let t=this._listeners.slice();for(let r of t)try{r.hasBeenCleared||r.trigger(e,r.complete)}catch(i){}}setValueIfChanged(e){e!==this._value&&this.setValue(e)}onUpdate(e,t){let r=()=>{if(t.clearSignal!==void 0&&t.clearSignal.deregister(r),i.hasBeenCleared)return;i.hasBeenCleared=!0;let a=this._listeners.indexOf(i);a>=0&&this._listeners.splice(a,1)},i={trigger:e,complete:r,hasBeenCleared:!1};if(this._listeners.push(i),t.emitCurrentValue===!0&&e(this._value,r),this._isFinished||i.hasBeenCleared){r();return}t.clearSignal.register(r)}waitUntilDefined(e,t){this.onUpdate((r,i)=>{r!==void 0&&(i(),e(this._value))},{clearSignal:t.clearSignal,emitCurrentValue:!0})}_onFinished(e,t){if(t.isCancelled())return D;let r=()=>{let o=re(this._onFinishCbs,s=>s.trigger===i);o>=0&&(this._onFinishCbs[o].hasBeenCleared=!0,this._onFinishCbs.splice(o,1))},i=()=>{r(),e()},a=t.register(r);return this._onFinishCbs.push({trigger:i,hasBeenCleared:!1}),a}finish(){this._deregisterCancellation!==void 0&&this._deregisterCancellation(),this._isFinished=!0;let e=this._listeners.slice();for(let t of e)try{t.hasBeenCleared||(t.complete(),t.hasBeenCleared=!0)}catch(r){}if(this._listeners.length=0,this._onFinishCbs.length>0){let t=this._onFinishCbs.slice();for(let r of t)try{r.hasBeenCleared||(r.trigger(),r.hasBeenCleared=!0)}catch(i){}this._onFinishCbs.length=0}}};function tn(n,e,t){let r=new lr(e(n.getValue()),t);return n.onUpdate(function(a){r.setValue(e(a))},{clearSignal:t}),n._onFinished(()=>{r.finish()},t),r}var Y=lr;var si=new Y(0);function lo({date:n,timestamp:e}){let t=n-e,r=typeof performance!="undefined"?Date.now()-performance.now():0;si.setValueIfChanged(r-t)}var Du=typeof performance!="undefined"?()=>performance.now()+si.getValue():()=>Date.now()+si.getValue(),L=Du;var Bu="NONE",nn=class extends fe{constructor(){super(),this.error=D,this.warn=D,this.info=D,this.debug=D,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentFormat="standard",this._currentLevel=Bu}setLevel(e,t,r){let i,a=this._levels[e];typeof a=="number"?(i=a,this._currentLevel=e):(i=0,this._currentLevel="NONE");let o;if(t==="standard"||t==="full"?o=t:o="standard",o==="full"&&o!==this._currentFormat){let u=L();console.log(String(u.toFixed(2)),"[Init]",`Local-Date: ${Date.now()}`)}this._currentFormat=o;let s=this._currentFormat==="full"?(u,d)=>(f,...l)=>{let m=L();return d(String(m.toFixed(2)),`[${u}]`,f+":",...l.map(g=>typeof g=="object"&&g!==null&&!(g instanceof Error)?fo(g):g))}:(u,d)=>(f,...l)=>d(f+":",...l.map(m=>typeof m=="object"&&m!==null&&!(m instanceof Error)?fo(m):m));if(r===void 0)this.error=i>=this._levels.ERROR?s("error",console.error.bind(console)):D,this.warn=i>=this._levels.WARNING?s("warn",console.warn.bind(console)):D,this.info=i>=this._levels.INFO?s("info",console.info.bind(console)):D,this.debug=i>=this._levels.DEBUG?s("log",console.log.bind(console)):D;else{let u=d=>i>=this._levels[d]?(f,...l)=>r(d,f,l):D;this.error=u("ERROR"),this.warn=u("WARNING"),this.info=u("INFO"),this.debug=u("DEBUG")}this.trigger("onLogLevelChange",{level:this._currentLevel,format:this._currentFormat})}getLevel(){return this._currentLevel}getFormat(){return this._currentFormat}hasLevel(e){return this._levels[e]>=this._levels[this._currentLevel]}};function fo(n){let e="";for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){e.length>0&&(e+=" ");let r=n[t];r instanceof Error?e+=`${t}="${JSON.stringify(r==null?void 0:r.toString())}"`:e+=`${t}=${typeof r=="string"?`${JSON.stringify(r)}`:String(r)}`}return e}var Nu=new nn,c=Nu;var fr=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope;var Uu=typeof window=="undefined"&&!fr,mr=Uu;var cr;fr?cr=self:mr?cr=global:cr=window;var te=cr;var de=class n extends Error{constructor(e,t,r){let i;switch(r){case"TIMEOUT":i="The request timed out";break;case"ERROR_EVENT":i="An error prevented the request to be performed successfully";break;case"PARSE_ERROR":i="An error happened while formatting the response data";break;case"ERROR_HTTP_CODE":i="An HTTP status code indicating failure was received: "+String(t);break}super(i),Object.setPrototypeOf(this,n.prototype),this.name="RequestError",this.url=e,this.status=t,this.type=r}serialize(){return{url:this.url,status:this.status,type:this.type}}},Pe={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"};var ui=typeof Headers=="function"?Headers:null,pr=typeof AbortController=="function"?AbortController:null;function gr(n){var m,g;let e;if(!v(n.headers))if(v(ui))e=n.headers;else{e=new ui;let p=Object.keys(n.headers);for(let b=0;b<p.length;b++){let h=p[b];e.append(h,n.headers[h])}}c.debug("utils","Fetch",{url:n.url});let t=null,r=!1,i=!1,a=L(),o=v(pr)?null:new pr;function s(){if(v(o)){c.warn("utils","Fetch: AbortController API not available.");return}o.abort()}let u;n.timeout!==void 0&&(u=setTimeout(()=>{r=!0,d!==void 0&&clearTimeout(d),s()},n.timeout));let d;n.connectionTimeout!==void 0&&(d=setTimeout(()=>{i=!0,u!==void 0&&clearTimeout(u),s()},n.connectionTimeout));let f=n.cancelSignal.register(function(b){t=b,s()}),l={method:"GET"};if(e!==void 0&&(l.headers=e),l.signal=v(o)?null:o.signal,c.hasLevel("DEBUG")){let p="fetch GET "+n.url;n.timeout!==void 0&&(p+=" to="+String(n.timeout/1e3)),n.connectionTimeout!==void 0&&(p+=" cto="+String(n.connectionTimeout/1e3)),((m=n.headers)==null?void 0:m.Range)!==void 0&&(p+=" Range="+((g=n.headers)==null?void 0:g.Range)),c.debug("utils",p)}return fetch(n.url,l).then(p=>{if(d!==void 0&&clearTimeout(d),p.status>=300)throw c.warn("utils","Fetch: Request HTTP Error",{status:p.status,responseUrl:p.url}),new de(p.url,p.status,Pe.ERROR_HTTP_CODE);if(v(p.body))throw new de(p.url,p.status,Pe.PARSE_ERROR);let b=p.headers.get("Content-Length"),h=!v(b)&&!isNaN(+b)?+b:void 0,S=p.body.getReader(),_=0;return P();async function P(){let T=await S.read();if(!T.done&&!v(T.value)){_+=T.value.byteLength;let R=L(),E={url:p.url,currentTime:R,duration:R-a,sendingTime:a,chunkSize:T.value.byteLength,chunk:T.value.buffer,size:_,totalSize:h};return n.onData(E),P()}else if(T.done){u!==void 0&&clearTimeout(u),f();let R=L();return{requestDuration:R-a,receivedTime:R,sendingTime:a,size:_,status:p.status,url:p.url}}return P()}}).catch(p=>{throw t!==null?t:(f(),r?(c.warn("utils","Fetch: Request timed out.",{url:n.url,timeout:n.timeout}),new de(n.url,0,Pe.TIMEOUT)):i?(c.warn("utils","Fetch: Request connection timed out.",{url:n.url,connectionTimeout:n.connectionTimeout}),new de(n.url,0,Pe.TIMEOUT)):p instanceof de?p:(c.warn("utils","Fetch: Request Error",{error:p instanceof Error?p.toString():"Unkwown Error"}),new de(n.url,0,Pe.ERROR_EVENT)))})}function rn(){let n=/\[\s*native\s+code\s*\]/;return typeof te.fetch=="function"&&!v(pr)&&n.test(pr.toString())&&!v(ui)}function j(n){return typeof n=="string"&&n.length>0}var Lu="json";function an(n){let e={url:n.url,headers:n.headers,responseType:v(n.responseType)?Lu:n.responseType,timeout:n.timeout,connectionTimeout:n.connectionTimeout};return new Promise((t,r)=>{let{onProgress:i,cancelSignal:a}=n,{url:o,headers:s,responseType:u,timeout:d,connectionTimeout:f}=e,l=new XMLHttpRequest;l.open("GET",o,!0);let m;d!==void 0&&(l.timeout=d,m=setTimeout(()=>{h(),r(new de(o,l.status,Pe.TIMEOUT))},d+3e3));let g;if(f!==void 0&&(g=setTimeout(()=>{h(),l.readyState!==XMLHttpRequest.DONE&&l.abort(),r(new de(o,l.status,Pe.TIMEOUT))},f)),l.responseType=u,l.responseType==="document"&&l.overrideMimeType("text/xml"),!v(s)){let S=s;for(let _ in S)Object.prototype.hasOwnProperty.call(S,_)&&l.setRequestHeader(_,S[_])}let p=L(),b=null;if(a!==void 0&&(b=a.register(function(_){h(),l.readyState!==XMLHttpRequest.DONE&&l.abort(),r(_)}),a.isCancelled()))return;if(l.onerror=function(){h(),r(new de(o,l.status,Pe.ERROR_EVENT))},l.ontimeout=function(){h(),r(new de(o,l.status,Pe.TIMEOUT))},f!==void 0&&(l.onreadystatechange=function(){l.readyState>=XMLHttpRequest.HEADERS_RECEIVED&&clearTimeout(g)}),i!==void 0&&(l.onprogress=function(_){let P=L();i({url:o,duration:P-p,sendingTime:p,currentTime:P,size:_.loaded,totalSize:_.total})}),l.onload=function(_){if(l.readyState===XMLHttpRequest.DONE)if(h(),l.status>=200&&l.status<300){let P=L(),T=l.response instanceof ArrayBuffer?l.response.byteLength:_.total,R=l.status,E=l.responseType,M=j(l.responseURL)?l.responseURL:o,C;if(E==="json"?C=typeof l.response=="object"?l.response:Fu(l.responseText):C=l.response,v(C)){r(new de(o,l.status,Pe.PARSE_ERROR));return}t({status:R,url:M,responseType:E,sendingTime:p,receivedTime:P,requestDuration:P-p,size:T,responseData:C})}else r(new de(o,l.status,Pe.ERROR_HTTP_CODE))},c.hasLevel("DEBUG")){let S="XHR GET "+o;n.responseType!==void 0&&(S+=" type="+n.responseType),d!==void 0&&(S+=" to="+String(d/1e3)),f!==void 0&&(S+=" cto="+String(f/1e3)),(s==null?void 0:s.Range)!==void 0&&(S+=" Range="+(s==null?void 0:s.Range)),c.debug("utils",S)}l.send();function h(){m!==void 0&&clearTimeout(m),g!==void 0&&clearTimeout(g),b!==null&&b()}})}function Fu(n){try{return JSON.parse(n)}catch(e){return null}}var be=an;var Rt=Pe,Ge={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"};function tt(n,e){return`${n}: ${e}`}var on=class n extends Error{constructor(e,t,r){super(tt(e,t)),Object.setPrototypeOf(this,n.prototype),this.name="EncryptedMediaError",this.type=Ge.ENCRYPTED_MEDIA_ERROR,this.code=e,this._originalMessage=t,this.fatal=!1,this.keyStatuses=r.keyStatuses,this.keySystemConfiguration=r.keySystemConfiguration,this.keySystem=r.keySystem}serialize(){return{isSerializedError:!0,name:this.name,code:this.code,reason:this._originalMessage,keyStatuses:this.keyStatuses,keySystemConfiguration:this.keySystemConfiguration,keySystem:this.keySystem}}};var Z=class n extends Error{constructor(e,t,r){super(tt(e,t)),Object.setPrototypeOf(this,n.prototype),this.name="MediaError",this.type=Ge.MEDIA_ERROR,this._originalMessage=t,this.code=e,this.fatal=!1,(r==null?void 0:r.tracks)!==void 0&&(r==null?void 0:r.tracks.length)>0&&(this.tracksInfo=r.tracks)}serialize(){return{isSerializedError:!0,name:this.name,code:this.code,reason:this._originalMessage,tracks:this.tracksInfo}}};var Ze=class n extends Error{constructor(e,t){super(tt(e,t.message)),Object.setPrototypeOf(this,n.prototype),this.name="NetworkError",this.type=Ge.NETWORK_ERROR,this.url=t.url,this.status=t.status,this.errorType=t.type,this._baseError=t,this.code=e,this.fatal=!1}isHttpError(e){return this.errorType===Rt.ERROR_HTTP_CODE&&this.status===e}serialize(){return{isSerializedError:!0,name:this.name,code:this.code,baseError:this._baseError.serialize()}}};var _e=class n extends Error{constructor(e,t){super(tt(e,t)),Object.setPrototypeOf(this,n.prototype),this.name="OtherError",this.type=Ge.OTHER_ERROR,this.code=e,this.fatal=!1,this._originalMessage=t}serialize(){return{isSerializedError:!0,name:this.name,code:this.code,reason:this._originalMessage}}};function Nt(n){return(n instanceof on||n instanceof Z||n instanceof _e||n instanceof Ze)&&Object.keys(Ge).indexOf(n.type)>=0}function ge(n,{defaultCode:e,defaultReason:t}){if(Nt(n))return n;let r=n instanceof Error?n.toString():t;return new _e(e,r)}var xe=class n extends Error{constructor(e,t,r){super(t),Object.setPrototypeOf(this,n.prototype),this.name="SourceBufferError",this.errorName=e,this.isBufferFull=r}serialize(){return{errorName:this.name,message:this.message,isBufferFull:this.isBufferFull}}toString(){return`${this.errorName}: ${this.message}`}};var zu={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextDisplayer:null,htmlTextTracksParsers:{},mainThreadMediaSourceInit:null,multithread:null,nativeTextDisplayer:null,nativeTextTracksParsers:{},transports:{}},mo=zu;var De=mo;function K(n,e,t){if(typeof Array.prototype.find=="function")return n.find(e,t);let r=n.length>>>0;for(let i=0;i<r;i++){let a=n[i];if(e.call(t,a,i,n))return a}}var Wu={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},co=Wu;var qu={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"},po=qu;function Vu(n){if(v(n)||n==="")return"und";let t=(""+n).toLowerCase().split("-")[0],r=Gu(t);return j(r)?r:n}function Gu(n){let e;switch(n.length){case 2:e=co[n];break;case 3:e=po[n];break}return e}var go=Vu;var ho=go;function hr(n,e){if(n.length!==e.length)return!1;if(n===e)return!0;for(let t=n.length-1;t>=0;t--)if(n[t]!==e[t])return!1;return!0}function di(n){return Object.keys(n).map(e=>n[e])}var Ir=typeof Object.values=="function"?Object.values:di;var Ut=["audio","video","text"];function bo(n){var a,o;let e=n.timeBounds;if(e.timeshiftDepth===null)return(a=e.minimumSafePosition)!=null?a:0;let{maximumTimeData:t}=e,r;if(!e.maximumTimeData.isLinear)r=t.maximumSafePosition;else{let s=L()-t.time;r=t.maximumSafePosition+s/1e3}let i=r-e.timeshiftDepth;return Math.max((o=e.minimumSafePosition)!=null?o:0,i)}function yo(n){let{maximumTimeData:e}=n.timeBounds;if(!n.isLive||e.livePosition===void 0)return;if(!e.isLinear)return e.livePosition;let t=L()-e.time;return e.livePosition+t/1e3}function So(n){let{maximumTimeData:e}=n.timeBounds;if(!e.isLinear)return e.maximumSafePosition;let t=L()-e.time;return e.maximumSafePosition+t/1e3}function To(n,e){if(e===void 0)return fi(n).filter(r=>r.supportStatus.hasSupportedCodec!==!1&&r.supportStatus.isDecipherable!==!1);let t=n.adaptations[e];return t===void 0?[]:t.filter(r=>r.supportStatus.hasSupportedCodec!==!1&&r.supportStatus.isDecipherable!==!1)}function Eo(n,e){let t=null;for(let r=n.periods.length-1;r>=0;r--){let i=n.periods[r];if(li(i,e,t))return i;t=i}}function _o(n,e){let t=e.end;if(t===void 0)return null;let r=K(n.periods,i=>i.end===void 0||t<i.end);return r===void 0?null:r}function li(n,e,t){return e>=n.start&&(n.end===void 0||e<n.end)?!0:e===n.end&&(t===null||t.start>n.end)}function fi(n){let e=n.adaptations;return di(e).reduce((t,r)=>v(r)?t:t.concat(r),[])}function Hu(n,e){var r,i;let t={language:(r=n.language)!=null?r:"",normalized:(i=n.normalizedLanguage)!=null?i:"",audioDescription:n.isAudioDescription===!0,id:n.id,representations:(e?n.representations.filter(a=>sn(a)===!0):n.representations).map(Yu),label:n.label};return n.isDub===!0&&(t.dub=!0),t}function Ku(n){var e,t;return{language:(e=n.language)!=null?e:"",normalized:(t=n.normalizedLanguage)!=null?t:"",closedCaption:n.isClosedCaption===!0,id:n.id,label:n.label,forced:n.isForcedSubtitles}}function ju(n,e){let t=n.trickModeTracks!==void 0?n.trickModeTracks.map(i=>{let a=(e?i.representations.filter(s=>sn(s)===!0):i.representations).map(Io),o={id:i.id,representations:a,isTrickModeTrack:!0};return i.isSignInterpreted===!0&&(o.signInterpreted=!0),o}):void 0,r={id:n.id,representations:(e?n.representations.filter(i=>sn(i)===!0):n.representations).map(Io),label:n.label};return n.isSignInterpreted===!0&&(r.signInterpreted=!0),n.isTrickModeTrack===!0&&(r.isTrickModeTrack=!0),t!==void 0&&(r.trickModeTracks=t),r}function Yu(n){let{id:e,bitrate:t,codecs:r,isSpatialAudio:i,isSupported:a,decipherable:o}=n;return{id:e,bitrate:t,codec:r==null?void 0:r[0],isSpatialAudio:i,isCodecSupported:a,decipherable:o}}function Io(n){let{id:e,bitrate:t,frameRate:r,width:i,height:a,codecs:o,hdrInfo:s,isSupported:u,decipherable:d,contentProtections:f}=n;return{id:e,bitrate:t,frameRate:r,width:i,height:a,codec:o==null?void 0:o[0],hdrInfo:s,isCodecSupported:u,decipherable:d,contentProtections:f!==void 0?{keyIds:f.keyIds}:void 0}}function Pt(n){switch(n.type){case"audio":return{type:"audio",track:Hu(n,!1)};case"video":return{type:"video",track:ju(n,!1)};case"text":return{type:"text",track:Ku(n)}}}function sn(n){return n.decipherable===!1?!1:n.isSupported}function Ro(n){return new Function(`return (${n}(arguments[0], arguments[1]))`)}function Me(){let n="",e=-1;return function(){return e++,e>=Number.MAX_SAFE_INTEGER&&(n+="0",e=0),n+String(e)}}var br=class n extends Error{constructor(e){super(e),Object.setPrototypeOf(this,n.prototype),this.name="AssertionError"}};function ce(n,e){if(I.DEV===I.CURRENT_ENV&&!n)throw new br(e===void 0?"invalid assertion":e)}function Ne(n){throw new br("Unreachable path taken")}var Qu=typeof te=="object"&&typeof te.TextDecoder=="function",$u=typeof te=="object"&&typeof te.TextEncoder=="function";function un(n){if($u)try{return new TextEncoder().encode(n)}catch(i){let a=i instanceof Error?i:"Unknown Error";c.warn("utils","Could not use TextEncoder to encode string into UTF-8, fallbacking to another implementation",a)}let e,t=encodeURIComponent(n);if(typeof unescape=="function")e=unescape(t);else{let i=/[0-9a-fA-F]/,a=t.length;e="";for(let o=0;o<t.length;o++){let s=!1;if(t[o]==="%"){if(o<=a-6&&t[o+1]==="u"&&i.test(t[o+2])&&i.test(t[o+3])&&i.test(t[o+4])&&i.test(t[o+5])){let u=parseInt(t.substring(o+1,o+6),16);e+=String.fromCharCode(u),s=!0,o+=5}else if(o<=a-3&&i.test(t[o+1])&&i.test(t[o+2])){let u=parseInt(t.substring(o+1,o+3),16);e+=String.fromCharCode(u),s=!0,o+=2}}s||(e+=t[o])}}let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i)&255;return r}function Xu(n){let t="";for(let r=0;r<n.length;r+=16e3){let i=n.subarray(r,r+16e3);t+=String.fromCharCode.apply(null,i)}return t}function Po(n,e){let t=n.toString(16);return t.length>=e?t:new Array(e-t.length+1).join("0")+t}function Ke(n){if(Qu)try{return new TextDecoder().decode(n)}catch(i){let a=i instanceof Error?i:"Unknown Error";c.warn("utils","could not use TextDecoder to parse UTF-8, fallbacking to another implementation",a)}let e=n;e[0]===239&&e[1]===187&&e[2]===191&&(e=e.subarray(3));let t=Xu(e),r;if(typeof escape=="function")r=escape(t);else{let i=/[A-Za-z0-9*_+-./]/;r="";for(let a=0;a<t.length;a++)if(i.test(t[a]))r+=t[a];else{let o=t.charCodeAt(a);r+=o>=256?"%u"+Po(o,4):"%"+Po(o,2)}}return decodeURIComponent(r)}function dn(n){let e=n.length,t=new Uint8Array(e/2);for(let r=0,i=0;r<e;r+=2,i++)t[i]=parseInt(n.substring(r,r+2),16)&255;return t}function yr(n,e=""){let t="";for(let r=0;r<n.byteLength;r++)t+=(n[r]>>>4).toString(16),t+=(n[r]&15).toString(16),e.length>0&&r<n.byteLength-1&&(t+=e);return t}function mi(n,e){let t=e;for(;t<n.length&&n[t]!==0;)t+=1;let r=n.subarray(e,t);return{end:t+1,string:Ke(r)}}var Zu=Me(),ci=class{constructor(e,t,r){var a,o,s,u,d;this.id=e.id,this.uniqueId=Zu(),this.shouldBeAvoided=!1,this.bitrate=e.bitrate,this.codecs=[],this.trackType=t,e.isSpatialAudio!==void 0&&(this.isSpatialAudio=e.isSpatialAudio),e.height!==void 0&&(this.height=e.height),e.width!==void 0&&(this.width=e.width),e.mimeType!==void 0&&(this.mimeType=e.mimeType),e.contentProtections!==void 0&&(this.contentProtections=e.contentProtections),e.frameRate!==void 0&&(this.frameRate=e.frameRate),e.hdrInfo!==void 0&&(this.hdrInfo=e.hdrInfo),this.cdnMetadata=e.cdnMetadata,this.index=e.index;let i=this.contentProtections!==void 0;if(t==="audio"||t==="video"){if(e.supplementalCodecs!==void 0){let f=r.isSupported((a=this.mimeType)!=null?a:"",(o=e.supplementalCodecs)!=null?o:"",i);f!==!1&&(this.codecs=[e.supplementalCodecs],this.isSupported=f)}this.isSupported!==!0&&(this.codecs.length>0?this.codecs.push((s=e.codecs)!=null?s:""):(this.codecs=e.codecs===void 0?[]:[e.codecs],this.isSupported=r.isSupported((u=this.mimeType)!=null?u:"",(d=e.codecs)!=null?d:"",i)))}else e.codecs!==void 0&&this.codecs.push(e.codecs),this.isSupported=!0}refreshCodecSupport(e){var s,u;if(this.isSupported!==void 0)return;let t=this.contentProtections!==void 0,r=!1,i=(s=this.mimeType)!=null?s:"",a=(u=this.codecs)!=null?u:[];a.length===0&&(a=[""]);let o=!1;for(let d of a){if(r=e.isSupported(i,d,t),r===!0){this.codecs=[d];break}r===void 0&&(o=!0)}r===!0?this.isSupported=!0:o?this.isSupported=void 0:this.isSupported=!1}getMimeTypeString(){var e,t,r;return`${(e=this.mimeType)!=null?e:""};codecs="${(r=(t=this.codecs)==null?void 0:t[0])!=null?r:""}"`}getEncryptionData(e){var i;let t=this.getAllEncryptionData(),r=[];for(let a=0;a<t.length;a++){let o=!1,s=t[a];for(let u=0;u<s.values.length;u++)if(s.values[u].systemId.toLowerCase()===e.toLowerCase())if(o)r[r.length-1].values.push(s.values[u]);else{let d=(i=this.contentProtections)==null?void 0:i.keyIds;r.push({type:s.type,keyIds:d,values:[s.values[u]]}),o=!0}}return r}getAllEncryptionData(){var t;if(this.contentProtections===void 0||this.contentProtections.initData.length===0)return[];let e=(t=this.contentProtections)==null?void 0:t.keyIds;return this.contentProtections.initData.map(r=>({type:r.type,keyIds:e,values:r.values}))}addProtectionData(e,t,r){let i=!1;if(this.contentProtections===void 0)return this.contentProtections={keyIds:t!==void 0?[t]:[],initData:[{type:e,values:r}]},!0;if(t!==void 0){let o=this.contentProtections.keyIds;if(o===void 0)this.contentProtections.keyIds=[t];else{let s=!1;for(let u of o)hr(u,t)&&(s=!0);s||(c.warn("manifest","found unanounced key id.",{keyId:yr(t)}),o.push(t))}}let a=this.contentProtections.initData;for(let o=0;o<a.length;o++)if(a[o].type===e){let s=a[o].values;for(let u=0;u<r.length;u++){let d=r[u],f;for(f=0;f<s.length;f++)if(d.systemId===s[f].systemId){if(hr(d.data,s[f].data))break;c.warn("manifest","different init data for the same system ID",{systemId:d.systemId})}f===s.length&&(s.push(d),i=!0)}return i}return this.contentProtections.initData.push({type:e,values:r}),!0}isPlayable(){return sn(this)}getMetadataSnapshot(){return{id:this.id,uniqueId:this.uniqueId,bitrate:this.bitrate,codecs:this.codecs,mimeType:this.mimeType,width:this.width,height:this.height,frameRate:this.frameRate,isSupported:this.isSupported,hdrInfo:this.hdrInfo,contentProtections:this.contentProtections,decipherable:this.decipherable,isCodecSupportedInWebWorker:this.isCodecSupportedInWebWorker}}},ln=ci;var mt=class n{constructor(e,t,r={}){let{trickModeTracks:i}=e,{representationFilter:a,isManuallyAdded:o}=r;this.id=e.id,this.type=e.type,e.isTrickModeTrack!==void 0&&(this.isTrickModeTrack=e.isTrickModeTrack),e.language!==void 0&&(this.language=e.language,this.normalizedLanguage=ho(e.language)),e.closedCaption!==void 0&&(this.isClosedCaption=e.closedCaption),e.audioDescription!==void 0&&(this.isAudioDescription=e.audioDescription),e.isDub!==void 0&&(this.isDub=e.isDub),e.forcedSubtitles!==void 0&&(this.isForcedSubtitles=e.forcedSubtitles),e.isSignInterpreted!==void 0&&(this.isSignInterpreted=e.isSignInterpreted),e.label!==void 0&&(this.label=e.label),i!==void 0&&i.length>0&&(this.trickModeTracks=i.map(d=>new n(d,t)));let s=e.representations,u=[];this.supportStatus={hasSupportedCodec:!1,hasCodecWithUndefinedSupport:!1,isDecipherable:!1};for(let d=0;d<s.length;d++){let f=new ln(s[d],this.type,t),l=!0;if(!v(a)){let m={id:f.id,bitrate:f.bitrate,codecs:f.codecs,height:f.height,width:f.width,frameRate:f.frameRate,hdrInfo:f.hdrInfo};if(f.contentProtections!==void 0&&(m.contentProtections={},f.contentProtections.keyIds!==void 0)){let g=f.contentProtections.keyIds;m.contentProtections.keyIds=g}l=a(m,{trackType:this.type,language:this.language,normalizedLanguage:this.normalizedLanguage,isClosedCaption:this.isClosedCaption,isDub:this.isDub,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted})}l?(u.push(f),f.isSupported===void 0?(this.supportStatus.hasCodecWithUndefinedSupport=!0,this.supportStatus.hasSupportedCodec===!1&&(this.supportStatus.hasSupportedCodec=void 0)):f.isSupported&&(this.supportStatus.hasSupportedCodec=!0),f.decipherable===void 0?this.supportStatus.isDecipherable===!1&&(this.supportStatus.isDecipherable=void 0):f.decipherable&&(this.supportStatus.isDecipherable=!0)):c.debug("manifest","Filtering Representation due to representationFilter",this.type,`Adaptation: ${this.id}`,`Representation: ${f.id}`,`(${f.bitrate})`)}u.sort((d,f)=>d.bitrate-f.bitrate),this.representations=u,this.manuallyAdded=o===!0}refreshCodecSupport(e){let t=!1,r=!1;for(let i of this.representations)i.refreshCodecSupport(e),i.isSupported===void 0?t=!0:i.isSupported&&(r=!0);r?this.supportStatus.hasSupportedCodec=!0:t?this.supportStatus.hasSupportedCodec=void 0:this.supportStatus.hasSupportedCodec=!1,this.supportStatus.hasCodecWithUndefinedSupport=t}getRepresentation(e){return K(this.representations,({id:t})=>e===t)}getMetadataSnapshot(){let e=[],t=this.representations;for(let r of t)e.push(r.getMetadataSnapshot());return{id:this.id,type:this.type,supportStatus:this.supportStatus,language:this.language,isForcedSubtitles:this.isForcedSubtitles,isClosedCaption:this.isClosedCaption,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted,normalizedLanguage:this.normalizedLanguage,representations:e,label:this.label,isDub:this.isDub}}};var ye=te,vo,Co,Ao,ko,xo,ct=(xo=(ko=(Ao=(Co=(vo=ye==null?void 0:ye.MediaSource)!=null?vo:ye==null?void 0:ye.MozMediaSource)!=null?Co:ye==null?void 0:ye.WebKitMediaSource)!=null?Ao:ye==null?void 0:ye.MSMediaSource)!=null?ko:ye==null?void 0:ye.ManagedMediaSource)!=null?xo:void 0,Zg=ct!==void 0&&ct===(ye==null?void 0:ye.ManagedMediaSource);var pt={EdgeChromium:0,Firefox:1,Ie11:2,OtherIeOrEdgePreEdgeChromium:3,SafariDesktop:4,SafariMobile:5,Other:6},Ue={A1KStb40xx:100,Panasonic:101,PhilipsNetTv:102,PlayStation4:103,PlayStation5:104,Tizen:105,WebOs2021:106,WebOs2022:107,WebOsOther:108,Xbox:109,Other:110},Se={DEVICES:Ue,BROWSERS:pt,browser:pt.Other,device:Ue.Other,isSamsungBrowser:!1};Ju();function Ju(){var n,e,t;mr||(typeof te.MSInputMethodContext!="undefined"&&typeof document.documentMode!="undefined"?Se.browser=pt.Ie11:navigator.appName==="Microsoft Internet Explorer"||navigator.appName==="Netscape"&&/(Trident|Edge)\//.test(navigator.userAgent)?Se.browser=pt.OtherIeOrEdgePreEdgeChromium:navigator.userAgent.toLowerCase().indexOf("edg/")!==-1?Se.browser=pt.EdgeChromium:navigator.userAgent.toLowerCase().indexOf("firefox")!==-1?Se.browser=pt.Firefox:typeof navigator.platform=="string"&&/iPad|iPhone|iPod/.test(navigator.platform)?Se.browser=pt.SafariMobile:(Object.prototype.toString.call(te.HTMLElement).indexOf("Constructor")>=0||((e=(n=te.safari)==null?void 0:n.pushNotification)==null?void 0:e.toString())==="[object SafariRemoteNotification]"||/Safari\/(\d+)/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&((t=navigator.vendor)==null?void 0:t.indexOf("Apple"))!==-1&&!/Chrome\/(\d+)/.test(navigator.userAgent)&&!/Chromium\/(\d+)/.test(navigator.userAgent))&&(Se.browser=pt.SafariDesktop),/SamsungBrowser/.test(navigator.userAgent)&&(Se.isSamsungBrowser=!0),navigator.userAgent.indexOf("PlayStation 4")!==-1?Se.device=Ue.PlayStation4:navigator.userAgent.indexOf("PlayStation 5")!==-1?Se.device=Ue.PlayStation5:/Tizen/.test(navigator.userAgent)?Se.device=Ue.Tizen:/[Ww]eb[O0]S/.test(navigator.userAgent)?/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)?Se.device=Ue.WebOs2022:/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent)?Se.device=Ue.WebOs2021:Se.device=Ue.WebOsOther:navigator.userAgent.indexOf("NETTV")!==-1&&navigator.userAgent.indexOf("Philips")!==-1?Se.device=Ue.PhilipsNetTv:/[Pp]anasonic/.test(navigator.userAgent)?Se.device=Ue.Panasonic:navigator.userAgent.indexOf("Xbox")!==-1?Se.device=Ue.Xbox:navigator.userAgent.indexOf("Model/a1-kstb40xx")!==-1&&(Se.device=Ue.A1KStb40xx))}var pi=Se;function gi(n){return new Promise(e=>{setTimeout(e,n)})}function vt(n,e){let t;return new Promise((r,i)=>{if(n.cancellationError!==null)return i(n.cancellationError);let a=!1;t=e(function(u){n.deregister(o),a=!0,r(u)},function(u){n.deregister(o),a=!0,i(u)}),a||n.register(o);function o(s){t!==void 0&&t(),i(s)}})}function fn(n,e){return vt(e,t=>{let r=setTimeout(()=>t(),n);return()=>clearTimeout(r)})}var F=class{constructor(){let[e,t]=ed();this._isUsed=!1,this._trigger=e,this.signal=new hi(t)}isUsed(){return this._isUsed}linkToSignal(e){let t=e.register(()=>{this.cancel()});return this.signal.register(t),t}cancel(e){if(this._isUsed)return;this._isUsed=!0;let t=e!=null?e:new ue;this._trigger(t)}static isCancellationError(e){return e instanceof ue}},hi=class{constructor(e){this._isCancelled=!1,this.cancellationError=null,this._listeners=[],e(t=>{for(this.cancellationError=t,this._isCancelled=!0;this._listeners.length>0;)try{let r=this._listeners.pop();r==null||r(t)}catch(r){c.error("utils","Error while calling clean up listener",r instanceof Error?r:"Unknown Error")}})}isCancelled(){return this._isCancelled}register(e){return this._isCancelled?(ce(this.cancellationError!==null),e(this.cancellationError),D):(this._listeners.push(e),()=>this.deregister(e))}deregister(e){for(let t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)}},ue=class n extends Error{constructor(){super("This task was cancelled."),Object.setPrototypeOf(this,n.prototype),this.name="CancellationError"}};function ed(){let n=D;return[function(t){n(t)},function(t){n=t}]}var td=["","webkit","moz","ms"];function nd(n,e){let t=document.createElement(n.tagName),r="on"+e;return r in t?!0:(t.setAttribute(r,"return;"),typeof t[r]=="function")}function rd(n,e){return e.filter(t=>nd(n,t))[0]}function id(n,e){return n.reduce((t,r)=>t.concat((e===void 0?td:e).map(i=>i+r)),[])}function ve(n,e){let t,r=id(n,e);return(i,a,o)=>{if(!o.isCancelled()){if(typeof HTMLElement!="undefined"&&i instanceof HTMLElement)if(typeof t=="undefined"&&(t=rd(i,r)),j(t))i.addEventListener(t,a),o.register(()=>{t!==void 0&&i.removeEventListener(t,a)});else{c.warn("utils",`element ${i.tagName} does not support any of these events: `+r.join(", "));return}r.forEach(s=>{let u=!1;typeof i.addEventListener=="function"?i.addEventListener(s,a):(u=!0,i["on"+s]=a),o.register(()=>{typeof i.removeEventListener=="function"&&i.removeEventListener(s,a),u&&delete i["on"+s]})})}}}var Ph=ve(["loadedmetadata"]),vh=ve(["timeupdate"]),Ch=ve(["addtrack"]),Ah=ve(["removetrack"]),Lt=ve(["sourceopen","webkitsourceopen"]),Sr=ve(["sourceclose","webkitsourceclose"]),Tr=ve(["sourceended","webkitsourceended"]),Mo=ve(["update"]),Oo=ve(["removesourcebuffer"]),kh=ve(["keymessage","message"]),xh=ve(["keyadded","ready"]),Mh=ve(["keyerror","error"]),Oh=ve(["keystatuseschange"]),wh=ve(["seeking"]),Dh=ve(["seeked"]),Bh=ve(["ended"]);var wo=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function Er(n){if(n>=wo.length)throw new Error("Unable to parse base64 string.");let e=wo[n];if(e===255)throw new Error("Unable to parse base64 string.");return e}function _r(n){let e=n.length%4,t=n;e!==0&&(c.warn("utils","base64ToBytes: base64 given miss padding",{padding:e}),t+=e===3?"=":e===2?"==":"===");let r=t.indexOf("=");if(r!==-1&&r<t.length-2)throw new Error("Unable to parse base64 string.");let i=t.endsWith("==")?2:t.endsWith("=")?1:0,a=t.length,o=new Uint8Array(a/4*3),s;for(let u=0,d=0;u<a;u+=4,d+=3)s=Er(t.charCodeAt(u))<<18|Er(t.charCodeAt(u+1))<<12|Er(t.charCodeAt(u+2))<<6|Er(t.charCodeAt(u+3)),o[d]=s>>16,o[d+1]=s>>8&255,o[d+2]=s&255;return o.subarray(0,o.length-i)}function Ct(...n){let e=n.length,t=-1,r=0,i;for(;++t<e;)i=n[t],r+=typeof i=="number"?i:i.length;let a=new Uint8Array(r),o=0;for(t=-1;++t<e;)i=n[t],typeof i=="number"?o+=i:i.length>0&&(a.set(i,o),o+=i.length);return a}function Do(n,e){return(n[e+0]<<8)+(n[e+1]<<0)}function Ii(n,e){return n[e+0]*65536+n[e+1]*256+n[e+2]}function ie(n,e){return n[e+0]*16777216+n[e+1]*65536+n[e+2]*256+n[e+3]}function gt(n,e){return(n[e+0]*16777216+n[e+1]*65536+n[e+2]*256+n[e+3])*4294967296+n[e+4]*16777216+n[e+5]*65536+n[e+6]*256+n[e+7]}function Bo(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer)}function Oe(n,e,t){if(typeof String.prototype.startsWith=="function")return n.startsWith(e,t);let r=typeof t=="number"?Math.max(t,0):0;return n.substring(r,r+e.length)===e}function Je(n,e){let t=n.length,r=0;for(;r+8<=t;){let i=ie(n,r);if(i===0)i=t-r;else if(i===1){if(r+16>t)return-1;i=gt(n,r+8)}if(isNaN(i)||i<=0)return-1;if(ie(n,r+4)===e)return r+i<=t?r:-1;r+=i}return-1}function Rr(n){let e=0,t=[],r=null;for(;e<=n.length;){if(e===n.length){r=null;break}r=n.subarray(e,1/0);let i=Je(r,1836019558);if(i<0)break;let a=ie(n,i+e),o=e+i+a;if(o>n.length)break;let s=Je(r,1835295092);if(s<0)break;let u=ie(n,s+e),d=e+s+u;if(d>n.length)break;let f=Math.max(o,d),l=n.subarray(e,f);t.push(l),e=f}return t.length===0?[null,r]:[t,r]}function ad(n,e,t){return new Uint8Array(Array.prototype.slice.call(n,e,t))}function od(n,e,t){return n.slice(e,t)}var bi=typeof Uint8Array.prototype.slice=="function"?od:ad;function yi(n,e){let t=n;for(let r of e){let i=he(t,r);if(i===null)return null;t=i}return t}function he(n,e){let t=Ft(n,e);return t!==null?n.subarray(t[1],t[2]):null}function No(n,e){let t=[],r=n;for(;;){let i=Ft(r,e);if(i===null)return t;ce(i[2]!==0&&r.length!==0),t.push(r.subarray(i[1],i[2])),r=r.subarray(i[2])}}function Ft(n,e){let t=n.length,r=0,i,a=0,o;for(;r+8<=t;){if(o=r,a=ie(n,o),o+=4,i=ie(n,o),o+=4,a===0)a=t-r;else if(a===1){if(o+8>t)return null;a=gt(n,o),o+=8}if(a<0)throw new Error("ISOBMFF: Size out of range");if(i===e)return e===1970628964&&(o+=16),[r,o,r+a];r+=a}return null}function Pr(n){let e=0,t=he(n,1836019574);if(t===null)return[];let r=[];for(;e<t.length;){let i;try{i=Ft(t,1886614376)}catch(s){let u=s instanceof Error?s:"";return c.warn("isobmff","Error while removing PSSH from ISOBMFF",u),r}if(i===null)return r;let a=bi(t,i[0],i[2]),o=Uo(a,i[1]-i[0]);o!==void 0&&r.push({systemId:o,data:a}),t[i[0]+4]=102,t[i[0]+5]=114,t[i[0]+6]=101,t[i[0]+7]=101,e=i[2]}return r}function Uo(n,e){if(n[e]>1){c.warn("isobmff","un-handled PSSH version");return}let t=e+4;if(t+16>n.length)return;let r=bi(n,t,t+16);return yr(r)}function Si(n){let e=he(n,1836019558);return e===null?null:he(e,1953653094)}function Lo(n){return No(n,1836019558).reduce((t,r)=>{let i=he(r,1953653094);return i!==null&&t.push(i),t},[])}function Ti(n){return he(n,1835295092)}function Ei(n){let e=he(n,1836019574);if(e===null)return null;let t=he(e,1953653099);return t===null?null:he(t,1835297121)}function Fo(n,e=0){return he(n.subarray(e),1701671783)}function mn(n,e){let t=Ft(n,1936286840);if(t===null)return null;let r=e,i=t[2]-t[0],a=t[1],o=n[a];a+=8;let s=ie(n,a);a+=4;let u;if(o===0)u=ie(n,a),a+=4,r+=ie(n,a)+i,a+=4;else if(o===1)u=gt(n,a),a+=8,r+=gt(n,a)+i,a+=8;else return null;let d=[];a+=2;let f=Do(n,a);for(a+=2;--f>=0;){let l=ie(n,a);a+=4;let m=(l&2147483648)>>>31,g=l&2147483647;if(m===1)throw new Error("sidx with reference_type `1` not yet implemented");let p=ie(n,a);a+=4,a+=4,d.push({time:u,duration:p,timescale:s,range:[r,r+g-1]}),u+=p,r+=g}return d}function _i(n){let e=Si(n);if(e===null)return;let t=he(e,1952867444);if(t===null)return;let r=t[0];if(r===1)return gt(t,4);if(r===0)return ie(t,4)}function sd(n){let e=he(n,1952868452);if(e===null)return;let t=1,r=Ii(e,t);t+=3;let i=(r&1)>0,a=(r&2)>0;return(r&8)>0?(t+=4,i&&(t+=8),a&&(t+=4),ie(e,t)):void 0}function Ri(n){let e=Lo(n);if(e.length===0)return;let t=0;for(let r of e){let i=he(r,1953658222);if(i===null)return;let a=0,o=i[a];if(a+=1,o>1)return;let s=Ii(i,a);a+=3;let u=(s&256)>0,d=0;if(!u&&(d=sd(r),d===void 0))return;let f=(s&1)>0,l=(s&4)>0,m=(s&512)>0,g=(s&1024)>0,p=(s&2048)>0,b=ie(i,a);a+=4,f&&(a+=4),l&&(a+=4);let h=b,S=0;for(;h-- >0;)u?(S+=ie(i,a),a+=4):S+=d,m&&(a+=4),g&&(a+=4),p&&(a+=4);t+=S}return t}function cn(n){let e=Ei(n);if(e===null)return;let t=he(e,1835296868);if(t===null)return;let r=0,i=t[r];if(r+=4,i===1)return ie(t,r+16);if(i===0)return ie(t,r+8)}function zo(n){let e=[],t=0;for(;t<n.length;){let r=Fo(n,t);if(r===null)break;let i=r.length;t+=i;let a=r[0];if(a!==0)c.warn("isobmff","EMSG version "+a.toString()+" not supported.");else{let o=4,{end:s,string:u}=mi(r,o);o=s;let{end:d,string:f}=mi(r,o);o=d;let l=ie(r,o);o+=4;let m=ie(r,o);o+=4;let g=ie(r,o);o+=4;let p=ie(r,o);o+=4;let b=r.subarray(o,i),h={schemeIdUri:u,value:f,timescale:l,presentationTimeDelta:m,eventDuration:g,id:p,messageData:b};e.push(h)}}if(e.length!==0)return e}function Wo(n){let e=yi(n,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(e===null)return null;let t=e.subarray(8),r=he(t,1701733238),i=0;if(r===null?(i=28,r=he(t,1701733217)):i=78,r===null)return null;let a=yi(r.subarray(i),[1936289382,1935894633,1952804451]);if(a===null||a.byteLength<24)return null;let o=a.subarray(8,24);return o.every(s=>s===0)?null:o}function Ie(n,e,t){if(typeof Array.prototype.includes=="function")return n.includes(e,t);let r=n.length>>>0;if(r===0)return!1;let i=t|0,a=i>=0?Math.min(i,r-1):Math.max(r+i,0),o=(s,u)=>s===u||typeof s=="number"&&typeof u=="number"&&isNaN(s)&&isNaN(u);for(;a<r;){if(o(n[a],e))return!0;a++}return!1}function ud(n,e){let{mimeType:t,codecs:r}=qo(n),{mimeType:i,codecs:a}=qo(e);if(t!==i||r===""||a==="")return!1;let o=r.split(".")[0];o=o==="hev1"?"hvc1":o;let s=a.split(".")[0];return s=s==="hev1"?"hvc1":s,o===s}var dd=7;function qo(n){var i;let[e,...t]=n.split(";"),r=(i=K(t,a=>Oe(a,"codecs=")))!=null?i:"";return r=r.substring(dd),r[0]==='"'&&(r=r.substring(1,r.length-1)),{mimeType:e,codecs:r}}var Vo=ud;function Pi(n,e){return typeof Array.prototype.flatMap=="function"?n.flatMap(e):n.reduce((t,r)=>{let i=e(r);return Array.isArray(i)?(t.push(...i),t):(t.push(i),t)},[])}function vi(n){let e=(Math.random()*2-1)*.3;return n*(e+1)}function Go(n){var t,r,i,a,o;let e=[];for(let s of n.periods){let u=[...(t=s.adaptations.video)!=null?t:[],...(r=s.adaptations.audio)!=null?r:[]];for(let d of u)if(d.supportStatus.hasCodecWithUndefinedSupport)for(let f of d.representations)f.isSupported===void 0&&e.push({mimeType:(i=f.mimeType)!=null?i:"",codec:(o=(a=f.codecs)==null?void 0:a[0])!=null?o:""})}return e}var Ho=[];function rt(n){Ie(Ho,n)||(console.warn(n),Ho.push(n))}var pn=class{constructor(e){this.supportMap=new Map,this.addCodecs(e)}addCodecs(e){for(let t of e){let r=this.supportMap.get(t.mimeType);r===void 0&&(r=new Map,this.supportMap.set(t.mimeType,r)),r.set(t.codec,{supported:t.supported,supportedIfEncrypted:t.supportedIfEncrypted})}}isSupported(e,t,r){let i=this.supportMap.get(e);if(i===void 0)return;let a=i.get(t);if(a!==void 0)return r?a.supportedIfEncrypted:a.supported}};var ht=class{constructor(e,t,r){if(this.id=e.id,this.adaptations=ld(e.adaptations,t,r),Ko(this.adaptations.video)&&Ko(this.adaptations.audio))throw new Z("MANIFEST_PARSE_ERROR","The manifest has no video nor audio tracks.");this.thumbnailTracks=e.thumbnailTracks.map(i=>({id:i.id,mimeType:i.mimeType,index:i.index,cdnMetadata:i.cdnMetadata,height:i.height,width:i.width,horizontalTiles:i.horizontalTiles,verticalTiles:i.verticalTiles,start:i.start,end:i.end,tileDuration:i.tileDuration})),this.duration=e.duration,this.start=e.start,!v(this.duration)&&!v(this.start)&&(this.end=this.start+this.duration),this.streamEvents=e.streamEvents===void 0?[]:e.streamEvents}refreshCodecSupport(e,t){Object.keys(this.adaptations).forEach(r=>{let i=this.adaptations[r];if(i!==void 0)for(let a of i){if(!a.supportStatus.hasCodecWithUndefinedSupport)continue;let o=a.supportStatus.hasSupportedCodec;a.refreshCodecSupport(t),o!==!1&&a.supportStatus.hasSupportedCodec===!1&&e.push(a)}},{})}getAdaptations(){return fi(this)}getAdaptationsForType(e){let t=this.adaptations[e];return t!=null?t:[]}getAdaptation(e){return K(this.getAdaptations(),({id:t})=>e===t)}getSupportedAdaptations(e){return To(this,e)}containsTime(e,t){return li(this,e,t)}getMetadataSnapshot(){let e={},t=this.getAdaptations();for(let r of t){let i=e[r.type];i===void 0&&(i=[],e[r.type]=i),i.push(r.getMetadataSnapshot())}return{start:this.start,end:this.end,id:this.id,streamEvents:this.streamEvents,adaptations:e,thumbnailTracks:this.thumbnailTracks.map(r=>({id:r.id,mimeType:r.mimeType,height:r.height,width:r.width,horizontalTiles:r.horizontalTiles,verticalTiles:r.verticalTiles,start:r.start,end:r.end,tileDuration:r.tileDuration}))}}};function Ko(n){return Array.isArray(n)?n.length===0:!0}function ld(n,e,t){let r={};for(let[i,a]of Object.entries(n))v(a)||(r[i]=a.map(o=>new mt(o,e,{representationFilter:t})).filter(o=>o.representations.length>0));return r}function gn(n,e,t){let r={updatedAdaptations:[],removedAdaptations:[],addedAdaptations:[],updatedThumbnailTracks:[],removedThumbnailTracks:[],addedThumbnailTracks:[]};n.start=e.start,n.end=e.end,n.duration=e.duration,n.streamEvents=e.streamEvents;let i=n.thumbnailTracks,a=e.thumbnailTracks;for(let u=0;u<i.length;u++){let d=i[u