@mux/mux-video 0.13.2 → 0.14.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/README.md +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +2 -2
- package/dist/mux-video.js +16 -16
- package/dist/mux-video.js.map +3 -3
- package/dist/mux-video.mjs +16 -16
- package/dist/mux-video.mjs.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +11 -8
- package/dist/types-ts3.4/index.d.ts +10 -8
- package/package.json +3 -3
package/dist/mux-video.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
"use strict";(()=>{var Ks=Object.create;var $n=Object.defineProperty;var Hs=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var Vs=Object.getPrototypeOf,Ys=Object.prototype.hasOwnProperty;var Ws=(x,w,A)=>w in x?$n(x,w,{enumerable:!0,configurable:!0,writable:!0,value:A}):x[w]=A;var Ga=(x,w)=>()=>(w||x((w={exports:{}}).exports,w),w.exports);var Xs=(x,w,A,le)=>{if(w&&typeof w=="object"||typeof w=="function")for(let oe of qs(w))!Ys.call(x,oe)&&oe!==A&&$n(x,oe,{get:()=>w[oe],enumerable:!(le=Hs(w,oe))||le.enumerable});return x};var Ka=(x,w,A)=>(A=x!=null?Ks(Vs(x)):{},Xs(w||!x||!x.__esModule?$n(A,"default",{value:x,enumerable:!0}):A,x));var Ki=(x,w,A)=>(Ws(x,typeof w!="symbol"?w+"":w,A),A),Zn=(x,w,A)=>{if(!w.has(x))throw TypeError("Cannot "+A)};var Ye=(x,w,A)=>(Zn(x,w,"read from private field"),A?A.call(x):w.get(x)),bt=(x,w,A)=>{if(w.has(x))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(x):w.set(x,A)},Nt=(x,w,A,le)=>(Zn(x,w,"write to private field"),le?le.call(x,A):w.set(x,A),A);var zt=(x,w,A)=>(Zn(x,w,"access private method"),A);var Va=Ga((En,ia)=>{(function(){var x,w;x=this,w=function(){return function(){var A={80:function(X,B,j){X.exports=j(728).default},728:function(X,B,j){"use strict";j.d(B,{default:function(){return Un}});var re=j(48),R=j.n(re),g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(p){var h=16*Math.random()|0;return(p==="x"?h:3&h|8).toString(16)})},k=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},L=function(p){return p&&p.nodeName!==void 0?(p.muxId||(p.muxId=p.id||k()),p.muxId):p},me=function(p){var h;p&&p.nodeName!==void 0?p=L(h=p):h=document.querySelector(p);var f=h&&h.nodeName?h.nodeName.toLowerCase():"";return[h,p,f]},ne=j(640),ce=j.n(ne),we=ce().methodFactory;ce().methodFactory=function(p,h,f){var y=we(p,h,f);return function(){for(var b=["[mux]"],M=0;M<arguments.length;M++)b.push(arguments[M]);y.apply(void 0,b)}},ce().setLevel(ce().getLevel());var q=ce();function ye(){return(R().doNotTrack||R().navigator&&R().navigator.doNotTrack)==="1"}var J={now:function(){var p=R().performance,h=p&&p.timing,f=h&&h.navigationStart,y=typeof f=="number"&&typeof p.now=="function"?f+p.now():Date.now();return Math.round(y)}},se=j(678),K=j.n(se),Ee=function(p){return ke(p)[0]},ke=function(p){if(typeof p!="string"||p==="")return["localhost"];var h,f=(p.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return f&&(h=(f.match(/[^\.]+\.[^\.]+$/)||[])[0]),[f,h]},Ne={exists:function(){var p=R().performance;return(p&&p.timing)!==void 0},domContentLoadedEventEnd:function(){var p=R().performance,h=p&&p.timing;return h&&h.domContentLoadedEventEnd},navigationStart:function(){var p=R().performance,h=p&&p.timing;return h&&h.navigationStart}};function V(p,h,f){f=f===void 0?1:f,p[h]=p[h]||0,p[h]+=f}var E=["x-cdn","content-type","x-request-id"];function U(p){var h={};return(p=p||"").trim().split(/[\r\n]+/).forEach(function(f){if(f){var y=f.split(": "),b=y.shift();b&&(E.indexOf(b.toLowerCase())>=0||b.toLowerCase().indexOf("x-litix-")===0)&&(h[b]=y.join(": "))}}),h}var D=function(p){var h={};for(var f in p){var y=p[f];y["DATA-ID"].search("io.litix.data.")!==-1&&(h[y["DATA-ID"].replace("io.litix.data.","")]=y.VALUE)}return h};function de(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function Se(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?de(Object(f),!0).forEach(function(y){z(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):de(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function z(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var $=function(p){if(!p)return{};var h=Ne.navigationStart(),f=p.loading,y=f?f.start:p.trequest,b=f?f.first:p.tfirst,M=f?f.end:p.tload;return{bytesLoaded:p.total,requestStart:Math.round(h+y),responseStart:Math.round(h+b),responseEnd:Math.round(h+M)}},Le=function(p){if(p&&typeof p.getAllResponseHeaders=="function")return U(p.getAllResponseHeaders())};function Oe(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function xe(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?Oe(Object(f),!0).forEach(function(y){be(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):Oe(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function be(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var qe=function(p,h){if(!p||typeof p.getRequests!="function")return{};var f=p.getRequests({state:"executed"});if(f.length===0)return{};var y,b=f[f.length-1],M=Ee(b.url),I=b.url,Y=b.bytesLoaded,he=new Date(b.requestStartDate).getTime(),ee=new Date(b.firstByteDate).getTime(),Me=new Date(b.requestEndDate).getTime(),ut=isNaN(b.duration)?0:b.duration,Ze=typeof h.getMetricsFor=="function"?h.getMetricsFor(b.mediaType).HttpList:h.getDashMetrics().getHttpRequests(b.mediaType);return Ze.length>0&&(y=U(Ze[Ze.length-1]._responseHeaders||"")),{requestStart:he,requestResponseStart:ee,requestResponseEnd:Me,requestBytesLoaded:Y,requestResponseHeaders:y,requestMediaDuration:ut,requestHostname:M,requestUrl:I}},at=function(p,h){var f=h.getQualityFor(p),y=h.getCurrentTrackFor(p).bitrateList;return y?{currentLevel:f,renditionWidth:y[f].width||null,renditionHeight:y[f].height||null,renditionBitrate:y[f].bandwidth}:{}},ie=function(p){var h;return(h=p.match(/.*codecs\*?="(.*)"/))===null||h===void 0?void 0:h[1]};function pe(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var ae=0,Ue=function(){function p(){(function(b,M){if(!(b instanceof M))throw new TypeError("Cannot call a class as a function")})(this,p)}var h,f,y;return h=p,f=[{key:"on",value:function(b,M,I){return M._eventEmitterGuid=M._eventEmitterGuid||++ae,this._listeners=this._listeners||{},this._listeners[b]=this._listeners[b]||[],I&&(M=M.bind(I)),this._listeners[b].push(M),M}},{key:"off",value:function(b,M){var I=this._listeners&&this._listeners[b];I&&I.forEach(function(Y,he){Y._eventEmitterGuid===M._eventEmitterGuid&&I.splice(he,1)})}},{key:"one",value:function(b,M,I){var Y=this;M._eventEmitterGuid=M._eventEmitterGuid||++ae;var he=function ee(){Y.off(b,ee),M.apply(I||this,arguments)};he._eventEmitterGuid=M._eventEmitterGuid,this.on(b,he)}},{key:"emit",value:function(b,M){var I=this;if(this._listeners){M=M||{};var Y=this._listeners["before*"]||[],he=this._listeners[b]||[],ee=this._listeners["after"+b]||[],Me=function(ut,Ze){(ut=ut.slice()).forEach(function(st){st.call(I,{type:b},Ze)})};Me(Y,M),Me(he,M),Me(ee,M)}}}],f&&pe(h.prototype,f),y&&pe(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}(),H=Ue;function ve(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Ie=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,b.on("playing",function(){M._playheadShouldBeProgressing=!0}),b.on("play",this._startPlaybackHeartbeatInterval.bind(this)),b.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),b.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),b.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),b.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("seeked",function(){b.data.player_is_paused?M._stopPlaybackHeartbeatInterval():M._startPlaybackHeartbeatInterval()}),b.on("timeupdate",function(){M._playbackHeartbeatInterval!==null&&b.emit("playbackheartbeat")}),b.on("devicesleep",function(I,Y){M._playbackHeartbeatInterval!==null&&(R().clearInterval(M._playbackHeartbeatInterval),b.emit("playbackheartbeatend",{viewer_time:Y.viewer_time}),M._playbackHeartbeatInterval=null)})}var h,f,y;return h=p,(f=[{key:"_startPlaybackHeartbeatInterval",value:function(){var b=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=R().setInterval(function(){b.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(R().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&ve(h.prototype,f),y&&ve(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Fe(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function fe(p,h,f){return h&&Fe(p.prototype,h),f&&Fe(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var Ce=fe(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),h.on("viewinit",function(){f.viewErrored=!1}),h.on("error",function(y,b){try{var M=h.errorTranslator({player_error_code:b.player_error_code,player_error_message:b.player_error_message,player_error_context:b.player_error_context});M?(h.data.player_error_code=M.player_error_code||b.player_error_code,h.data.player_error_message=M.player_error_message||b.player_error_message,h.data.player_error_context=M.player_error_context||b.player_error_context,f.viewErrored=!0):(delete h.data.player_error_code,delete h.data.player_error_message,delete h.data.player_error_context)}catch(I){h.mux.log.warn("Exception in error translator callback.",I),f.viewErrored=!0}})});function Ve(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Xe=function(){function p(b){(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._watchTimeTrackerLastCheckedTime=null,b.on("playbackheartbeat",this._updateWatchTime.bind(this)),b.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var h,f,y;return h=p,(f=[{key:"_updateWatchTime",value:function(b,M){var I=M.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=I),V(this.pm.data,"view_watch_time",I-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=I}},{key:"_clearWatchTimeState",value:function(b,M){this._updateWatchTime(b,M),this._watchTimeTrackerLastCheckedTime=null}}])&&Ve(h.prototype,f),y&&Ve(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function it(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var lt=function(){function p(b){(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._playbackTimeTrackerLastPlayheadPosition=-1,b.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),b.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),b.on("seeking",this._clearPlaybackTimeState.bind(this))}var h,f,y;return h=p,(f=[{key:"_updatePlaybackTime",value:function(){var b=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&b>this._playbackTimeTrackerLastPlayheadPosition){var M=b-this._playbackTimeTrackerLastPlayheadPosition;M<=1e3&&V(this.pm.data,"view_content_playback_time",M)}this._playbackTimeTrackerLastPlayheadPosition=b}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&it(h.prototype,f),y&&it(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Ct(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Rt=function(){function p(b){(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b;var M=this._updatePlayheadTime.bind(this);b.on("playbackheartbeat",M),b.on("playbackheartbeatend",M),b.on("timeupdate",M),b.on("destroy",function(){b.off("timeupdate",M)})}var h,f,y;return h=p,(f=[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=this.pm.data.view_max_playhead_position===void 0?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(b,M){var I=this,Y=function(){I.pm.currentFragmentPDT&&I.pm.currentFragmentStart&&(I.pm.data.player_program_time=I.pm.currentFragmentPDT+I.pm.data.player_playhead_time-I.pm.currentFragmentStart)};if(M&&M.player_playhead_time)this.pm.data.player_playhead_time=M.player_playhead_time,Y(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var he=this.pm.getPlayheadTime();he!==void 0&&(this.pm.data.player_playhead_time=he,Y(),this._updateMaxPlayheadPosition())}}}])&&Ct(h.prototype,f),y&&Ct(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function St(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function wt(p,h,f){return h&&St(p.prototype,h),f&&St(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var gt=wt(function p(h){if(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")}(this,p),!h.disableRebufferTracking){var f,y=function(M,I){b(I),f=void 0},b=function(M){if(f){var I=M.viewer_time-f;V(h.data,"view_rebuffer_duration",I),f=M.viewer_time}h.data.view_watch_time>=0&&h.data.view_rebuffer_count>0&&(h.data.view_rebuffer_frequency=h.data.view_rebuffer_count/h.data.view_watch_time,h.data.view_rebuffer_percentage=h.data.view_rebuffer_duration/h.data.view_watch_time)};h.on("playbackheartbeat",function(M,I){return b(I)}),h.on("rebufferstart",function(M,I){f||(V(h.data,"view_rebuffer_count",1),f=I.viewer_time,h.one("rebufferend",y))}),h.on("viewinit",function(){f=void 0,h.off("rebufferend",y)})}});function dt(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var tt=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,b.disableRebufferTracking||b.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,b.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),b.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),b.on("seeking",function(){M._cleanupRebufferTracker(null,{viewer_time:J.now()})}))}var h,f,y;return h=p,f=[{key:"_checkIfRebuffering",value:function(b,M){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(b,M);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var I=M.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&I>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=M.viewer_time}else this._cleanupRebufferTracker(b,M,!0);else this._prepareRebufferTrackerState(M.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(b){this._lastCheckedTime=b,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=b}},{key:"_cleanupRebufferTracker",value:function(b,M){var I=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:M.viewer_time});else{if(this._lastCheckedTime===null)return;var Y=this.pm.data.player_playhead_time-this._lastPlayheadTime,he=M.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&Y>0&&he-Y>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+he-Y}))}I?this._prepareRebufferTrackerState(M.viewer_time):this._clearRebufferTrackerState()}}],f&&dt(h.prototype,f),y&&dt(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}(),It=tt;function Ut(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Wt=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,b.on("viewinit",function(){var I=b.data,Y=I.view_id;if(!I.view_program_changed){var he=function(ee,Me){var ut=Me.viewer_time;ee.type==="playing"&&b.data.view_time_to_first_frame===void 0?M.calculateTimeToFirstFrame(ut||J.now(),Y):ee.type!=="adplaying"||b.data.view_time_to_first_frame!==void 0&&!M._inPrerollPosition()||M.calculateTimeToFirstFrame(ut||J.now(),Y)};b.one("playing",he),b.one("adplaying",he),b.one("viewend",function(){b.off("playing",he),b.off("adplaying",he)})}})}var h,f,y;return h=p,(f=[{key:"_inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(b,M){M===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:b}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}])&&Ut(h.prototype,f),y&&Ut(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Bt(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function ar(p,h,f){return h&&Bt(p.prototype,h),f&&Bt(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var te=ar(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),h.on("viewinit",function(){f._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(y){h.on(y,function(){if(f._lastPlayheadPosition>=0&&h.data.player_playhead_time>=0&&f._lastPlayerWidth>=0&&f._lastSourceWidth>0&&f._lastPlayerHeight>=0&&f._lastSourceHeight>0){var b=h.data.player_playhead_time-f._lastPlayheadPosition;if(b<0)return void(f._lastPlayheadPosition=-1);var M=Math.min(f._lastPlayerWidth/f._lastSourceWidth,f._lastPlayerHeight/f._lastSourceHeight),I=Math.max(0,M-1),Y=Math.max(0,1-M);h.data.view_max_upscale_percentage=Math.max(h.data.view_max_upscale_percentage||0,I),h.data.view_max_downscale_percentage=Math.max(h.data.view_max_downscale_percentage||0,Y),V(h.data,"view_total_content_playback_time",b),V(h.data,"view_total_upscaling",I*b),V(h.data,"view_total_downscaling",Y*b)}f._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(y){h.on(y,function(){f._lastPlayheadPosition=h.data.player_playhead_time,f._lastPlayerWidth=h.data.player_width,f._lastPlayerHeight=h.data.player_height,f._lastSourceWidth=h.data.video_source_width,f._lastSourceHeight=h.data.video_source_height})})});function N(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function T(p,h,f){return h&&N(p.prototype,h),f&&N(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var O=T(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),this.isSeeking=!1,h.on("seeking",function(y,b){K()(h.data,b),f._lastSeekingTime=J.now(),f.isSeeking===!1&&(f.isSeeking=!0,h.send("seeking"))}),h.on("seeked",function(){f.isSeeking=!1;var y=f._lastSeekingTime||J.now(),b=J.now()-y;V(h.data,"view_seek_count",1),V(h.data,"view_seek_duration",b);var M=h.data.view_max_seek_time||0;h.data.view_max_seek_time=Math.max(M,b)}),h.on("viewend",function(){f.isSeeking=!1})});function C(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return G(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?G(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
"use strict";(()=>{var Ks=Object.create;var $n=Object.defineProperty;var Hs=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var Vs=Object.getPrototypeOf,Ys=Object.prototype.hasOwnProperty;var Ws=(x,w,A)=>w in x?$n(x,w,{enumerable:!0,configurable:!0,writable:!0,value:A}):x[w]=A;var Ga=(x,w)=>()=>(w||x((w={exports:{}}).exports,w),w.exports);var Xs=(x,w,A,le)=>{if(w&&typeof w=="object"||typeof w=="function")for(let ae of qs(w))!Ys.call(x,ae)&&ae!==A&&$n(x,ae,{get:()=>w[ae],enumerable:!(le=Hs(w,ae))||le.enumerable});return x};var Ka=(x,w,A)=>(A=x!=null?Ks(Vs(x)):{},Xs(w||!x||!x.__esModule?$n(A,"default",{value:x,enumerable:!0}):A,x));var Ki=(x,w,A)=>(Ws(x,typeof w!="symbol"?w+"":w,A),A),Zn=(x,w,A)=>{if(!w.has(x))throw TypeError("Cannot "+A)};var Ye=(x,w,A)=>(Zn(x,w,"read from private field"),A?A.call(x):w.get(x)),_t=(x,w,A)=>{if(w.has(x))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(x):w.set(x,A)},Nt=(x,w,A,le)=>(Zn(x,w,"write to private field"),le?le.call(x,A):w.set(x,A),A);var zt=(x,w,A)=>(Zn(x,w,"access private method"),A);var Va=Ga((En,ia)=>{(function(){var x,w;x=this,w=function(){return function(){var A={80:function(W,B,j){W.exports=j(728).default},728:function(W,B,j){"use strict";j.d(B,{default:function(){return Un}});var re=j(48),R=j.n(re),g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(p){var h=16*Math.random()|0;return(p==="x"?h:3&h|8).toString(16)})},k=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},L=function(p){return p&&p.nodeName!==void 0?(p.muxId||(p.muxId=p.id||k()),p.muxId):p},me=function(p){var h;p&&p.nodeName!==void 0?p=L(h=p):h=document.querySelector(p);var f=h&&h.nodeName?h.nodeName.toLowerCase():"";return[h,p,f]},ne=j(640),ce=j.n(ne),we=ce().methodFactory;ce().methodFactory=function(p,h,f){var y=we(p,h,f);return function(){for(var b=["[mux]"],M=0;M<arguments.length;M++)b.push(arguments[M]);y.apply(void 0,b)}},ce().setLevel(ce().getLevel());var q=ce();function ye(){return(R().doNotTrack||R().navigator&&R().navigator.doNotTrack)==="1"}var J={now:function(){var p=R().performance,h=p&&p.timing,f=h&&h.navigationStart,y=typeof f=="number"&&typeof p.now=="function"?f+p.now():Date.now();return Math.round(y)}},oe=j(678),K=j.n(oe),Ee=function(p){return ke(p)[0]},ke=function(p){if(typeof p!="string"||p==="")return["localhost"];var h,f=(p.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return f&&(h=(f.match(/[^\.]+\.[^\.]+$/)||[])[0]),[f,h]},Ne={exists:function(){var p=R().performance;return(p&&p.timing)!==void 0},domContentLoadedEventEnd:function(){var p=R().performance,h=p&&p.timing;return h&&h.domContentLoadedEventEnd},navigationStart:function(){var p=R().performance,h=p&&p.timing;return h&&h.navigationStart}};function V(p,h,f){f=f===void 0?1:f,p[h]=p[h]||0,p[h]+=f}var E=["x-cdn","content-type","x-request-id"];function U(p){var h={};return(p=p||"").trim().split(/[\r\n]+/).forEach(function(f){if(f){var y=f.split(": "),b=y.shift();b&&(E.indexOf(b.toLowerCase())>=0||b.toLowerCase().indexOf("x-litix-")===0)&&(h[b]=y.join(": "))}}),h}var D=function(p){var h={};for(var f in p){var y=p[f];y["DATA-ID"].search("io.litix.data.")!==-1&&(h[y["DATA-ID"].replace("io.litix.data.","")]=y.VALUE)}return h};function de(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function Se(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?de(Object(f),!0).forEach(function(y){z(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):de(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function z(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var $=function(p){if(!p)return{};var h=Ne.navigationStart(),f=p.loading,y=f?f.start:p.trequest,b=f?f.first:p.tfirst,M=f?f.end:p.tload;return{bytesLoaded:p.total,requestStart:Math.round(h+y),responseStart:Math.round(h+b),responseEnd:Math.round(h+M)}},Le=function(p){if(p&&typeof p.getAllResponseHeaders=="function")return U(p.getAllResponseHeaders())};function Oe(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function xe(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?Oe(Object(f),!0).forEach(function(y){be(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):Oe(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function be(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var qe=function(p,h){if(!p||typeof p.getRequests!="function")return{};var f=p.getRequests({state:"executed"});if(f.length===0)return{};var y,b=f[f.length-1],M=Ee(b.url),I=b.url,Y=b.bytesLoaded,he=new Date(b.requestStartDate).getTime(),ee=new Date(b.firstByteDate).getTime(),Me=new Date(b.requestEndDate).getTime(),ut=isNaN(b.duration)?0:b.duration,Ze=typeof h.getMetricsFor=="function"?h.getMetricsFor(b.mediaType).HttpList:h.getDashMetrics().getHttpRequests(b.mediaType);return Ze.length>0&&(y=U(Ze[Ze.length-1]._responseHeaders||"")),{requestStart:he,requestResponseStart:ee,requestResponseEnd:Me,requestBytesLoaded:Y,requestResponseHeaders:y,requestMediaDuration:ut,requestHostname:M,requestUrl:I}},at=function(p,h){var f=h.getQualityFor(p),y=h.getCurrentTrackFor(p).bitrateList;return y?{currentLevel:f,renditionWidth:y[f].width||null,renditionHeight:y[f].height||null,renditionBitrate:y[f].bandwidth}:{}},ie=function(p){var h;return(h=p.match(/.*codecs\*?="(.*)"/))===null||h===void 0?void 0:h[1]};function pe(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var se=0,Ue=function(){function p(){(function(b,M){if(!(b instanceof M))throw new TypeError("Cannot call a class as a function")})(this,p)}var h,f,y;return h=p,f=[{key:"on",value:function(b,M,I){return M._eventEmitterGuid=M._eventEmitterGuid||++se,this._listeners=this._listeners||{},this._listeners[b]=this._listeners[b]||[],I&&(M=M.bind(I)),this._listeners[b].push(M),M}},{key:"off",value:function(b,M){var I=this._listeners&&this._listeners[b];I&&I.forEach(function(Y,he){Y._eventEmitterGuid===M._eventEmitterGuid&&I.splice(he,1)})}},{key:"one",value:function(b,M,I){var Y=this;M._eventEmitterGuid=M._eventEmitterGuid||++se;var he=function ee(){Y.off(b,ee),M.apply(I||this,arguments)};he._eventEmitterGuid=M._eventEmitterGuid,this.on(b,he)}},{key:"emit",value:function(b,M){var I=this;if(this._listeners){M=M||{};var Y=this._listeners["before*"]||[],he=this._listeners[b]||[],ee=this._listeners["after"+b]||[],Me=function(ut,Ze){(ut=ut.slice()).forEach(function(st){st.call(I,{type:b},Ze)})};Me(Y,M),Me(he,M),Me(ee,M)}}}],f&&pe(h.prototype,f),y&&pe(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}(),H=Ue;function ve(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Ie=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,b.on("playing",function(){M._playheadShouldBeProgressing=!0}),b.on("play",this._startPlaybackHeartbeatInterval.bind(this)),b.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),b.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),b.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),b.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),b.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),b.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),b.on("seeked",function(){b.data.player_is_paused?M._stopPlaybackHeartbeatInterval():M._startPlaybackHeartbeatInterval()}),b.on("timeupdate",function(){M._playbackHeartbeatInterval!==null&&b.emit("playbackheartbeat")}),b.on("devicesleep",function(I,Y){M._playbackHeartbeatInterval!==null&&(R().clearInterval(M._playbackHeartbeatInterval),b.emit("playbackheartbeatend",{viewer_time:Y.viewer_time}),M._playbackHeartbeatInterval=null)})}var h,f,y;return h=p,(f=[{key:"_startPlaybackHeartbeatInterval",value:function(){var b=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=R().setInterval(function(){b.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(R().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&ve(h.prototype,f),y&&ve(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Fe(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function fe(p,h,f){return h&&Fe(p.prototype,h),f&&Fe(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var Ce=fe(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),h.on("viewinit",function(){f.viewErrored=!1}),h.on("error",function(y,b){try{var M=h.errorTranslator({player_error_code:b.player_error_code,player_error_message:b.player_error_message,player_error_context:b.player_error_context});M?(h.data.player_error_code=M.player_error_code||b.player_error_code,h.data.player_error_message=M.player_error_message||b.player_error_message,h.data.player_error_context=M.player_error_context||b.player_error_context,f.viewErrored=!0):(delete h.data.player_error_code,delete h.data.player_error_message,delete h.data.player_error_context)}catch(I){h.mux.log.warn("Exception in error translator callback.",I),f.viewErrored=!0}})});function Ve(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Xe=function(){function p(b){(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._watchTimeTrackerLastCheckedTime=null,b.on("playbackheartbeat",this._updateWatchTime.bind(this)),b.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var h,f,y;return h=p,(f=[{key:"_updateWatchTime",value:function(b,M){var I=M.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=I),V(this.pm.data,"view_watch_time",I-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=I}},{key:"_clearWatchTimeState",value:function(b,M){this._updateWatchTime(b,M),this._watchTimeTrackerLastCheckedTime=null}}])&&Ve(h.prototype,f),y&&Ve(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function it(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var lt=function(){function p(b){(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,this._playbackTimeTrackerLastPlayheadPosition=-1,b.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),b.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),b.on("seeking",this._clearPlaybackTimeState.bind(this))}var h,f,y;return h=p,(f=[{key:"_updatePlaybackTime",value:function(){var b=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&b>this._playbackTimeTrackerLastPlayheadPosition){var M=b-this._playbackTimeTrackerLastPlayheadPosition;M<=1e3&&V(this.pm.data,"view_content_playback_time",M)}this._playbackTimeTrackerLastPlayheadPosition=b}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&it(h.prototype,f),y&&it(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Ct(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Rt=function(){function p(b){(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b;var M=this._updatePlayheadTime.bind(this);b.on("playbackheartbeat",M),b.on("playbackheartbeatend",M),b.on("timeupdate",M),b.on("destroy",function(){b.off("timeupdate",M)})}var h,f,y;return h=p,(f=[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=this.pm.data.view_max_playhead_position===void 0?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(b,M){var I=this,Y=function(){I.pm.currentFragmentPDT&&I.pm.currentFragmentStart&&(I.pm.data.player_program_time=I.pm.currentFragmentPDT+I.pm.data.player_playhead_time-I.pm.currentFragmentStart)};if(M&&M.player_playhead_time)this.pm.data.player_playhead_time=M.player_playhead_time,Y(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var he=this.pm.getPlayheadTime();he!==void 0&&(this.pm.data.player_playhead_time=he,Y(),this._updateMaxPlayheadPosition())}}}])&&Ct(h.prototype,f),y&&Ct(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function St(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function wt(p,h,f){return h&&St(p.prototype,h),f&&St(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var gt=wt(function p(h){if(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")}(this,p),!h.disableRebufferTracking){var f,y=function(M,I){b(I),f=void 0},b=function(M){if(f){var I=M.viewer_time-f;V(h.data,"view_rebuffer_duration",I),f=M.viewer_time}h.data.view_watch_time>=0&&h.data.view_rebuffer_count>0&&(h.data.view_rebuffer_frequency=h.data.view_rebuffer_count/h.data.view_watch_time,h.data.view_rebuffer_percentage=h.data.view_rebuffer_duration/h.data.view_watch_time)};h.on("playbackheartbeat",function(M,I){return b(I)}),h.on("rebufferstart",function(M,I){f||(V(h.data,"view_rebuffer_count",1),f=I.viewer_time,h.one("rebufferend",y))}),h.on("viewinit",function(){f=void 0,h.off("rebufferend",y)})}});function dt(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var tt=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,b.disableRebufferTracking||b.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,b.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),b.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),b.on("seeking",function(){M._cleanupRebufferTracker(null,{viewer_time:J.now()})}))}var h,f,y;return h=p,f=[{key:"_checkIfRebuffering",value:function(b,M){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(b,M);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var I=M.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&I>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=M.viewer_time}else this._cleanupRebufferTracker(b,M,!0);else this._prepareRebufferTrackerState(M.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(b){this._lastCheckedTime=b,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=b}},{key:"_cleanupRebufferTracker",value:function(b,M){var I=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:M.viewer_time});else{if(this._lastCheckedTime===null)return;var Y=this.pm.data.player_playhead_time-this._lastPlayheadTime,he=M.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&Y>0&&he-Y>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+he-Y}))}I?this._prepareRebufferTrackerState(M.viewer_time):this._clearRebufferTrackerState()}}],f&&dt(h.prototype,f),y&&dt(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}(),It=tt;function Ut(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Wt=function(){function p(b){var M=this;(function(I,Y){if(!(I instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,b.on("viewinit",function(){var I=b.data,Y=I.view_id;if(!I.view_program_changed){var he=function(ee,Me){var ut=Me.viewer_time;ee.type==="playing"&&b.data.view_time_to_first_frame===void 0?M.calculateTimeToFirstFrame(ut||J.now(),Y):ee.type!=="adplaying"||b.data.view_time_to_first_frame!==void 0&&!M._inPrerollPosition()||M.calculateTimeToFirstFrame(ut||J.now(),Y)};b.one("playing",he),b.one("adplaying",he),b.one("viewend",function(){b.off("playing",he),b.off("adplaying",he)})}})}var h,f,y;return h=p,(f=[{key:"_inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(b,M){M===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:b}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}])&&Ut(h.prototype,f),y&&Ut(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Bt(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function ar(p,h,f){return h&&Bt(p.prototype,h),f&&Bt(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var te=ar(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),h.on("viewinit",function(){f._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(y){h.on(y,function(){if(f._lastPlayheadPosition>=0&&h.data.player_playhead_time>=0&&f._lastPlayerWidth>=0&&f._lastSourceWidth>0&&f._lastPlayerHeight>=0&&f._lastSourceHeight>0){var b=h.data.player_playhead_time-f._lastPlayheadPosition;if(b<0)return void(f._lastPlayheadPosition=-1);var M=Math.min(f._lastPlayerWidth/f._lastSourceWidth,f._lastPlayerHeight/f._lastSourceHeight),I=Math.max(0,M-1),Y=Math.max(0,1-M);h.data.view_max_upscale_percentage=Math.max(h.data.view_max_upscale_percentage||0,I),h.data.view_max_downscale_percentage=Math.max(h.data.view_max_downscale_percentage||0,Y),V(h.data,"view_total_content_playback_time",b),V(h.data,"view_total_upscaling",I*b),V(h.data,"view_total_downscaling",Y*b)}f._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(y){h.on(y,function(){f._lastPlayheadPosition=h.data.player_playhead_time,f._lastPlayerWidth=h.data.player_width,f._lastPlayerHeight=h.data.player_height,f._lastSourceWidth=h.data.video_source_width,f._lastSourceHeight=h.data.video_source_height})})});function N(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function T(p,h,f){return h&&N(p.prototype,h),f&&N(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var O=T(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),this.isSeeking=!1,h.on("seeking",function(y,b){K()(h.data,b),f._lastSeekingTime=J.now(),f.isSeeking===!1&&(f.isSeeking=!0,h.send("seeking"))}),h.on("seeked",function(){f.isSeeking=!1;var y=f._lastSeekingTime||J.now(),b=J.now()-y;V(h.data,"view_seek_count",1),V(h.data,"view_seek_duration",b);var M=h.data.view_max_seek_time||0;h.data.view_max_seek_time=Math.max(M,b)}),h.on("viewend",function(){f.isSeeking=!1})});function C(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return G(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?G(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function G(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}function Q(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}var Z=function(p,h){p.push(h),p.sort(function(f,y){return f.viewer_time-y.viewer_time})},Te=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Re=function(){function p(b){var M=this;(function(Y,he){if(!(Y instanceof he))throw new TypeError("Cannot call a class as a function")})(this,p),this.pm=b,b.on("viewinit",function(){M.isAdBreak=!1,M._currentAdRequestNumber=0,M._currentAdResponseNumber=0,M._adRequests=[],M._adResponses=[],M._adHasPlayed=!1,M._wouldBeNewAdPlay=!0,M._prerollPlayTime=void 0}),Te.forEach(function(Y){return b.on(Y,M._updateAdData.bind(M))});var I=function(){M.isAdBreak=!1};b.on("adbreakstart",function(){M.isAdBreak=!0}),b.on("play",I),b.on("playing",I),b.on("viewend",I),b.on("adrequest",function(Y,he){he=K()({ad_request_id:"generatedAdRequestId"+M._currentAdRequestNumber++},he),Z(M._adRequests,he),V(b.data,"view_ad_request_count"),M.inPrerollPosition()&&(b.data.view_preroll_requested=!0,M._adHasPlayed||V(b.data,"view_preroll_request_count"))}),b.on("adresponse",function(Y,he){he=K()({ad_request_id:"generatedAdRequestId"+M._currentAdResponseNumber++},he),Z(M._adResponses,he);var ee=M.findAdRequest(he.ad_request_id);ee&&V(b.data,"view_ad_request_time",Math.max(0,he.viewer_time-ee.viewer_time))}),b.on("adplay",function(Y,he){M._adHasPlayed=!0,M._wouldBeNewAdPlay&&(M._wouldBeNewAdPlay=!1,V(b.data,"view_ad_played_count")),M.inPrerollPosition()&&!b.data.view_preroll_played&&(b.data.view_preroll_played=!0,M._adRequests.length>0&&(b.data.view_preroll_request_time=Math.max(0,he.viewer_time-M._adRequests[0].viewer_time)),b.data.view_start&&(b.data.view_startup_preroll_request_time=Math.max(0,he.viewer_time-b.data.view_start)),M._prerollPlayTime=he.viewer_time)}),b.on("adplaying",function(Y,he){M.inPrerollPosition()&&b.data.view_preroll_load_time===void 0&&M._prerollPlayTime!==void 0&&(b.data.view_preroll_load_time=he.viewer_time-M._prerollPlayTime,b.data.view_startup_preroll_load_time=he.viewer_time-M._prerollPlayTime)}),b.on("adended",function(){M._wouldBeNewAdPlay=!0}),b.on("aderror",function(){M._wouldBeNewAdPlay=!0})}var h,f,y;return h=p,(f=[{key:"inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(b){for(var M=0;M<this._adRequests.length;M++)if(this._adRequests[M].ad_request_id===b)return this._adRequests[M]}},{key:"_updateAdData",value:function(b,M){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&M.ad_tag_url){var I=C(ke(M.ad_tag_url),2),Y=I[0],he=I[1];this.pm.data.view_preroll_ad_tag_domain=he,this.pm.data.view_preroll_ad_tag_hostname=Y}if(!this.pm.data.view_preroll_ad_asset_hostname&&M.ad_asset_url){var ee=C(ke(M.ad_asset_url),2),Me=ee[0],ut=ee[1];this.pm.data.view_preroll_ad_asset_domain=ut,this.pm.data.view_preroll_ad_asset_hostname=Me}}}}])&&Q(h.prototype,f),y&&Q(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Pe(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function Be(p,h,f){return h&&Pe(p.prototype,h),f&&Pe(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var We=Be(function p(h){var f,y;(function(Y,he){if(!(Y instanceof he))throw new TypeError("Cannot call a class as a function")})(this,p);var b=function(){h.disableRebufferTracking||f&&(V(h.data,"view_waiting_rebuffer_duration",J.now()-f),f=!1,R().clearInterval(y))},M=!1,I=function(){M=!1,b()};h.on("waiting",function(){M&&(h.disableRebufferTracking||(V(h.data,"view_waiting_rebuffer_count",1),f=J.now(),y=R().setInterval(function(){if(f){var Y=J.now();V(h.data,"view_waiting_rebuffer_duration",Y-f),f=Y}},250)))}),h.on("playing",function(){b(),M=!0}),h.on("pause",I),h.on("seeking",I)});function Ge(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function $e(p,h,f){return h&&Ge(p.prototype,h),f&&Ge(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var ht=$e(function p(h){var f=this;(function(M,I){if(!(M instanceof I))throw new TypeError("Cannot call a class as a function")})(this,p);var y=function(){f.lastWallClockTime=J.now(),h.on("before*",b)},b=function(M){var I=J.now(),Y=f.lastWallClockTime;f.lastWallClockTime=I,I-Y>3e4&&(h.emit("devicesleep",{viewer_time:Y}),K()(h.data,{viewer_time:Y}),h.send("devicesleep"),h.emit("devicewake",{viewer_time:I}),K()(h.data,{viewer_time:I}),h.send("devicewake"))};h.one("playbackheartbeat",y),h.on("playbackheartbeatend",function(){h.off("before*",b),h.one("playbackheartbeat",y)})}),Dt=j(375),ze=j(655),Pt=j.n(ze),tr="muxData",jt=function(){var p;try{p=Dt.parse(Pt().get(tr)||"")}catch{p={}}return p},Ft=function(p){try{Pt().set(tr,Dt.stringify(p),{expires:7300})}catch{}},Ht=function(){var p=jt();return p.mux_viewer_id=p.mux_viewer_id||g(),p.msn=p.msn||Math.random(),Ft(p),{mux_viewer_id:p.mux_viewer_id,mux_sample_number:p.msn}};function rt(p,h){var f=h.beaconCollectionDomain,y=h.beaconDomain;if(f)return"https://"+f;var b=y||"litix.io";return(p=p||"inferred").match(/^[a-z0-9]+$/)?"https://"+p+"."+b:"https://img.litix.io/a.gif"}var lr=function(){var p;switch(Ar()){case"cellular":p="cellular";break;case"ethernet":p="wired";break;case"wifi":p="wifi";break;case void 0:break;default:p="other"}return p},Ar=function(){var p=R().navigator,h=p&&(p.connection||p.mozConnection||p.webkitConnection);return h&&h.type};lr.getConnectionFromAPI=Ar;var Kt=lr,Jt=Cr({a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"}),pr=Cr({ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ep:"experiments",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function Cr(p){var h={};for(var f in p)p.hasOwnProperty(f)&&(h[p[f]]=f);return h}function vr(p){var h={},f={};return Object.keys(p).forEach(function(y){var b=!1;if(p.hasOwnProperty(y)&&p[y]!==void 0){var M=y.split("_"),I=M[0],Y=Jt[I];Y||(q.info("Data key word `"+M[0]+"` not expected in "+y),Y=I+"_"),M.splice(1).forEach(function(he){he==="url"&&(b=!0),pr[he]?Y+=pr[he]:Number(he)&&Math.floor(Number(he))===Number(he)?Y+=he:(q.info("Data key word `"+he+"` not expected in "+y),Y+="_"+he+"_")}),b?f[Y]=p[y]:h[Y]=p[y]}}),K()(h,f)}var Gt={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},Di=["hb","requestcompleted","requestfailed","requestcanceled"],nn="https://img.litix.io",kr=function(p){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=p||nn,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=K()({},Gt,h)};kr.prototype.queueEvent=function(p,h){var f=K()({},h);return(this._eventQueue.length<=this._options.maxQueueLength||p==="eventrateexceeded")&&(this._eventQueue.push(f),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},kr.prototype.flushEvents=function(){var p=arguments.length>0&&arguments[0]!==void 0&&arguments[0];p&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},kr.prototype.destroy=function(){var p=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,p?this._clearBeaconQueue():this.flushEvents(),R().clearTimeout(this._sendTimeout)},kr.prototype._clearBeaconQueue=function(){var p=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,h=this._eventQueue.slice(p);p>0&&K()(h[h.length-1],vr({mux_view_message:"event queue truncated"}));var f=this._createPayload(h);li(this._beaconUrl,f,!0,function(){})},kr.prototype._sendBeaconQueue=function(){var p=this;if(!this._postInFlight){var h=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var f=this._createPayload(h),y=J.now();li(this._beaconUrl,f,!1,function(b,M){M?(p._eventQueue=h.concat(p._eventQueue),p._failureCount+=1,q.info("Error sending beacon: "+M)):p._failureCount=0,p._roundTripTime=J.now()-y,p._postInFlight=!1})}},kr.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var p=Math.pow(2,this._failureCount-1);return(1+(p*=Math.random()))*this._options.baseTimeBetweenBeacons},kr.prototype._startBeaconSending=function(){var p=this;R().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=R().setTimeout(function(){p._eventQueue.length&&p._sendBeaconQueue(),p._startBeaconSending()},this._getNextBeaconTime()))},kr.prototype._createPayload=function(p){var h,f,y,b=this,M={transmission_timestamp:Math.round(J.now())};this._roundTripTime&&(M.rtt_ms=Math.round(this._roundTripTime));var I=function(){h=JSON.stringify({metadata:M,events:f||p}),y=h.length/1024},Y=function(){return y<=b._options.maxPayloadKBSize};return I(),Y()||(q.info("Payload size is too big ("+y+" kb). Removing unnecessary events."),f=p.filter(function(he){return Di.indexOf(he.e)===-1}),I()),Y()||(q.info("Payload size still too big ("+y+" kb). Cropping fields.."),f.forEach(function(he){for(var ee in he){var Me=he[ee];typeof Me=="string"&&Me.length>51200&&(he[ee]=Me.substring(0,51200))}}),I()),h};var li=function(p,h,f,y){if(f&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(p,h))y();else if(R().fetch)R().fetch(p,{method:"POST",body:h,headers:{"Content-Type":"text/plain"},keepalive:!0}).then(function(M){return y(null,M.ok?null:"Error")}).catch(function(M){return y(null,M)});else{if(R().XMLHttpRequest){var b=new(R()).XMLHttpRequest;return b.onreadystatechange=function(){if(b.readyState===4)return y(null,b.status!==200?"error":void 0)},b.open("POST",p),b.setRequestHeader("Content-Type","text/plain"),void b.send(h)}y()}},an=kr;function sn(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return ui(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?ui(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ui(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}function di(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function Kr(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?di(Object(f),!0).forEach(function(y){Hr(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):di(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function Zr(p){return Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},Zr(p)}function wn(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function on(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function Hr(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var br=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],At=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended"],ln=["viewstart","error","ended","viewend"],qr=function(){function p(b,M){var I,Y,he,ee,Me,ut,Ze,st,Qe,ot,Ot,qt,rr,ur,
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function hi(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}function fi(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function vi(p,h){return vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,y){return f.__proto__=y,f},vi(p,h)}function Li(p){var h=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var f,y=pi(p);if(h){var b=pi(this).constructor;f=Reflect.construct(y,arguments,b)}else f=y.apply(this,arguments);return un(this,f)}}function un(p,h){if(h&&(Ur(h)==="object"||typeof h=="function"))return h;if(h!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $t(p)}function $t(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function pi(p){return pi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(h){return h.__proto__||Object.getPrototypeOf(h)},pi(p)}var Dn=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],dn=function(p){(function(I,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(Y&&Y.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),Object.defineProperty(I,"prototype",{writable:!1}),Y&&vi(I,Y)})(M,p);var h,f,y,b=Li(M);function M(I,Y,he){var ee;(function(Qe,ot){if(!(Qe instanceof ot))throw new TypeError("Cannot call a class as a function")})(this,M),(ee=b.call(this)).DOM_CONTENT_LOADED_EVENT_END=Ne.domContentLoadedEventEnd(),ee.NAVIGATION_START=Ne.navigationStart(),ee.mux=I,ee.id=Y,(he=K()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(Qe){return Qe}},he)).data=he.data||{},he.data.property_key&&(he.data.env_key=he.data.property_key,delete he.data.property_key),q.setLevel(he.debug?"debug":"warn"),ee.getPlayheadTime=he.getPlayheadTime,ee.getStateData=he.getStateData||function(){return{}},ee.getAdData=he.getAdData||function(){},ee.minimumRebufferDuration=he.minimumRebufferDuration,ee.sustainedRebufferThreshold=he.sustainedRebufferThreshold,ee.playbackHeartbeatTime=he.playbackHeartbeatTime,ee.disableRebufferTracking=he.disableRebufferTracking,ee.disableRebufferTracking&&ee.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),ee.disablePlayheadRebufferTracking=he.disablePlayheadRebufferTracking,ee.errorTranslator=he.errorTranslator,ee.playbackEventDispatcher=new qr(I,he.data.env_key,he),ee.data={player_instance_id:g(),mux_sample_rate:he.sampleRate,beacon_domain:he.beaconCollectionDomain?he.beaconCollectionDomain:he.beaconDomain},ee.data.view_sequence_number=1,ee.data.player_sequence_number=1,ee.oldEmit=ee.emit,ee.emit=function(Qe,ot){ot=K()({viewer_time:this.mux.utils.now()},ot),this.oldEmit(Qe,ot)};var Me=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind($t(ee));ee.on("viewinit",function(Qe,ot){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),K()(this.data,ot),this._initializeViewData(),this.one("play",Me),this.one("adbreakstart",Me)});var ut=function(Qe){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",Qe)}.bind($t(ee));if(ee.on("videochange",function(Qe,ot){ut(ot)}),ee.on("programchange",function(Qe,ot){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),ut(K()(ot,{view_program_changed:!0})),Me(),this.emit("play"),this.emit("playing")}),ee.on("fragmentchange",function(Qe,ot){this.currentFragmentPDT=ot.currentFragmentPDT,this.currentFragmentStart=ot.currentFragmentStart}),ee.on("destroy",ee.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Ze=function(){var Qe=ee.data.view_start!==void 0;ee.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",Qe&&ee.mux.WINDOW_HIDDEN&&(ee.data.player_is_paused||ee.emit("hb"))};window.addEventListener("visibilitychange",Ze,!1);var st=function(Qe){Qe.persisted||ee.destroy()};window.addEventListener("pagehide",st,!1),ee.on("destroy",function(){window.removeEventListener("visibilitychange",Ze),window.removeEventListener("pagehide",st)})}return ee.on("playerready",function(Qe,ot){K()(this.data,ot)}),Dn.forEach(function(Qe){ee.on(Qe,function(ot,Ot){Qe.indexOf("ad")!==0&&this._updateStateData(),K()(this.data,Ot),this._sanitizeData()}),ee.on("after"+Qe,function(){(Qe!=="error"||this.errorTracker.viewErrored)&&this.send(Qe)})}),ee.on("viewend",function(Qe,ot){K()(ee.data,ot)}),ee.one("playerready",function(Qe){var ot=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=ot-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),ee.longResumeTracker=new Lr($t(ee)),ee.errorTracker=new Ce($t(ee)),new ht($t(ee)),ee.seekingTracker=new O($t(ee)),ee.playheadTime=new Rt($t(ee)),ee.playbackHeartbeat=new Ie($t(ee)),new te($t(ee)),ee.watchTimeTracker=new Xe($t(ee)),new lt($t(ee)),ee.adTracker=new Re($t(ee)),new It($t(ee)),new gt($t(ee)),new Wt($t(ee)),new We($t(ee)),new wr($t(ee)),he.hlsjs&&ee.addHLSJS(he),he.dashjs&&ee.addDashJS(he),ee.emit("viewinit",he.data),ee}return h=M,f=[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(I){var Y=K()({},this.data);if(Y.video_source_is_live===void 0&&(Y.player_source_duration===1/0||Y.video_source_duration===1/0?Y.video_source_is_live=!0:(Y.player_source_duration>0||Y.video_source_duration>0)&&(Y.video_source_is_live=!1)),Y.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(ut){Y[ut]=void 0}),Y.video_source_url=Y.video_source_url||Y.player_source_url,Y.video_source_url){var he=Yr(ke(Y.video_source_url),2),ee=he[0],Me=he[1];Y.video_source_domain=Me,Y.video_source_hostname=ee}delete Y.ad_request_id,this.playbackEventDispatcher.send(I,Y),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){K()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var I=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(Y){var he=parseInt(I.data[Y],10);I.data[Y]=isNaN(he)?void 0:he}),["player_source_url","video_source_url"].forEach(function(Y){if(I.data[Y]){var he=I.data[Y].toLowerCase();he.indexOf("data:")!==0&&he.indexOf("blob:")!==0||(I.data[Y]="MSE style URL")}})}},{key:"_resetVideoData",value:function(I,Y){var he=this;Object.keys(this.data).forEach(function(ee){ee.indexOf("video_")===0&&delete he.data[ee]})}},{key:"_resetViewData",value:function(){var I=this;Object.keys(this.data).forEach(function(Y){Y.indexOf("view_")===0&&delete I.data[Y]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(I,Y){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var I=this,Y=this.data.view_id=g(),he=function(){Y===I.data.view_id&&V(I.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",he):he()}},{key:"_restartHeartBeat",value:function(){var I=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){I.data.player_is_paused||I.emit("hb")},1e4))}},{key:"addHLSJS",value:function(I){I.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=I.hlsjs,function(Y,he,ee){var Me=arguments.length>4?arguments[4]:void 0,ut=Y.log,Ze=Y.utils.secondsToMs,st=function(Lt){var nt,vt=parseInt(Me.version);return vt===1&&Lt.programDateTime!==null&&(nt=Lt.programDateTime),vt===0&&Lt.pdt!==null&&(nt=Lt.pdt),nt};if(Ne.exists()){var Qe=function(Lt,nt){return Y.emit(he,Lt,nt)},ot=function(Lt,nt){var vt=nt.levels,et=nt.audioTracks,ft=nt.url,Vt=nt.stats,Xt=nt.networkDetails,dr=nt.sessionData,or={},mr={};vt.forEach(function(Er,zr){or[zr]={width:Er.width,height:Er.height,bitrate:Er.bitrate,attrs:Er.attrs}}),et.forEach(function(Er,zr){mr[zr]={name:Er.name,language:Er.lang,bitrate:Er.bitrate}});var cr=$(Vt),yr=cr.bytesLoaded,Qt=cr.requestStart,hr=cr.responseStart,ni=cr.responseEnd;Qe("requestcompleted",Se(Se({},D(dr)),{},{request_event_type:Lt,request_bytes_loaded:yr,request_start:Qt,request_response_start:hr,request_response_end:ni,request_type:"manifest",request_hostname:Ee(ft),request_response_headers:Le(Xt),request_rendition_lists:{media:or,audio:mr,video:{}}}))};ee.on(Me.Events.MANIFEST_LOADED,ot);var Ot=function(Lt,nt){var vt=nt.details,et=nt.level,ft=nt.networkDetails,Vt=nt.stats,Xt=$(Vt),dr=Xt.bytesLoaded,or=Xt.requestStart,mr=Xt.responseStart,cr=Xt.responseEnd,yr=vt.fragments[vt.fragments.length-1],Qt=st(yr)+Ze(yr.duration);Qe("requestcompleted",{request_event_type:Lt,request_bytes_loaded:dr,request_start:or,request_response_start:mr,request_response_end:cr,request_current_level:et,request_type:"manifest",request_hostname:Ee(vt.url),request_response_headers:Le(ft),video_holdback:vt.holdBack&&Ze(vt.holdBack),video_part_holdback:vt.partHoldBack&&Ze(vt.partHoldBack),video_part_target_duration:vt.partTarget&&Ze(vt.partTarget),video_target_duration:vt.targetduration&&Ze(vt.targetduration),video_source_is_live:vt.live,player_manifest_newest_program_time:isNaN(Qt)?void 0:Qt})};ee.on(Me.Events.LEVEL_LOADED,Ot);var qt=function(Lt,nt){var vt=nt.details,et=nt.networkDetails,ft=nt.stats,Vt=$(ft),Xt=Vt.bytesLoaded,dr=Vt.requestStart,or=Vt.responseStart,mr=Vt.responseEnd;Qe("requestcompleted",{request_event_type:Lt,request_bytes_loaded:Xt,request_start:dr,request_response_start:or,request_response_end:mr,request_type:"manifest",request_hostname:Ee(vt.url),request_response_headers:Le(et)})};ee.on(Me.Events.AUDIO_TRACK_LOADED,qt);var rr=function(Lt,nt){var vt=nt.stats,et=nt.networkDetails,ft=nt.frag;vt=vt||ft.stats;var Vt=$(vt),Xt=Vt.bytesLoaded,dr=Vt.requestStart,or=Vt.responseStart,mr=Vt.responseEnd,cr=Le(et),yr=cr==null?void 0:cr["x-request-id"],Qt={request_event_type:Lt,request_bytes_loaded:Xt,request_start:dr,request_response_start:or,request_response_end:mr,request_hostname:et?Ee(et.responseURL):void 0,request_id:yr,request_response_headers:cr,request_media_duration:ft.duration,request_url:et==null?void 0:et.responseURL};ft.type==="main"?(Qt.request_type="media",Qt.request_current_level=ft.level,Qt.request_video_width=(ee.levels[ft.level]||{}).width,Qt.request_video_height=(ee.levels[ft.level]||{}).height,Qt.request_labeled_bitrate=(ee.levels[ft.level]||{}).bitrate):Qt.request_type=ft.type,Qe("requestcompleted",Qt)};ee.on(Me.Events.FRAG_LOADED,rr);var ur=function(Lt,nt){var vt=nt.frag,et=vt.start,ft={currentFragmentPDT:st(vt),currentFragmentStart:Ze(et)};Qe("fragmentchange",ft)};ee.on(Me.Events.FRAG_CHANGED,ur);var Tt=function(Lt,nt){var vt=nt.type,et=nt.details,ft=nt.response,Vt=nt.fatal,Xt=nt.context,dr=nt.frag;if(et===Me.ErrorDetails.MANIFEST_LOAD_ERROR||et===Me.ErrorDetails.MANIFEST_LOAD_TIMEOUT||et===Me.ErrorDetails.FRAG_LOAD_ERROR||et===Me.ErrorDetails.FRAG_LOAD_TIMEOUT||et===Me.ErrorDetails.LEVEL_LOAD_ERROR||et===Me.ErrorDetails.LEVEL_LOAD_TIMEOUT){var or=dr&&dr.url||Xt&&Xt.url||"";Qe("requestfailed",{request_error:et,request_url:or,request_hostname:Ee(or),request_type:et===Me.ErrorDetails.FRAG_LOAD_ERROR||et===Me.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:ft&&ft.code,request_error_text:ft&&ft.text})}Vt&&Qe("error",{player_error_code:vt,player_error_message:et})};ee.on(Me.Events.ERROR,Tt);var Zt=function(Lt,nt){var vt=nt.frag,et=vt&&vt._url||"";Qe("requestcanceled",{request_event_type:Lt,request_url:et,request_type:"media",request_hostname:Ee(et)})};ee.on(Me.Events.FRAG_LOAD_EMERGENCY_ABORTED,Zt);var sr=function(Lt,nt){var vt=nt.level,et=ee.levels[vt];if(et&&et.attrs&&et.attrs.BANDWIDTH){var ft,Vt=et.attrs.BANDWIDTH,Xt=parseFloat(et.attrs["FRAME-RATE"]);isNaN(Xt)||(ft=Xt),Vt?Qe("renditionchange",{video_source_fps:ft,video_source_bitrate:Vt,video_source_width:et.width,video_source_height:et.height,video_source_rendition_name:et.name,video_source_codec:et==null?void 0:et.videoCodec}):ut.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};ee.on(Me.Events.LEVEL_SWITCHED,sr),ee._stopMuxMonitor=function(){ee.off(Me.Events.MANIFEST_LOADED,ot),ee.off(Me.Events.LEVEL_LOADED,Ot),ee.off(Me.Events.AUDIO_TRACK_LOADED,qt),ee.off(Me.Events.FRAG_LOADED,rr),ee.off(Me.Events.FRAG_CHANGED,ur),ee.off(Me.Events.ERROR,Tt),ee.off(Me.Events.FRAG_LOAD_EMERGENCY_ABORTED,Zt),ee.off(Me.Events.LEVEL_SWITCHED,sr),ee.off(Me.Events.DESTROYING,ee._stopMuxMonitor),delete ee._stopMuxMonitor},ee.on(Me.Events.DESTROYING,ee._stopMuxMonitor)}else ut.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,I.hlsjs,{},I.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var I;this.hlsjs&&((I=this.hlsjs)&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(I){I.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=I.dashjs,function(Y,he,ee){var Me=Y.log;if(ee&&ee.on){var ut=function(Tt,Zt){return Y.emit(he,Tt,Zt)},Ze=function(Tt){var Zt=Tt.type,sr=(Tt.data||{}).url;ut("requestcompleted",{request_event_type:Zt,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:Ee(sr),request_url:sr})};ee.on("manifestLoaded",Ze);var st={},Qe=function(Tt){var Zt=Tt.type,sr=Tt.fragmentModel,Lt=(Tt.chunk||{}).mediaInfo||{},nt=Lt.type,vt=Lt.bitrateList,et={};(vt=vt||[]).forEach(function(Qt,hr){et[hr]={},et[hr].width=Qt.width,et[hr].height=Qt.height,et[hr].bitrate=Qt.bandwidth,et[hr].attrs={}}),nt==="video"?st.video=et:nt==="audio"?st.audio=et:st.media=et;var ft=qe(sr,ee),Vt=ft.requestStart,Xt=ft.requestResponseStart,dr=ft.requestResponseEnd,or=ft.requestResponseHeaders,mr=ft.requestMediaDuration,cr=ft.requestHostname,yr=ft.requestUrl;ut("requestcompleted",{request_event_type:Zt,request_start:Vt,request_response_start:Xt,request_response_end:dr,request_bytes_loaded:-1,request_type:nt+"_init",request_response_headers:or,request_hostname:cr,request_url:yr,request_media_duration:mr,request_rendition_lists:st})};ee.on("initFragmentLoaded",Qe);var ot=function(Tt){var Zt=Tt.type,sr=Tt.fragmentModel,Lt=Tt.chunk||{},nt=Lt.mediaInfo,vt=Lt.start,et=(nt||{}).type,ft=qe(sr,ee),Vt=ft.requestStart,Xt=ft.requestResponseStart,dr=ft.requestResponseEnd,or=ft.requestBytesLoaded,mr=ft.requestResponseHeaders,cr=ft.requestMediaDuration,yr=ft.requestHostname,Qt=ft.requestUrl,hr=at(et,ee),ni=hr.currentLevel,Er=hr.renditionWidth,zr=hr.renditionHeight,pn=hr.renditionBitrate;ut("requestcompleted",{request_event_type:Zt,request_start:Vt,request_response_start:Xt,request_response_end:dr,request_bytes_loaded:or,request_type:et,request_response_headers:mr,request_hostname:yr,request_url:Qt,request_media_start_time:vt,request_media_duration:cr,request_current_level:ni,request_labeled_bitrate:pn,request_video_width:Er,request_video_height:zr})};ee.on("mediaFragmentLoaded",ot);var Ot={video:void 0,audio:void 0,totalBitrate:void 0},qt=function(){if(Ot.video&&typeof Ot.video.bitrate=="number"){if(Ot.video.width&&Ot.video.height){var Tt=Ot.video.bitrate;return Ot.audio&&typeof Ot.audio.bitrate=="number"&&(Tt+=Ot.audio.bitrate),Tt!==Ot.totalBitrate?(Ot.totalBitrate=Tt,{video_source_bitrate:Tt,video_source_height:Ot.video.height,video_source_width:Ot.video.width,video_source_codec:ie(Ot.video.codec)}):void 0}Me.warn("have bitrate info for video but missing width/height")}},rr=function(Tt,Zt,sr){if(typeof Tt.newQuality=="number"){var Lt=Tt.mediaType;if(Lt==="audio"||Lt==="video"){var nt=ee.getBitrateInfoListFor(Lt).find(function(et){return et.qualityIndex===Tt.newQuality});if(nt&&typeof nt.bitrate=="number"){Ot[Lt]=xe(xe({},nt),{},{codec:ee.getCurrentTrackFor(Lt).codec});var vt=qt();vt&&ut("renditionchange",vt)}else Me.warn("missing bitrate info for ".concat(Lt))}}else Me.warn("missing evt.newQuality in qualityChangeRendered event",Tt)};ee.on("qualityChangeRendered",rr);var ur=function(Tt){var Zt=Tt.error,sr=Tt.event,Lt=(sr=sr||{}).request||{},nt=R().event&&R().event.currentTarget||{};ut("requestfailed",{request_error:Zt+"_"+sr.id+"_"+Lt.type,request_url:sr.url,request_hostname:Ee(sr.url),request_type:Lt.mediaType,request_error_code:nt.status,request_error_type:nt.statusText})};ee.on("error",ur),ee._stopMuxMonitor=function(){ee.off("manifestLoaded",Ze),ee.off("initFragmentLoaded",Qe),ee.off("mediaFragmentLoaded",ot),ee.off("qualityChangeRendered",rr),ee.off("error",ur),delete ee._stopMuxMonitor}}else Me.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,I.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var I;this.dashjs&&((I=this.dashjs)&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor(),this.dashjs=void 0)}}],f&&fi(h.prototype,f),y&&fi(h,y),Object.defineProperty(h,"prototype",{writable:!1}),M}(H),Br=dn,Ri=j(153),ti=j.n(Ri);function ri(p){return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},ri(p)}function Ii(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return cn(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?cn(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ui(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}function di(p,h){var f=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);h&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(p,b).enumerable})),f.push.apply(f,y)}return f}function Kr(p){for(var h=1;h<arguments.length;h++){var f=arguments[h]!=null?arguments[h]:{};h%2?di(Object(f),!0).forEach(function(y){Hr(p,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):di(Object(f)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(f,y))})}return p}function Zr(p){return Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},Zr(p)}function wn(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function on(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function Hr(p,h,f){return h in p?Object.defineProperty(p,h,{value:f,enumerable:!0,configurable:!0,writable:!0}):p[h]=f,p}var br=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],At=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended"],ln=["viewstart","error","ended","viewend"],qr=function(){function p(b,M){var I,Y,he,ee,Me,ut,Ze,st,Qe,ot,Ot,qt,rr,ur,bt,Zt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};wn(this,p),Hr(this,"previousBeaconData",null),Hr(this,"lastEventTime",0),Hr(this,"rateLimited",!1),this.mux=b,this.envKey=M,this.options=Zt,this.eventQueue=new an(rt(this.envKey,this.options)),this.sampleRate=(I=this.options.sampleRate)!==null&&I!==void 0?I:1,this.disableCookies=(Y=this.options.disableCookies)!==null&&Y!==void 0&&Y,this.respectDoNotTrack=(he=this.options.respectDoNotTrack)!==null&&he!==void 0&&he,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(ee=this.options.platform)===null||ee===void 0?void 0:ee.name,viewer_application_version:(Me=this.options.platform)===null||Me===void 0?void 0:Me.version,viewer_application_engine:(ut=this.options.platform)===null||ut===void 0?void 0:ut.layout,viewer_device_name:(Ze=this.options.platform)===null||Ze===void 0?void 0:Ze.product,viewer_device_category:"",viewer_device_manufacturer:(st=this.options.platform)===null||st===void 0?void 0:st.manufacturer,viewer_os_family:(Qe=this.options.platform)===null||Qe===void 0||(ot=Qe.os)===null||ot===void 0?void 0:ot.family,viewer_os_architecture:(Ot=this.options.platform)===null||Ot===void 0||(qt=Ot.os)===null||qt===void 0?void 0:qt.architecture,viewer_os_version:(rr=this.options.platform)===null||rr===void 0||(ur=rr.os)===null||ur===void 0?void 0:ur.version,viewer_connection_type:Kt(),page_url:R()===null||R()===void 0||(bt=R().location)===null||bt===void 0?void 0:bt.href},this.viewerData=this.disableCookies?{}:Ht()}var h,f,y;return h=p,(f=[{key:"send",value:function(b,M){var I;if(b){if(this.respectDoNotTrack&&ye())return q.info("Not sending `"+b+"` because Do Not Track is enabled");if(!M||Zr(M)!=="object")return q.error("A data object was expected in send() but was not provided");var Y,he,ee=this.disableCookies?{}:(Y=jt(),he=J.now(),Y.session_start&&(Y.sst=Y.session_start,delete Y.session_start),Y.session_id&&(Y.sid=Y.session_id,delete Y.session_id),Y.session_expires&&(Y.sex=Y.session_expires,delete Y.session_expires),(!Y.sex||Y.sex<he)&&(Y.sid=g(),Y.sst=he),Y.sex=he+15e5,Ft(Y),{session_id:Y.sid,session_start:Y.sst,session_expires:Y.sex}),Me=Kr(Kr(Kr(Kr(Kr({},this.pageLevelData),M),ee),this.viewerData),{},{event:b,env_key:this.envKey});Me.user_id&&(Me.viewer_user_id=Me.user_id,delete Me.user_id);var ut=((I=Me.mux_sample_number)!==null&&I!==void 0?I:0)>=this.sampleRate,Ze=vr(this._deduplicateBeaconData(b,Me));if(this.lastEventTime=this.mux.utils.now(),ut)return q.info("Not sending event due to sample rate restriction",b,Me,Ze);if(this.envKey||q.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",b,Me,Ze),!this.rateLimited){if(q.info("Sending event",b,Me,Ze),this.rateLimited=!this.eventQueue.queueEvent(b,Ze),this.mux.WINDOW_UNLOADING&&b==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&b==="hb"?this.eventQueue.flushEvents(!0):ln.indexOf(b)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Me.event="eventrateexceeded",Ze=vr(Me),this.eventQueue.queueEvent(Me.event,Ze),q.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(b,M){var I=this,Y={},he=M.view_id;if(!he||b==="viewstart"||b==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)Y=Kr({},M),he&&(this.previousBeaconData=Y),he&&b==="viewend"&&(this.previousBeaconData=null);else{var ee=b.indexOf("request")===0;Object.entries(M).forEach(function(Me){var ut=sn(Me,2),Ze=ut[0],st=ut[1];I.previousBeaconData&&(st!==I.previousBeaconData[Ze]||br.indexOf(Ze)>-1||I.objectHasChanged(ee,Ze,st,I.previousBeaconData[Ze])||I.eventRequiresKey(b,Ze))&&(Y[Ze]=st,I.previousBeaconData[Ze]=st)})}return Y}},{key:"objectHasChanged",value:function(b,M,I,Y){return!(!b||M.indexOf("request_")!==0||M!=="request_response_headers"&&Zr(I)==="object"&&Zr(Y)==="object"&&Object.keys(I||{}).length===Object.keys(Y||{}).length)}},{key:"eventRequiresKey",value:function(b,M){return b==="renditionchange"&&M.indexOf("video_source_")===0||!(M.indexOf("ad_")!==0||!At.includes(b))}}])&&on(h.prototype,f),y&&on(h,y),Object.defineProperty(h,"prototype",{writable:!1}),p}();function Nr(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function ci(p,h,f){return h&&Nr(p.prototype,h),f&&Nr(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var wr=ci(function p(h){(function(ee,Me){if(!(ee instanceof Me))throw new TypeError("Cannot call a class as a function")})(this,p);var f=0,y=0,b=0,M=0,I=0,Y=0,he=0;h.on("requestcompleted",function(ee,Me){var ut,Ze,st=Me.request_start,Qe=Me.request_response_start,ot=Me.request_response_end,Ot=Me.request_bytes_loaded;if(M++,Qe?(ut=Qe-st,Ze=ot-Qe):Ze=ot-st,Ze>0&&Ot>0){var qt=Ot/Ze*8e3;I++,y+=Ot,b+=Ze,h.data.view_min_request_throughput=Math.min(h.data.view_min_request_throughput||1/0,qt),h.data.view_average_request_throughput=y/b*8e3,h.data.view_request_count=M,ut>0&&(f+=ut,h.data.view_max_request_latency=Math.max(h.data.view_max_request_latency||0,ut),h.data.view_average_request_latency=f/I)}}),h.on("requestfailed",function(ee,Me){M++,Y++,h.data.view_request_count=M,h.data.view_request_failed_count=Y}),h.on("requestcanceled",function(ee,Me){M++,he++,h.data.view_request_count=M,h.data.view_request_canceled_count=he})});function Vr(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function ei(p,h,f){return h&&Vr(p.prototype,h),f&&Vr(p,f),Object.defineProperty(p,"prototype",{writable:!1}),p}var Lr=ei(function p(h){var f=this;(function(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")})(this,p),h.on("before*",function(y,b){var M=b.viewer_time,I=J.now(),Y=f._lastEventTime;if(f._lastEventTime=I,Y&&I-Y>36e5){var he=Object.keys(h.data).reduce(function(ee,Me){return Me.indexOf("video_")===0?K()(ee,function(ut,Ze,st){return Ze in ut?Object.defineProperty(ut,Ze,{value:st,enumerable:!0,configurable:!0,writable:!0}):ut[Ze]=st,ut}({},Me,h.data[Me])):ee},{});h.mux.log.info("Received event after at least an hour inactivity, creating a new view"),h.emit("viewinit",K()({viewer_time:M},he)),h.playbackHeartbeat._playheadShouldBeProgressing&&y.type!=="play"&&y.type!=="adbreakstart"&&(h.emit("play",{viewer_time:M}),y.type!=="playing"&&h.emit("playing",{viewer_time:M}))}})});function Ur(p){return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},Ur(p)}function Yr(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return hi(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?hi(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function hi(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}function fi(p,h){for(var f=0;f<h.length;f++){var y=h[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,y.key,y)}}function vi(p,h){return vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,y){return f.__proto__=y,f},vi(p,h)}function Li(p){var h=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var f,y=pi(p);if(h){var b=pi(this).constructor;f=Reflect.construct(y,arguments,b)}else f=y.apply(this,arguments);return un(this,f)}}function un(p,h){if(h&&(Ur(h)==="object"||typeof h=="function"))return h;if(h!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $t(p)}function $t(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function pi(p){return pi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(h){return h.__proto__||Object.getPrototypeOf(h)},pi(p)}var Dn=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],dn=function(p){(function(I,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(Y&&Y.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),Object.defineProperty(I,"prototype",{writable:!1}),Y&&vi(I,Y)})(M,p);var h,f,y,b=Li(M);function M(I,Y,he){var ee;(function(Qe,ot){if(!(Qe instanceof ot))throw new TypeError("Cannot call a class as a function")})(this,M),(ee=b.call(this)).DOM_CONTENT_LOADED_EVENT_END=Ne.domContentLoadedEventEnd(),ee.NAVIGATION_START=Ne.navigationStart(),ee.mux=I,ee.id=Y,(he=K()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(Qe){return Qe}},he)).data=he.data||{},he.data.property_key&&(he.data.env_key=he.data.property_key,delete he.data.property_key),q.setLevel(he.debug?"debug":"warn"),ee.getPlayheadTime=he.getPlayheadTime,ee.getStateData=he.getStateData||function(){return{}},ee.getAdData=he.getAdData||function(){},ee.minimumRebufferDuration=he.minimumRebufferDuration,ee.sustainedRebufferThreshold=he.sustainedRebufferThreshold,ee.playbackHeartbeatTime=he.playbackHeartbeatTime,ee.disableRebufferTracking=he.disableRebufferTracking,ee.disableRebufferTracking&&ee.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),ee.disablePlayheadRebufferTracking=he.disablePlayheadRebufferTracking,ee.errorTranslator=he.errorTranslator,ee.playbackEventDispatcher=new qr(I,he.data.env_key,he),ee.data={player_instance_id:g(),mux_sample_rate:he.sampleRate,beacon_domain:he.beaconCollectionDomain?he.beaconCollectionDomain:he.beaconDomain},ee.data.view_sequence_number=1,ee.data.player_sequence_number=1,ee.oldEmit=ee.emit,ee.emit=function(Qe,ot){ot=K()({viewer_time:this.mux.utils.now()},ot),this.oldEmit(Qe,ot)};var Me=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind($t(ee));ee.on("viewinit",function(Qe,ot){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),K()(this.data,ot),this._initializeViewData(),this.one("play",Me),this.one("adbreakstart",Me)});var ut=function(Qe){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",Qe)}.bind($t(ee));if(ee.on("videochange",function(Qe,ot){ut(ot)}),ee.on("programchange",function(Qe,ot){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),ut(K()(ot,{view_program_changed:!0})),Me(),this.emit("play"),this.emit("playing")}),ee.on("fragmentchange",function(Qe,ot){this.currentFragmentPDT=ot.currentFragmentPDT,this.currentFragmentStart=ot.currentFragmentStart}),ee.on("destroy",ee.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Ze=function(){var Qe=ee.data.view_start!==void 0;ee.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",Qe&&ee.mux.WINDOW_HIDDEN&&(ee.data.player_is_paused||ee.emit("hb"))};window.addEventListener("visibilitychange",Ze,!1);var st=function(Qe){Qe.persisted||ee.destroy()};window.addEventListener("pagehide",st,!1),ee.on("destroy",function(){window.removeEventListener("visibilitychange",Ze),window.removeEventListener("pagehide",st)})}return ee.on("playerready",function(Qe,ot){K()(this.data,ot)}),Dn.forEach(function(Qe){ee.on(Qe,function(ot,Ot){Qe.indexOf("ad")!==0&&this._updateStateData(),K()(this.data,Ot),this._sanitizeData()}),ee.on("after"+Qe,function(){(Qe!=="error"||this.errorTracker.viewErrored)&&this.send(Qe)})}),ee.on("viewend",function(Qe,ot){K()(ee.data,ot)}),ee.one("playerready",function(Qe){var ot=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=ot-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),ee.longResumeTracker=new Lr($t(ee)),ee.errorTracker=new Ce($t(ee)),new ht($t(ee)),ee.seekingTracker=new O($t(ee)),ee.playheadTime=new Rt($t(ee)),ee.playbackHeartbeat=new Ie($t(ee)),new te($t(ee)),ee.watchTimeTracker=new Xe($t(ee)),new lt($t(ee)),ee.adTracker=new Re($t(ee)),new It($t(ee)),new gt($t(ee)),new Wt($t(ee)),new We($t(ee)),new wr($t(ee)),he.hlsjs&&ee.addHLSJS(he),he.dashjs&&ee.addDashJS(he),ee.emit("viewinit",he.data),ee}return h=M,f=[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(I){var Y=K()({},this.data);if(Y.video_source_is_live===void 0&&(Y.player_source_duration===1/0||Y.video_source_duration===1/0?Y.video_source_is_live=!0:(Y.player_source_duration>0||Y.video_source_duration>0)&&(Y.video_source_is_live=!1)),Y.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(ut){Y[ut]=void 0}),Y.video_source_url=Y.video_source_url||Y.player_source_url,Y.video_source_url){var he=Yr(ke(Y.video_source_url),2),ee=he[0],Me=he[1];Y.video_source_domain=Me,Y.video_source_hostname=ee}delete Y.ad_request_id,this.playbackEventDispatcher.send(I,Y),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){K()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var I=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(Y){var he=parseInt(I.data[Y],10);I.data[Y]=isNaN(he)?void 0:he}),["player_source_url","video_source_url"].forEach(function(Y){if(I.data[Y]){var he=I.data[Y].toLowerCase();he.indexOf("data:")!==0&&he.indexOf("blob:")!==0||(I.data[Y]="MSE style URL")}})}},{key:"_resetVideoData",value:function(I,Y){var he=this;Object.keys(this.data).forEach(function(ee){ee.indexOf("video_")===0&&delete he.data[ee]})}},{key:"_resetViewData",value:function(){var I=this;Object.keys(this.data).forEach(function(Y){Y.indexOf("view_")===0&&delete I.data[Y]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(I,Y){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var I=this,Y=this.data.view_id=g(),he=function(){Y===I.data.view_id&&V(I.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",he):he()}},{key:"_restartHeartBeat",value:function(){var I=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){I.data.player_is_paused||I.emit("hb")},1e4))}},{key:"addHLSJS",value:function(I){I.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=I.hlsjs,function(Y,he,ee){var Me=arguments.length>4?arguments[4]:void 0,ut=Y.log,Ze=Y.utils.secondsToMs,st=function(Lt){var nt,vt=parseInt(Me.version);return vt===1&&Lt.programDateTime!==null&&(nt=Lt.programDateTime),vt===0&&Lt.pdt!==null&&(nt=Lt.pdt),nt};if(Ne.exists()){var Qe=function(Lt,nt){return Y.emit(he,Lt,nt)},ot=function(Lt,nt){var vt=nt.levels,et=nt.audioTracks,ft=nt.url,Vt=nt.stats,Xt=nt.networkDetails,dr=nt.sessionData,or={},mr={};vt.forEach(function(Er,zr){or[zr]={width:Er.width,height:Er.height,bitrate:Er.bitrate,attrs:Er.attrs}}),et.forEach(function(Er,zr){mr[zr]={name:Er.name,language:Er.lang,bitrate:Er.bitrate}});var cr=$(Vt),yr=cr.bytesLoaded,Qt=cr.requestStart,hr=cr.responseStart,ni=cr.responseEnd;Qe("requestcompleted",Se(Se({},D(dr)),{},{request_event_type:Lt,request_bytes_loaded:yr,request_start:Qt,request_response_start:hr,request_response_end:ni,request_type:"manifest",request_hostname:Ee(ft),request_response_headers:Le(Xt),request_rendition_lists:{media:or,audio:mr,video:{}}}))};ee.on(Me.Events.MANIFEST_LOADED,ot);var Ot=function(Lt,nt){var vt=nt.details,et=nt.level,ft=nt.networkDetails,Vt=nt.stats,Xt=$(Vt),dr=Xt.bytesLoaded,or=Xt.requestStart,mr=Xt.responseStart,cr=Xt.responseEnd,yr=vt.fragments[vt.fragments.length-1],Qt=st(yr)+Ze(yr.duration);Qe("requestcompleted",{request_event_type:Lt,request_bytes_loaded:dr,request_start:or,request_response_start:mr,request_response_end:cr,request_current_level:et,request_type:"manifest",request_hostname:Ee(vt.url),request_response_headers:Le(ft),video_holdback:vt.holdBack&&Ze(vt.holdBack),video_part_holdback:vt.partHoldBack&&Ze(vt.partHoldBack),video_part_target_duration:vt.partTarget&&Ze(vt.partTarget),video_target_duration:vt.targetduration&&Ze(vt.targetduration),video_source_is_live:vt.live,player_manifest_newest_program_time:isNaN(Qt)?void 0:Qt})};ee.on(Me.Events.LEVEL_LOADED,Ot);var qt=function(Lt,nt){var vt=nt.details,et=nt.networkDetails,ft=nt.stats,Vt=$(ft),Xt=Vt.bytesLoaded,dr=Vt.requestStart,or=Vt.responseStart,mr=Vt.responseEnd;Qe("requestcompleted",{request_event_type:Lt,request_bytes_loaded:Xt,request_start:dr,request_response_start:or,request_response_end:mr,request_type:"manifest",request_hostname:Ee(vt.url),request_response_headers:Le(et)})};ee.on(Me.Events.AUDIO_TRACK_LOADED,qt);var rr=function(Lt,nt){var vt=nt.stats,et=nt.networkDetails,ft=nt.frag;vt=vt||ft.stats;var Vt=$(vt),Xt=Vt.bytesLoaded,dr=Vt.requestStart,or=Vt.responseStart,mr=Vt.responseEnd,cr=Le(et),yr=cr==null?void 0:cr["x-request-id"],Qt={request_event_type:Lt,request_bytes_loaded:Xt,request_start:dr,request_response_start:or,request_response_end:mr,request_hostname:et?Ee(et.responseURL):void 0,request_id:yr,request_response_headers:cr,request_media_duration:ft.duration,request_url:et==null?void 0:et.responseURL};ft.type==="main"?(Qt.request_type="media",Qt.request_current_level=ft.level,Qt.request_video_width=(ee.levels[ft.level]||{}).width,Qt.request_video_height=(ee.levels[ft.level]||{}).height,Qt.request_labeled_bitrate=(ee.levels[ft.level]||{}).bitrate):Qt.request_type=ft.type,Qe("requestcompleted",Qt)};ee.on(Me.Events.FRAG_LOADED,rr);var ur=function(Lt,nt){var vt=nt.frag,et=vt.start,ft={currentFragmentPDT:st(vt),currentFragmentStart:Ze(et)};Qe("fragmentchange",ft)};ee.on(Me.Events.FRAG_CHANGED,ur);var bt=function(Lt,nt){var vt=nt.type,et=nt.details,ft=nt.response,Vt=nt.fatal,Xt=nt.context,dr=nt.frag;if(et===Me.ErrorDetails.MANIFEST_LOAD_ERROR||et===Me.ErrorDetails.MANIFEST_LOAD_TIMEOUT||et===Me.ErrorDetails.FRAG_LOAD_ERROR||et===Me.ErrorDetails.FRAG_LOAD_TIMEOUT||et===Me.ErrorDetails.LEVEL_LOAD_ERROR||et===Me.ErrorDetails.LEVEL_LOAD_TIMEOUT){var or=dr&&dr.url||Xt&&Xt.url||"";Qe("requestfailed",{request_error:et,request_url:or,request_hostname:Ee(or),request_type:et===Me.ErrorDetails.FRAG_LOAD_ERROR||et===Me.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:ft&&ft.code,request_error_text:ft&&ft.text})}Vt&&Qe("error",{player_error_code:vt,player_error_message:et})};ee.on(Me.Events.ERROR,bt);var Zt=function(Lt,nt){var vt=nt.frag,et=vt&&vt._url||"";Qe("requestcanceled",{request_event_type:Lt,request_url:et,request_type:"media",request_hostname:Ee(et)})};ee.on(Me.Events.FRAG_LOAD_EMERGENCY_ABORTED,Zt);var sr=function(Lt,nt){var vt=nt.level,et=ee.levels[vt];if(et&&et.attrs&&et.attrs.BANDWIDTH){var ft,Vt=et.attrs.BANDWIDTH,Xt=parseFloat(et.attrs["FRAME-RATE"]);isNaN(Xt)||(ft=Xt),Vt?Qe("renditionchange",{video_source_fps:ft,video_source_bitrate:Vt,video_source_width:et.width,video_source_height:et.height,video_source_rendition_name:et.name,video_source_codec:et==null?void 0:et.videoCodec}):ut.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};ee.on(Me.Events.LEVEL_SWITCHED,sr),ee._stopMuxMonitor=function(){ee.off(Me.Events.MANIFEST_LOADED,ot),ee.off(Me.Events.LEVEL_LOADED,Ot),ee.off(Me.Events.AUDIO_TRACK_LOADED,qt),ee.off(Me.Events.FRAG_LOADED,rr),ee.off(Me.Events.FRAG_CHANGED,ur),ee.off(Me.Events.ERROR,bt),ee.off(Me.Events.FRAG_LOAD_EMERGENCY_ABORTED,Zt),ee.off(Me.Events.LEVEL_SWITCHED,sr),ee.off(Me.Events.DESTROYING,ee._stopMuxMonitor),delete ee._stopMuxMonitor},ee.on(Me.Events.DESTROYING,ee._stopMuxMonitor)}else ut.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,I.hlsjs,{},I.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var I;this.hlsjs&&((I=this.hlsjs)&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(I){I.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=I.dashjs,function(Y,he,ee){var Me=Y.log;if(ee&&ee.on){var ut=function(bt,Zt){return Y.emit(he,bt,Zt)},Ze=function(bt){var Zt=bt.type,sr=(bt.data||{}).url;ut("requestcompleted",{request_event_type:Zt,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:Ee(sr),request_url:sr})};ee.on("manifestLoaded",Ze);var st={},Qe=function(bt){var Zt=bt.type,sr=bt.fragmentModel,Lt=(bt.chunk||{}).mediaInfo||{},nt=Lt.type,vt=Lt.bitrateList,et={};(vt=vt||[]).forEach(function(Qt,hr){et[hr]={},et[hr].width=Qt.width,et[hr].height=Qt.height,et[hr].bitrate=Qt.bandwidth,et[hr].attrs={}}),nt==="video"?st.video=et:nt==="audio"?st.audio=et:st.media=et;var ft=qe(sr,ee),Vt=ft.requestStart,Xt=ft.requestResponseStart,dr=ft.requestResponseEnd,or=ft.requestResponseHeaders,mr=ft.requestMediaDuration,cr=ft.requestHostname,yr=ft.requestUrl;ut("requestcompleted",{request_event_type:Zt,request_start:Vt,request_response_start:Xt,request_response_end:dr,request_bytes_loaded:-1,request_type:nt+"_init",request_response_headers:or,request_hostname:cr,request_url:yr,request_media_duration:mr,request_rendition_lists:st})};ee.on("initFragmentLoaded",Qe);var ot=function(bt){var Zt=bt.type,sr=bt.fragmentModel,Lt=bt.chunk||{},nt=Lt.mediaInfo,vt=Lt.start,et=(nt||{}).type,ft=qe(sr,ee),Vt=ft.requestStart,Xt=ft.requestResponseStart,dr=ft.requestResponseEnd,or=ft.requestBytesLoaded,mr=ft.requestResponseHeaders,cr=ft.requestMediaDuration,yr=ft.requestHostname,Qt=ft.requestUrl,hr=at(et,ee),ni=hr.currentLevel,Er=hr.renditionWidth,zr=hr.renditionHeight,pn=hr.renditionBitrate;ut("requestcompleted",{request_event_type:Zt,request_start:Vt,request_response_start:Xt,request_response_end:dr,request_bytes_loaded:or,request_type:et,request_response_headers:mr,request_hostname:yr,request_url:Qt,request_media_start_time:vt,request_media_duration:cr,request_current_level:ni,request_labeled_bitrate:pn,request_video_width:Er,request_video_height:zr})};ee.on("mediaFragmentLoaded",ot);var Ot={video:void 0,audio:void 0,totalBitrate:void 0},qt=function(){if(Ot.video&&typeof Ot.video.bitrate=="number"){if(Ot.video.width&&Ot.video.height){var bt=Ot.video.bitrate;return Ot.audio&&typeof Ot.audio.bitrate=="number"&&(bt+=Ot.audio.bitrate),bt!==Ot.totalBitrate?(Ot.totalBitrate=bt,{video_source_bitrate:bt,video_source_height:Ot.video.height,video_source_width:Ot.video.width,video_source_codec:ie(Ot.video.codec)}):void 0}Me.warn("have bitrate info for video but missing width/height")}},rr=function(bt,Zt,sr){if(typeof bt.newQuality=="number"){var Lt=bt.mediaType;if(Lt==="audio"||Lt==="video"){var nt=ee.getBitrateInfoListFor(Lt).find(function(et){return et.qualityIndex===bt.newQuality});if(nt&&typeof nt.bitrate=="number"){Ot[Lt]=xe(xe({},nt),{},{codec:ee.getCurrentTrackFor(Lt).codec});var vt=qt();vt&&ut("renditionchange",vt)}else Me.warn("missing bitrate info for ".concat(Lt))}}else Me.warn("missing evt.newQuality in qualityChangeRendered event",bt)};ee.on("qualityChangeRendered",rr);var ur=function(bt){var Zt=bt.error,sr=bt.event,Lt=(sr=sr||{}).request||{},nt=R().event&&R().event.currentTarget||{};ut("requestfailed",{request_error:Zt+"_"+sr.id+"_"+Lt.type,request_url:sr.url,request_hostname:Ee(sr.url),request_type:Lt.mediaType,request_error_code:nt.status,request_error_type:nt.statusText})};ee.on("error",ur),ee._stopMuxMonitor=function(){ee.off("manifestLoaded",Ze),ee.off("initFragmentLoaded",Qe),ee.off("mediaFragmentLoaded",ot),ee.off("qualityChangeRendered",rr),ee.off("error",ur),delete ee._stopMuxMonitor}}else Me.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,I.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var I;this.dashjs&&((I=this.dashjs)&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor(),this.dashjs=void 0)}}],f&&fi(h.prototype,f),y&&fi(h,y),Object.defineProperty(h,"prototype",{writable:!1}),M}(H),Br=dn,Ri=j(153),ti=j.n(Ri);function ri(p){return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},ri(p)}function Ii(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return cn(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?cn(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
5
5
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function cn(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}var Wr,Ci=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Ln={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};R()&&R().WeakMap&&(Wr=new WeakMap);var gi="#EXT-X-TARGETDURATION",Rn="#EXT-X-PART-INF",In="#EXT-X-SERVER-CONTROL",Cn="#EXTINF",hn="#EXT-X-PROGRAM-DATE-TIME",mi="#EXT-X-VERSION",Pi="#EXT-X-SESSION-DATA",yi=function(p){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(p),this.manifest};yi.prototype.process=function(p){var h;for(this.buffer+=p,h=this.buffer.indexOf(`
|
|
6
6
|
`);h>-1;h=this.buffer.indexOf(`
|
|
7
|
-
`))this.processLine(this.buffer.substring(0,h)),this.buffer=this.buffer.substring(h+1)},yi.prototype.processLine=function(p){var h=p.indexOf(":"),f=xn(p,h),y=f[0],b=f.length===2?ii(f[1]):void 0;if(y[0]!=="#")this.currentUri.uri=y,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(y){case gi:if(!isFinite(b)||b<0)return;this.manifest.targetDuration=b,this.setHoldBack();break;case Rn:Oi(this.manifest,f),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case In:Oi(this.manifest,f),this.setHoldBack();break;case Cn:b===0?this.currentUri.duration=.01:b>0&&(this.currentUri.duration=b);break;case hn:var M=b,I=new Date(M);this.manifest.dateTimeString||(this.manifest.dateTimeString=M,this.manifest.dateTimeObject=I),this.currentUri.dateTimeString=M,this.currentUri.dateTimeObject=I;break;case mi:Oi(this.manifest,f);break;case Pi:var Y=Mn(f[1]),he=D(Y);K()(this.manifest.sessionData,he)}},yi.prototype.setHoldBack=function(){var p=this.manifest,h=p.serverControl,f=p.targetDuration,y=p.partTargetDuration;if(h){var b="holdBack",M="partHoldBack",I=f&&3*f,Y=y&&2*y;f&&!h.hasOwnProperty(b)&&(h[b]=I),I&&h[b]<I&&(h[b]=I),y&&!h.hasOwnProperty(M)&&(h[M]=3*y),y&&h[M]<Y&&(h[M]=Y)}};var Oi=function(p,h){var f,y=fn(h[0].replace("#EXT-X-",""));xi(h[1])?(f={},f=K()(On(h[1]),f)):f=ii(h[1]),p[y]=f},fn=function(p){return p.toLowerCase().replace(/-(\w)/g,function(h){return h[1].toUpperCase()})},ii=function(p){if(p.toLowerCase()==="yes"||p.toLowerCase()==="no")return p.toLowerCase()==="yes";var h=p.indexOf(":")!==-1?p:parseFloat(p);return isNaN(h)?p:h},Pn=function(p){var h={},f=p.split("=");return f.length>1&&(h[fn(f[0])]=ii(f[1])),h},On=function(p){for(var h=p.split(","),f={},y=0;h.length>y;y++){var b=h[y],M=Pn(b);f=K()(M,f)}return f},xi=function(p){return p.indexOf("=")>-1},xn=function(p,h){return h===-1?[p]:[p.substring(0,h),p.substring(h+1)]},Mn=function(p){var h={};if(p){var f=p.search(",");return[p.slice(0,f),p.slice(f+1)].forEach(function(y,b){for(var M=y.replace(/['"]+/g,"").split("="),I=0;I<M.length;I++)M[I]==="DATA-ID"&&(h["DATA-ID"]=M[1-I]),M[I]==="VALUE"&&(h.VALUE=M[1-I])}),{data:h}}},Fn=yi,Mi={safeCall:function(p,h,f,y){var b=y;if(p&&typeof p[h]=="function")try{b=p[h].apply(p,f)}catch(M){q.info("safeCall error",M)}return b},safeIncrement:V,getComputedStyle:function(p,h){var f;if(p&&h&&R()&&typeof R().getComputedStyle=="function")return Wr&&Wr.has(p)&&(f=Wr.get(p)),f||(f=R().getComputedStyle(p,null),Wr&&Wr.set(p,f)),f.getPropertyValue(h)},secondsToMs:function(p){return Math.floor(1e3*p)},assign:K(),headersStringToObject:U,extractHostnameAndDomain:ke,extractHostname:Ee,manifestParser:Fn,generateShortID:k,generateUUID:g,now:J.now},Fi={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};function Nn(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Et(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}var gr={},Xr=function p(h){var f=arguments;typeof h=="string"?p.hasOwnProperty(h)?R().setTimeout(function(){f=Array.prototype.splice.call(f,1),p[h].apply(null,f)},0):q.warn("`"+h+"` is an unknown task"):typeof h=="function"?R().setTimeout(function(){h(p)},0):q.warn("`"+h+"` is invalid.")},vn={loaded:J.now(),NAME:"mux-embed",VERSION:"4.17.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(p,h){return function(f,y,b){var M=Ii(me(y),3),I=M[0],Y=M[1],he=M[2],ee=f.log,Me=f.utils.getComputedStyle,ut=f.utils.secondsToMs;if(!I)return ee.error("No element was found with the `"+Y+"` query selector.");if(he!=="video"&&he!=="audio")return ee.error("The element of `"+Y+"` was not a media element.");I.mux&&(I.mux.destroy(),delete I.mux,ee.warn("Already monitoring this video element, replacing existing event listeners")),(b=K()({automaticErrorTracking:!0},b)).data=K()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:f.VERSION},b.data),b.getPlayheadTime=function(){return ut(I.currentTime)},b.getStateData=function(){var st,Qe,ot=this.hlsjs&&this.hlsjs.url,Ot=this.dashjs&&ri(this.dashjs.getSource==="function")&&this.dashjs.getSource(),qt={player_is_paused:I.paused,player_playhead_time:ut(I.currentTime),player_width:parseInt(Me(I,"width")),player_height:parseInt(Me(I,"height")),player_autoplay_on:I.autoplay,player_preload_on:I.preload,player_language_code:I.lang,player_is_fullscreen:ti()&&!!(ti().fullscreenElement||ti().webkitFullscreenElement||ti().mozFullScreenElement||ti().msFullscreenElement),video_poster_url:I.poster,video_source_url:ot||Ot||I.currentSrc,video_source_duration:ut(I.duration),video_source_height:I.videoHeight,video_source_width:I.videoWidth,view_dropped_frame_count:(st=I)===null||st===void 0||(Qe=st.getVideoPlaybackQuality)===null||Qe===void 0?void 0:Qe.call(st).droppedVideoFrames},rr=b.getPlayheadTime();if(I.getStartDate&&rr>0){var ur=I.getStartDate();if(ur&&typeof ur.getTime=="function"&&ur.getTime()){var Tt=ur.getTime();if(qt.player_program_time=Tt+rr,I.seekable.length>0){var Zt=Tt+I.seekable.end(I.seekable.length-1);qt.player_live_edge_program_time=Zt}}}return qt},I.mux=I.mux||{},I.mux.deleted=!1,I.mux.emit=function(st,Qe){f.emit(Y,st,Qe)};var Ze=function(){ee.error("The monitor for this video element has already been destroyed.")};I.mux.destroy=function(){Object.keys(I.mux.listeners).forEach(function(st){I.removeEventListener(st,I.mux.listeners[st],!1)}),delete I.mux.listeners,I.mux.destroy=Ze,I.mux.swapElement=Ze,I.mux.emit=Ze,I.mux.addHLSJS=Ze,I.mux.addDashJS=Ze,I.mux.removeHLSJS=Ze,I.mux.removeDashJS=Ze,I.mux.deleted=!0,f.emit(Y,"destroy")},I.mux.swapElement=function(st){var Qe=Ii(me(st),3),ot=Qe[0],Ot=Qe[1],qt=Qe[2];return ot?qt!=="video"&&qt!=="audio"?f.log.error("The element of `"+Ot+"` was not a media element."):(ot.muxId=I.muxId,delete I.muxId,ot.mux=ot.mux||{},ot.mux.listeners=K()({},I.mux.listeners),delete I.mux.listeners,Object.keys(ot.mux.listeners).forEach(function(rr){I.removeEventListener(rr,ot.mux.listeners[rr],!1),ot.addEventListener(rr,ot.mux.listeners[rr],!1)}),ot.mux.swapElement=I.mux.swapElement,ot.mux.destroy=I.mux.destroy,delete I.mux,void(I=ot)):f.log.error("No element was found with the `"+Ot+"` query selector.")},I.mux.addHLSJS=function(st){f.addHLSJS(Y,st)},I.mux.addDashJS=function(st){f.addDashJS(Y,st)},I.mux.removeHLSJS=function(){f.removeHLSJS(Y)},I.mux.removeDashJS=function(){f.removeDashJS(Y)},f.init(Y,b),f.emit(Y,"playerready"),I.paused||(f.emit(Y,"play"),I.readyState>2&&f.emit(Y,"playing")),I.mux.listeners={},Ci.forEach(function(st){(st!=="error"||b.automaticErrorTracking)&&(I.mux.listeners[st]=function(){var Qe={};if(st==="error"){if(!I.error||I.error.code===1)return;Qe.player_error_code=I.error.code,Qe.player_error_message=Ln[I.error.code]||I.error.message}f.emit(Y,st,Qe)},I.addEventListener(st,I.mux.listeners[st],!1))})}(Xr,p,h)},destroyMonitor:function(p){var h=Nn(me(p),1)[0];h&&h.mux&&typeof h.mux.destroy=="function"?h.mux.destroy():q.error("A video element monitor for `"+p+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(p,h){var f=L(p);gr[f]?gr[f].addHLSJS(h):q.error("A monitor for `"+f+"` has not been initialized.")},addDashJS:function(p,h){var f=L(p);gr[f]?gr[f].addDashJS(h):q.error("A monitor for `"+f+"` has not been initialized.")},removeHLSJS:function(p){var h=L(p);gr[h]?gr[h].removeHLSJS():q.error("A monitor for `"+h+"` has not been initialized.")},removeDashJS:function(p){var h=L(p);gr[h]?gr[h].removeDashJS():q.error("A monitor for `"+h+"` has not been initialized.")},init:function(p,h){ye()&&h&&h.respectDoNotTrack&&q.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var f=L(p);gr[f]=new Br(Xr,f,h)},emit:function(p,h,f){var y=L(p);gr[y]?(gr[y].emit(h,f),h==="destroy"&&delete gr[y]):q.error("A monitor for `"+y+"` has not been initialized.")},checkDoNotTrack:ye,log:q,utils:Mi,events:Fi,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Xr,vn),R()!==void 0&&typeof R().addEventListener=="function"&&R().addEventListener("pagehide",function(p){p.persisted||(Xr.WINDOW_UNLOADING=!0)},!1);var Un=Xr},655:function(X,B,j){var re,R;function g(k){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},g(k);}(function(k){var L=!1;if((R=typeof(re=k)=="function"?re.call(B,j,B,X):re)===void 0||(X.exports=R),L=!0,g(B)==="object"&&(X.exports=k(),L=!0),!L){var me=window.Cookies,ne=window.Cookies=k();ne.noConflict=function(){return window.Cookies=me,ne}}})(function(){var k=function(){for(var L=0,me={};L<arguments.length;L++){var ne=arguments[L];for(var ce in ne)me[ce]=ne[ce]}return me};return function L(me){function ne(ce,we,q){var ye;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(q=k({path:"/"},ne.defaults,q)).expires=="number"){var J=new Date;J.setMilliseconds(J.getMilliseconds()+864e5*q.expires),q.expires=J}try{ye=JSON.stringify(we),/^[\{\[]/.test(ye)&&(we=ye)}catch{}return we=me.write?me.write(we,ce):encodeURIComponent(String(we)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),ce=(ce=(ce=encodeURIComponent(String(ce))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[ce,"=",we,q.expires?"; expires="+q.expires.toUTCString():"",q.path?"; path="+q.path:"",q.domain?"; domain="+q.domain:"",q.secure?"; secure":""].join("")}ce||(ye={});for(var se=document.cookie?document.cookie.split("; "):[],K=/(%[0-9A-Z]{2})+/g,Ee=0;Ee<se.length;Ee++){var ke=se[Ee].split("="),Ne=ke.slice(1).join("=");Ne.charAt(0)==='"'&&(Ne=Ne.slice(1,-1));try{var V=ke[0].replace(K,decodeURIComponent);if(Ne=me.read?me.read(Ne,V):me(Ne,V)||Ne.replace(K,decodeURIComponent),this.json)try{Ne=JSON.parse(Ne)}catch{}if(ce===V){ye=Ne;break}ce||(ye[V]=Ne)}catch{}}return ye}}return ne.set=ne,ne.get=function(ce){return ne.call(ne,ce)},ne.getJSON=function(){return ne.apply({json:!0},[].slice.call(arguments))},ne.defaults={},ne.remove=function(ce,we){ne(ce,"",k(we,{expires:-1}))},ne.withConverter=L,ne}(function(){})})},153:function(X,B,j){var re,R=j.g!==void 0?j.g:typeof window!="undefined"?window:{},g=j(558);typeof document!="undefined"?re=document:(re=R["__GLOBAL_DOCUMENT_CACHE@4"])||(re=R["__GLOBAL_DOCUMENT_CACHE@4"]=g),X.exports=re},48:function(X,B,j){var re;re=typeof window!="undefined"?window:j.g!==void 0?j.g:typeof self!="undefined"?self:{},X.exports=re},678:function(X){var B=9007199254740991,j="[object Arguments]",re="[object Function]",R="[object GeneratorFunction]",g=/^(?:0|[1-9]\d*)$/;function k(z,$,Le){switch(Le.length){case 0:return z.call($);case 1:return z.call($,Le[0]);case 2:return z.call($,Le[0],Le[1]);case 3:return z.call($,Le[0],Le[1],Le[2])}return z.apply($,Le)}var L,me,ne=Object.prototype,ce=ne.hasOwnProperty,we=ne.toString,q=ne.propertyIsEnumerable,ye=(L=Object.keys,me=Object,function(z){return L(me(z))}),J=Math.max,se=!q.call({valueOf:1},"valueOf");function K(z,$){var Le=E(z)||function(qe){return function(at){return function(ie){return!!ie&&typeof ie=="object"}(at)&&U(at)}(qe)&&ce.call(qe,"callee")&&(!q.call(qe,"callee")||we.call(qe)==j)}(z)?function(qe,at){for(var ie=-1,pe=Array(qe);++ie<qe;)pe[ie]=at(ie);return pe}(z.length,String):[],Oe=Le.length,xe=!!Oe;for(var be in z)!$&&!ce.call(z,be)||xe&&(be=="length"||ke(be,Oe))||Le.push(be);return Le}function Ee(z,$,Le){var Oe=z[$];ce.call(z,$)&&V(Oe,Le)&&(Le!==void 0||$ in z)||(z[$]=Le)}function ke(z,$){return!!($=$==null?B:$)&&(typeof z=="number"||g.test(z))&&z>-1&&z%1==0&&z<$}function Ne(z){var $=z&&z.constructor;return z===(typeof $=="function"&&$.prototype||ne)}function V(z,$){return z===$||z!=z&&$!=$}var E=Array.isArray;function U(z){return z!=null&&function($){return typeof $=="number"&&$>-1&&$%1==0&&$<=B}(z.length)&&!function($){var Le=D($)?we.call($):"";return Le==re||Le==R}(z)}function D(z){var $=typeof z;return!!z&&($=="object"||$=="function")}var de,Se=(de=function(z,$){if(se||Ne($)||U($))(function(Oe,xe,be,qe){be||(be={});for(var at=-1,ie=xe.length;++at<ie;){var pe=xe[at],ae=qe?qe(be[pe],Oe[pe],pe,be,Oe):void 0;Ee(be,pe,ae===void 0?Oe[pe]:ae)}})($,function(Oe){return U(Oe)?K(Oe):function(xe){if(!Ne(xe))return ye(xe);var be=[];for(var qe in Object(xe))ce.call(xe,qe)&&qe!="constructor"&&be.push(qe);return be}(Oe)}($),z);else for(var Le in $)ce.call($,Le)&&Ee(z,Le,$[Le])},function(z,$){return $=J($===void 0?z.length-1:$,0),function(){for(var Le=arguments,Oe=-1,xe=J(Le.length-$,0),be=Array(xe);++Oe<xe;)be[Oe]=Le[$+Oe];Oe=-1;for(var qe=Array($+1);++Oe<$;)qe[Oe]=Le[Oe];return qe[$]=be,k(z,this,qe)}}(function(z,$){var Le=-1,Oe=$.length,xe=Oe>1?$[Oe-1]:void 0,be=Oe>2?$[2]:void 0;for(xe=de.length>3&&typeof xe=="function"?(Oe--,xe):void 0,be&&function(at,ie,pe){if(!D(pe))return!1;var ae=typeof ie;return!!(ae=="number"?U(pe)&&ke(ie,pe.length):ae=="string"&&ie in pe)&&V(pe[ie],at)}($[0],$[1],be)&&(xe=Oe<3?void 0:xe,Oe=1),z=Object(z);++Le<Oe;){var qe=$[Le];qe&&de(z,qe,Le,xe)}return z}));X.exports=Se},640:function(X,B,j){var re,R;(function(g,k){"use strict";re=function(){var L=function(){},me="undefined",ne=typeof window!==me&&typeof window.navigator!==me&&/Trident\/|MSIE /.test(window.navigator.userAgent),ce=["trace","debug","info","warn","error"];function we(E,U){var D=E[U];if(typeof D.bind=="function")return D.bind(E);try{return Function.prototype.bind.call(D,E)}catch{return function(){return Function.prototype.apply.apply(D,[E,arguments])}}}function q(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function ye(E){return E==="debug"&&(E="log"),typeof console!==me&&(E==="trace"&&ne?q:console[E]!==void 0?we(console,E):console.log!==void 0?we(console,"log"):L)}function J(E,U){for(var D=0;D<ce.length;D++){var de=ce[D];this[de]=D<E?L:this.methodFactory(de,E,U)}this.log=this.debug}function se(E,U,D){return function(){typeof console!==me&&(J.call(this,U,D),this[E].apply(this,arguments))}}function K(E,U,D){return ye(E)||se.apply(this,arguments)}function Ee(E,U,D){var de,Se=this;U=U==null?"WARN":U;var z="loglevel";function $(be){var qe=(ce[be]||"silent").toUpperCase();if(typeof window!==me&&z){try{return void(window.localStorage[z]=qe)}catch{}try{window.document.cookie=encodeURIComponent(z)+"="+qe+";"}catch{}}}function Le(){var be;if(typeof window!==me&&z){try{be=window.localStorage[z]}catch{}if(typeof be===me)try{var qe=window.document.cookie,at=qe.indexOf(encodeURIComponent(z)+"=");at!==-1&&(be=/^([^;]+)/.exec(qe.slice(at))[1])}catch{}return Se.levels[be]===void 0&&(be=void 0),be}}function Oe(){if(typeof window!==me&&z){try{return void window.localStorage.removeItem(z)}catch{}try{window.document.cookie=encodeURIComponent(z)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof E=="string"?z+=":"+E:typeof E=="symbol"&&(z=void 0),Se.name=E,Se.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Se.methodFactory=D||K,Se.getLevel=function(){return de},Se.setLevel=function(be,qe){if(typeof be=="string"&&Se.levels[be.toUpperCase()]!==void 0&&(be=Se.levels[be.toUpperCase()]),!(typeof be=="number"&&be>=0&&be<=Se.levels.SILENT))throw"log.setLevel() called with invalid level: "+be;if(de=be,qe!==!1&&$(be),J.call(Se,be,E),typeof console===me&&be<Se.levels.SILENT)return"No console available for logging"},Se.setDefaultLevel=function(be){U=be,Le()||Se.setLevel(be,!1)},Se.resetLevel=function(){Se.setLevel(U,!1),Oe()},Se.enableAll=function(be){Se.setLevel(Se.levels.TRACE,be)},Se.disableAll=function(be){Se.setLevel(Se.levels.SILENT,be)};var xe=Le();xe==null&&(xe=U),Se.setLevel(xe,!1)}var ke=new Ee,Ne={};ke.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var U=Ne[E];return U||(U=Ne[E]=new Ee(E,ke.getLevel(),ke.methodFactory)),U};var V=typeof window!==me?window.log:void 0;return ke.noConflict=function(){return typeof window!==me&&window.log===ke&&(window.log=V),ke},ke.getLoggers=function(){return Ne},ke.default=ke,ke},(R=typeof re=="function"?re.call(B,j,B,X):re)===void 0||(X.exports=R)})()},375:function(X,B){"use strict";var j=Object.prototype.hasOwnProperty;function re(g){try{return decodeURIComponent(g.replace(/\+/g," "))}catch{return null}}function R(g){try{return encodeURIComponent(g)}catch{return null}}B.stringify=function(g,k){k=k||"";var L,me,ne=[];for(me in typeof k!="string"&&(k="?"),g)if(j.call(g,me)){if((L=g[me])||L!=null&&!isNaN(L)||(L=""),me=R(me),L=R(L),me===null||L===null)continue;ne.push(me+"="+L)}return ne.length?k+ne.join("&"):""},B.parse=function(g){for(var k,L=/([^=?#&]+)=?([^&]*)/g,me={};k=L.exec(g);){var ne=re(k[1]),ce=re(k[2]);ne===null||ce===null||ne in me||(me[ne]=ce)}return me}},558:function(){}},le={};function oe(X){var B=le[X];if(B!==void 0)return B.exports;var j=le[X]={exports:{}};return A[X].call(j.exports,j,j.exports,oe),j.exports}return oe.n=function(X){var B=X&&X.__esModule?function(){return X.default}:function(){return X};return oe.d(B,{a:B}),B},oe.d=function(X,B){for(var j in B)oe.o(B,j)&&!oe.o(X,j)&&Object.defineProperty(X,j,{enumerable:!0,get:B[j]})},oe.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),oe.o=function(X,B){return Object.prototype.hasOwnProperty.call(X,B)},oe(80)}()},typeof En=="object"&&typeof ia=="object"?ia.exports=w():typeof En=="object"?En.mux=w():x.mux=w()})()});var Ya=Ga((Vi,na)=>{typeof window!="undefined"&&function(x,w){typeof Vi=="object"&&typeof na=="object"?na.exports=w():typeof define=="function"&&define.amd?define([],w):typeof Vi=="object"?Vi.Hls=w():x.Hls=w()}(Vi,()=>(()=>{var x={21:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{default:()=>me});var j=function(){function ne(ce,we){this.subtle=void 0,this.aesIV=void 0,this.subtle=ce,this.aesIV=we}return ne.prototype.decrypt=function(ce,we){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},we,ce)},ne}(),re=function(){function ne(ce,we){this.subtle=void 0,this.key=void 0,this.subtle=ce,this.key=we}return ne.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},ne}(),R=B(145),g=function(){function ne(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var ce=ne.prototype;return ce.uint8ArrayToUint32Array_=function(we){for(var q=new DataView(we),ye=new Uint32Array(4),J=0;J<4;J++)ye[J]=q.getUint32(4*J);return ye},ce.initTable=function(){var we=this.sBox,q=this.invSBox,ye=this.subMix,J=ye[0],se=ye[1],K=ye[2],Ee=ye[3],ke=this.invSubMix,Ne=ke[0],V=ke[1],E=ke[2],U=ke[3],D=new Uint32Array(256),de=0,Se=0,z=0;for(z=0;z<256;z++)D[z]=z<128?z<<1:z<<1^283;for(z=0;z<256;z++){var $=Se^Se<<1^Se<<2^Se<<3^Se<<4;$=$>>>8^255&$^99,we[de]=$,q[$]=de;var Le=D[de],Oe=D[Le],xe=D[Oe],be=257*D[$]^16843008*$;J[de]=be<<24|be>>>8,se[de]=be<<16|be>>>16,K[de]=be<<8|be>>>24,Ee[de]=be,be=16843009*xe^65537*Oe^257*Le^16843008*de,Ne[$]=be<<24|be>>>8,V[$]=be<<16|be>>>16,E[$]=be<<8|be>>>24,U[$]=be,de?(de=Le^D[D[D[xe^Le]]],Se^=D[D[Se]]):de=Se=1}},ce.expandKey=function(we){for(var q=this.uint8ArrayToUint32Array_(we),ye=!0,J=0;J<q.length&&ye;)ye=q[J]===this.key[J],J++;if(!ye){this.key=q;var se=this.keySize=q.length;if(se!==4&&se!==6&&se!==8)throw new Error("Invalid aes key size="+se);var K,Ee,ke,Ne,V=this.ksRows=4*(se+6+1),E=this.keySchedule=new Uint32Array(V),U=this.invKeySchedule=new Uint32Array(V),D=this.sBox,de=this.rcon,Se=this.invSubMix,z=Se[0],$=Se[1],Le=Se[2],Oe=Se[3];for(K=0;K<V;K++)K<se?ke=E[K]=q[K]:(Ne=ke,K%se==0?(Ne=D[(Ne=Ne<<8|Ne>>>24)>>>24]<<24|D[Ne>>>16&255]<<16|D[Ne>>>8&255]<<8|D[255&Ne],Ne^=de[K/se|0]<<24):se>6&&K%se==4&&(Ne=D[Ne>>>24]<<24|D[Ne>>>16&255]<<16|D[Ne>>>8&255]<<8|D[255&Ne]),E[K]=ke=(E[K-se]^Ne)>>>0);for(Ee=0;Ee<V;Ee++)K=V-Ee,Ne=3&Ee?E[K]:E[K-4],U[Ee]=Ee<4||K<=4?Ne:z[D[Ne>>>24]]^$[D[Ne>>>16&255]]^Le[D[Ne>>>8&255]]^Oe[D[255&Ne]],U[Ee]=U[Ee]>>>0}},ce.networkToHostOrderSwap=function(we){return we<<24|(65280&we)<<8|(16711680&we)>>8|we>>>24},ce.decrypt=function(we,q,ye){for(var J,se,K,Ee,ke,Ne,V,E,U,D,de,Se,z,$,Le=this.keySize+6,Oe=this.invKeySchedule,xe=this.invSBox,be=this.invSubMix,qe=be[0],at=be[1],ie=be[2],pe=be[3],ae=this.uint8ArrayToUint32Array_(ye),Ue=ae[0],H=ae[1],ve=ae[2],Ie=ae[3],Fe=new Int32Array(we),fe=new Int32Array(Fe.length),Ce=this.networkToHostOrderSwap;q<Fe.length;){for(U=Ce(Fe[q]),D=Ce(Fe[q+1]),de=Ce(Fe[q+2]),Se=Ce(Fe[q+3]),ke=U^Oe[0],Ne=Se^Oe[1],V=de^Oe[2],E=D^Oe[3],z=4,$=1;$<Le;$++)J=qe[ke>>>24]^at[Ne>>16&255]^ie[V>>8&255]^pe[255&E]^Oe[z],se=qe[Ne>>>24]^at[V>>16&255]^ie[E>>8&255]^pe[255&ke]^Oe[z+1],K=qe[V>>>24]^at[E>>16&255]^ie[ke>>8&255]^pe[255&Ne]^Oe[z+2],Ee=qe[E>>>24]^at[ke>>16&255]^ie[Ne>>8&255]^pe[255&V]^Oe[z+3],ke=J,Ne=se,V=K,E=Ee,z+=4;J=xe[ke>>>24]<<24^xe[Ne>>16&255]<<16^xe[V>>8&255]<<8^xe[255&E]^Oe[z],se=xe[Ne>>>24]<<24^xe[V>>16&255]<<16^xe[E>>8&255]<<8^xe[255&ke]^Oe[z+1],K=xe[V>>>24]<<24^xe[E>>16&255]<<16^xe[ke>>8&255]<<8^xe[255&Ne]^Oe[z+2],Ee=xe[E>>>24]<<24^xe[ke>>16&255]<<16^xe[Ne>>8&255]<<8^xe[255&V]^Oe[z+3],fe[q]=Ce(J^Ue),fe[q+1]=Ce(Ee^H),fe[q+2]=Ce(K^ve),fe[q+3]=Ce(se^Ie),Ue=U,H=D,ve=de,Ie=Se,q+=4}return fe.buffer},ne}(),k=B(93),L=B(63),me=function(){function ne(we,q){var ye=(q===void 0?{}:q).removePKCS7Padding,J=ye===void 0||ye;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=we.enableSoftwareAES,this.removePKCS7Padding=J,J)try{var se=self.crypto;se&&(this.subtle=se.subtle||se.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var ce=ne.prototype;return ce.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},ce.isSync=function(){return this.useSoftware},ce.flush=function(){var we=this.currentResult,q=this.remainderData;if(!we||q)return k.logger.error("[softwareDecrypt] "+(q?"overflow bytes: "+q.byteLength:"no result")),this.reset(),null;var ye,J,se,K=new Uint8Array(we);return this.reset(),this.removePKCS7Padding?(se=(J=(ye=K).byteLength)&&new DataView(ye.buffer).getUint8(J-1))?(0,R.sliceUint8)(ye,0,J-se):ye:K},ce.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},ce.decrypt=function(we,q,ye){var J=this;return this.useSoftware?new Promise(function(se,K){J.softwareDecrypt(new Uint8Array(we),q,ye);var Ee=J.flush();Ee?se(Ee.buffer):K(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(we),q,ye)},ce.softwareDecrypt=function(we,q,ye){var J=this.currentIV,se=this.currentResult,K=this.remainderData;this.logOnce("JS AES decrypt"),K&&(we=(0,L.appendUint8Array)(K,we),this.remainderData=null);var Ee=this.getValidChunk(we);if(!Ee.length)return null;J&&(ye=J);var ke=this.softwareDecrypter;ke||(ke=this.softwareDecrypter=new g),ke.expandKey(q);var Ne=se;return this.currentResult=ke.decrypt(Ee.buffer,0,ye),this.currentIV=(0,R.sliceUint8)(Ee,-16).buffer,Ne||null},ce.webCryptoDecrypt=function(we,q,ye){var J=this,se=this.subtle;return this.key===q&&this.fastAesKey||(this.key=q,this.fastAesKey=new re(se,q)),this.fastAesKey.expandKey().then(function(K){return se?(J.logOnce("WebCrypto AES decrypt"),new j(se,new Uint8Array(ye)).decrypt(we.buffer,K)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(K){return k.logger.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+K.name+": "+K.message),J.onWebCryptoError(we,q,ye)})},ce.onWebCryptoError=function(we,q,ye){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(we,q,ye);var J=this.flush();if(J)return J.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},ce.getValidChunk=function(we){var q=we,ye=we.length-we.length%16;return ye!==we.length&&(q=(0,R.sliceUint8)(we,0,ye),this.remainderData=(0,R.sliceUint8)(we,ye)),q},ce.logOnce=function(we){this.logEnabled&&(k.logger.log("[decrypter]: "+we),this.logEnabled=!1)},ne}()},181:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{canParse:()=>L,decodeFrame:()=>q,getID3Data:()=>g,getID3Frames:()=>we,getTimeStamp:()=>me,isFooter:()=>R,isHeader:()=>re,isTimeStampFrame:()=>ne,testables:()=>ke,utf8ArrayToStr:()=>Ee});var j,re=function(V,E){return E+10<=V.length&&V[E]===73&&V[E+1]===68&&V[E+2]===51&&V[E+3]<255&&V[E+4]<255&&V[E+6]<128&&V[E+7]<128&&V[E+8]<128&&V[E+9]<128},R=function(V,E){return E+10<=V.length&&V[E]===51&&V[E+1]===68&&V[E+2]===73&&V[E+3]<255&&V[E+4]<255&&V[E+6]<128&&V[E+7]<128&&V[E+8]<128&&V[E+9]<128},g=function(V,E){for(var U=E,D=0;re(V,E);)D+=10,D+=k(V,E+6),R(V,E+10)&&(D+=10),E+=D;if(D>0)return V.subarray(U,U+D)},k=function(V,E){var U=0;return U=(127&V[E])<<21,U|=(127&V[E+1])<<14,(U|=(127&V[E+2])<<7)|127&V[E+3]},L=function(V,E){return re(V,E)&&k(V,E+6)+10<=V.length-E},me=function(V){for(var E=we(V),U=0;U<E.length;U++){var D=E[U];if(ne(D))return K(D)}},ne=function(V){return V&&V.key==="PRIV"&&V.info==="com.apple.streaming.transportStreamTimestamp"},ce=function(V){var E=String.fromCharCode(V[0],V[1],V[2],V[3]),U=k(V,4);return{type:E,size:U,data:V.subarray(10,10+U)}},we=function(V){for(var E=0,U=[];re(V,E);){for(var D=k(V,E+6),de=(E+=10)+D;E+8<de;){var Se=ce(V.subarray(E)),z=q(Se);z&&U.push(z),E+=Se.size+10}R(V,E)&&(E+=10)}return U},q=function(V){return V.type==="PRIV"?ye(V):V.type[0]==="W"?se(V):J(V)},ye=function(V){if(!(V.size<2)){var E=Ee(V.data,!0),U=new Uint8Array(V.data.subarray(E.length+1));return{key:V.type,info:E,data:U.buffer}}},J=function(V){if(!(V.size<2)){if(V.type==="TXXX"){var E=1,U=Ee(V.data.subarray(E),!0);E+=U.length+1;var D=Ee(V.data.subarray(E));return{key:V.type,info:U,data:D}}var de=Ee(V.data.subarray(1));return{key:V.type,data:de}}},se=function(V){if(V.type==="WXXX"){if(V.size<2)return;var E=1,U=Ee(V.data.subarray(E),!0);E+=U.length+1;var D=Ee(V.data.subarray(E));return{key:V.type,info:U,data:D}}var de=Ee(V.data);return{key:V.type,data:de}},K=function(V){if(V.data.byteLength===8){var E=new Uint8Array(V.data),U=1&E[3],D=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return D/=45,U&&(D+=4772185884e-2),Math.round(D)}},Ee=function(V,E){E===void 0&&(E=!1);var U=Ne();if(U){var D=U.decode(V);if(E){var de=D.indexOf("\0");return de!==-1?D.substring(0,de):D}return D.replace(/\0/g,"")}for(var Se,z,$,Le=V.length,Oe="",xe=0;xe<Le;){if((Se=V[xe++])===0&&E)return Oe;if(Se!==0&&Se!==3)switch(Se>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:Oe+=String.fromCharCode(Se);break;case 12:case 13:z=V[xe++],Oe+=String.fromCharCode((31&Se)<<6|63&z);break;case 14:z=V[xe++],$=V[xe++],Oe+=String.fromCharCode((15&Se)<<12|(63&z)<<6|(63&$)<<0)}}return Oe},ke={decodeTextFrame:J};function Ne(){return j||self.TextDecoder===void 0||(j=new self.TextDecoder("utf-8")),j}},182:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{default:()=>L});var j=B(544),re=B(851),R=B(93),g=B(729),k=B(973);function L(we){var q=new g.EventEmitter,ye=function(J,se){we.postMessage({event:J,data:se})};q.on(re.Events.FRAG_DECRYPTED,ye),q.on(re.Events.ERROR,ye),we.addEventListener("message",function(J){var se=J.data;switch(se.cmd){case"init":var K=JSON.parse(se.config);we.transmuxer=new j.default(q,se.typeSupported,K,se.vendor,se.id),(0,R.enableLogs)(K.debug,se.id),function(){var V=function(U){R.logger[U]=function(D){ye("workerLog",{logType:U,message:D})}};for(var E in R.logger)V(E)}(),ye("init",null);break;case"configure":we.transmuxer.configure(se.config);break;case"demux":var Ee=we.transmuxer.push(se.data,se.decryptdata,se.chunkMeta,se.state);(0,j.isPromise)(Ee)?(we.transmuxer.async=!0,Ee.then(function(V){me(we,V)}).catch(function(V){ye(re.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:se.chunkMeta,fatal:!1,error:V,err:V,reason:"transmuxer-worker push error"})})):(we.transmuxer.async=!1,me(we,Ee));break;case"flush":var ke=se.chunkMeta,Ne=we.transmuxer.flush(ke);(0,j.isPromise)(Ne)||we.transmuxer.async?((0,j.isPromise)(Ne)||(Ne=Promise.resolve(Ne)),Ne.then(function(V){ce(we,V,ke)}).catch(function(V){ye(re.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:se.chunkMeta,fatal:!1,error:V,err:V,reason:"transmuxer-worker flush error"})})):ce(we,Ne,ke)}})}function me(we,q){if(!((ye=q.remuxResult).audio||ye.video||ye.text||ye.id3||ye.initSegment))return!1;var ye,J=[],se=q.remuxResult,K=se.audio,Ee=se.video;return K&&ne(J,K),Ee&&ne(J,Ee),we.postMessage({event:"transmuxComplete",data:q},J),!0}function ne(we,q){q.data1&&we.push(q.data1.buffer),q.data2&&we.push(q.data2.buffer)}function ce(we,q,ye){q.reduce(function(J,se){return me(we,se)||J},!1)||we.postMessage({event:"transmuxComplete",data:q[0]}),we.postMessage({event:"flush",data:ye})}},544:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{TransmuxConfig:()=>Bt,TransmuxState:()=>ar,default:()=>It,isPromise:()=>Wt});var j=B(851),re=B(973),R=B(21),g=B(965),k=B(181),L=B(856);function me(te,N){return te===void 0&&(te=""),N===void 0&&(N=9e4),{type:te,id:-1,pid:-1,inputTimeScale:N,sequenceNumber:-1,samples:[],dropped:0}}var ne=B(63),ce=B(145),we=function(){function te(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var N=te.prototype;return N.resetInitSegment=function(T,O,C,G){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},N.resetTimeStamp=function(T){this.initPTS=T,this.resetContiguity()},N.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},N.canParse=function(T,O){return!1},N.appendFrame=function(T,O,C){},N.demux=function(T,O){this.cachedData&&(T=(0,ne.appendUint8Array)(this.cachedData,T),this.cachedData=null);var C,G=k.getID3Data(T,0),Q=G?G.length:0,Z=this._audioTrack,Te=this._id3Track,Re=G?k.getTimeStamp(G):void 0,Pe=T.length;for((this.basePTS===null||this.frameIndex===0&&(0,g.isFiniteNumber)(Re))&&(this.basePTS=q(Re,O,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),G&&G.length>0&&Te.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:G,type:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});Q<Pe;){if(this.canParse(T,Q)){var Be=this.appendFrame(Z,T,Q);Be?(this.frameIndex++,this.lastPTS=Be.sample.pts,C=Q+=Be.length):Q=Pe}else k.canParse(T,Q)?(G=k.getID3Data(T,Q),Te.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:G,type:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),C=Q+=G.length):Q++;if(Q===Pe&&C!==Pe){var We=(0,ce.sliceUint8)(T,C);this.cachedData?this.cachedData=(0,ne.appendUint8Array)(this.cachedData,We):this.cachedData=We}}return{audioTrack:Z,videoTrack:me(),id3Track:Te,textTrack:me()}},N.demuxSampleAes=function(T,O,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},N.flush=function(T){var O=this.cachedData;return O&&(this.cachedData=null,this.demux(O,0)),{audioTrack:this._audioTrack,videoTrack:me(),id3Track:this._id3Track,textTrack:me()}},N.destroy=function(){},te}(),q=function(te,N,T){return(0,g.isFiniteNumber)(te)?90*te:9e4*N+(T||0)};let ye=we;var J=B(93);function se(te,N){return te[N]===255&&(246&te[N+1])==240}function K(te,N){return 1&te[N+1]?7:9}function Ee(te,N){return(3&te[N+3])<<11|te[N+4]<<3|(224&te[N+5])>>>5}function ke(te,N){return N+1<te.length&&se(te,N)}function Ne(te,N){if(ke(te,N)){var T=K(te,N);if(N+T>=te.length)return!1;var O=Ee(te,N);if(O<=T)return!1;var C=N+O;return C===te.length||ke(te,C)}return!1}function V(te,N,T,O,C){if(!te.samplerate){var G=function(Q,Z,Te,Re){var Pe,Be,We,Ge,$e=navigator.userAgent.toLowerCase(),ht=Re,Dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Pe=1+((192&Z[Te+2])>>>6);var ze=(60&Z[Te+2])>>>2;if(!(ze>Dt.length-1))return We=(1&Z[Te+2])<<2,We|=(192&Z[Te+3])>>>6,J.logger.log("manifest codec:"+Re+", ADTS type:"+Pe+", samplingIndex:"+ze),/firefox/i.test($e)?ze>=6?(Pe=5,Ge=new Array(4),Be=ze-3):(Pe=2,Ge=new Array(2),Be=ze):$e.indexOf("android")!==-1?(Pe=2,Ge=new Array(2),Be=ze):(Pe=5,Ge=new Array(4),Re&&(Re.indexOf("mp4a.40.29")!==-1||Re.indexOf("mp4a.40.5")!==-1)||!Re&&ze>=6?Be=ze-3:((Re&&Re.indexOf("mp4a.40.2")!==-1&&(ze>=6&&We===1||/vivaldi/i.test($e))||!Re&&We===1)&&(Pe=2,Ge=new Array(2)),Be=ze)),Ge[0]=Pe<<3,Ge[0]|=(14&ze)>>1,Ge[1]|=(1&ze)<<7,Ge[1]|=We<<3,Pe===5&&(Ge[1]|=(14&Be)>>1,Ge[2]=(1&Be)<<7,Ge[2]|=8,Ge[3]=0),{config:Ge,samplerate:Dt[ze],channelCount:We,codec:"mp4a.40."+Pe,manifestCodec:ht};Q.trigger(j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+ze})}(N,T,O,C);if(!G)return;te.config=G.config,te.samplerate=G.samplerate,te.channelCount=G.channelCount,te.codec=G.codec,te.manifestCodec=G.manifestCodec,J.logger.log("parsed codec:"+te.codec+", rate:"+G.samplerate+", channels:"+G.channelCount)}}function E(te){return 9216e4/te}function U(te,N,T,O,C){var G,Q=O+C*E(te.samplerate),Z=function($e,ht){var Dt=K($e,ht);if(ht+Dt<=$e.length){var ze=Ee($e,ht)-Dt;if(ze>0)return{headerLength:Dt,frameLength:ze}}}(N,T);if(Z){var Te=Z.frameLength,Re=Z.headerLength,Pe=Re+Te,Be=Math.max(0,T+Pe-N.length);Be?(G=new Uint8Array(Pe-Re)).set(N.subarray(T+Re,N.length),0):G=N.subarray(T+Re,T+Pe);var We={unit:G,pts:Q};return Be||te.samples.push(We),{sample:We,length:Pe,missing:Be}}var Ge=N.length-T;return(G=new Uint8Array(Ge)).set(N.subarray(T,N.length),0),{sample:{unit:G,pts:Q},length:Ge,missing:-1}}function D(te,N){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,O){return T.__proto__=O,T},D(te,N)}let de=function(te){var N,T;function O(G,Q){var Z;return(Z=te.call(this)||this).observer=void 0,Z.config=void 0,Z.observer=G,Z.config=Q,Z}T=te,(N=O).prototype=Object.create(T.prototype),N.prototype.constructor=N,D(N,T);var C=O.prototype;return C.resetInitSegment=function(G,Q,Z,Te){te.prototype.resetInitSegment.call(this,G,Q,Z,Te),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:Q,duration:Te,inputTimeScale:9e4,dropped:0}},O.probe=function(G){if(!G)return!1;for(var Q=(k.getID3Data(G,0)||[]).length,Z=G.length;Q<Z;Q++)if(Ne(G,Q))return J.logger.log("ADTS sync word found !"),!0;return!1},C.canParse=function(G,Q){return function(Z,Te){return function(Re,Pe){return Pe+5<Re.length}(Z,Te)&&se(Z,Te)&&Ee(Z,Te)<=Z.length-Te}(G,Q)},C.appendFrame=function(G,Q,Z){V(G,this.observer,Q,Z,G.manifestCodec);var Te=U(G,Q,Z,this.basePTS,this.frameIndex);if(Te&&Te.missing===0)return Te},O}(ye);var Se=/\/emsg[-/]ID3/i;let z=function(){function te(T,O){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=O}var N=te.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(T,O,C,G){var Q=this.videoTrack=me("video",1),Z=this.audioTrack=me("audio",1),Te=this.txtTrack=me("text",1);if(this.id3Track=me("id3",1),this.timeOffset=0,T&&T.byteLength){var Re=(0,ne.parseInitSegment)(T);if(Re.video){var Pe=Re.video,Be=Pe.id,We=Pe.timescale,Ge=Pe.codec;Q.id=Be,Q.timescale=Te.timescale=We,Q.codec=Ge}if(Re.audio){var $e=Re.audio,ht=$e.id,Dt=$e.timescale,ze=$e.codec;Z.id=ht,Z.timescale=Dt,Z.codec=ze}Te.id=ne.RemuxerTrackIdConfig.text,Q.sampleDuration=0,Q.duration=Z.duration=G}},N.resetContiguity=function(){},te.probe=function(T){return T=T.length>16384?T.subarray(0,16384):T,(0,ne.findBox)(T,["moof"]).length>0},N.demux=function(T,O){this.timeOffset=O;var C=T,G=this.videoTrack,Q=this.txtTrack;if(this.config.progressive){this.remainderData&&(C=(0,ne.appendUint8Array)(this.remainderData,T));var Z=(0,ne.segmentValidRange)(C);this.remainderData=Z.remainder,G.samples=Z.valid||new Uint8Array}else G.samples=C;var Te=this.extractID3Track(G,O);return Q.samples=(0,ne.parseSamples)(O,G),{videoTrack:G,audioTrack:this.audioTrack,id3Track:Te,textTrack:this.txtTrack}},N.flush=function(){var T=this.timeOffset,O=this.videoTrack,C=this.txtTrack;O.samples=this.remainderData||new Uint8Array,this.remainderData=null;var G=this.extractID3Track(O,this.timeOffset);return C.samples=(0,ne.parseSamples)(T,O),{videoTrack:O,audioTrack:me(),id3Track:G,textTrack:me()}},N.extractID3Track=function(T,O){var C=this.id3Track;if(T.samples.length){var G=(0,ne.findBox)(T.samples,["emsg"]);G&&G.forEach(function(Q){var Z=(0,ne.parseEmsg)(Q);if(Se.test(Z.schemeIdUri)){var Te=(0,g.isFiniteNumber)(Z.presentationTime)?Z.presentationTime/Z.timeScale:O+Z.presentationTimeDelta/Z.timeScale,Re=Z.eventDuration===4294967295?Number.POSITIVE_INFINITY:Z.eventDuration/Z.timeScale;Re<=.001&&(Re=Number.POSITIVE_INFINITY);var Pe=Z.payload;C.samples.push({data:Pe,len:Pe.byteLength,dts:Te,pts:Te,type:L.MetadataSchema.emsg,duration:Re})}})}return C},N.demuxSampleAes=function(T,O,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},te}();var $=null,Le=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Oe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],xe=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],be=[0,1,1,4];function qe(te,N,T,O,C){if(!(T+24>N.length)){var G=at(N,T);if(G&&T+G.frameLength<=N.length){var Q=O+C*(9e4*G.samplesPerFrame/G.sampleRate),Z={unit:N.subarray(T,T+G.frameLength),pts:Q,dts:Q};return te.config=[],te.channelCount=G.channelCount,te.samplerate=G.sampleRate,te.samples.push(Z),{sample:Z,length:G.frameLength,missing:0}}}}function at(te,N){var T=te[N+1]>>3&3,O=te[N+1]>>1&3,C=te[N+2]>>4&15,G=te[N+2]>>2&3;if(T!==1&&C!==0&&C!==15&&G!==3){var Q=te[N+2]>>1&1,Z=te[N+3]>>6,Te=1e3*Le[14*(T===3?3-O:O===3?3:4)+C-1],Re=Oe[3*(T===3?0:T===2?1:2)+G],Pe=Z===3?1:2,Be=xe[T][O],We=be[O],Ge=8*Be*We,$e=Math.floor(Be*Te/Re+Q)*We;if($===null){var ht=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);$=ht?parseInt(ht[1]):0}return!!$&&$<=87&&O===2&&Te>=224e3&&Z===0&&(te[N+3]=128|te[N+3]),{sampleRate:Re,channelCount:Pe,frameLength:$e,samplesPerFrame:Ge}}}function ie(te,N){return te[N]===255&&(224&te[N+1])==224&&(6&te[N+1])!=0}function pe(te,N){return N+1<te.length&&ie(te,N)}function ae(te,N){if(N+1<te.length&&ie(te,N)){var T=at(te,N),O=4;T!=null&&T.frameLength&&(O=T.frameLength);var C=N+O;return C===te.length||pe(te,C)}return!1}let Ue=function(){function te(T){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=T,this.bytesAvailable=T.byteLength,this.word=0,this.bitsAvailable=0}var N=te.prototype;return N.loadWord=function(){var T=this.data,O=this.bytesAvailable,C=T.byteLength-O,G=new Uint8Array(4),Q=Math.min(4,O);if(Q===0)throw new Error("no bytes available");G.set(T.subarray(C,C+Q)),this.word=new DataView(G.buffer).getUint32(0),this.bitsAvailable=8*Q,this.bytesAvailable-=Q},N.skipBits=function(T){var O;T=Math.min(T,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>T?(this.word<<=T,this.bitsAvailable-=T):(T-=this.bitsAvailable,T-=(O=T>>3)<<3,this.bytesAvailable-=O,this.loadWord(),this.word<<=T,this.bitsAvailable-=T)},N.readBits=function(T){var O=Math.min(this.bitsAvailable,T),C=this.word>>>32-O;if(T>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0)this.word<<=O;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(O=T-O)>0&&this.bitsAvailable?C<<O|this.readBits(O):C},N.skipLZ=function(){var T;for(T=0;T<this.bitsAvailable;++T)if((this.word&2147483648>>>T)!=0)return this.word<<=T,this.bitsAvailable-=T,T;return this.loadWord(),T+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var T=this.skipLZ();return this.readBits(T+1)-1},N.readEG=function(){var T=this.readUEG();return 1&T?1+T>>>1:-1*(T>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(T){for(var O=8,C=8,G=0;G<T;G++)C!==0&&(C=(O+this.readEG()+256)%256),O=C===0?O:C},N.readSPS=function(){var T,O,C,G=0,Q=0,Z=0,Te=0,Re=this.readUByte.bind(this),Pe=this.readBits.bind(this),Be=this.readUEG.bind(this),We=this.readBoolean.bind(this),Ge=this.skipBits.bind(this),$e=this.skipEG.bind(this),ht=this.skipUEG.bind(this),Dt=this.skipScalingList.bind(this);Re();var ze=Re();if(Pe(5),Ge(3),Re(),ht(),ze===100||ze===110||ze===122||ze===244||ze===44||ze===83||ze===86||ze===118||ze===128){var Pt=Be();if(Pt===3&&Ge(1),ht(),ht(),Ge(1),We())for(O=Pt!==3?8:12,C=0;C<O;C++)We()&&Dt(C<6?16:64)}ht();var tr=Be();if(tr===0)Be();else if(tr===1)for(Ge(1),$e(),$e(),T=Be(),C=0;C<T;C++)$e();ht(),Ge(1);var jt=Be(),Ft=Be(),Ht=Pe(1);Ht===0&&Ge(1),Ge(1),We()&&(G=Be(),Q=Be(),Z=Be(),Te=Be());var rt=[1,1];if(We()&&We())switch(Re()){case 1:rt=[1,1];break;case 2:rt=[12,11];break;case 3:rt=[10,11];break;case 4:rt=[16,11];break;case 5:rt=[40,33];break;case 6:rt=[24,11];break;case 7:rt=[20,11];break;case 8:rt=[32,11];break;case 9:rt=[80,33];break;case 10:rt=[18,11];break;case 11:rt=[15,11];break;case 12:rt=[64,33];break;case 13:rt=[160,99];break;case 14:rt=[4,3];break;case 15:rt=[3,2];break;case 16:rt=[2,1];break;case 255:rt=[Re()<<8|Re(),Re()<<8|Re()]}return{width:Math.ceil(16*(jt+1)-2*G-2*Q),height:(2-Ht)*(Ft+1)*16-(Ht?2:4)*(Z+Te),pixelRatio:rt}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},te}(),H=function(){function te(T,O,C){this.keyData=void 0,this.decrypter=void 0,this.keyData=C,this.decrypter=new R.default(O,{removePKCS7Padding:!1})}var N=te.prototype;return N.decryptBuffer=function(T){return this.decrypter.decrypt(T,this.keyData.key.buffer,this.keyData.iv.buffer)},N.decryptAacSample=function(T,O,C){var G=this,Q=T[O].unit;if(!(Q.length<=16)){var Z=Q.subarray(16,Q.length-Q.length%16),Te=Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.length);this.decryptBuffer(Te).then(function(Re){var Pe=new Uint8Array(Re);Q.set(Pe,16),G.decrypter.isSync()||G.decryptAacSamples(T,O+1,C)})}},N.decryptAacSamples=function(T,O,C){for(;;O++){if(O>=T.length)return void C();if(!(T[O].unit.length<32||(this.decryptAacSample(T,O,C),this.decrypter.isSync())))return}},N.getAvcEncryptedData=function(T){for(var O=16*Math.floor((T.length-48)/160)+16,C=new Int8Array(O),G=0,Q=32;Q<T.length-16;Q+=160,G+=16)C.set(T.subarray(Q,Q+16),G);return C},N.getAvcDecryptedUnit=function(T,O){for(var C=new Uint8Array(O),G=0,Q=32;Q<T.length-16;Q+=160,G+=16)T.set(C.subarray(G,G+16),Q);return T},N.decryptAvcSample=function(T,O,C,G,Q){var Z=this,Te=(0,ne.discardEPB)(Q.data),Re=this.getAvcEncryptedData(Te);this.decryptBuffer(Re.buffer).then(function(Pe){Q.data=Z.getAvcDecryptedUnit(Te,Pe),Z.decrypter.isSync()||Z.decryptAvcSamples(T,O,C+1,G)})},N.decryptAvcSamples=function(T,O,C,G){if(T instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;O++,C=0){if(O>=T.length)return void G();for(var Q=T[O].units;!(C>=Q.length);C++){var Z=Q[C];if(!(Z.data.length<=48||Z.type!==1&&Z.type!==5||(this.decryptAvcSample(T,O,C,G,Z),this.decrypter.isSync())))return}}},te}();function ve(){return ve=Object.assign?Object.assign.bind():function(te){for(var N=1;N<arguments.length;N++){var T=arguments[N];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(te[O]=T[O])}return te},ve.apply(this,arguments)}var Ie=188;function Fe(te,N,T,O){return{key:te,frame:!1,pts:N,dts:T,units:[],debug:O,length:0}}function fe(te,N){return(31&te[N+10])<<8|te[N+11]}function Ce(te,N,T,O){var C={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},G=N+3+((15&te[N+1])<<8|te[N+2])-4;for(N+=12+((15&te[N+10])<<8|te[N+11]);N<G;){var Q=(31&te[N+1])<<8|te[N+2];switch(te[N]){case 207:if(!O){J.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=Q);break;case 21:C.id3===-1&&(C.id3=Q);break;case 219:if(!O){J.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=Q);break;case 3:case 4:T.mpeg!==!0&&T.mp3!==!0?J.logger.log("MPEG audio found, not supported in this browser"):C.audio===-1&&(C.audio=Q,C.segmentCodec="mp3");break;case 36:J.logger.warn("Unsupported HEVC stream type found")}N+=5+((15&te[N+3])<<8|te[N+4])}return C}function Ve(te){var N,T,O,C,G,Q=0,Z=te.data;if(!te||te.size===0)return null;for(;Z[0].length<19&&Z.length>1;){var Te=new Uint8Array(Z[0].length+Z[1].length);Te.set(Z[0]),Te.set(Z[1],Z[0].length),Z[0]=Te,Z.splice(1,1)}if(((N=Z[0])[0]<<16)+(N[1]<<8)+N[2]===1){if((T=(N[4]<<8)+N[5])&&T>te.size-6)return null;var Re=N[7];192&Re&&(C=536870912*(14&N[9])+4194304*(255&N[10])+16384*(254&N[11])+128*(255&N[12])+(254&N[13])/2,64&Re?C-(G=536870912*(14&N[14])+4194304*(255&N[15])+16384*(254&N[16])+128*(255&N[17])+(254&N[18])/2)>54e5&&(J.logger.warn(Math.round((C-G)/9e4)+"s delta between PTS and DTS, align them"),C=G):G=C);var Pe=(O=N[8])+9;if(te.size<=Pe)return null;te.size-=Pe;for(var Be=new Uint8Array(te.size),We=0,Ge=Z.length;We<Ge;We++){var $e=(N=Z[We]).byteLength;if(Pe){if(Pe>$e){Pe-=$e;continue}N=N.subarray(Pe),$e-=Pe,Pe=0}Be.set(N,Q),Q+=$e}return T&&(T-=O+3),{data:Be,pts:C,dts:G,len:T}}return null}function Xe(te,N){if(te.units.length&&te.frame){if(te.pts===void 0){var T=N.samples,O=T.length;if(!O)return void N.dropped++;var C=T[O-1];te.pts=C.pts,te.dts=C.dts}N.samples.push(te)}te.debug.length&&J.logger.log(te.pts+"/"+te.dts+":"+te.debug)}let it=function(){function te(T,O,C){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=T,this.config=O,this.typeSupported=C}te.probe=function(T){var O=te.syncOffset(T);return O>0&&J.logger.warn("MPEG2-TS detected but first sync word found @ offset "+O),O!==-1},te.syncOffset=function(T){for(var O=Math.min(940,T.length-376)+1,C=0;C<O;){if(T[C]===71&&T[C+Ie]===71)return C;C++}return-1},te.createTrack=function(T,O){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:ne.RemuxerTrackIdConfig[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?O:void 0}};var N=te.prototype;return N.resetInitSegment=function(T,O,C,G){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=te.createTrack("video"),this._audioTrack=te.createTrack("audio",G),this._id3Track=te.createTrack("id3"),this._txtTrack=te.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=O,this.videoCodec=C,this._duration=G},N.resetTimeStamp=function(){},N.resetContiguity=function(){var T=this._audioTrack,O=this._avcTrack,C=this._id3Track;T&&(T.pesData=null),O&&(O.pesData=null),C&&(C.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},N.demux=function(T,O,C,G){var Q;C===void 0&&(C=!1),G===void 0&&(G=!1),C||(this.sampleAes=null);var Z=this._avcTrack,Te=this._audioTrack,Re=this._id3Track,Pe=this._txtTrack,Be=Z.pid,We=Z.pesData,Ge=Te.pid,$e=Re.pid,ht=Te.pesData,Dt=Re.pesData,ze=null,Pt=this.pmtParsed,tr=this._pmtId,jt=T.length;if(this.remainderData&&(jt=(T=(0,ne.appendUint8Array)(this.remainderData,T)).length,this.remainderData=null),jt<Ie&&!G)return this.remainderData=T,{audioTrack:Te,videoTrack:Z,id3Track:Re,textTrack:Pe};var Ft=Math.max(0,te.syncOffset(T));(jt-=(jt-Ft)%Ie)<T.byteLength&&!G&&(this.remainderData=new Uint8Array(T.buffer,jt,T.buffer.byteLength-jt));for(var Ht=0,rt=Ft;rt<jt;rt+=Ie)if(T[rt]===71){var lr=!!(64&T[rt+1]),Ar=((31&T[rt+1])<<8)+T[rt+2],Kt=void 0;if((48&T[rt+3])>>4>1){if((Kt=rt+5+T[rt+4])===rt+Ie)continue}else Kt=rt+4;switch(Ar){case Be:lr&&(We&&(Q=Ve(We))&&this.parseAVCPES(Z,Pe,Q,!1),We={data:[],size:0}),We&&(We.data.push(T.subarray(Kt,rt+Ie)),We.size+=rt+Ie-Kt);break;case Ge:if(lr){if(ht&&(Q=Ve(ht)))switch(Te.segmentCodec){case"aac":this.parseAACPES(Te,Q);break;case"mp3":this.parseMPEGPES(Te,Q)}ht={data:[],size:0}}ht&&(ht.data.push(T.subarray(Kt,rt+Ie)),ht.size+=rt+Ie-Kt);break;case $e:lr&&(Dt&&(Q=Ve(Dt))&&this.parseID3PES(Re,Q),Dt={data:[],size:0}),Dt&&(Dt.data.push(T.subarray(Kt,rt+Ie)),Dt.size+=rt+Ie-Kt);break;case 0:lr&&(Kt+=T[Kt]+1),tr=this._pmtId=fe(T,Kt);break;case tr:lr&&(Kt+=T[Kt]+1);var Jt=Ce(T,Kt,this.typeSupported,C);(Be=Jt.avc)>0&&(Z.pid=Be),(Ge=Jt.audio)>0&&(Te.pid=Ge,Te.segmentCodec=Jt.segmentCodec),($e=Jt.id3)>0&&(Re.pid=$e),ze===null||Pt||(J.logger.log("unknown PID '"+ze+"' in TS found"),ze=null,rt=Ft-188),Pt=this.pmtParsed=!0;break;case 17:case 8191:break;default:ze=Ar}}else Ht++;Ht>0&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Ht+" TS packet/s that do not start with 0x47"}),Z.pesData=We,Te.pesData=ht,Re.pesData=Dt;var pr={audioTrack:Te,videoTrack:Z,id3Track:Re,textTrack:Pe};return G&&this.extractRemainingSamples(pr),pr},N.flush=function(){var T,O=this.remainderData;return this.remainderData=null,T=O?this.demux(O,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},N.extractRemainingSamples=function(T){var O,C=T.audioTrack,G=T.videoTrack,Q=T.id3Track,Z=T.textTrack,Te=G.pesData,Re=C.pesData,Pe=Q.pesData;if(Te&&(O=Ve(Te))?(this.parseAVCPES(G,Z,O,!0),G.pesData=null):G.pesData=Te,Re&&(O=Ve(Re))){switch(C.segmentCodec){case"aac":this.parseAACPES(C,O);break;case"mp3":this.parseMPEGPES(C,O)}C.pesData=null}else Re!=null&&Re.size&&J.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=Re;Pe&&(O=Ve(Pe))?(this.parseID3PES(Q,O),Q.pesData=null):Q.pesData=Pe},N.demuxSampleAes=function(T,O,C){var G=this.demux(T,C,!0,!this.config.progressive),Q=this.sampleAes=new H(this.observer,this.config,O);return this.decrypt(G,Q)},N.decrypt=function(T,O){return new Promise(function(C){var G=T.audioTrack,Q=T.videoTrack;G.samples&&G.segmentCodec==="aac"?O.decryptAacSamples(G.samples,0,function(){Q.samples?O.decryptAvcSamples(Q.samples,0,0,function(){C(T)}):C(T)}):Q.samples&&O.decryptAvcSamples(Q.samples,0,0,function(){C(T)})})},N.destroy=function(){this._duration=0},N.parseAVCPES=function(T,O,C,G){var Q,Z=this,Te=this.parseAVCNALu(T,C.data),Re=this.avcSample,Pe=!1;C.data=null,Re&&Te.length&&!T.audFound&&(Xe(Re,T),Re=this.avcSample=Fe(!1,C.pts,C.dts,"")),Te.forEach(function(Be){switch(Be.type){case 1:Q=!0,Re||(Re=Z.avcSample=Fe(!0,C.pts,C.dts,"")),Re.frame=!0;var We=Be.data;if(Pe&&We.length>4){var Ge=new Ue(We).readSliceType();Ge!==2&&Ge!==4&&Ge!==7&&Ge!==9||(Re.key=!0)}break;case 5:Q=!0,Re||(Re=Z.avcSample=Fe(!0,C.pts,C.dts,"")),Re.key=!0,Re.frame=!0;break;case 6:Q=!0,(0,ne.parseSEIMessageFromNALu)(Be.data,1,C.pts,O.samples);break;case 7:if(Q=!0,Pe=!0,!T.sps){var $e=new Ue(Be.data).readSPS();T.width=$e.width,T.height=$e.height,T.pixelRatio=$e.pixelRatio,T.sps=[Be.data],T.duration=Z._duration;for(var ht=Be.data.subarray(1,4),Dt="avc1.",ze=0;ze<3;ze++){var Pt=ht[ze].toString(16);Pt.length<2&&(Pt="0"+Pt),Dt+=Pt}T.codec=Dt}break;case 8:Q=!0,T.pps||(T.pps=[Be.data]);break;case 9:Q=!1,T.audFound=!0,Re&&Xe(Re,T),Re=Z.avcSample=Fe(!1,C.pts,C.dts,"");break;case 12:Q=!0;break;default:Q=!1,Re&&(Re.debug+="unknown NAL "+Be.type+" ")}Re&&Q&&Re.units.push(Be)}),G&&Re&&(Xe(Re,T),this.avcSample=null)},N.getLastNalUnit=function(T){var O,C,G=this.avcSample;if(G&&G.units.length!==0||(G=T[T.length-1]),(O=G)!==null&&O!==void 0&&O.units){var Q=G.units;C=Q[Q.length-1]}return C},N.parseAVCNALu=function(T,O){var C,G,Q=O.byteLength,Z=T.naluState||0,Te=Z,Re=[],Pe=0,Be=-1,We=0;for(Z===-1&&(Be=0,We=31&O[0],Z=0,Pe=1);Pe<Q;)if(C=O[Pe++],Z)if(Z!==1)if(C)if(C===1){if(Be>=0){var Ge={data:O.subarray(Be,Pe-Z-1),type:We};Re.push(Ge)}else{var $e=this.getLastNalUnit(T.samples);if($e&&(Te&&Pe<=4-Te&&$e.state&&($e.data=$e.data.subarray(0,$e.data.byteLength-Te)),(G=Pe-Z-1)>0)){var ht=new Uint8Array($e.data.byteLength+G);ht.set($e.data,0),ht.set(O.subarray(0,G),$e.data.byteLength),$e.data=ht,$e.state=0}}Pe<Q?(Be=Pe,We=31&O[Pe],Z=0):Z=-1}else Z=0;else Z=3;else Z=C?0:2;else Z=C?0:1;if(Be>=0&&Z>=0){var Dt={data:O.subarray(Be,Q),type:We,state:Z};Re.push(Dt)}if(Re.length===0){var ze=this.getLastNalUnit(T.samples);if(ze){var Pt=new Uint8Array(ze.data.byteLength+O.byteLength);Pt.set(ze.data,0),Pt.set(O,ze.data.byteLength),ze.data=Pt}}return T.naluState=Z,Re},N.parseAACPES=function(T,O){var C,G,Q,Z,Te,Re=0,Pe=this.aacOverFlow,Be=O.data;if(Pe){this.aacOverFlow=null;var We=Pe.missing,Ge=Pe.sample.unit.byteLength;if(We===-1){var $e=new Uint8Array(Ge+Be.byteLength);$e.set(Pe.sample.unit,0),$e.set(Be,Ge),Be=$e}else{var ht=Ge-We;Pe.sample.unit.set(Be.subarray(0,We),ht),T.samples.push(Pe.sample),Re=Pe.missing}}for(C=Re,G=Be.length;C<G-1&&!ke(Be,C);C++);if(C===Re||(C<G-1?(Q="AAC PES did not start with ADTS header,offset:"+C,Z=!1):(Q="no ADTS header found in AAC PES",Z=!0),J.logger.warn("parsing error:"+Q),this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:Q}),!Z)){if(V(T,this.observer,Be,C,this.audioCodec),O.pts!==void 0)Te=O.pts;else{if(!Pe)return void J.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var Dt=E(T.samplerate);Te=Pe.sample.pts+Dt}for(var ze,Pt=0;C<G;){if(C+=(ze=U(T,Be,C,Te,Pt)).length,ze.missing){this.aacOverFlow=ze;break}for(Pt++;C<G-1&&!ke(Be,C);C++);}}},N.parseMPEGPES=function(T,O){var C=O.data,G=C.length,Q=0,Z=0,Te=O.pts;if(Te!==void 0)for(;Z<G;)if(pe(C,Z)){var Re=qe(T,C,Z,Te,Q);if(!Re)break;Z+=Re.length,Q++}else Z++;else J.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},N.parseID3PES=function(T,O){if(O.pts!==void 0){var C=ve({},O,{type:this._avcTrack?L.MetadataSchema.emsg:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});T.samples.push(C)}else J.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},te}();function lt(te,N){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,O){return T.__proto__=O,T},lt(te,N)}let Ct=function(te){var N,T;function O(){return te.apply(this,arguments)||this}T=te,(N=O).prototype=Object.create(T.prototype),N.prototype.constructor=N,lt(N,T);var C=O.prototype;return C.resetInitSegment=function(G,Q,Z,Te){te.prototype.resetInitSegment.call(this,G,Q,Z,Te),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:Q,duration:Te,inputTimeScale:9e4,dropped:0}},O.probe=function(G){if(!G)return!1;for(var Q=(k.getID3Data(G,0)||[]).length,Z=G.length;Q<Z;Q++)if(ae(G,Q))return J.logger.log("MPEG Audio sync word found !"),!0;return!1},C.canParse=function(G,Q){return function(Z,Te){return ie(Z,Te)&&4<=Z.length-Te}(G,Q)},C.appendFrame=function(G,Q,Z){if(this.basePTS!==null)return qe(G,Q,Z,this.basePTS,this.frameIndex)},O}(ye);var Rt=B(524),St=B(923);function wt(te,N){var T=te==null?void 0:te.codec;return T&&T.length>4?T:T==="hvc1"||T==="hev1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||N===St.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}let gt=function(){function te(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndTime=null}var N=te.prototype;return N.destroy=function(){},N.resetTimeStamp=function(T){this.initPTS=T,this.lastEndTime=null},N.resetNextTimestamp=function(){this.lastEndTime=null},N.resetInitSegment=function(T,O,C,G){this.audioCodec=O,this.videoCodec=C,this.generateInitSegment((0,ne.patchEncyptionData)(T,G)),this.emitInitSegment=!0},N.generateInitSegment=function(T){var O=this.audioCodec,C=this.videoCodec;if(!T||!T.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var G=this.initData=(0,ne.parseInitSegment)(T);O||(O=wt(G.audio,St.ElementaryStreamTypes.AUDIO)),C||(C=wt(G.video,St.ElementaryStreamTypes.VIDEO));var Q={};G.audio&&G.video?Q.audiovideo={container:"video/mp4",codec:O+","+C,initSegment:T,id:"main"}:G.audio?Q.audio={container:"audio/mp4",codec:O,initSegment:T,id:"audio"}:G.video?Q.video={container:"video/mp4",codec:C,initSegment:T,id:"main"}:J.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=Q},N.remux=function(T,O,C,G,Q){var Z,Te=this.initPTS,Re=this.lastEndTime,Pe={audio:void 0,video:void 0,text:G,id3:C,initSegment:void 0};(0,g.isFiniteNumber)(Re)||(Re=this.lastEndTime=Q||0);var Be=O.samples;if(!Be||!Be.length)return Pe;var We={initPTS:void 0,timescale:1},Ge=this.initData;if(Ge&&Ge.length||(this.generateInitSegment(Be),Ge=this.initData),!Ge||!Ge.length)return J.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),Pe;this.emitInitSegment&&(We.tracks=this.initTracks,this.emitInitSegment=!1);var $e=(0,ne.getStartDTS)(Ge,Be);(0,g.isFiniteNumber)(Te)||(this.initPTS=We.initPTS=Te=$e-Q);var ht=(0,ne.getDuration)(Be,Ge),Dt=T?$e-Te:Re,ze=Dt+ht;(0,ne.offsetStartDTS)(Ge,Be,Te),ht>0?this.lastEndTime=ze:(J.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var Pt=!!Ge.audio,tr=!!Ge.video,jt="";Pt&&(jt+="audio"),tr&&(jt+="video");var Ft={data1:Be,startPTS:Dt,startDTS:Dt,endPTS:ze,endDTS:ze,type:jt,hasAudio:Pt,hasVideo:tr,nb:1,dropped:0};Pe.audio=Ft.type==="audio"?Ft:void 0,Pe.video=Ft.type!=="audio"?Ft:void 0,Pe.initSegment=We;var Ht=(Z=this.initPTS)!=null?Z:0;return Pe.id3=(0,Rt.flushTextTrackMetadataCueSamples)(C,Q,Ht,Ht),G.samples.length&&(Pe.text=(0,Rt.flushTextTrackUserdataCueSamples)(G,Q,Ht)),Pe},te}();var dt;try{dt=self.performance.now.bind(self.performance)}catch{J.logger.debug("Unable to use Performance API on this environment"),dt=self.Date.now}var tt=[{demux:z,remux:gt},{demux:it,remux:Rt.default},{demux:de,remux:Rt.default},{demux:Ct,remux:Rt.default}],It=function(){function te(T,O,C,G,Q){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=T,this.typeSupported=O,this.config=C,this.vendor=G,this.id=Q}var N=te.prototype;return N.configure=function(T){this.transmuxConfig=T,this.decrypter&&this.decrypter.reset()},N.push=function(T,O,C,G){var Q=this,Z=C.transmuxing;Z.executeStart=dt();var Te=new Uint8Array(T),Re=this.currentTransmuxState,Pe=this.transmuxConfig;G&&(this.currentTransmuxState=G);var Be=G||Re,We=Be.contiguous,Ge=Be.discontinuity,$e=Be.trackSwitch,ht=Be.accurateTimeOffset,Dt=Be.timeOffset,ze=Be.initSegmentChange,Pt=Pe.audioCodec,tr=Pe.videoCodec,jt=Pe.defaultInitPts,Ft=Pe.duration,Ht=Pe.initSegmentData,rt=function(Cr,vr){var Gt=null;return Cr.byteLength>0&&vr!=null&&vr.key!=null&&vr.iv!==null&&vr.method!=null&&(Gt=vr),Gt}(Te,O);if(rt&&rt.method==="AES-128"){var lr=this.getDecrypter();if(!lr.isSync())return this.decryptionPromise=lr.webCryptoDecrypt(Te,rt.key.buffer,rt.iv.buffer).then(function(Cr){var vr=Q.push(Cr,null,C);return Q.decryptionPromise=null,vr}),this.decryptionPromise;var Ar=lr.softwareDecrypt(Te,rt.key.buffer,rt.iv.buffer);if(!Ar)return Z.executeEnd=dt(),Ut(C);Te=new Uint8Array(Ar)}var Kt=this.needsProbing(Ge,$e);Kt&&this.configureTransmuxer(Te),(Ge||$e||ze||Kt)&&this.resetInitSegment(Ht,Pt,tr,Ft,O),(Ge||ze||Kt)&&this.resetInitialTimestamp(jt),We||this.resetContiguity();var Jt=this.transmux(Te,rt,Dt,ht,C),pr=this.currentTransmuxState;return pr.contiguous=!0,pr.discontinuity=!1,pr.trackSwitch=!1,Z.executeEnd=dt(),Jt},N.flush=function(T){var O=this,C=T.transmuxing;C.executeStart=dt();var G=this.decrypter,Q=this.currentTransmuxState,Z=this.decryptionPromise;if(Z)return Z.then(function(){return O.flush(T)});var Te=[],Re=Q.timeOffset;if(G){var Pe=G.flush();Pe&&Te.push(this.push(Pe,null,T))}var Be=this.demuxer,We=this.remuxer;if(!Be||!We)return this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=dt(),[Ut(T)];var Ge=Be.flush(Re);return Wt(Ge)?Ge.then(function($e){return O.flushRemux(Te,$e,T),Te}):(this.flushRemux(Te,Ge,T),Te)},N.flushRemux=function(T,O,C){var G=O.audioTrack,Q=O.videoTrack,Z=O.id3Track,Te=O.textTrack,Re=this.currentTransmuxState,Pe=Re.accurateTimeOffset,Be=Re.timeOffset;J.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var We=this.remuxer.remux(G,Q,Z,Te,Be,Pe,!0,this.id);T.push({remuxResult:We,chunkMeta:C}),C.transmuxing.executeEnd=dt()},N.resetInitialTimestamp=function(T){var O=this.demuxer,C=this.remuxer;O&&C&&(O.resetTimeStamp(T),C.resetTimeStamp(T))},N.resetContiguity=function(){var T=this.demuxer,O=this.remuxer;T&&O&&(T.resetContiguity(),O.resetNextTimestamp())},N.resetInitSegment=function(T,O,C,G,Q){var Z=this.demuxer,Te=this.remuxer;Z&&Te&&(Z.resetInitSegment(T,O,C,G),Te.resetInitSegment(T,O,C,Q))},N.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},N.transmux=function(T,O,C,G,Q){return O&&O.method==="SAMPLE-AES"?this.transmuxSampleAes(T,O,C,G,Q):this.transmuxUnencrypted(T,C,G,Q)},N.transmuxUnencrypted=function(T,O,C,G){var Q=this.demuxer.demux(T,O,!1,!this.config.progressive),Z=Q.audioTrack,Te=Q.videoTrack,Re=Q.id3Track,Pe=Q.textTrack;return{remuxResult:this.remuxer.remux(Z,Te,Re,Pe,O,C,!1,this.id),chunkMeta:G}},N.transmuxSampleAes=function(T,O,C,G,Q){var Z=this;return this.demuxer.demuxSampleAes(T,O,C).then(function(Te){return{remuxResult:Z.remuxer.remux(Te.audioTrack,Te.videoTrack,Te.id3Track,Te.textTrack,C,G,!1,Z.id),chunkMeta:Q}})},N.configureTransmuxer=function(T){for(var O,C=this.config,G=this.observer,Q=this.typeSupported,Z=this.vendor,Te=0,Re=tt.length;Te<Re;Te++)if(tt[Te].demux.probe(T)){O=tt[Te];break}O||(J.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),O={demux:z,remux:gt});var Pe=this.demuxer,Be=this.remuxer,We=O.remux,Ge=O.demux;Be&&Be instanceof We||(this.remuxer=new We(G,C,Q,Z)),Pe&&Pe instanceof Ge||(this.demuxer=new Ge(G,C,Q),this.probe=Ge.probe)},N.needsProbing=function(T,O){return!this.demuxer||!this.remuxer||T||O},N.getDecrypter=function(){var T=this.decrypter;return T||(T=this.decrypter=new R.default(this.config)),T},te}(),Ut=function(te){return{remuxResult:{},chunkMeta:te}};function Wt(te){return"then"in te&&te.then instanceof Function}var Bt=function(te,N,T,O,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=te,this.videoCodec=N,this.initSegmentData=T,this.duration=O,this.defaultInitPts=C},ar=function(te,N,T,O,C,G){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=te,this.contiguous=N,this.accurateTimeOffset=T,this.trackSwitch=O,this.timeOffset=C,this.initSegmentChange=G}},973:(oe,X,B)=>{"use strict";var j,re;B.r(X),B.d(X,{ErrorDetails:()=>re,ErrorTypes:()=>j}),function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"}(j||(j={})),function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",R.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",R.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",R.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"}(re||(re={}))},851:(oe,X,B)=>{"use strict";var j;B.r(X),B.d(X,{Events:()=>j}),function(re){re.MEDIA_ATTACHING="hlsMediaAttaching",re.MEDIA_ATTACHED="hlsMediaAttached",re.MEDIA_DETACHING="hlsMediaDetaching",re.MEDIA_DETACHED="hlsMediaDetached",re.BUFFER_RESET="hlsBufferReset",re.BUFFER_CODECS="hlsBufferCodecs",re.BUFFER_CREATED="hlsBufferCreated",re.BUFFER_APPENDING="hlsBufferAppending",re.BUFFER_APPENDED="hlsBufferAppended",re.BUFFER_EOS="hlsBufferEos",re.BUFFER_FLUSHING="hlsBufferFlushing",re.BUFFER_FLUSHED="hlsBufferFlushed",re.MANIFEST_LOADING="hlsManifestLoading",re.MANIFEST_LOADED="hlsManifestLoaded",re.MANIFEST_PARSED="hlsManifestParsed",re.LEVEL_SWITCHING="hlsLevelSwitching",re.LEVEL_SWITCHED="hlsLevelSwitched",re.LEVEL_LOADING="hlsLevelLoading",re.LEVEL_LOADED="hlsLevelLoaded",re.LEVEL_UPDATED="hlsLevelUpdated",re.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",re.LEVELS_UPDATED="hlsLevelsUpdated",re.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",re.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",re.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",re.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",re.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",re.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",re.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",re.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",re.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",re.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",re.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",re.CUES_PARSED="hlsCuesParsed",re.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",re.INIT_PTS_FOUND="hlsInitPtsFound",re.FRAG_LOADING="hlsFragLoading",re.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",re.FRAG_LOADED="hlsFragLoaded",re.FRAG_DECRYPTED="hlsFragDecrypted",re.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",re.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",re.FRAG_PARSING_METADATA="hlsFragParsingMetadata",re.FRAG_PARSED="hlsFragParsed",re.FRAG_BUFFERED="hlsFragBuffered",re.FRAG_CHANGED="hlsFragChanged",re.FPS_DROP="hlsFpsDrop",re.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",re.ERROR="hlsError",re.DESTROYING="hlsDestroying",re.KEY_LOADING="hlsKeyLoading",re.KEY_LOADED="hlsKeyLoaded",re.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",re.BACK_BUFFER_REACHED="hlsBackBufferReached"}(j||(j={}))},76:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{default:()=>ja});var j,re=B(945),R=B(965),g=B(851),k=B(973),L=B(93),me=/^(\d+)x(\d+)$/,ne=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,ce=function(){function d(e){for(var t in typeof e=="string"&&(e=d.parseAttrList(e)),e)e.hasOwnProperty(t)&&(this[t]=e[t])}var o=d.prototype;return o.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},o.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var i=new Uint8Array(t.length/2),n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(2*n,2*n+2),16);return i}return null},o.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},o.decimalFloatingPoint=function(e){return parseFloat(this[e])},o.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},o.enumeratedString=function(e){return this[e]},o.bool=function(e){return this[e]==="YES"},o.decimalResolution=function(e){var t=me.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},d.parseAttrList=function(e){var t,i={};for(ne.lastIndex=0;(t=ne.exec(e))!==null;){var n=t[2];n.indexOf('"')===0&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),i[t[1]]=n}return i},d}();function we(){return we=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},we.apply(this,arguments)}function q(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}(function(d){d.ID="ID",d.CLASS="CLASS",d.START_DATE="START-DATE",d.DURATION="DURATION",d.END_DATE="END-DATE",d.END_ON_NEXT="END-ON-NEXT",d.PLANNED_DURATION="PLANNED-DURATION",d.SCTE35_OUT="SCTE35-OUT",d.SCTE35_IN="SCTE35-IN"})(j||(j={}));var ye=function(){function d(t,i){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,i){var n=i.attr;for(var a in n)if(Object.prototype.hasOwnProperty.call(t,a)&&t[a]!==n[a]){L.logger.warn('DATERANGE tag attribute: "'+a+'" does not match for tags with ID: "'+t.ID+'"'),this._badValueForSameId=a;break}t=we(new ce({}),n,t)}if(this.attr=t,this._startDate=new Date(t[j.START_DATE]),j.END_DATE in this.attr){var r=new Date(this.attr[j.END_DATE]);(0,R.isFiniteNumber)(r.getTime())&&(this._endDate=r)}}var o,e;return o=d,(e=[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var t=this.duration;return t!==null?new Date(this._startDate.getTime()+1e3*t):null}},{key:"duration",get:function(){if(j.DURATION in this.attr){var t=this.attr.decimalFloatingPoint(j.DURATION);if((0,R.isFiniteNumber)(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return j.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(j.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(j.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&(0,R.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}])&&q(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}(),J=B(923);function se(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var K,Ee,ke,Ne=function(){function d(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}var o,e;return d.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var i=this.lastPartSn-t.lastPartSn,n=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!n||!!i,this.advanced=this.endSN>t.endSN||i>0||i===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},o=d,(e=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&(0,R.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return(t=this.fragments)!==null&&t!==void 0&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&se(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function V(d){return Uint8Array.from(atob(d),function(o){return o.charCodeAt(0)})}function E(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(o){return o.charCodeAt(0)})}function U(d){switch(d){case Ee.FAIRPLAY:return K.FAIRPLAY;case Ee.PLAYREADY:return K.PLAYREADY;case Ee.WIDEVINE:return K.WIDEVINE;case Ee.CLEARKEY:return K.CLEARKEY}}function D(d){switch(d){case K.FAIRPLAY:return Ee.FAIRPLAY;case K.PLAYREADY:return Ee.PLAYREADY;case K.WIDEVINE:return Ee.WIDEVINE;case K.CLEARKEY:return Ee.CLEARKEY}}function de(d){var o=d.drmSystems,e=d.widevineLicenseUrl,t=o?[K.FAIRPLAY,K.WIDEVINE,K.PLAYREADY,K.CLEARKEY].filter(function(i){return!!o[i]}):[];return!t[K.WIDEVINE]&&e&&t.push(K.WIDEVINE),t}(function(d){d.CLEARKEY="org.w3.clearkey",d.FAIRPLAY="com.apple.fps",d.PLAYREADY="com.microsoft.playready",d.WIDEVINE="com.widevine.alpha"})(K||(K={})),function(d){d.CLEARKEY="org.w3.clearkey",d.FAIRPLAY="com.apple.streamingkeydelivery",d.PLAYREADY="com.microsoft.playready",d.WIDEVINE="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"}(Ee||(Ee={})),function(d){d.WIDEVINE="edef8ba979d64acea3c827dcd51d21ed"}(ke||(ke={}));var Se=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null,z=B(63),$={},Le=function(){function d(e,t,i,n,a){n===void 0&&(n=[1]),a===void 0&&(a=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=a,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){$={}};var o=d.prototype;return o.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;switch(this.keyFormat){case"identity":return this.method==="SAMPLE-AES";case Ee.FAIRPLAY:case Ee.WIDEVINE:case Ee.PLAYREADY:case Ee.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},o.getDecryptData=function(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method!=="AES-128"||this.iv||L.logger.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(F){for(var P=new Uint8Array(16),W=12;W<16;W++)P[W]=F>>8*(15-W)&255;return P}(e);return new d(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=function(F){var P,W,ue=F.split(":"),_e=null;if(ue[0]==="data"&&ue.length===2){var ge=ue[1].split(";"),De=ge[ge.length-1].split(",");if(De.length===2){var He=De[0]==="base64",Je=De[1];He?(ge.splice(-1,1),_e=V(Je)):(P=E(Je).subarray(0,16),(W=new Uint8Array(16)).set(P,16-P.length),_e=W)}}return _e}(this.uri);if(i)switch(this.keyFormat){case Ee.WIDEVINE:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Ee.PLAYREADY:var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=(0,z.mp4pssh)(n,null,i);var a=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),r=String.fromCharCode.apply(null,Array.from(a)),s=r.substring(r.indexOf("<"),r.length),l=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(l){var u=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(u){var c=V(u).subarray(0,16);(function(F){var P=function(W,ue,_e){var ge=W[ue];W[ue]=W[_e],W[_e]=ge};P(F,0,3),P(F,1,2),P(F,4,5),P(F,6,7)})(c),this.keyId=c}}break;default:var v=i.subarray(0,16);if(v.length!==16){var m=new Uint8Array(16);m.set(v,16-v.length),v=m}this.keyId=v}if(!this.keyId||this.keyId.byteLength!==16){var _=$[this.uri];if(!_){var S=Object.keys($).length%Number.MAX_SAFE_INTEGER;_=new Uint8Array(16),new DataView(_.buffer,12,4).setUint32(0,S),$[this.uri]=_}this.keyId=_}return this},d}(),Oe={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function xe(d,o){return MediaSource.isTypeSupported((o||"video")+'/mp4;codecs="'+d+'"')}function be(){return be=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},be.apply(this,arguments)}var qe=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+|#EXT-X-SESSION-KEY:([^\n\r]*)[\r\n]+/g,at=/#EXT-X-MEDIA:(.*)/g,ie=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),pe=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),ae=function(){function d(){}return d.findGroup=function(o,e){for(var t=0;t<o.length;t++){var i=o[t];if(i.id===e)return i}},d.convertAVC1ToAVCOTI=function(o){var e=o.split(".");if(e.length>2){var t=e.shift()+".";return(t+=parseInt(e.shift()).toString(16))+("000"+parseInt(e.shift()).toString(16)).slice(-4)}return o},d.resolve=function(o,e){return(0,re.buildAbsoluteURL)(e,o,{alwaysNormalize:!0})},d.parseMasterPlaylist=function(o,e){var t,i=[],n=[],a={},r=[],s=!1;for(qe.lastIndex=0;(t=qe.exec(o))!=null;)if(t[1]){var l,u=new ce(t[1]),c={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(t[2],e)},v=u.decimalResolution("RESOLUTION");v&&(c.width=v.width,c.height=v.height),H((u.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),c),c.videoCodec&&c.videoCodec.indexOf("avc1")!==-1&&(c.videoCodec=d.convertAVC1ToAVCOTI(c.videoCodec)),(l=c.unknownCodecs)!==null&&l!==void 0&&l.length||n.push(c),i.push(c)}else if(t[3]){var m=new ce(t[3]);m["DATA-ID"]&&(s=!0,a[m["DATA-ID"]]=m)}else if(t[4]){var _=t[4],S=Ue(_,e);S.encrypted&&S.isSupported()?r.push(S):L.logger.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+_+'"')}return{levels:n.length>0&&n.length<i.length?n:i,sessionData:s?a:null,sessionKeys:r.length?r:null}},d.parseMasterPlaylistMedia=function(o,e,t,i){var n;i===void 0&&(i=[]);var a=[],r=0;for(at.lastIndex=0;(n=at.exec(o))!==null;){var s=new ce(n[1]);if(s.TYPE===t){var l={attrs:s,bitrate:0,id:r++,groupId:s["GROUP-ID"],instreamId:s["INSTREAM-ID"],name:s.NAME||s.LANGUAGE||"",type:t,default:s.bool("DEFAULT"),autoselect:s.bool("AUTOSELECT"),forced:s.bool("FORCED"),lang:s.LANGUAGE,url:s.URI?d.resolve(s.URI,e):""};if(i.length){var u=d.findGroup(i,l.groupId)||i[0];ve(l,u,"audioCodec"),ve(l,u,"textCodec")}a.push(l)}}return a},d.parseLevelPlaylist=function(o,e,t,i,n){var a,r,s,l=new Ne(e),u=l.fragments,c=null,v=0,m=0,_=0,S=0,F=null,P=new J.Fragment(i,e),W=-1,ue=!1;for(ie.lastIndex=0,l.m3u8=o;(a=ie.exec(o))!==null;){ue&&(ue=!1,(P=new J.Fragment(i,e)).start=_,P.sn=v,P.cc=S,P.level=t,c&&(P.initSegment=c,P.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null));var _e=a[1];if(_e){P.duration=parseFloat(_e);var ge=(" "+a[2]).slice(1);P.title=ge||null,P.tagList.push(ge?["INF",_e,ge]:["INF",_e])}else if(a[3]){if((0,R.isFiniteNumber)(P.duration)){if(P.start=_,s){P.levelkeys=s;var De=l.encryptedFragments;!P.levelkeys||!Object.keys(P.levelkeys).some(function(Ir){return P.levelkeys[Ir].isCommonEncryption})||De.length&&De[De.length-1].levelkeys===s||De.push(P)}P.sn=v,P.level=t,P.cc=S,P.urlId=n,u.push(P),P.relurl=(" "+a[3]).slice(1),Ie(P,F),F=P,_+=P.duration,v++,m=0,ue=!0}}else if(a[4]){var He=(" "+a[4]).slice(1);F?P.setByteRange(He,F):P.setByteRange(He)}else if(a[5])P.rawProgramDateTime=(" "+a[5]).slice(1),P.tagList.push(["PROGRAM-DATE-TIME",P.rawProgramDateTime]),W===-1&&(W=u.length);else{if(!(a=a[0].match(pe))){L.logger.warn("No matches on slow regex match for level playlist!");continue}for(r=1;r<a.length&&a[r]===void 0;r++);var Je=(" "+a[r]).slice(1),Ae=(" "+a[r+1]).slice(1),Ke=a[r+2]?(" "+a[r+2]).slice(1):"";switch(Je){case"PLAYLIST-TYPE":l.type=Ae.toUpperCase();break;case"MEDIA-SEQUENCE":v=l.startSN=parseInt(Ae);break;case"SKIP":var je=new ce(Ae),pt=je.decimalInteger("SKIPPED-SEGMENTS");if((0,R.isFiniteNumber)(pt)){l.skippedSegments=pt;for(var Mt=pt;Mt--;)u.unshift(null);v+=pt}var mt=je.enumeratedString("RECENTLY-REMOVED-DATERANGES");mt&&(l.recentlyRemovedDateranges=mt.split(" "));break;case"TARGETDURATION":l.targetduration=parseFloat(Ae);break;case"VERSION":l.version=parseInt(Ae);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(Ae||Ke)&&P.tagList.push(Ke?[Ae,Ke]:[Ae]);break;case"DISCONTINUITY":S++,P.tagList.push(["DIS"]);break;case"GAP":P.tagList.push([Je]);break;case"BITRATE":P.tagList.push([Je,Ae]);break;case"DATERANGE":var kt=new ce(Ae),xt=new ye(kt,l.dateRanges[kt.ID]);xt.isValid||l.skippedSegments?l.dateRanges[xt.id]=xt:L.logger.warn('Ignoring invalid DATERANGE tag: "'+Ae+'"'),P.tagList.push(["EXT-X-DATERANGE",Ae]);break;case"DISCONTINUITY-SEQUENCE":S=parseInt(Ae);break;case"KEY":var ir=Ue(Ae,e);if(ir.isSupported()){if(ir.method==="NONE"){s=void 0;break}s||(s={}),s[ir.keyFormat]&&(s=be({},s)),s[ir.keyFormat]=ir}else L.logger.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+Ae+'"');break;case"START":var er=new ce(Ae).decimalFloatingPoint("TIME-OFFSET");(0,R.isFiniteNumber)(er)&&(l.startTimeOffset=er);break;case"MAP":var Yt=new ce(Ae);if(P.duration){var nr=new J.Fragment(i,e);Fe(nr,Yt,t,s),c=nr,P.initSegment=c,c.rawProgramDateTime&&!P.rawProgramDateTime&&(P.rawProgramDateTime=c.rawProgramDateTime)}else Fe(P,Yt,t,s),c=P,ue=!0;break;case"SERVER-CONTROL":var _r=new ce(Ae);l.canBlockReload=_r.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=_r.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&_r.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=_r.optionalFloat("PART-HOLD-BACK",0),l.holdBack=_r.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Jn=new ce(Ae);l.partTarget=Jn.decimalFloatingPoint("PART-TARGET");break;case"PART":var Pr=l.partList;Pr||(Pr=l.partList=[]);var Bi=m>0?Pr[Pr.length-1]:void 0,ji=m++,Gi=new J.Part(new ce(Ae),P,e,ji,Bi);Pr.push(Gi),P.duration+=Gi.duration;break;case"PRELOAD-HINT":var ct=new ce(Ae);l.preloadHint=ct;break;case"RENDITION-REPORT":var yt=new ce(Ae);l.renditionReports=l.renditionReports||[],l.renditionReports.push(yt);break;default:L.logger.warn("line parsed but not handled: "+a)}}}F&&!F.relurl?(u.pop(),_-=F.duration,l.partList&&(l.fragmentHint=F)):l.partList&&(Ie(P,F),P.cc=S,l.fragmentHint=P);var Ei=u.length,jr=u[0],Or=u[Ei-1];if((_+=l.skippedSegments*l.targetduration)>0&&Ei&&Or){l.averagetargetduration=_/Ei;var Ti=Or.sn;l.endSN=Ti!=="initSegment"?Ti:0,l.live||(Or.endList=!0),jr&&(l.startCC=jr.cc)}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(_+=l.fragmentHint.duration),l.totalduration=_,l.endCC=S,W>0&&function(Ir,Gr){for(var Qr=Ir[Gr],Dr=Gr;Dr--;){var Jr=Ir[Dr];if(!Jr)return;Jr.programDateTime=Qr.programDateTime-1e3*Jr.duration,Qr=Jr}}(u,W),l},d}();function Ue(d,o){var e,t,i=new ce(d),n=(e=i.enumeratedString("METHOD"))!=null?e:"",a=i.URI,r=i.hexadecimalInteger("IV"),s=i.enumeratedString("KEYFORMATVERSIONS"),l=(t=i.enumeratedString("KEYFORMAT"))!=null?t:"identity";a&&i.IV&&!r&&L.logger.error("Invalid IV: "+i.IV);var u=a?ae.resolve(a,o):"",c=(s||"1").split("/").map(Number).filter(Number.isFinite);return new Le(n,u,l,c,r)}function H(d,o){["video","audio","text"].forEach(function(e){var t=d.filter(function(n){return function(a,r){var s=Oe[r];return!!s&&s[a.slice(0,4)]===!0}(n,e)});if(t.length){var i=t.filter(function(n){return n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0});o[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(n){return t.indexOf(n)===-1})}}),o.unknownCodecs=d}function ve(d,o,e){var t=o[e];t&&(d[e]=t)}function Ie(d,o){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):o!=null&&o.programDateTime&&(d.programDateTime=o.endProgramDateTime),(0,R.isFiniteNumber)(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function Fe(d,o,e,t){d.relurl=o.URI,o.BYTERANGE&&d.setByteRange(o.BYTERANGE),d.level=e,d.sn="initSegment",t&&(d.levelkeys=t),d.initSegment=null}var fe=B(308);function Ce(d,o){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=o.url),e}let Ve=function(){function d(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var o=d.prototype;return o.startLoad=function(e){},o.stopLoad=function(){this.destroyInternalLoaders()},o.registerListeners=function(){var e=this.hls;e.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,n=t.loader,a=new(i||n)(t);return e.loader=a,this.loaders[e.type]=a,a},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},o.onManifestLoading=function(e,t){var i=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:fe.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},o.onLevelLoading=function(e,t){var i=t.id,n=t.level,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:null,level:n,responseType:"text",type:fe.PlaylistContextType.LEVEL,url:a,deliveryDirectives:r})},o.onAudioTrackLoading=function(e,t){var i=t.id,n=t.groupId,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:n,level:null,responseType:"text",type:fe.PlaylistContextType.AUDIO_TRACK,url:a,deliveryDirectives:r})},o.onSubtitleTrackLoading=function(e,t){var i=t.id,n=t.groupId,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:n,level:null,responseType:"text",type:fe.PlaylistContextType.SUBTITLE_TRACK,url:a,deliveryDirectives:r})},o.load=function(e){var t,i,n,a,r,s,l=this.hls.config,u=this.getInternalLoader(e);if(u){var c=u.context;if(c&&c.url===e.url)return void L.logger.trace("[playlist-loader]: playlist request ongoing");L.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),u.abort()}switch(e.type){case fe.PlaylistContextType.MANIFEST:i=l.manifestLoadingMaxRetry,n=l.manifestLoadingTimeOut,a=l.manifestLoadingRetryDelay,r=l.manifestLoadingMaxRetryTimeout;break;case fe.PlaylistContextType.LEVEL:case fe.PlaylistContextType.AUDIO_TRACK:case fe.PlaylistContextType.SUBTITLE_TRACK:i=0,n=l.levelLoadingTimeOut;break;default:i=l.levelLoadingMaxRetry,n=l.levelLoadingTimeOut,a=l.levelLoadingRetryDelay,r=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part&&(e.type===fe.PlaylistContextType.LEVEL&&e.level!==null?s=this.hls.levels[e.level].details:e.type===fe.PlaylistContextType.AUDIO_TRACK&&e.id!==null?s=this.hls.audioTracks[e.id].details:e.type===fe.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(s=this.hls.subtitleTracks[e.id].details),s)){var v=s.partTarget,m=s.targetduration;v&&m&&(n=Math.min(1e3*Math.max(3*v,.8*m),n))}var _={timeout:n,maxRetry:i,retryDelay:a,maxRetryDelay:r,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(e,_,S)},o.loadsuccess=function(e,t,i,n){n===void 0&&(n=null),this.resetInternalLoader(i.type);var a=e.data;a.indexOf("#EXTM3U")===0?(t.parsing.start=performance.now(),a.indexOf("#EXTINF:")>0||a.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,i,n):this.handleMasterPlaylist(e,t,i,n)):this.handleManifestParsingError(e,i,"no EXTM3U delimiter",n)},o.loaderror=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!1,e)},o.loadtimeout=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!0)},o.handleMasterPlaylist=function(e,t,i,n){var a=this.hls,r=e.data,s=Ce(e,i),l=ae.parseMasterPlaylist(r,s),u=l.levels,c=l.sessionData,v=l.sessionKeys;if(u.length){var m=u.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),_=u.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),S=ae.parseMasterPlaylistMedia(r,s,"AUDIO",m),F=ae.parseMasterPlaylistMedia(r,s,"SUBTITLES",_),P=ae.parseMasterPlaylistMedia(r,s,"CLOSED-CAPTIONS");S.length&&(S.some(function(W){return!W.url})||!u[0].audioCodec||u[0].attrs.AUDIO||(L.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),S.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ce({}),bitrate:0,url:""}))),a.trigger(g.Events.MANIFEST_LOADED,{levels:u,audioTracks:S,subtitles:F,captions:P,url:s,stats:t,networkDetails:n,sessionData:c,sessionKeys:v})}else this.handleManifestParsingError(e,i,"no level found in manifest",n)},o.handleTrackOrLevelPlaylist=function(e,t,i,n){var a=this.hls,r=i.id,s=i.level,l=i.type,u=Ce(e,i),c=(0,R.isFiniteNumber)(r)?r:0,v=(0,R.isFiniteNumber)(s)?s:c,m=function(F){switch(F.type){case fe.PlaylistContextType.AUDIO_TRACK:return fe.PlaylistLevelType.AUDIO;case fe.PlaylistContextType.SUBTITLE_TRACK:return fe.PlaylistLevelType.SUBTITLE;default:return fe.PlaylistLevelType.MAIN}}(i),_=ae.parseLevelPlaylist(e.data,u,v,m,c);if(_.fragments.length){if(l===fe.PlaylistContextType.MANIFEST){var S={attrs:new ce({}),bitrate:0,details:_,name:"",url:u};a.trigger(g.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:u,stats:t,networkDetails:n,sessionData:null,sessionKeys:null})}t.parsing.end=performance.now(),i.levelDetails=_,this.handlePlaylistLoaded(e,t,i,n)}else a.trigger(g.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof i.level=="number"?i.level:void 0})},o.handleManifestParsingError=function(e,t,i,n){this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===fe.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:n})},o.handleNetworkError=function(e,t,i,n){i===void 0&&(i=!1),L.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var a=k.ErrorDetails.UNKNOWN,r=!1,s=this.getInternalLoader(e);switch(e.type){case fe.PlaylistContextType.MANIFEST:a=i?k.ErrorDetails.MANIFEST_LOAD_TIMEOUT:k.ErrorDetails.MANIFEST_LOAD_ERROR,r=!0;break;case fe.PlaylistContextType.LEVEL:a=i?k.ErrorDetails.LEVEL_LOAD_TIMEOUT:k.ErrorDetails.LEVEL_LOAD_ERROR,r=!1;break;case fe.PlaylistContextType.AUDIO_TRACK:a=i?k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,r=!1;break;case fe.PlaylistContextType.SUBTITLE_TRACK:a=i?k.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:k.ErrorDetails.SUBTITLE_LOAD_ERROR,r=!1}s&&this.resetInternalLoader(e.type);var l={type:k.ErrorTypes.NETWORK_ERROR,details:a,fatal:r,url:e.url,loader:s,context:e,networkDetails:t};n&&(l.response=n),this.hls.trigger(g.Events.ERROR,l)},o.handlePlaylistLoaded=function(e,t,i,n){var a=i.type,r=i.level,s=i.id,l=i.groupId,u=i.loader,c=i.levelDetails,v=i.deliveryDirectives;if(c!=null&&c.targetduration){if(u)switch(c.live&&(u.getCacheAge&&(c.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(c.ageHeader)||(c.ageHeader=0)),a){case fe.PlaylistContextType.MANIFEST:case fe.PlaylistContextType.LEVEL:this.hls.trigger(g.Events.LEVEL_LOADED,{details:c,level:r||0,id:s||0,stats:t,networkDetails:n,deliveryDirectives:v});break;case fe.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(g.Events.AUDIO_TRACK_LOADED,{details:c,id:s||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:v});break;case fe.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(g.Events.SUBTITLE_TRACK_LOADED,{details:c,id:s||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:v})}}else this.handleManifestParsingError(e,i,"invalid target duration",n)},d}();function Xe(d,o){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=d,o.dispatchEvent(e)}function it(d,o){var e=d.mode;if(e==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(o.id))try{if(d.addCue(o),!d.cues.getCueById(o.id))throw new Error("addCue is failed for: "+o)}catch(i){L.logger.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(o.startTime,o.endTime,o.text);t.id=o.id,d.addCue(t)}e==="disabled"&&(d.mode=e)}function lt(d){var o=d.mode;if(o==="disabled"&&(d.mode="hidden"),d.cues)for(var e=d.cues.length;e--;)d.removeCue(d.cues[e]);o==="disabled"&&(d.mode=o)}function Ct(d,o,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var n=function(r,s,l){var u=[],c=function(S,F){if(F<S[0].startTime)return 0;var P=S.length-1;if(F>S[P].endTime)return-1;for(var W=0,ue=P;W<=ue;){var _e=Math.floor((ue+W)/2);if(F<S[_e].startTime)ue=_e-1;else{if(!(F>S[_e].startTime&&W<P))return _e;W=_e+1}}return S[W].startTime-F<F-S[ue].startTime?W:ue}(r,s);if(c>-1)for(var v=c,m=r.length;v<m;v++){var _=r[v];if(_.startTime>=s&&_.endTime<=l)u.push(_);else if(_.startTime>l)return u}return u}(d.cues,o,e),a=0;a<n.length;a++)t&&!t(n[a])||d.removeCue(n[a]);i==="disabled"&&(d.mode=i)}var Rt=B(181),St=B(856);function wt(){return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var gt=function(){var d=wt();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function dt(d,o){return d.getTime()/1e3-o}let tt=function(){function d(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var o=d.prototype;return o.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},o._registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},o._unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},o.onMediaAttached=function(e,t){this.media=t.media},o.onMediaDetaching=function(){this.id3Track&&(lt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},o.onManifestLoading=function(){this.dateRangeCuesAppended={}},o.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},o.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Xe(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},o.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,n=i.enableEmsgMetadataCues,a=i.enableID3MetadataCues;if(n||a){var r=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var s=wt(),l=0;l<r.length;l++){var u=r[l].type;if((u!==St.MetadataSchema.emsg||n)&&a){var c=Rt.getID3Frames(r[l].data);if(c){var v=r[l].pts,m=v+r[l].duration;m>gt&&(m=gt),m-v<=0&&(m=v+.25);for(var _=0;_<c.length;_++){var S=c[_];if(!Rt.isTimeStampFrame(S)){this.updateId3CueEnds(v);var F=new s(v,m,"");F.value=S,u&&(F.type=u),this.id3Track.addCue(F)}}}}}}}},o.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)===null||t===void 0?void 0:t.cues;if(i)for(var n=i.length;n--;){var a=i[n];a.startTime<e&&a.endTime===gt&&(a.endTime=e)}},o.onBufferFlushing=function(e,t){var i=t.startOffset,n=t.endOffset,a=t.type,r=this.id3Track,s=this.hls;if(s){var l=s.config,u=l.enableEmsgMetadataCues,c=l.enableID3MetadataCues;r&&(u||c)&&Ct(r,i,n,a==="audio"?function(v){return v.type===St.MetadataSchema.audioId3&&c}:a==="video"?function(v){return v.type===St.MetadataSchema.emsg&&u}:function(v){return v.type===St.MetadataSchema.audioId3&&c||v.type===St.MetadataSchema.emsg&&u})}},o.onLevelUpdated=function(e,t){var i=this,n=t.details;if(this.media&&n.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var a=this.dateRangeCuesAppended,r=this.id3Track,s=n.dateRanges,l=Object.keys(s);if(r)for(var u=Object.keys(a).filter(function(W){return!l.includes(W)}),c=function(W){var ue=u[W];Object.keys(a[ue].cues).forEach(function(_e){r.removeCue(a[ue].cues[_e])}),delete a[ue]},v=u.length;v--;)c(v);var m=n.fragments[n.fragments.length-1];if(l.length!==0&&(0,R.isFiniteNumber)(m==null?void 0:m.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var _=m.programDateTime/1e3-m.start,S=wt(),F=function(W){var ue=l[W],_e=s[ue],ge=a[ue],De=(ge==null?void 0:ge.cues)||{},He=(ge==null?void 0:ge.durationKnown)||!1,Je=dt(_e.startDate,_),Ae=gt,Ke=_e.endDate;if(Ke)Ae=dt(Ke,_),He=!0;else if(_e.endOnNext&&!He){var je=l.reduce(function(er,Yt){var nr=s[Yt];return nr.class===_e.class&&nr.id!==Yt&&nr.startDate>_e.startDate&&er.push(nr),er},[]).sort(function(er,Yt){return er.startDate.getTime()-Yt.startDate.getTime()})[0];je&&(Ae=dt(je.startDate,_),He=!0)}for(var pt,Mt=Object.keys(_e.attr),mt=0;mt<Mt.length;mt++){var kt=Mt[mt];if(kt!==j.ID&&kt!==j.CLASS&&kt!==j.START_DATE&&kt!==j.DURATION&&kt!==j.END_DATE&&kt!==j.END_ON_NEXT){var xt=De[kt];if(xt)He&&!ge.durationKnown&&(xt.endTime=Ae);else{var ir=_e.attr[kt];xt=new S(Je,Ae,""),kt!==j.SCTE35_OUT&&kt!==j.SCTE35_IN||(pt=ir,ir=Uint8Array.from(pt.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),xt.value={key:kt,data:ir},xt.type=St.MetadataSchema.dateRange,i.id3Track.addCue(xt),De[kt]=xt}}}a[ue]={cues:De,dateRange:_e,durationKnown:He}},P=0;P<l.length;P++)F(P)}}},d}();function It(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Ut=function(){function d(i){var n=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return n.timeupdate()},this.hls=i,this.config=i.config,this.registerListeners()}var o,e,t=d.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},t.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(g.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(g.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(g.Events.ERROR,this.onError)},t.onMediaAttached=function(i,n){this.media=n.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(i,n){var a=n.details;this.levelDetails=a,a.advanced&&this.timeupdate(),!a.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},t.onError=function(i,n){n.details===k.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},t.timeupdate=function(){var i=this.media,n=this.levelDetails;if(i&&n){this.currentTime=i.currentTime;var a=this.computeLatency();if(a!==null){this._latency=a;var r=this.config,s=r.lowLatencyMode,l=r.maxLiveSyncPlaybackRate;if(s&&l!==1){var u=this.targetLatency;if(u!==null){var c=a-u,v=c<Math.min(this.maxLatency,u+n.targetduration);if(n.live&&v&&c>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,l)),_=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;i.playbackRate=Math.min(m,Math.max(1,_))}else i.playbackRate!==1&&i.playbackRate!==0&&(i.playbackRate=1)}}}}},t.estimateLiveEdge=function(){var i=this.levelDetails;return i===null?null:i.edge+i.age},t.computeLatency=function(){var i=this.estimateLiveEdge();return i===null?null:i-this.currentTime},o=d,(e=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var i=this.config,n=this.levelDetails;return i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:n?i.liveMaxLatencyDurationCount*n.targetduration:0}},{key:"targetLatency",get:function(){var i=this.levelDetails;if(i===null)return null;var n=i.holdBack,a=i.partHoldBack,r=i.targetduration,s=this.config,l=s.liveSyncDuration,u=s.liveSyncDurationCount,c=s.lowLatencyMode,v=this.hls.userConfig,m=c&&a||n;(v.liveSyncDuration||v.liveSyncDurationCount||m===0)&&(m=l!==void 0?l:u*r);var _=r;return m+Math.min(1*this.stallCount,_)}},{key:"liveSyncPosition",get:function(){var i=this.estimateLiveEdge(),n=this.targetLatency,a=this.levelDetails;if(i===null||n===null||a===null)return null;var r=a.edge,s=i-n-this.edgeStalled,l=r-a.totalduration,u=r-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(l,s),u)}},{key:"drift",get:function(){var i=this.levelDetails;return i===null?1:i.drift}},{key:"edgeStalled",get:function(){var i=this.levelDetails;if(i===null)return 0;var n=3*(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.max(i.age-n,0)}},{key:"forwardBufferLength",get:function(){var i=this.media,n=this.levelDetails;if(!i||!n)return 0;var a=i.buffered.length;return(a?i.buffered.end(a-1):n.edge)-this.currentTime}}])&&It(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function Wt(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Bt,ar=["NONE","TYPE-0","TYPE-1","TYPE-2",null];(function(d){d.No="",d.Yes="YES",d.v2="v2"})(Bt||(Bt={}));var te=function(){function d(o,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=o,this.part=e,this.skip=t}return d.prototype.addDirectives=function(o){var e=new self.URL(o);return this.msn!==void 0&&e.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href},d}(),N=function(){function d(t){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter(function(i){return i}).join(",").replace(/\.[^.,]+/g,"")}var o,e;return o=d,(e=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var i=t%this.url.length;this._urlId!==i&&(this.details=void 0,this._urlId=i)}}])&&Wt(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function T(){return T=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},T.apply(this,arguments)}function O(d,o,e){switch(o){case"audio":d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds.push(e);break;case"text":d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds.push(e)}}function C(d){var o={};d.forEach(function(e){var t=e.groupId||"";e.id=o[t]=o[t]||0,o[t]++})}function G(d,o){var e=o.startPTS;if((0,R.isFiniteNumber)(e)){var t,i=0;o.sn>d.sn?(i=e-d.start,t=d):(i=d.start-e,t=o),t.duration!==i&&(t.duration=i)}else o.sn>d.sn?d.cc===o.cc&&d.minEndPTS?o.start=d.start+(d.minEndPTS-d.start):o.start=d.start+d.duration:o.start=Math.max(d.start-o.duration,0)}function Q(d,o,e,t,i,n){t-e<=0&&(L.logger.warn("Fragment should have a positive duration",o),t=e+o.duration,n=i+o.duration);var a=e,r=t,s=o.startPTS,l=o.endPTS;if((0,R.isFiniteNumber)(s)){var u=Math.abs(s-e);(0,R.isFiniteNumber)(o.deltaPTS)?o.deltaPTS=Math.max(u,o.deltaPTS):o.deltaPTS=u,a=Math.max(e,s),e=Math.min(e,s),i=Math.min(i,o.startDTS),r=Math.min(t,l),t=Math.max(t,l),n=Math.max(n,o.endDTS)}o.duration=t-e;var c=e-o.start;o.start=o.startPTS=e,o.maxStartPTS=a,o.startDTS=i,o.endPTS=t,o.minEndPTS=r,o.endDTS=n;var v,m=o.sn;if(!d||m<d.startSN||m>d.endSN)return 0;var _=m-d.startSN,S=d.fragments;for(S[_]=o,v=_;v>0;v--)G(S[v],S[v-1]);for(v=_;v<S.length-1;v++)G(S[v],S[v+1]);return d.fragmentHint&&G(S[S.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,c}function Z(d,o){var e=o.startSN+o.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Te(o,t[e].start)}function Te(d,o){if(o){for(var e=d.fragments,t=d.skippedSegments;t<e.length;t++)e[t].start+=o;d.fragmentHint&&(d.fragmentHint.start+=o)}}var Re=function(){function d(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=L.logger.log.bind(L.logger,t+":"),this.warn=L.logger.warn.bind(L.logger,t+":"),this.hls=e}var o=d.prototype;return o.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},o.onError=function(e,t){!t.fatal||t.type!==k.ErrorTypes.NETWORK_ERROR&&t.type!==k.ErrorTypes.KEY_SYSTEM_ERROR||this.stopLoad()},o.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},o.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.requestScheduled=-1,this.loadPlaylist()},o.stopLoad=function(){this.canLoad=!1,this.clearTimer()},o.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i)for(var n=0;n<i.length;n++){var a=i[n],r=void 0;try{r=new self.URL(a.URI,t.url).href}catch(c){L.logger.warn("Could not construct new URL for Rendition Report: "+c),r=a.URI||""}if(r===e.slice(-r.length)){var s=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn),l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}return new te(s,l>=0?l:void 0,Bt.No)}}},o.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},o.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},o.playlistLoaded=function(e,t,i){var n=this,a=t.details,r=t.stats,s=self.performance.now(),l=r.loading.first?Math.max(0,s-r.loading.first):0;if(a.advancedDateTime=Date.now()-l,a.live||i!=null&&i.live){if(a.reloaded(i),i&&this.log("live playlist "+e+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),i&&a.fragments.length>0&&function(Ke,je){for(var pt=null,Mt=Ke.fragments,mt=Mt.length-1;mt>=0;mt--){var kt=Mt[mt].initSegment;if(kt){pt=kt;break}}Ke.fragmentHint&&delete Ke.fragmentHint.endPTS;var xt,ir,er,Yt,nr,_r=0;if(function(ct,yt,Ei){for(var jr=yt.skippedSegments,Or=Math.max(ct.startSN,yt.startSN)-yt.startSN,Ti=(ct.fragmentHint?1:0)+(jr?yt.endSN:Math.min(ct.endSN,yt.endSN))-yt.startSN,Ir=yt.startSN-ct.startSN,Gr=yt.fragmentHint?yt.fragments.concat(yt.fragmentHint):yt.fragments,Qr=ct.fragmentHint?ct.fragments.concat(ct.fragmentHint):ct.fragments,Dr=Or;Dr<=Ti;Dr++){var Jr=Qr[Ir+Dr],yn=Gr[Dr];jr&&!yn&&Dr<jr&&(yn=yt.fragments[Dr]=Jr),Jr&&yn&&Ei(Jr,yn)}}(Ke,je,function(ct,yt){ct.relurl&&(_r=ct.cc-yt.cc),(0,R.isFiniteNumber)(ct.startPTS)&&(0,R.isFiniteNumber)(ct.endPTS)&&(yt.start=yt.startPTS=ct.startPTS,yt.startDTS=ct.startDTS,yt.appendedPTS=ct.appendedPTS,yt.maxStartPTS=ct.maxStartPTS,yt.endPTS=ct.endPTS,yt.endDTS=ct.endDTS,yt.minEndPTS=ct.minEndPTS,yt.duration=ct.endPTS-ct.startPTS,yt.duration&&(xt=yt),je.PTSKnown=je.alignedSliding=!0),yt.elementaryStreams=ct.elementaryStreams,yt.loader=ct.loader,yt.stats=ct.stats,yt.urlId=ct.urlId,ct.initSegment&&(yt.initSegment=ct.initSegment,pt=ct.initSegment)}),pt&&(je.fragmentHint?je.fragments.concat(je.fragmentHint):je.fragments).forEach(function(ct){var yt;ct.initSegment&&ct.initSegment.relurl!==((yt=pt)===null||yt===void 0?void 0:yt.relurl)||(ct.initSegment=pt)}),je.skippedSegments)if(je.deltaUpdateFailed=je.fragments.some(function(ct){return!ct}),je.deltaUpdateFailed){L.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var Jn=je.skippedSegments;Jn--;)je.fragments.shift();je.startSN=je.fragments[0].sn,je.startCC=je.fragments[0].cc}else je.canSkipDateRanges&&(je.dateRanges=(ir=Ke.dateRanges,er=je.dateRanges,Yt=je.recentlyRemovedDateranges,nr=T({},ir),Yt&&Yt.forEach(function(ct){delete nr[ct]}),Object.keys(er).forEach(function(ct){var yt=new ye(er[ct].attr,nr[ct]);yt.isValid?nr[ct]=yt:L.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(er[ct].attr)+'"')}),nr));var Pr=je.fragments;if(_r){L.logger.warn("discontinuity sliding from playlist, take drift into account");for(var Bi=0;Bi<Pr.length;Bi++)Pr[Bi].cc+=_r}je.skippedSegments&&(je.startCC=je.fragments[0].cc),function(ct,yt,Ei){if(ct&&yt)for(var jr=0,Or=0,Ti=ct.length;Or<=Ti;Or++){var Ir=ct[Or],Gr=yt[Or+jr];Ir&&Gr&&Ir.index===Gr.index&&Ir.fragment.sn===Gr.fragment.sn?(Qr=Ir,(Dr=Gr).elementaryStreams=Qr.elementaryStreams,Dr.stats=Qr.stats):jr--}var Qr,Dr}(Ke.partList,je.partList),xt?Q(je,xt,xt.startPTS,xt.endPTS,xt.startDTS,xt.endDTS):Z(Ke,je),Pr.length&&(je.totalduration=je.edge-Pr[0].start),je.driftStartTime=Ke.driftStartTime,je.driftStart=Ke.driftStart;var ji=je.advancedDateTime;if(je.advanced&&ji){var Gi=je.edge;je.driftStart||(je.driftStartTime=ji,je.driftStart=Gi),je.driftEndTime=ji,je.driftEnd=Gi}else je.driftEndTime=Ke.driftEndTime,je.driftEnd=Ke.driftEnd,je.advancedDateTime=Ke.advancedDateTime}(i,a),!this.canLoad||!a.live)return;var u,c=void 0,v=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var m=this.hls.config.lowLatencyMode,_=a.lastPartSn,S=a.endSN,F=a.lastPartIndex,P=_===S;F!==-1?(c=P?S+1:_,v=P?m?0:F:F+1):c=S+1;var W=a.age,ue=W+a.ageHeader,_e=Math.min(ue-a.partTarget,1.5*a.targetduration);if(_e>0){if(i&&_e>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+_e+" with playlist age: "+a.age),_e=0;else{var ge=Math.floor(_e/a.targetduration);c+=ge,v!==void 0&&(v+=Math.round(_e%a.targetduration/a.partTarget)),this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+W.toFixed(2)+"s goal: "+_e+" skip sn "+ge+" to part "+v)}a.tuneInGoal=_e}if(u=this.getDeliveryDirectives(a,t.deliveryDirectives,c,v),m||!P)return void this.loadPlaylist(u)}else u=this.getDeliveryDirectives(a,t.deliveryDirectives,c,v);var De=this.hls.mainForwardBufferInfo,He=De?De.end-De.len:0,Je=function(Ke,je){je===void 0&&(je=1/0);var pt=1e3*Ke.targetduration;if(Ke.updated){var Mt=Ke.fragments;if(Mt.length&&4*pt>je){var mt=1e3*Mt[Mt.length-1].duration;mt<pt&&(pt=mt)}}else pt/=2;return Math.round(pt)}(a,1e3*(a.edge-He));a.updated?s>this.requestScheduled+Je&&(this.requestScheduled=r.loading.start):this.requestScheduled=-1,c!==void 0&&a.canBlockReload?this.requestScheduled=r.loading.first+Je-(1e3*a.partTarget||1e3):this.requestScheduled=(this.requestScheduled===-1?s:this.requestScheduled)+Je;var Ae=this.requestScheduled-s;Ae=Math.max(0,Ae),this.log("reload live playlist "+e+" in "+Math.round(Ae)+" ms"),this.timer=self.setTimeout(function(){return n.loadPlaylist(u)},Ae)}else this.clearTimer()},o.getDeliveryDirectives=function(e,t,i,n){var a=function(r,s){var l=r.canSkipUntil,u=r.canSkipDateRanges,c=r.endSN;return l&&(s!==void 0?s-c:0)<l?u?Bt.v2:Bt.Yes:Bt.No}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,a=Bt.No),new te(i,n,a)},o.retryLoadingOrFail=function(e){var t,i=this,n=this.hls.config,a=this.retryCount<n.levelLoadingMaxRetry;if(a)if(this.requestScheduled=-1,this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&(t=e.context)!==null&&t!==void 0&&t.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return i.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return a},d}();function Pe(){return Pe=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Pe.apply(this,arguments)}function Be(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function We(d,o){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},We(d,o)}var Ge,$e=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),ht=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[level-controller]")||this)._levels=[],s._firstLevel=-1,s._startLevel=void 0,s.currentLevelIndex=-1,s.manualLevelIndex=-1,s.onParsedComplete=void 0,s._registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,We(o,e);var i,n,a=t.prototype;return a._registerListeners=function(){var r=this.hls;r.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,d.prototype.destroy.call(this)},a.startLoad=function(){this._levels.forEach(function(r){r.loadError=0}),d.prototype.startLoad.call(this)},a.onManifestLoaded=function(r,s){var l,u,c=[],v=[],m=[],_={},S=!1,F=!1,P=!1;if(s.levels.forEach(function(ge){var De=ge.attrs;S=S||!(!ge.width||!ge.height),F=F||!!ge.videoCodec,P=P||!!ge.audioCodec,$e&&ge.audioCodec&&ge.audioCodec.indexOf("mp4a.40.34")!==-1&&(ge.audioCodec=void 0);var He=ge.bitrate+"-"+ge.attrs.RESOLUTION+"-"+ge.attrs.CODECS;(u=_[He])?u.url.push(ge.url):(u=new N(ge),_[He]=u,c.push(u)),De&&(De.AUDIO&&O(u,"audio",De.AUDIO),De.SUBTITLES&&O(u,"text",De.SUBTITLES))}),(S||F)&&P&&(c=c.filter(function(ge){var De=ge.videoCodec,He=ge.width,Je=ge.height;return!!De||!(!He||!Je)})),c=c.filter(function(ge){var De=ge.audioCodec,He=ge.videoCodec;return(!De||xe(De,"audio"))&&(!He||xe(He,"video"))}),s.audioTracks&&C(v=s.audioTracks.filter(function(ge){return!ge.audioCodec||xe(ge.audioCodec,"audio")})),s.subtitles&&C(m=s.subtitles),c.length>0){l=c[0].bitrate,c.sort(function(ge,De){return ge.attrs["HDCP-LEVEL"]!==De.attrs["HDCP-LEVEL"]?(ge.attrs["HDCP-LEVEL"]||"")>(De.attrs["HDCP-LEVEL"]||"")?1:-1:ge.bitrate!==De.bitrate?ge.bitrate-De.bitrate:ge.attrs.SCORE!==De.attrs.SCORE?ge.attrs.decimalFloatingPoint("SCORE")-De.attrs.decimalFloatingPoint("SCORE"):S&&ge.height!==De.height?ge.height-De.height:0}),this._levels=c;for(var W=0;W<c.length;W++)if(c[W].bitrate===l){this._firstLevel=W,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+l);break}var ue=P&&!F,_e={levels:c,audioTracks:v,subtitleTracks:m,sessionData:s.sessionData,sessionKeys:s.sessionKeys,firstLevel:this._firstLevel,stats:s.stats,audio:P,video:F,altAudio:!ue&&v.some(function(ge){return!!ge.url})};this.hls.trigger(g.Events.MANIFEST_PARSED,_e),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:s.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(r,s){var l,u;if(d.prototype.onError.call(this,r,s),!s.fatal){var c=s.context,v=this._levels[this.currentLevelIndex];if(c&&(c.type===fe.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&c.groupId===v.audioGroupIds[v.urlId]||c.type===fe.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&c.groupId===v.textGroupIds[v.urlId]))this.redundantFailover(this.currentLevelIndex);else{var m,_=!1,S=!0;switch(s.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(s.frag){var F=s.frag.type===fe.PlaylistLevelType.MAIN?s.frag.level:this.currentLevelIndex,P=this._levels[F];P?(P.fragmentError++,P.fragmentError>this.hls.config.fragLoadingMaxRetry&&(m=F)):m=F}break;case k.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var W=v.attrs["HDCP-LEVEL"];W&&(this.hls.maxHdcpLevel=ar[ar.indexOf(W)-1],this.warn('Restricting playback to HDCP-LEVEL of "'+this.hls.maxHdcpLevel+'" or lower'));case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_SYSTEM_NO_SESSION:m=((l=s.frag)===null||l===void 0?void 0:l.type)===fe.PlaylistLevelType.MAIN?s.frag.level:this.currentLevelIndex,s.levelRetry=!1;break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:c&&(c.deliveryDirectives&&(S=!1),m=c.level),_=!0;break;case k.ErrorDetails.REMUX_ALLOC_ERROR:m=(u=s.level)!=null?u:this.currentLevelIndex,_=!0}m!==void 0&&this.recoverLevel(s,m,_,S)}}},a.recoverLevel=function(r,s,l,u){var c=r.details,v=this._levels[s];if(v.loadError++,l){if(!this.retryLoadingOrFail(r))return void(this.currentLevelIndex=-1);r.levelRetry=!0}if(u){var m=v.url.length;if(m>1&&v.loadError<m)r.levelRetry=!0,this.redundantFailover(s);else if(this.manualLevelIndex===-1){for(var _=-1,S=this._levels,F=S.length;F--;){var P=(F+this.currentLevelIndex)%S.length;if(P!==this.currentLevelIndex&&S[P].loadError===0){_=P;break}}_>-1&&this.currentLevelIndex!==_?(this.warn(c+": switch to "+_),r.levelRetry=!0,this.hls.nextAutoLevel=_):r.levelRetry===!1&&(r.fatal=!0)}}},a.redundantFailover=function(r){var s=this._levels[r],l=s.url.length;if(l>1){var u=(s.urlId+1)%l;this.warn("Switching to redundant URL-id "+u),this._levels.forEach(function(c){c.urlId=u}),this.level=r}},a.onFragLoaded=function(r,s){var l=s.frag;if(l!==void 0&&l.type===fe.PlaylistLevelType.MAIN){var u=this._levels[l.level];u!==void 0&&(u.fragmentError=0,u.loadError=0)}},a.onLevelLoaded=function(r,s){var l,u,c=s.level,v=s.details,m=this._levels[c];if(!m)return this.warn("Invalid level index "+c),void((u=s.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(v.deltaUpdateFailed=!0));c===this.currentLevelIndex?(m.fragmentError===0&&(m.loadError=0,this.retryCount=0),this.playlistLoaded(c,s,m.details)):(l=s.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(v.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(r,s){var l=this.hls.levels[this.currentLevelIndex];if(l&&l.audioGroupIds){for(var u=-1,c=this.hls.audioTracks[s.id].groupId,v=0;v<l.audioGroupIds.length;v++)if(l.audioGroupIds[v]===c){u=v;break}u!==l.urlId&&(l.urlId=u,this.startLoad())}},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.currentLevelIndex,l=this._levels[s];if(this.canLoad&&l&&l.url.length>0){var u=l.urlId,c=l.url[u];if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+s+(r?" at sn "+r.msn+" part "+r.part:"")+" with URL-id "+u+" "+c),this.clearTimer(),this.hls.trigger(g.Events.LEVEL_LOADING,{url:c,level:s,id:u,deliveryDirectives:r||null})}},a.removeLevel=function(r,s){var l=function(c,v){return v!==s},u=this._levels.filter(function(c,v){return v!==r||c.url.length>1&&s!==void 0&&(c.url=c.url.filter(l),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(l)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(l)),c.urlId=0,!0)}).map(function(c,v){var m=c.details;return m!=null&&m.fragments&&m.fragments.forEach(function(_){_.level=v}),c});this._levels=u,this.hls.trigger(g.Events.LEVELS_UPDATED,{levels:u})},i=t,(n=[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(r){var s,l=this._levels;if(l.length!==0&&(this.currentLevelIndex!==r||(s=l[r])===null||s===void 0||!s.details)){if(r<0||r>=l.length){var u=r<0;if(this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.LEVEL_SWITCH_ERROR,level:r,fatal:u,reason:"invalid level idx"}),u)return;r=Math.min(r,l.length-1)}this.clearTimer();var c=this.currentLevelIndex,v=l[c],m=l[r];this.log("switching to level "+r+" from "+c),this.currentLevelIndex=r;var _=Pe({},m,{level:r,maxBitrate:m.maxBitrate,uri:m.uri,urlId:m.urlId});delete _._urlId,this.hls.trigger(g.Events.LEVEL_SWITCHING,_);var S=m.details;if(!S||S.live){var F=this.switchParams(m.uri,v==null?void 0:v.details);this.loadPlaylist(F)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(r){this.manualLevelIndex=r,this._startLevel===void 0&&(this._startLevel=r),r!==-1&&(this.level=r)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(r){this._firstLevel=r}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var r=this.hls.config.startLevel;return r!==void 0?r:this._firstLevel}return this._startLevel},set:function(r){this._startLevel=r}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(r){this.level=r,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=r)}}])&&Be(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);(function(d){d.NOT_LOADED="NOT_LOADED",d.APPENDING="APPENDING",d.PARTIAL="PARTIAL",d.OK="OK"})(Ge||(Ge={}));var Dt=function(){function d(e){this.activeFragment=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var o=d.prototype;return o._registerListeners=function(){var e=this.hls;e.on(g.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.Events.FRAG_LOADED,this.onFragLoaded,this)},o._unregisterListeners=function(){var e=this.hls;e.off(g.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.Events.FRAG_LOADED,this.onFragLoaded,this)},o.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.activeFragment=this.activeParts=null},o.getAppendedFrag=function(e,t){if(t===fe.PlaylistLevelType.MAIN){var i=this.activeFragment,n=this.activeParts;if(!i)return null;if(n)for(var a=n.length;a--;){var r=n[a],s=r?r.end:i.appendedPTS;if(r.start<=e&&s!==void 0&&e<=s)return a>9&&(this.activeParts=n.slice(a-9)),r}else if(i.start<=e&&i.appendedPTS!==void 0&&e<=i.appendedPTS)return i}return this.getBufferedFrag(e,t)},o.getBufferedFrag=function(e,t){for(var i=this.fragments,n=Object.keys(i),a=n.length;a--;){var r=i[n[a]];if((r==null?void 0:r.body.type)===t&&r.buffered){var s=r.body;if(s.start<=e&&e<=s.end)return s}}return null},o.detectEvictedFragments=function(e,t,i){var n=this;this.timeRanges&&(this.timeRanges[e]=t),Object.keys(this.fragments).forEach(function(a){var r=n.fragments[a];if(r)if(r.buffered||r.loaded){var s=r.range[e];s&&s.time.some(function(l){var u=!n.isTimeBuffered(l.startPTS,l.endPTS,t);return u&&n.removeFragment(r.body),u})}else r.body.type===i&&n.removeFragment(r.body)})},o.detectPartialFragments=function(e){var t=this,i=this.timeRanges,n=e.frag,a=e.part;if(i&&n.sn!=="initSegment"){var r=Pt(n),s=this.fragments[r];s&&(Object.keys(i).forEach(function(l){var u=n.elementaryStreams[l];if(u){var c=i[l],v=a!==null||u.partial===!0;s.range[l]=t.getBufferedTimes(n,a,v,c)}}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,s.body.endList&&(this.endListFragments[s.body.type]=s)):this.removeFragment(s.body))}},o.fragBuffered=function(e){var t=Pt(e),i=this.fragments[t];i&&(i.loaded=null,i.buffered=!0)},o.getBufferedTimes=function(e,t,i,n){for(var a={time:[],partial:i},r=t?t.start:e.start,s=t?t.end:e.end,l=e.minEndPTS||s,u=e.maxStartPTS||r,c=0;c<n.length;c++){var v=n.start(c)-this.bufferPadding,m=n.end(c)+this.bufferPadding;if(u>=v&&l<=m){a.time.push({startPTS:Math.max(r,n.start(c)),endPTS:Math.min(s,n.end(c))});break}if(r<m&&s>v)a.partial=!0,a.time.push({startPTS:Math.max(r,n.start(c)),endPTS:Math.min(s,n.end(c))});else if(s<=v)break}return a},o.getPartialFragment=function(e){var t,i,n,a=null,r=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(u){var c=l[u];c&&ze(c)&&(i=c.body.start-s,n=c.body.end+s,e>=i&&e<=n&&(t=Math.min(e-i,n-e),r<=t&&(a=c.body,r=t)))}),a},o.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||ze(t))},o.getState=function(e){var t=Pt(e),i=this.fragments[t];return i?i.buffered?ze(i)?Ge.PARTIAL:Ge.OK:Ge.APPENDING:Ge.NOT_LOADED},o.isTimeBuffered=function(e,t,i){for(var n,a,r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,a=i.end(r)+this.bufferPadding,e>=n&&t<=a)return!0;if(t<=n)return!1}return!1},o.onFragLoaded=function(e,t){var i=t.frag,n=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest&&!n){var a=Pt(i);this.fragments[a]={body:i,loaded:t,buffered:!1,range:Object.create(null)}}},o.onBufferAppended=function(e,t){var i=this,n=t.frag,a=t.part,r=t.timeRanges;if(n.type===fe.PlaylistLevelType.MAIN)if(this.activeFragment!==n&&(this.activeFragment=n,n.appendedPTS=void 0),a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(l){var u=r[l];if(i.detectEvictedFragments(l,u),!a&&n.type===fe.PlaylistLevelType.MAIN){var c=n.elementaryStreams[l];if(!c)return;for(var v=0;v<u.length;v++){var m=u.end(v);m<=c.endPTS&&m>c.startPTS?n.appendedPTS=Math.max(m,n.appendedPTS||0):n.appendedPTS=c.endPTS}}})},o.onFragBuffered=function(e,t){this.detectPartialFragments(t)},o.hasFragment=function(e){var t=Pt(e);return!!this.fragments[t]},o.removeFragmentsInRange=function(e,t,i){var n=this;Object.keys(this.fragments).forEach(function(a){var r=n.fragments[a];if(r&&r.buffered){var s=r.body;s.type===i&&s.start<t&&s.end>e&&n.removeFragment(s)}})},o.removeFragment=function(e){var t=Pt(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),e.appendedPTS=void 0,delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},o.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activeFragment=null,this.activeParts=null},d}();function ze(d){var o,e;return d.buffered&&(((o=d.range.video)===null||o===void 0?void 0:o.partial)||((e=d.range.audio)===null||e===void 0?void 0:e.partial))}function Pt(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}function tr(d){var o=typeof Map=="function"?new Map:void 0;return tr=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return jt(e,arguments,rt(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ht(i,e)},tr(d)}function jt(d,o,e){return jt=Ft()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ht(r,n.prototype),r},jt.apply(null,arguments)}function Ft(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ht(d,o){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(d,o)}function rt(d){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},rt(d)}var lr=Math.pow(2,17),Ar=function(){function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(e,t){var i=this,n=e.url;if(!n)return Promise.reject(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(n?"part list":"url")));this.abort();var a=this.config,r=a.fLoader,s=a.loader;return new Promise(function(l,u){i.loader&&i.loader.destroy();var c=i.loader=e.loader=r?new r(a):new s(a),v=Kt(e),m={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:e.sn==="initSegment"?1/0:lr};e.stats=c.stats,c.load(v,m,{onSuccess:function(_,S,F,P){i.resetLoader(e,c);var W=_.data;F.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(W.slice(0,16)),W=W.slice(16)),l({frag:e,part:null,payload:W,networkDetails:P})},onError:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:_,networkDetails:F}))},onAbort:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:F}))},onTimeout:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:F}))},onProgress:function(_,S,F,P){t&&t({frag:e,part:null,payload:F,networkDetails:P})}})})},o.loadPart=function(e,t,i){var n=this;this.abort();var a=this.config,r=a.fLoader,s=a.loader;return new Promise(function(l,u){n.loader&&n.loader.destroy();var c=n.loader=e.loader=r?new r(a):new s(a),v=Kt(e,t),m={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:lr};t.stats=c.stats,c.load(v,m,{onSuccess:function(_,S,F,P){n.resetLoader(e,c),n.updateStatsFromPart(e,t);var W={frag:e,part:t,payload:_.data,networkDetails:P};i(W),l(W)},onError:function(_,S,F){n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:_,networkDetails:F}))},onAbort:function(_,S,F){e.stats.aborted=t.stats.aborted,n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:F}))},onTimeout:function(_,S,F){n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:F}))}})})},o.updateStatsFromPart=function(e,t){var i=e.stats,n=t.stats,a=n.total;if(i.loaded+=n.loaded,a){var r=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/a),r),l=(r-s)*Math.round(i.loaded/s);i.total=i.loaded+l}else i.total=Math.max(i.loaded,i.total);var u=i.loading,c=n.loading;u.start?u.first+=c.first-c.start:(u.start=c.start,u.first=c.first),u.end=c.end},o.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d}();function Kt(d,o){o===void 0&&(o=null);var e=o||d,t={frag:d,part:o,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,n=e.byteRangeEndOffset;if((0,R.isFiniteNumber)(i)&&(0,R.isFiniteNumber)(n)){var a,r=i,s=n;if(d.sn==="initSegment"&&((a=d.decryptdata)===null||a===void 0?void 0:a.method)==="AES-128"){var l=n-i;l%16&&(s=n+(16-l%16)),i!==0&&(t.resetIV=!0,r=i-16)}t.rangeStart=r,t.rangeEnd=s}return t}var Jt=function(d){var o,e;function t(i){for(var n,a=arguments.length,r=new Array(a>1?a-1:0),s=1;s<a;s++)r[s-1]=arguments[s];return(n=d.call.apply(d,[this].concat(r))||this).data=void 0,n.data=i,n}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ht(o,e),t}(tr(Error)),pr=function(){function d(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var o=d.prototype;return o.abort=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.abort()}},o.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},o.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},o.createKeyLoadError=function(e,t,i,n){return t===void 0&&(t=k.ErrorDetails.KEY_LOAD_ERROR),new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:t,fatal:!1,frag:e,networkDetails:i})},o.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var n=e.sn,a=e.cc,r=function(l){var u=t[l];if(a<=u.cc&&(n==="initSegment"||n<u.sn))return i.emeController.selectKeySystemFormat(u).then(function(c){u.setKeyFormat(c)}),"break"},s=0;s<t.length&&r(s)!=="break";s++);},o.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(i){return t.loadInternal(e,i)}):this.loadInternal(e)},o.loadInternal=function(e,t){var i,n;t&&e.setKeyFormat(t);var a=e.decryptdata;if(!a){var r=t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading";return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,r))}var s=a.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,'Invalid key URI: "'+s+'"'));var l,u=this.keyUriToKeyInfo[s];if((i=u)!==null&&i!==void 0&&i.decryptdata.key)return a.key=u.decryptdata.key,Promise.resolve({frag:e,keyInfo:u});if((n=u)!==null&&n!==void 0&&n.keyLoadPromise)switch((l=u.mediaKeySessionContext)===null||l===void 0?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return u.keyLoadPromise}switch(u=this.keyUriToKeyInfo[s]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return a.keyFormat==="identity"?this.loadKeyHTTP(u,e):this.loadKeyEME(u,e);case"AES-128":return this.loadKeyHTTP(u,e);default:return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,'Key supplied with unsupported METHOD: "'+a.method+'"'))}},o.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(function(a){return e.mediaKeySessionContext=a,i})).catch(function(a){throw e.keyLoadPromise=null,a})}return Promise.resolve(i)},o.loadKeyHTTP=function(e,t){var i=this,n=this.config,a=new n.loader(n);return t.keyLoader=e.loader=a,e.keyLoadPromise=new Promise(function(r,s){var l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},c={onSuccess:function(v,m,_,S){var F=_.frag,P=_.keyInfo,W=_.url;if(!F.decryptdata||P!==i.keyUriToKeyInfo[W])return s(i.createKeyLoadError(F,k.ErrorDetails.KEY_LOAD_ERROR,S,"after key load, decryptdata unset or changed"));P.decryptdata.key=F.decryptdata.key=new Uint8Array(v.data),F.keyLoader=null,P.loader=null,r({frag:F,keyInfo:P})},onError:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.KEY_LOAD_ERROR,_))},onTimeout:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.KEY_LOAD_TIMEOUT,_))},onAbort:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.INTERNAL_ABORTED,_))}};a.load(l,u,c)})},o.resetLoader=function(e){var t=e.frag,i=e.keyInfo,n=e.url,a=i.loader;t.keyLoader===a&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],a&&a.destroy()},d}(),Cr=function(){function d(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var o=d.prototype;return o.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},o.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},o.onHandlerDestroyed=function(){},o.hasInterval=function(){return!!this._tickInterval},o.hasNextTick=function(){return!!this._tickTimer},o.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},o.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},o.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},o.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},o.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},o.doTick=function(){},d}(),vr={length:0,start:function(){return 0},end:function(){return 0}},Gt=function(){function d(){}return d.isBuffered=function(o,e){try{if(o){for(var t=d.getBuffered(o),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},d.bufferInfo=function(o,e,t){try{if(o){var i,n=d.getBuffered(o),a=[];for(i=0;i<n.length;i++)a.push({start:n.start(i),end:n.end(i)});return this.bufferedInfo(a,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},d.bufferedInfo=function(o,e,t){e=Math.max(0,e),o.sort(function(S,F){return S.start-F.start||F.end-S.end});var i=[];if(t)for(var n=0;n<o.length;n++){var a=i.length;if(a){var r=i[a-1].end;o[n].start-r<t?o[n].end>r&&(i[a-1].end=o[n].end):i.push(o[n])}else i.push(o[n])}else i=o;for(var s,l=0,u=e,c=e,v=0;v<i.length;v++){var m=i[v].start,_=i[v].end;if(e+t>=m&&e<_)u=m,l=(c=_)-e;else if(e+t<m){s=m;break}}return{len:l,start:u||0,end:c||0,nextStart:s}},d.getBuffered=function(o){try{return o.buffered}catch(e){return L.logger.log("failed to get media.buffered",e),vr}},d}(),Di=function(d,o,e,t,i,n){t===void 0&&(t=0),i===void 0&&(i=-1),n===void 0&&(n=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=d,this.sn=o,this.id=e,this.size=t,this.part=i,this.partial=n};function nn(d,o){for(var e=null,t=0,i=d.length;t<i;t++){var n=d[t];if(n&&n.cc===o){e=n;break}}return e}function kr(d,o){if(d){var e=d.start+o;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function li(d,o){for(var e=o.fragments,t=0,i=e.length;t<i;t++)kr(e[t],d);o.fragmentHint&&kr(o.fragmentHint,d),o.alignedSliding=!0}function an(d,o){if(d.hasProgramDateTime&&o.hasProgramDateTime){var e=d.fragments,t=o.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],n=nn(e,i.cc)||e[Math.round(e.length/2)-1],a=i.programDateTime,r=n.programDateTime;a!==null&&r!==null&&li((r-a)/1e3-(n.start-i.start),d)}}}let sn=function(d,o){for(var e=0,t=d.length-1,i=null,n=null;e<=t;){var a=o(n=d[i=(e+t)/2|0]);if(a>0)e=i+1;else{if(!(a<0))return n;t=i-1}}return null};function ui(d,o,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(d?i=o[d.sn-o[0].sn+1]||null:e===0&&o[0].start===0&&(i=o[0]),i&&di(e,t,i)===0)return i;var n=sn(o,di.bind(null,e,t));return!n||n===d&&i?i:n}function di(d,o,e){if(d===void 0&&(d=0),o===void 0&&(o=0),e.start<=d&&e.start+e.duration>d)return 0;var t=Math.min(o,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0}function Kr(d,o,e){var t=1e3*Math.min(o,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var Zr=B(21);let wn=function(d){for(var o="",e=d.length,t=0;t<e;t++)o+="["+d.start(t).toFixed(3)+","+d.end(t).toFixed(3)+"]";return o};function on(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Hr(d,o){return Hr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hr(d,o)}var br="STOPPED",At="IDLE",ln="KEY_LOADING",qr="FRAG_LOADING",Nr="FRAG_LOADING_WAITING_RETRY",ci="WAITING_TRACK",wr="PARSING",Vr="PARSED",ei="ENDED",Lr="ERROR",Ur="WAITING_INIT_PTS",Yr="WAITING_LEVEL",hi=function(d){var o,e;function t(r,s,l,u){var c;return(c=d.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=br,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.loadedmetadata=!1,c.fragLoadError=0,c.retryDate=0,c.levels=null,c.fragmentLoader=void 0,c.keyLoader=void 0,c.levelLastLoaded=null,c.startFragRequested=!1,c.decrypter=void 0,c.initPTS=[],c.onvseeking=null,c.onvended=null,c.logPrefix="",c.log=void 0,c.warn=void 0,c.logPrefix=u,c.log=L.logger.log.bind(L.logger,u+":"),c.warn=L.logger.warn.bind(L.logger,u+":"),c.hls=r,c.fragmentLoader=new Ar(r.config),c.keyLoader=l,c.fragmentTracker=s,c.config=r.config,c.decrypter=new Zr.default(r.config),r.on(g.Events.LEVEL_SWITCHING,c.onLevelSwitching,function(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}(c)),c}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Hr(o,e);var i,n,a=t.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(r){},a.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var r=this.fragCurrent;r&&(r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=br},a._streamEnded=function(r,s){if(s.live||r.nextStart||!r.end||!this.media)return!1;var l=s.partList;if(l!=null&&l.length){var u=l[l.length-1];return Gt.isBuffered(this.media,u.start+u.duration/2)}var c=s.fragments[s.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)},a.getLevelDetails=function(){var r;if(this.levels&&this.levelLastLoaded!==null)return(r=this.levels[this.levelLastLoaded])===null||r===void 0?void 0:r.details},a.onMediaAttached=function(r,s){var l=this.media=this.mediaBuffer=s.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),l.addEventListener("seeking",this.onvseeking),l.addEventListener("ended",this.onvended);var u=this.config;this.levels&&u.autoStartLoad&&this.state===br&&this.startLoad(u.startPosition)},a.onMediaDetaching=function(){var r=this.media;r!=null&&r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),r&&this.onvseeking&&this.onvended&&(r.removeEventListener("seeking",this.onvseeking),r.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var r=this.config,s=this.fragCurrent,l=this.media,u=this.mediaBuffer,c=this.state,v=l?l.currentTime:0,m=Gt.bufferInfo(u||l,v,r.maxBufferHole);if(this.log("media seeking to "+((0,R.isFiniteNumber)(v)?v.toFixed(3):v)+", state: "+c),this.state===ei)this.resetLoadingState();else if(s){var _=r.maxFragLookUpTolerance,S=s.start-_,F=s.start+s.duration+_;if(!m.len||F<m.start||S>m.end){var P=v>F;(v<S||P)&&(P&&s.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),s.abortRequests()),this.resetLoadingState())}}l&&(this.lastCurrentTime=v),this.loadedmetadata||m.len||(this.nextLoadPosition=this.startPosition=v),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onLevelSwitching=function(r,s){this.fragLoadError=0},a.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=br,this.hls.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,d.prototype.onHandlerDestroyed.call(this)},a.loadFragment=function(r,s,l){this._loadFragForPlayback(r,s,l)},a._loadFragForPlayback=function(r,s,l){var u=this;this._doFragLoad(r,s,l,function(c){if(u.fragContextChanged(r))return u.warn("Fragment "+r.sn+(c.part?" p: "+c.part.index:"")+" of level "+r.level+" was dropped during download."),void u.fragmentTracker.removeFragment(r);r.stats.chunkCount++,u._handleFragmentLoadProgress(c)}).then(function(c){if(c){u.fragLoadError=0;var v=u.state;u.fragContextChanged(r)?(v===qr||!u.fragCurrent&&v===wr)&&(u.fragmentTracker.removeFragment(r),u.state=At):("payload"in c&&(u.log("Loaded fragment "+r.sn+" of level "+r.level),u.hls.trigger(g.Events.FRAG_LOADED,c)),u._handleFragmentLoadComplete(c))}}).catch(function(c){u.state!==br&&u.state!==Lr&&(u.warn(c),u.resetFragmentLoading(r))})},a.flushMainBuffer=function(r,s,l){if(l===void 0&&(l=null),r-s){var u={startOffset:r,endOffset:s,type:l};this.fragLoadError=0,this.hls.trigger(g.Events.BUFFER_FLUSHING,u)}},a._loadInitSegment=function(r,s){var l=this;this._doFragLoad(r,s).then(function(u){if(!u||l.fragContextChanged(r)||!l.levels)throw new Error("init load aborted");return u}).then(function(u){var c=l.hls,v=u.payload,m=r.decryptdata;if(v&&v.byteLength>0&&m&&m.key&&m.iv&&m.method==="AES-128"){var _=self.performance.now();return l.decrypter.decrypt(new Uint8Array(v),m.key.buffer,m.iv.buffer).then(function(S){var F=self.performance.now();return c.trigger(g.Events.FRAG_DECRYPTED,{frag:r,payload:S,stats:{tstart:_,tdecrypt:F}}),u.payload=S,u})}return u}).then(function(u){var c=l.fragCurrent,v=l.hls,m=l.levels;if(!m)throw new Error("init load aborted, missing levels");m[r.level].details;var _=r.stats;l.state=At,l.fragLoadError=0,r.data=new Uint8Array(u.payload),_.parsing.start=_.buffering.start=self.performance.now(),_.parsing.end=_.buffering.end=self.performance.now(),u.frag===c&&v.trigger(g.Events.FRAG_BUFFERED,{stats:_,frag:c,part:null,id:r.type}),l.tick()}).catch(function(u){l.state!==br&&l.state!==Lr&&(l.warn(u),l.resetFragmentLoading(r))})},a.fragContextChanged=function(r){var s=this.fragCurrent;return!r||!s||r.level!==s.level||r.sn!==s.sn||r.urlId!==s.urlId},a.fragBufferedComplete=function(r,s){var l,u,c=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+r.type+" sn: "+r.sn+(s?" part: "+s.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level+" "+(c?wn(Gt.getBuffered(c)):"(detached)")),this.state=At,c&&(!this.loadedmetadata&&r.type==fe.PlaylistLevelType.MAIN&&c.buffered.length&&((l=this.fragCurrent)===null||l===void 0?void 0:l.sn)===((u=this.fragPrevious)===null||u===void 0?void 0:u.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},a.seekToStartPos=function(){},a._handleFragmentLoadComplete=function(r){var s=this.transmuxer;if(s){var l=r.frag,u=r.part,c=r.partsLoaded,v=!c||c.length===0||c.some(function(_){return!_}),m=new Di(l.level,l.sn,l.stats.chunkCount+1,0,u?u.index:-1,!v);s.flush(m)}},a._handleFragmentLoadProgress=function(r){},a._doFragLoad=function(r,s,l,u){var c,v=this;if(l===void 0&&(l=null),!this.levels)throw new Error("frag load aborted, missing levels");var m=null;if(!r.encrypted||(c=r.decryptdata)!==null&&c!==void 0&&c.key?!r.encrypted&&s.encryptedFragments.length&&this.keyLoader.loadClear(r,s.encryptedFragments):(this.log("Loading key for "+r.sn+" of ["+s.startSN+"-"+s.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level),this.state=ln,this.fragCurrent=r,m=this.keyLoader.load(r).then(function(W){if(!v.fragContextChanged(W.frag))return v.hls.trigger(g.Events.KEY_LOADED,W),W}),this.hls.trigger(g.Events.KEY_LOADING,{frag:r}),this.throwIfFragContextChanged("KEY_LOADING")),l=Math.max(r.start,l||0),this.config.lowLatencyMode&&s){var _=s.partList;if(_&&u){l>r.end&&s.fragmentHint&&(r=s.fragmentHint);var S=this.getNextPart(_,r,l);if(S>-1){var F=_[S];return this.log("Loading part sn: "+r.sn+" p: "+F.index+" cc: "+r.cc+" of playlist ["+s.startSN+"-"+s.endSN+"] parts [0-"+S+"-"+(_.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(l.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=qr,this.hls.trigger(g.Events.FRAG_LOADING,{frag:r,part:_[S],targetBufferTime:l}),this.throwIfFragContextChanged("FRAG_LOADING parts"),m?m.then(function(W){return!W||v.fragContextChanged(W.frag)?null:v.doFragPartsLoad(r,_,S,u)}).catch(function(W){return v.handleFragLoadError(W)}):this.doFragPartsLoad(r,_,S,u).catch(function(W){return v.handleFragLoadError(W)})}if(!r.url||this.loadedEndOfParts(_,l))return Promise.resolve(null)}}this.log("Loading fragment "+r.sn+" cc: "+r.cc+" "+(s?"of ["+s.startSN+"-"+s.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(l.toFixed(3))),(0,R.isFiniteNumber)(r.sn)&&!this.bitrateTest&&(this.nextLoadPosition=r.start+r.duration),this.state=qr,this.hls.trigger(g.Events.FRAG_LOADING,{frag:r,targetBufferTime:l}),this.throwIfFragContextChanged("FRAG_LOADING");var P=this.config.progressive;return P&&m?m.then(function(W){return!W||v.fragContextChanged(W==null?void 0:W.frag)?null:v.fragmentLoader.load(r,u)}).catch(function(W){return v.handleFragLoadError(W)}):Promise.all([this.fragmentLoader.load(r,P?u:void 0),m]).then(function(W){var ue=W[0];return!P&&ue&&u&&u(ue),ue}).catch(function(W){return v.handleFragLoadError(W)})},a.throwIfFragContextChanged=function(r){if(this.fragCurrent===null)throw new Error("frag load aborted, context changed in "+r)},a.doFragPartsLoad=function(r,s,l,u){var c=this;return new Promise(function(v,m){var _=[];(function S(F){var P=s[F];c.fragmentLoader.loadPart(r,P,u).then(function(W){_[P.index]=W;var ue=W.part;c.hls.trigger(g.Events.FRAG_LOADED,W);var _e=s[F+1];if(!_e||_e.fragment!==r)return v({frag:r,part:ue,partsLoaded:_});S(F+1)}).catch(m)})(l)})},a.handleFragLoadError=function(r){if("data"in r){var s=r.data;r.data&&s.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(s.frag,s.part):this.hls.trigger(g.Events.ERROR,s)}else this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,err:r,fatal:!0});return null},a._handleTransmuxerFlush=function(r){var s=this.getCurrentContext(r);if(s&&this.state===wr){var l=s.frag,u=s.part,c=s.level,v=self.performance.now();l.stats.parsing.end=v,u&&(u.stats.parsing.end=v),this.updateLevelTiming(l,u,c,r.partial)}else this.fragCurrent||this.state===br||this.state===Lr||(this.state=At)},a.getCurrentContext=function(r){var s=this.levels,l=r.level,u=r.sn,c=r.part;if(!s||!s[l])return this.warn("Levels object was unset while buffering fragment "+u+" of level "+l+". The current chunk will not be buffered."),null;var v=s[l],m=c>-1?function(S,F,P){if(!S||!S.details)return null;var W=S.details.partList;if(W)for(var ue=W.length;ue--;){var _e=W[ue];if(_e.index===P&&_e.fragment.sn===F)return _e}return null}(v,u,c):null,_=m?m.fragment:function(S,F,P){if(!S||!S.details)return null;var W=S.details,ue=W.fragments[F-W.startSN];return ue||((ue=W.fragmentHint)&&ue.sn===F?ue:F<W.startSN&&P&&P.sn===F?P:null)}(v,u,this.fragCurrent);return _?{frag:_,part:m,level:v}:null},a.bufferFragmentData=function(r,s,l,u){if(r&&this.state===wr){var c=r.data1,v=r.data2,m=c;if(c&&v&&(m=(0,z.appendUint8Array)(c,v)),m&&m.length){var _={type:r.type,frag:s,part:l,chunkMeta:u,parent:s.type,data:m};this.hls.trigger(g.Events.BUFFER_APPENDING,_),r.dropped&&r.independent&&!l&&this.flushBufferGap(s)}}},a.flushBufferGap=function(r){var s=this.media;if(s)if(Gt.isBuffered(s,s.currentTime)){var l=s.currentTime,u=Gt.bufferInfo(s,l,0),c=r.duration,v=Math.min(2*this.config.maxFragLookUpTolerance,.25*c),m=Math.max(Math.min(r.start-v,u.end-v),l+v);r.start-m>v&&this.flushMainBuffer(m,r.start)}else this.flushMainBuffer(0,r.start)},a.getFwdBufferInfo=function(r,s){var l=this.config,u=this.getLoadPosition();if(!(0,R.isFiniteNumber)(u))return null;var c=Gt.bufferInfo(r,u,l.maxBufferHole);if(c.len===0&&c.nextStart!==void 0){var v=this.fragmentTracker.getBufferedFrag(u,s);if(v&&c.nextStart<v.end)return Gt.bufferInfo(r,u,Math.max(c.nextStart,l.maxBufferHole))}return c},a.getMaxBufferLength=function(r){var s,l=this.config;return s=r?Math.max(8*l.maxBufferSize/r,l.maxBufferLength):l.maxBufferLength,Math.min(s,l.maxMaxBufferLength)},a.reduceMaxBufferLength=function(r){var s=this.config,l=r||s.maxBufferLength;return s.maxMaxBufferLength>=l&&(s.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+s.maxMaxBufferLength+"s"),!0)},a.getNextFragment=function(r,s){var l=s.fragments,u=l.length;if(!u)return null;var c,v=this.config,m=l[0].start;if(s.live){var _=v.initialLiveManifestSize;if(u<_)return this.warn("Not enough fragments to start playback (have: "+u+", need: "+_+")"),null;s.PTSKnown||this.startFragRequested||this.startPosition!==-1||(c=this.getInitialLiveFragment(s,l),this.startPosition=c?this.hls.liveSyncPosition||c.start:r)}else r<=m&&(c=l[0]);if(!c){var S=v.lowLatencyMode?s.partEnd:s.fragmentEnd;c=this.getFragmentAtPosition(r,S,s)}return this.mapToInitFragWhenRequired(c)},a.mapToInitFragWhenRequired=function(r){return r==null||!r.initSegment||r!=null&&r.initSegment.data||this.bitrateTest?r:r.initSegment},a.getNextPart=function(r,s,l){for(var u=-1,c=!1,v=!0,m=0,_=r.length;m<_;m++){var S=r[m];if(v=v&&!S.independent,u>-1&&l<S.start)break;var F=S.loaded;F?u=-1:(c||S.independent||v)&&S.fragment===s&&(u=m),c=F}return u},a.loadedEndOfParts=function(r,s){var l=r[r.length-1];return l&&s>l.start&&l.loaded},a.getInitialLiveFragment=function(r,s){var l=this.fragPrevious,u=null;if(l){if(r.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+l.programDateTime),u=function(_,S,F){if(S===null||!Array.isArray(_)||!_.length||!(0,R.isFiniteNumber)(S)||S<(_[0].programDateTime||0)||S>=(_[_.length-1].endProgramDateTime||0))return null;F=F||0;for(var P=0;P<_.length;++P){var W=_[P];if(Kr(S,F,W))return W}return null}(s,l.endProgramDateTime,this.config.maxFragLookUpTolerance)),!u){var c=l.sn+1;if(c>=r.startSN&&c<=r.endSN){var v=s[c-r.startSN];l.cc===v.cc&&(u=v,this.log("Live playlist, switching playlist, load frag with next SN: "+u.sn))}u||(u=function(_,S){return sn(_,function(F){return F.cc<S?1:F.cc>S?-1:0})}(s,l.cc),u&&this.log("Live playlist, switching playlist, load frag with same CC: "+u.sn))}}else{var m=this.hls.liveSyncPosition;m!==null&&(u=this.getFragmentAtPosition(m,this.bitrateTest?r.fragmentEnd:r.edge,r))}return u},a.getFragmentAtPosition=function(r,s,l){var u,c=this.config,v=this.fragPrevious,m=l.fragments,_=l.endSN,S=l.fragmentHint,F=c.maxFragLookUpTolerance,P=!!(c.lowLatencyMode&&l.partList&&S);if(P&&S&&!this.bitrateTest&&(m=m.concat(S),_=S.sn),u=r<s?ui(v,m,r,r>s-F?0:F):m[m.length-1]){var W=u.sn-l.startSN;if(this.fragmentTracker.getState(u)===Ge.OK&&(v=u),v&&u.sn===v.sn&&!P&&v&&u.level===v.level){var ue=m[W+1];u.sn<_&&this.fragmentTracker.getState(ue)!==Ge.OK?(this.log("SN "+u.sn+" just loaded, load next one: "+ue.sn),u=ue):u=null}}return u},a.synchronizeToLiveEdge=function(r){var s=this.config,l=this.media;if(l){var u=this.hls.liveSyncPosition,c=l.currentTime,v=r.fragments[0].start,m=r.edge,_=c>=v-s.maxFragLookUpTolerance&&c<=m;if(u!==null&&l.duration>u&&(c<u||!_)){var S=s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:s.liveMaxLatencyDurationCount*r.targetduration;(!_&&l.readyState<4||c<m-S)&&(this.loadedmetadata||(this.nextLoadPosition=u),l.readyState&&(this.warn("Playback: "+c.toFixed(3)+" is located too far from the end of live sliding playlist: "+m+", reset currentTime to : "+u.toFixed(3)),l.currentTime=u))}}},a.alignPlaylists=function(r,s){var l=this.levels,u=this.levelLastLoaded,c=this.fragPrevious,v=u!==null?l[u]:null,m=r.fragments.length;if(!m)return this.warn("No fragments in live playlist"),0;var _=r.fragments[0].start,S=!s,F=r.alignedSliding&&(0,R.isFiniteNumber)(_);if(S||!F&&!_){(function(W,ue,_e){ue&&(function(ge,De,He){if(function(Ae,Ke,je){return!(!Ke.details||!(je.endCC>je.startCC||Ae&&Ae.cc<je.startCC))}(ge,He,De)){var Je=function(Ae,Ke,je){je===void 0&&(je=0);var pt=Ae.fragments,Mt=Ke.fragments;if(Mt.length&&pt.length){var mt=nn(pt,Mt[0].cc);if(mt&&(!mt||mt.startPTS))return mt;L.logger.log("No frag in previous level to align on")}else L.logger.log("No fragments to align")}(He.details,De);Je&&(0,R.isFiniteNumber)(Je.start)&&(L.logger.log("Adjusting PTS using last level due to CC increase within current level "+De.url),li(Je.start,De))}}(W,_e,ue),!_e.alignedSliding&&ue.details&&function(ge,De){if(De.fragments.length&&ge.hasProgramDateTime&&De.hasProgramDateTime){var He=De.fragments[0].programDateTime,Je=ge.fragments[0].programDateTime,Ae=(Je-He)/1e3+De.fragments[0].start;Ae&&(0,R.isFiniteNumber)(Ae)&&(L.logger.log("Adjusting PTS using programDateTime delta "+(Je-He)+"ms, sliding:"+Ae.toFixed(3)+" "+ge.url+" "),li(Ae,ge))}}(_e,ue.details),_e.alignedSliding||!ue.details||_e.skippedSegments||Z(ue.details,_e))})(c,v,r);var P=r.fragments[0].start;return this.log("Live playlist sliding: "+P.toFixed(2)+" start-sn: "+(s?s.startSN:"na")+"->"+r.startSN+" prev-sn: "+(c?c.sn:"na")+" fragments: "+m),P}return _},a.waitForCdnTuneIn=function(r){return r.live&&r.canBlockReload&&r.partTarget&&r.tuneInGoal>Math.max(r.partHoldBack,3*r.partTarget)},a.setStartPosition=function(r,s){var l=this.startPosition;if(l<s&&(l=-1),l===-1||this.lastCurrentTime===-1){var u=r.startTimeOffset;(0,R.isFiniteNumber)(u)?(l=s+u,u<0&&(l+=r.totalduration),l=Math.min(Math.max(s,l),s+r.totalduration),this.log("Start time offset "+u+" found in playlist, adjust startPosition to "+l),this.startPosition=l):r.live?l=this.hls.liveSyncPosition||s:this.startPosition=l=0,this.lastCurrentTime=l}this.nextLoadPosition=l},a.getLoadPosition=function(){var r=this.media,s=0;return this.loadedmetadata&&r?s=r.currentTime:this.nextLoadPosition&&(s=this.nextLoadPosition),s},a.handleFragLoadAborted=function(r,s){this.transmuxer&&r.sn!=="initSegment"&&r.stats.aborted&&(this.warn("Fragment "+r.sn+(s?" part"+s.index:"")+" of level "+r.level+" was aborted"),this.resetFragmentLoading(r))},a.resetFragmentLoading=function(r){this.fragCurrent&&(this.fragContextChanged(r)||this.state===Nr)||(this.state=At)},a.onFragmentOrKeyLoadError=function(r,s){if(s.fatal)return this.stopLoad(),void(this.state=Lr);var l=this.config;if(s.chunkMeta){var u=this.getCurrentContext(s.chunkMeta);u&&(s.frag=u.frag,s.levelRetry=!0,this.fragLoadError=l.fragLoadingMaxRetry)}var c=s.frag;if(c&&c.type===r)if(this.fragCurrent,this.fragLoadError+1<=l.fragLoadingMaxRetry){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var v=Math.min(Math.pow(2,this.fragLoadError)*l.fragLoadingRetryDelay,l.fragLoadingMaxRetryTimeout);this.warn("Fragment "+c.sn+" of "+r+" "+c.level+" failed to load, retrying in "+v+"ms"),this.retryDate=self.performance.now()+v,this.fragLoadError++,this.state=Nr}else s.levelRetry?(r===fe.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=At):(L.logger.error(s.details+" reaches max retry, redispatch as fatal ..."),s.fatal=!0,this.hls.stopLoad(),this.state=Lr)},a.afterBufferFlushed=function(r,s,l){if(r){var u=Gt.getBuffered(r);this.fragmentTracker.detectEvictedFragments(s,u,l),this.state===ei&&this.resetLoadingState()}},a.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=At},a.resetStartWhenNotLoaded=function(r){if(!this.loadedmetadata){this.startFragRequested=!1;var s=this.levels?this.levels[r].details:null;s!=null&&s.live?(this.startPosition=-1,this.setStartPosition(s,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},a.updateLevelTiming=function(r,s,l,u){var c=this,v=l.details;Object.keys(r.elementaryStreams).reduce(function(m,_){var S=r.elementaryStreams[_];if(S){var F=S.endPTS-S.startPTS;if(F<=0)return c.warn("Could not parse fragment "+r.sn+" "+_+" duration reliably ("+F+")"),m||!1;var P=u?0:Q(v,r,S.startPTS,S.endPTS,S.startDTS,S.endDTS);return c.hls.trigger(g.Events.LEVEL_PTS_UPDATED,{details:v,level:l,drift:P,type:_,frag:r,start:S.startPTS,end:S.endPTS}),!0}return m},!1)||(this.warn("Found no media in fragment "+r.sn+" of level "+l.id+" resetting transmuxer to fallback to playlist timing"),this.resetTransmuxer()),this.state=Vr,this.hls.trigger(g.Events.FRAG_PARSED,{frag:r,part:s})},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},i=t,(n=[{key:"state",get:function(){return this._state},set:function(r){var s=this._state;s!==r&&(this._state=r,this.log(s+"->"+r))}}])&&on(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Cr);function fi(){return self.MediaSource||self.WebKitMediaSource}function vi(){return self.SourceBuffer||self.WebKitSourceBuffer}var Li=function(){var d=ENTRY_MODULE,o={},e=function i(n){var a=o[n];if(a!==void 0)return a.exports;var r=o[n]={exports:{}};return d[n].call(r.exports,r,r.exports,i),r.exports};e.m=d,e.n=function(i){var n=i&&i.__esModule?function(){return i.default}:function(){return i};return e.d(n,{a:n}),n},e.d=function(i,n){for(var a in n)e.o(n,a)&&!e.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:n[a]})},e.o=function(i,n){return Object.prototype.hasOwnProperty.call(i,n)},e.r=function(i){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var t=e(ENTRY_MODULE);return t.default||t}.toString().split("ENTRY_MODULE"),un="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function $t(d){return(d+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function pi(d,o,e){var t={};t[e]=[];var i=o.toString().replace(/^"[^"]+"/,"function"),n=i.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||i.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!n)return t;for(var a,r=n[1],s=new RegExp("(\\\\n|\\W)"+$t(r)+un,"g");a=s.exec(i);)a[3]!=="dll-reference"&&t[e].push(a[3]);for(s=new RegExp("\\("+$t(r)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)'+un,"g");a=s.exec(i);)d[a[2]]||(t[e].push(a[1]),d[a[2]]=B(a[1]).m),t[a[2]]=t[a[2]]||[],t[a[2]].push(a[4]);for(var l,u=Object.keys(t),c=0;c<u.length;c++)for(var v=0;v<t[u[c]].length;v++)l=t[u[c]][v],isNaN(1*l)||(t[u[c]][v]=1*t[u[c]][v]);return t}function Dn(d){return Object.keys(d).reduce(function(o,e){return o||d[e].length>0},!1)}function dn(d,o,e,t){var i=d[t].map(function(n){return'"'+n+'": '+o[t][n].toString().replace(/^"[^"]+"/,"function")}).join(",");return Li[0]+"{"+i+"}"+Li[1]+'"'+e+'"'+Li[2]}var Br=B(544),Ri=B(729),ti=B.n(Ri),ri=fi()||{isTypeSupported:function(){return!1}},Ii=function(){function d(e,t,i,n){var a=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;var s=function(v,m){(m=m||{}).frag=a.frag,m.id=a.id,a.hls.trigger(v,m)};this.observer=new Ri.EventEmitter,this.observer.on(g.Events.FRAG_DECRYPTED,s),this.observer.on(g.Events.ERROR,s);var l={mp4:ri.isTypeSupported("video/mp4"),mpeg:ri.isTypeSupported("audio/mpeg"),mp3:ri.isTypeSupported('audio/mp4; codecs="mp3"')},u=navigator.vendor;if(this.useWorker&&typeof Worker!="undefined"){var c;L.logger.log("demuxing in webworker");try{c=this.worker=function(v,m){m=m||{};var _={main:B.m},S=m.all?{main:Object.keys(_.main)}:function(_e,ge){for(var De={main:[ge]},He={main:[]},Je={main:{}};Dn(De);)for(var Ae=Object.keys(De),Ke=0;Ke<Ae.length;Ke++){var je=Ae[Ke],pt=De[je].pop();if(Je[je]=Je[je]||{},!Je[je][pt]&&_e[je][pt]){Je[je][pt]=!0,He[je]=He[je]||[],He[je].push(pt);for(var Mt=pi(_e,_e[je][pt],je),mt=Object.keys(Mt),kt=0;kt<mt.length;kt++)De[mt[kt]]=De[mt[kt]]||[],De[mt[kt]]=De[mt[kt]].concat(Mt[mt[kt]])}}return He}(_,v),F="";Object.keys(S).filter(function(_e){return _e!=="main"}).forEach(function(_e){for(var ge=0;S[_e][ge];)ge++;S[_e].push(ge),_[_e][ge]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",F=F+"var "+_e+" = ("+dn(S,_,ge,modules)+`)();
|
|
9
|
-
`}),F=F+"new (("+dn(S,_,v,"main")+")())(self);";var P=new window.Blob([F],{type:"text/javascript"}),
|
|
7
|
+
`))this.processLine(this.buffer.substring(0,h)),this.buffer=this.buffer.substring(h+1)},yi.prototype.processLine=function(p){var h=p.indexOf(":"),f=xn(p,h),y=f[0],b=f.length===2?ii(f[1]):void 0;if(y[0]!=="#")this.currentUri.uri=y,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(y){case gi:if(!isFinite(b)||b<0)return;this.manifest.targetDuration=b,this.setHoldBack();break;case Rn:Oi(this.manifest,f),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case In:Oi(this.manifest,f),this.setHoldBack();break;case Cn:b===0?this.currentUri.duration=.01:b>0&&(this.currentUri.duration=b);break;case hn:var M=b,I=new Date(M);this.manifest.dateTimeString||(this.manifest.dateTimeString=M,this.manifest.dateTimeObject=I),this.currentUri.dateTimeString=M,this.currentUri.dateTimeObject=I;break;case mi:Oi(this.manifest,f);break;case Pi:var Y=Mn(f[1]),he=D(Y);K()(this.manifest.sessionData,he)}},yi.prototype.setHoldBack=function(){var p=this.manifest,h=p.serverControl,f=p.targetDuration,y=p.partTargetDuration;if(h){var b="holdBack",M="partHoldBack",I=f&&3*f,Y=y&&2*y;f&&!h.hasOwnProperty(b)&&(h[b]=I),I&&h[b]<I&&(h[b]=I),y&&!h.hasOwnProperty(M)&&(h[M]=3*y),y&&h[M]<Y&&(h[M]=Y)}};var Oi=function(p,h){var f,y=fn(h[0].replace("#EXT-X-",""));xi(h[1])?(f={},f=K()(On(h[1]),f)):f=ii(h[1]),p[y]=f},fn=function(p){return p.toLowerCase().replace(/-(\w)/g,function(h){return h[1].toUpperCase()})},ii=function(p){if(p.toLowerCase()==="yes"||p.toLowerCase()==="no")return p.toLowerCase()==="yes";var h=p.indexOf(":")!==-1?p:parseFloat(p);return isNaN(h)?p:h},Pn=function(p){var h={},f=p.split("=");return f.length>1&&(h[fn(f[0])]=ii(f[1])),h},On=function(p){for(var h=p.split(","),f={},y=0;h.length>y;y++){var b=h[y],M=Pn(b);f=K()(M,f)}return f},xi=function(p){return p.indexOf("=")>-1},xn=function(p,h){return h===-1?[p]:[p.substring(0,h),p.substring(h+1)]},Mn=function(p){var h={};if(p){var f=p.search(",");return[p.slice(0,f),p.slice(f+1)].forEach(function(y,b){for(var M=y.replace(/['"]+/g,"").split("="),I=0;I<M.length;I++)M[I]==="DATA-ID"&&(h["DATA-ID"]=M[1-I]),M[I]==="VALUE"&&(h.VALUE=M[1-I])}),{data:h}}},Fn=yi,Mi={safeCall:function(p,h,f,y){var b=y;if(p&&typeof p[h]=="function")try{b=p[h].apply(p,f)}catch(M){q.info("safeCall error",M)}return b},safeIncrement:V,getComputedStyle:function(p,h){var f;if(p&&h&&R()&&typeof R().getComputedStyle=="function")return Wr&&Wr.has(p)&&(f=Wr.get(p)),f||(f=R().getComputedStyle(p,null),Wr&&Wr.set(p,f)),f.getPropertyValue(h)},secondsToMs:function(p){return Math.floor(1e3*p)},assign:K(),headersStringToObject:U,extractHostnameAndDomain:ke,extractHostname:Ee,manifestParser:Fn,generateShortID:k,generateUUID:g,now:J.now},Fi={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};function Nn(p,h){return function(f){if(Array.isArray(f))return f}(p)||function(f,y){var b=f==null?null:typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(b!=null){var M,I,Y=[],he=!0,ee=!1;try{for(b=b.call(f);!(he=(M=b.next()).done)&&(Y.push(M.value),!y||Y.length!==y);he=!0);}catch(Me){ee=!0,I=Me}finally{try{he||b.return==null||b.return()}finally{if(ee)throw I}}return Y}}(p,h)||function(f,y){if(f){if(typeof f=="string")return Tt(f,y);var b=Object.prototype.toString.call(f).slice(8,-1);return b==="Object"&&f.constructor&&(b=f.constructor.name),b==="Map"||b==="Set"?Array.from(f):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?Tt(f,y):void 0}}(p,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Tt(p,h){(h==null||h>p.length)&&(h=p.length);for(var f=0,y=new Array(h);f<h;f++)y[f]=p[f];return y}var gr={},Xr=function p(h){var f=arguments;typeof h=="string"?p.hasOwnProperty(h)?R().setTimeout(function(){f=Array.prototype.splice.call(f,1),p[h].apply(null,f)},0):q.warn("`"+h+"` is an unknown task"):typeof h=="function"?R().setTimeout(function(){h(p)},0):q.warn("`"+h+"` is invalid.")},vn={loaded:J.now(),NAME:"mux-embed",VERSION:"4.17.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(p,h){return function(f,y,b){var M=Ii(me(y),3),I=M[0],Y=M[1],he=M[2],ee=f.log,Me=f.utils.getComputedStyle,ut=f.utils.secondsToMs;if(!I)return ee.error("No element was found with the `"+Y+"` query selector.");if(he!=="video"&&he!=="audio")return ee.error("The element of `"+Y+"` was not a media element.");I.mux&&(I.mux.destroy(),delete I.mux,ee.warn("Already monitoring this video element, replacing existing event listeners")),(b=K()({automaticErrorTracking:!0},b)).data=K()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:f.VERSION},b.data),b.getPlayheadTime=function(){return ut(I.currentTime)},b.getStateData=function(){var st,Qe,ot=this.hlsjs&&this.hlsjs.url,Ot=this.dashjs&&ri(this.dashjs.getSource==="function")&&this.dashjs.getSource(),qt={player_is_paused:I.paused,player_playhead_time:ut(I.currentTime),player_width:parseInt(Me(I,"width")),player_height:parseInt(Me(I,"height")),player_autoplay_on:I.autoplay,player_preload_on:I.preload,player_language_code:I.lang,player_is_fullscreen:ti()&&!!(ti().fullscreenElement||ti().webkitFullscreenElement||ti().mozFullScreenElement||ti().msFullscreenElement),video_poster_url:I.poster,video_source_url:ot||Ot||I.currentSrc,video_source_duration:ut(I.duration),video_source_height:I.videoHeight,video_source_width:I.videoWidth,view_dropped_frame_count:(st=I)===null||st===void 0||(Qe=st.getVideoPlaybackQuality)===null||Qe===void 0?void 0:Qe.call(st).droppedVideoFrames},rr=b.getPlayheadTime();if(I.getStartDate&&rr>0){var ur=I.getStartDate();if(ur&&typeof ur.getTime=="function"&&ur.getTime()){var bt=ur.getTime();if(qt.player_program_time=bt+rr,I.seekable.length>0){var Zt=bt+I.seekable.end(I.seekable.length-1);qt.player_live_edge_program_time=Zt}}}return qt},I.mux=I.mux||{},I.mux.deleted=!1,I.mux.emit=function(st,Qe){f.emit(Y,st,Qe)};var Ze=function(){ee.error("The monitor for this video element has already been destroyed.")};I.mux.destroy=function(){Object.keys(I.mux.listeners).forEach(function(st){I.removeEventListener(st,I.mux.listeners[st],!1)}),delete I.mux.listeners,I.mux.destroy=Ze,I.mux.swapElement=Ze,I.mux.emit=Ze,I.mux.addHLSJS=Ze,I.mux.addDashJS=Ze,I.mux.removeHLSJS=Ze,I.mux.removeDashJS=Ze,I.mux.deleted=!0,f.emit(Y,"destroy")},I.mux.swapElement=function(st){var Qe=Ii(me(st),3),ot=Qe[0],Ot=Qe[1],qt=Qe[2];return ot?qt!=="video"&&qt!=="audio"?f.log.error("The element of `"+Ot+"` was not a media element."):(ot.muxId=I.muxId,delete I.muxId,ot.mux=ot.mux||{},ot.mux.listeners=K()({},I.mux.listeners),delete I.mux.listeners,Object.keys(ot.mux.listeners).forEach(function(rr){I.removeEventListener(rr,ot.mux.listeners[rr],!1),ot.addEventListener(rr,ot.mux.listeners[rr],!1)}),ot.mux.swapElement=I.mux.swapElement,ot.mux.destroy=I.mux.destroy,delete I.mux,void(I=ot)):f.log.error("No element was found with the `"+Ot+"` query selector.")},I.mux.addHLSJS=function(st){f.addHLSJS(Y,st)},I.mux.addDashJS=function(st){f.addDashJS(Y,st)},I.mux.removeHLSJS=function(){f.removeHLSJS(Y)},I.mux.removeDashJS=function(){f.removeDashJS(Y)},f.init(Y,b),f.emit(Y,"playerready"),I.paused||(f.emit(Y,"play"),I.readyState>2&&f.emit(Y,"playing")),I.mux.listeners={},Ci.forEach(function(st){(st!=="error"||b.automaticErrorTracking)&&(I.mux.listeners[st]=function(){var Qe={};if(st==="error"){if(!I.error||I.error.code===1)return;Qe.player_error_code=I.error.code,Qe.player_error_message=Ln[I.error.code]||I.error.message}f.emit(Y,st,Qe)},I.addEventListener(st,I.mux.listeners[st],!1))})}(Xr,p,h)},destroyMonitor:function(p){var h=Nn(me(p),1)[0];h&&h.mux&&typeof h.mux.destroy=="function"?h.mux.destroy():q.error("A video element monitor for `"+p+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(p,h){var f=L(p);gr[f]?gr[f].addHLSJS(h):q.error("A monitor for `"+f+"` has not been initialized.")},addDashJS:function(p,h){var f=L(p);gr[f]?gr[f].addDashJS(h):q.error("A monitor for `"+f+"` has not been initialized.")},removeHLSJS:function(p){var h=L(p);gr[h]?gr[h].removeHLSJS():q.error("A monitor for `"+h+"` has not been initialized.")},removeDashJS:function(p){var h=L(p);gr[h]?gr[h].removeDashJS():q.error("A monitor for `"+h+"` has not been initialized.")},init:function(p,h){ye()&&h&&h.respectDoNotTrack&&q.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var f=L(p);gr[f]=new Br(Xr,f,h)},emit:function(p,h,f){var y=L(p);gr[y]?(gr[y].emit(h,f),h==="destroy"&&delete gr[y]):q.error("A monitor for `"+y+"` has not been initialized.")},checkDoNotTrack:ye,log:q,utils:Mi,events:Fi,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Xr,vn),R()!==void 0&&typeof R().addEventListener=="function"&&R().addEventListener("pagehide",function(p){p.persisted||(Xr.WINDOW_UNLOADING=!0)},!1);var Un=Xr},655:function(W,B,j){var re,R;function g(k){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},g(k);}(function(k){var L=!1;if((R=typeof(re=k)=="function"?re.call(B,j,B,W):re)===void 0||(W.exports=R),L=!0,g(B)==="object"&&(W.exports=k(),L=!0),!L){var me=window.Cookies,ne=window.Cookies=k();ne.noConflict=function(){return window.Cookies=me,ne}}})(function(){var k=function(){for(var L=0,me={};L<arguments.length;L++){var ne=arguments[L];for(var ce in ne)me[ce]=ne[ce]}return me};return function L(me){function ne(ce,we,q){var ye;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(q=k({path:"/"},ne.defaults,q)).expires=="number"){var J=new Date;J.setMilliseconds(J.getMilliseconds()+864e5*q.expires),q.expires=J}try{ye=JSON.stringify(we),/^[\{\[]/.test(ye)&&(we=ye)}catch{}return we=me.write?me.write(we,ce):encodeURIComponent(String(we)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),ce=(ce=(ce=encodeURIComponent(String(ce))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[ce,"=",we,q.expires?"; expires="+q.expires.toUTCString():"",q.path?"; path="+q.path:"",q.domain?"; domain="+q.domain:"",q.secure?"; secure":""].join("")}ce||(ye={});for(var oe=document.cookie?document.cookie.split("; "):[],K=/(%[0-9A-Z]{2})+/g,Ee=0;Ee<oe.length;Ee++){var ke=oe[Ee].split("="),Ne=ke.slice(1).join("=");Ne.charAt(0)==='"'&&(Ne=Ne.slice(1,-1));try{var V=ke[0].replace(K,decodeURIComponent);if(Ne=me.read?me.read(Ne,V):me(Ne,V)||Ne.replace(K,decodeURIComponent),this.json)try{Ne=JSON.parse(Ne)}catch{}if(ce===V){ye=Ne;break}ce||(ye[V]=Ne)}catch{}}return ye}}return ne.set=ne,ne.get=function(ce){return ne.call(ne,ce)},ne.getJSON=function(){return ne.apply({json:!0},[].slice.call(arguments))},ne.defaults={},ne.remove=function(ce,we){ne(ce,"",k(we,{expires:-1}))},ne.withConverter=L,ne}(function(){})})},153:function(W,B,j){var re,R=j.g!==void 0?j.g:typeof window!="undefined"?window:{},g=j(558);typeof document!="undefined"?re=document:(re=R["__GLOBAL_DOCUMENT_CACHE@4"])||(re=R["__GLOBAL_DOCUMENT_CACHE@4"]=g),W.exports=re},48:function(W,B,j){var re;re=typeof window!="undefined"?window:j.g!==void 0?j.g:typeof self!="undefined"?self:{},W.exports=re},678:function(W){var B=9007199254740991,j="[object Arguments]",re="[object Function]",R="[object GeneratorFunction]",g=/^(?:0|[1-9]\d*)$/;function k(z,$,Le){switch(Le.length){case 0:return z.call($);case 1:return z.call($,Le[0]);case 2:return z.call($,Le[0],Le[1]);case 3:return z.call($,Le[0],Le[1],Le[2])}return z.apply($,Le)}var L,me,ne=Object.prototype,ce=ne.hasOwnProperty,we=ne.toString,q=ne.propertyIsEnumerable,ye=(L=Object.keys,me=Object,function(z){return L(me(z))}),J=Math.max,oe=!q.call({valueOf:1},"valueOf");function K(z,$){var Le=E(z)||function(qe){return function(at){return function(ie){return!!ie&&typeof ie=="object"}(at)&&U(at)}(qe)&&ce.call(qe,"callee")&&(!q.call(qe,"callee")||we.call(qe)==j)}(z)?function(qe,at){for(var ie=-1,pe=Array(qe);++ie<qe;)pe[ie]=at(ie);return pe}(z.length,String):[],Oe=Le.length,xe=!!Oe;for(var be in z)!$&&!ce.call(z,be)||xe&&(be=="length"||ke(be,Oe))||Le.push(be);return Le}function Ee(z,$,Le){var Oe=z[$];ce.call(z,$)&&V(Oe,Le)&&(Le!==void 0||$ in z)||(z[$]=Le)}function ke(z,$){return!!($=$==null?B:$)&&(typeof z=="number"||g.test(z))&&z>-1&&z%1==0&&z<$}function Ne(z){var $=z&&z.constructor;return z===(typeof $=="function"&&$.prototype||ne)}function V(z,$){return z===$||z!=z&&$!=$}var E=Array.isArray;function U(z){return z!=null&&function($){return typeof $=="number"&&$>-1&&$%1==0&&$<=B}(z.length)&&!function($){var Le=D($)?we.call($):"";return Le==re||Le==R}(z)}function D(z){var $=typeof z;return!!z&&($=="object"||$=="function")}var de,Se=(de=function(z,$){if(oe||Ne($)||U($))(function(Oe,xe,be,qe){be||(be={});for(var at=-1,ie=xe.length;++at<ie;){var pe=xe[at],se=qe?qe(be[pe],Oe[pe],pe,be,Oe):void 0;Ee(be,pe,se===void 0?Oe[pe]:se)}})($,function(Oe){return U(Oe)?K(Oe):function(xe){if(!Ne(xe))return ye(xe);var be=[];for(var qe in Object(xe))ce.call(xe,qe)&&qe!="constructor"&&be.push(qe);return be}(Oe)}($),z);else for(var Le in $)ce.call($,Le)&&Ee(z,Le,$[Le])},function(z,$){return $=J($===void 0?z.length-1:$,0),function(){for(var Le=arguments,Oe=-1,xe=J(Le.length-$,0),be=Array(xe);++Oe<xe;)be[Oe]=Le[$+Oe];Oe=-1;for(var qe=Array($+1);++Oe<$;)qe[Oe]=Le[Oe];return qe[$]=be,k(z,this,qe)}}(function(z,$){var Le=-1,Oe=$.length,xe=Oe>1?$[Oe-1]:void 0,be=Oe>2?$[2]:void 0;for(xe=de.length>3&&typeof xe=="function"?(Oe--,xe):void 0,be&&function(at,ie,pe){if(!D(pe))return!1;var se=typeof ie;return!!(se=="number"?U(pe)&&ke(ie,pe.length):se=="string"&&ie in pe)&&V(pe[ie],at)}($[0],$[1],be)&&(xe=Oe<3?void 0:xe,Oe=1),z=Object(z);++Le<Oe;){var qe=$[Le];qe&&de(z,qe,Le,xe)}return z}));W.exports=Se},640:function(W,B,j){var re,R;(function(g,k){"use strict";re=function(){var L=function(){},me="undefined",ne=typeof window!==me&&typeof window.navigator!==me&&/Trident\/|MSIE /.test(window.navigator.userAgent),ce=["trace","debug","info","warn","error"];function we(E,U){var D=E[U];if(typeof D.bind=="function")return D.bind(E);try{return Function.prototype.bind.call(D,E)}catch{return function(){return Function.prototype.apply.apply(D,[E,arguments])}}}function q(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function ye(E){return E==="debug"&&(E="log"),typeof console!==me&&(E==="trace"&&ne?q:console[E]!==void 0?we(console,E):console.log!==void 0?we(console,"log"):L)}function J(E,U){for(var D=0;D<ce.length;D++){var de=ce[D];this[de]=D<E?L:this.methodFactory(de,E,U)}this.log=this.debug}function oe(E,U,D){return function(){typeof console!==me&&(J.call(this,U,D),this[E].apply(this,arguments))}}function K(E,U,D){return ye(E)||oe.apply(this,arguments)}function Ee(E,U,D){var de,Se=this;U=U==null?"WARN":U;var z="loglevel";function $(be){var qe=(ce[be]||"silent").toUpperCase();if(typeof window!==me&&z){try{return void(window.localStorage[z]=qe)}catch{}try{window.document.cookie=encodeURIComponent(z)+"="+qe+";"}catch{}}}function Le(){var be;if(typeof window!==me&&z){try{be=window.localStorage[z]}catch{}if(typeof be===me)try{var qe=window.document.cookie,at=qe.indexOf(encodeURIComponent(z)+"=");at!==-1&&(be=/^([^;]+)/.exec(qe.slice(at))[1])}catch{}return Se.levels[be]===void 0&&(be=void 0),be}}function Oe(){if(typeof window!==me&&z){try{return void window.localStorage.removeItem(z)}catch{}try{window.document.cookie=encodeURIComponent(z)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof E=="string"?z+=":"+E:typeof E=="symbol"&&(z=void 0),Se.name=E,Se.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Se.methodFactory=D||K,Se.getLevel=function(){return de},Se.setLevel=function(be,qe){if(typeof be=="string"&&Se.levels[be.toUpperCase()]!==void 0&&(be=Se.levels[be.toUpperCase()]),!(typeof be=="number"&&be>=0&&be<=Se.levels.SILENT))throw"log.setLevel() called with invalid level: "+be;if(de=be,qe!==!1&&$(be),J.call(Se,be,E),typeof console===me&&be<Se.levels.SILENT)return"No console available for logging"},Se.setDefaultLevel=function(be){U=be,Le()||Se.setLevel(be,!1)},Se.resetLevel=function(){Se.setLevel(U,!1),Oe()},Se.enableAll=function(be){Se.setLevel(Se.levels.TRACE,be)},Se.disableAll=function(be){Se.setLevel(Se.levels.SILENT,be)};var xe=Le();xe==null&&(xe=U),Se.setLevel(xe,!1)}var ke=new Ee,Ne={};ke.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var U=Ne[E];return U||(U=Ne[E]=new Ee(E,ke.getLevel(),ke.methodFactory)),U};var V=typeof window!==me?window.log:void 0;return ke.noConflict=function(){return typeof window!==me&&window.log===ke&&(window.log=V),ke},ke.getLoggers=function(){return Ne},ke.default=ke,ke},(R=typeof re=="function"?re.call(B,j,B,W):re)===void 0||(W.exports=R)})()},375:function(W,B){"use strict";var j=Object.prototype.hasOwnProperty;function re(g){try{return decodeURIComponent(g.replace(/\+/g," "))}catch{return null}}function R(g){try{return encodeURIComponent(g)}catch{return null}}B.stringify=function(g,k){k=k||"";var L,me,ne=[];for(me in typeof k!="string"&&(k="?"),g)if(j.call(g,me)){if((L=g[me])||L!=null&&!isNaN(L)||(L=""),me=R(me),L=R(L),me===null||L===null)continue;ne.push(me+"="+L)}return ne.length?k+ne.join("&"):""},B.parse=function(g){for(var k,L=/([^=?#&]+)=?([^&]*)/g,me={};k=L.exec(g);){var ne=re(k[1]),ce=re(k[2]);ne===null||ce===null||ne in me||(me[ne]=ce)}return me}},558:function(){}},le={};function ae(W){var B=le[W];if(B!==void 0)return B.exports;var j=le[W]={exports:{}};return A[W].call(j.exports,j,j.exports,ae),j.exports}return ae.n=function(W){var B=W&&W.__esModule?function(){return W.default}:function(){return W};return ae.d(B,{a:B}),B},ae.d=function(W,B){for(var j in B)ae.o(B,j)&&!ae.o(W,j)&&Object.defineProperty(W,j,{enumerable:!0,get:B[j]})},ae.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),ae.o=function(W,B){return Object.prototype.hasOwnProperty.call(W,B)},ae(80)}()},typeof En=="object"&&typeof ia=="object"?ia.exports=w():typeof En=="object"?En.mux=w():x.mux=w()})()});var Ya=Ga((Vi,na)=>{typeof window!="undefined"&&function(x,w){typeof Vi=="object"&&typeof na=="object"?na.exports=w():typeof define=="function"&&define.amd?define([],w):typeof Vi=="object"?Vi.Hls=w():x.Hls=w()}(Vi,()=>(()=>{var x={21:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{default:()=>me});var j=function(){function ne(ce,we){this.subtle=void 0,this.aesIV=void 0,this.subtle=ce,this.aesIV=we}return ne.prototype.decrypt=function(ce,we){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},we,ce)},ne}(),re=function(){function ne(ce,we){this.subtle=void 0,this.key=void 0,this.subtle=ce,this.key=we}return ne.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},ne}(),R=B(145),g=function(){function ne(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var ce=ne.prototype;return ce.uint8ArrayToUint32Array_=function(we){for(var q=new DataView(we),ye=new Uint32Array(4),J=0;J<4;J++)ye[J]=q.getUint32(4*J);return ye},ce.initTable=function(){var we=this.sBox,q=this.invSBox,ye=this.subMix,J=ye[0],oe=ye[1],K=ye[2],Ee=ye[3],ke=this.invSubMix,Ne=ke[0],V=ke[1],E=ke[2],U=ke[3],D=new Uint32Array(256),de=0,Se=0,z=0;for(z=0;z<256;z++)D[z]=z<128?z<<1:z<<1^283;for(z=0;z<256;z++){var $=Se^Se<<1^Se<<2^Se<<3^Se<<4;$=$>>>8^255&$^99,we[de]=$,q[$]=de;var Le=D[de],Oe=D[Le],xe=D[Oe],be=257*D[$]^16843008*$;J[de]=be<<24|be>>>8,oe[de]=be<<16|be>>>16,K[de]=be<<8|be>>>24,Ee[de]=be,be=16843009*xe^65537*Oe^257*Le^16843008*de,Ne[$]=be<<24|be>>>8,V[$]=be<<16|be>>>16,E[$]=be<<8|be>>>24,U[$]=be,de?(de=Le^D[D[D[xe^Le]]],Se^=D[D[Se]]):de=Se=1}},ce.expandKey=function(we){for(var q=this.uint8ArrayToUint32Array_(we),ye=!0,J=0;J<q.length&&ye;)ye=q[J]===this.key[J],J++;if(!ye){this.key=q;var oe=this.keySize=q.length;if(oe!==4&&oe!==6&&oe!==8)throw new Error("Invalid aes key size="+oe);var K,Ee,ke,Ne,V=this.ksRows=4*(oe+6+1),E=this.keySchedule=new Uint32Array(V),U=this.invKeySchedule=new Uint32Array(V),D=this.sBox,de=this.rcon,Se=this.invSubMix,z=Se[0],$=Se[1],Le=Se[2],Oe=Se[3];for(K=0;K<V;K++)K<oe?ke=E[K]=q[K]:(Ne=ke,K%oe==0?(Ne=D[(Ne=Ne<<8|Ne>>>24)>>>24]<<24|D[Ne>>>16&255]<<16|D[Ne>>>8&255]<<8|D[255&Ne],Ne^=de[K/oe|0]<<24):oe>6&&K%oe==4&&(Ne=D[Ne>>>24]<<24|D[Ne>>>16&255]<<16|D[Ne>>>8&255]<<8|D[255&Ne]),E[K]=ke=(E[K-oe]^Ne)>>>0);for(Ee=0;Ee<V;Ee++)K=V-Ee,Ne=3&Ee?E[K]:E[K-4],U[Ee]=Ee<4||K<=4?Ne:z[D[Ne>>>24]]^$[D[Ne>>>16&255]]^Le[D[Ne>>>8&255]]^Oe[D[255&Ne]],U[Ee]=U[Ee]>>>0}},ce.networkToHostOrderSwap=function(we){return we<<24|(65280&we)<<8|(16711680&we)>>8|we>>>24},ce.decrypt=function(we,q,ye){for(var J,oe,K,Ee,ke,Ne,V,E,U,D,de,Se,z,$,Le=this.keySize+6,Oe=this.invKeySchedule,xe=this.invSBox,be=this.invSubMix,qe=be[0],at=be[1],ie=be[2],pe=be[3],se=this.uint8ArrayToUint32Array_(ye),Ue=se[0],H=se[1],ve=se[2],Ie=se[3],Fe=new Int32Array(we),fe=new Int32Array(Fe.length),Ce=this.networkToHostOrderSwap;q<Fe.length;){for(U=Ce(Fe[q]),D=Ce(Fe[q+1]),de=Ce(Fe[q+2]),Se=Ce(Fe[q+3]),ke=U^Oe[0],Ne=Se^Oe[1],V=de^Oe[2],E=D^Oe[3],z=4,$=1;$<Le;$++)J=qe[ke>>>24]^at[Ne>>16&255]^ie[V>>8&255]^pe[255&E]^Oe[z],oe=qe[Ne>>>24]^at[V>>16&255]^ie[E>>8&255]^pe[255&ke]^Oe[z+1],K=qe[V>>>24]^at[E>>16&255]^ie[ke>>8&255]^pe[255&Ne]^Oe[z+2],Ee=qe[E>>>24]^at[ke>>16&255]^ie[Ne>>8&255]^pe[255&V]^Oe[z+3],ke=J,Ne=oe,V=K,E=Ee,z+=4;J=xe[ke>>>24]<<24^xe[Ne>>16&255]<<16^xe[V>>8&255]<<8^xe[255&E]^Oe[z],oe=xe[Ne>>>24]<<24^xe[V>>16&255]<<16^xe[E>>8&255]<<8^xe[255&ke]^Oe[z+1],K=xe[V>>>24]<<24^xe[E>>16&255]<<16^xe[ke>>8&255]<<8^xe[255&Ne]^Oe[z+2],Ee=xe[E>>>24]<<24^xe[ke>>16&255]<<16^xe[Ne>>8&255]<<8^xe[255&V]^Oe[z+3],fe[q]=Ce(J^Ue),fe[q+1]=Ce(Ee^H),fe[q+2]=Ce(K^ve),fe[q+3]=Ce(oe^Ie),Ue=U,H=D,ve=de,Ie=Se,q+=4}return fe.buffer},ne}(),k=B(93),L=B(63),me=function(){function ne(we,q){var ye=(q===void 0?{}:q).removePKCS7Padding,J=ye===void 0||ye;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=we.enableSoftwareAES,this.removePKCS7Padding=J,J)try{var oe=self.crypto;oe&&(this.subtle=oe.subtle||oe.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var ce=ne.prototype;return ce.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},ce.isSync=function(){return this.useSoftware},ce.flush=function(){var we=this.currentResult,q=this.remainderData;if(!we||q)return k.logger.error("[softwareDecrypt] "+(q?"overflow bytes: "+q.byteLength:"no result")),this.reset(),null;var ye,J,oe,K=new Uint8Array(we);return this.reset(),this.removePKCS7Padding?(oe=(J=(ye=K).byteLength)&&new DataView(ye.buffer).getUint8(J-1))?(0,R.sliceUint8)(ye,0,J-oe):ye:K},ce.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},ce.decrypt=function(we,q,ye){var J=this;return this.useSoftware?new Promise(function(oe,K){J.softwareDecrypt(new Uint8Array(we),q,ye);var Ee=J.flush();Ee?oe(Ee.buffer):K(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(we),q,ye)},ce.softwareDecrypt=function(we,q,ye){var J=this.currentIV,oe=this.currentResult,K=this.remainderData;this.logOnce("JS AES decrypt"),K&&(we=(0,L.appendUint8Array)(K,we),this.remainderData=null);var Ee=this.getValidChunk(we);if(!Ee.length)return null;J&&(ye=J);var ke=this.softwareDecrypter;ke||(ke=this.softwareDecrypter=new g),ke.expandKey(q);var Ne=oe;return this.currentResult=ke.decrypt(Ee.buffer,0,ye),this.currentIV=(0,R.sliceUint8)(Ee,-16).buffer,Ne||null},ce.webCryptoDecrypt=function(we,q,ye){var J=this,oe=this.subtle;return this.key===q&&this.fastAesKey||(this.key=q,this.fastAesKey=new re(oe,q)),this.fastAesKey.expandKey().then(function(K){return oe?(J.logOnce("WebCrypto AES decrypt"),new j(oe,new Uint8Array(ye)).decrypt(we.buffer,K)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(K){return k.logger.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+K.name+": "+K.message),J.onWebCryptoError(we,q,ye)})},ce.onWebCryptoError=function(we,q,ye){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(we,q,ye);var J=this.flush();if(J)return J.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},ce.getValidChunk=function(we){var q=we,ye=we.length-we.length%16;return ye!==we.length&&(q=(0,R.sliceUint8)(we,0,ye),this.remainderData=(0,R.sliceUint8)(we,ye)),q},ce.logOnce=function(we){this.logEnabled&&(k.logger.log("[decrypter]: "+we),this.logEnabled=!1)},ne}()},181:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{canParse:()=>L,decodeFrame:()=>q,getID3Data:()=>g,getID3Frames:()=>we,getTimeStamp:()=>me,isFooter:()=>R,isHeader:()=>re,isTimeStampFrame:()=>ne,testables:()=>ke,utf8ArrayToStr:()=>Ee});var j,re=function(V,E){return E+10<=V.length&&V[E]===73&&V[E+1]===68&&V[E+2]===51&&V[E+3]<255&&V[E+4]<255&&V[E+6]<128&&V[E+7]<128&&V[E+8]<128&&V[E+9]<128},R=function(V,E){return E+10<=V.length&&V[E]===51&&V[E+1]===68&&V[E+2]===73&&V[E+3]<255&&V[E+4]<255&&V[E+6]<128&&V[E+7]<128&&V[E+8]<128&&V[E+9]<128},g=function(V,E){for(var U=E,D=0;re(V,E);)D+=10,D+=k(V,E+6),R(V,E+10)&&(D+=10),E+=D;if(D>0)return V.subarray(U,U+D)},k=function(V,E){var U=0;return U=(127&V[E])<<21,U|=(127&V[E+1])<<14,(U|=(127&V[E+2])<<7)|127&V[E+3]},L=function(V,E){return re(V,E)&&k(V,E+6)+10<=V.length-E},me=function(V){for(var E=we(V),U=0;U<E.length;U++){var D=E[U];if(ne(D))return K(D)}},ne=function(V){return V&&V.key==="PRIV"&&V.info==="com.apple.streaming.transportStreamTimestamp"},ce=function(V){var E=String.fromCharCode(V[0],V[1],V[2],V[3]),U=k(V,4);return{type:E,size:U,data:V.subarray(10,10+U)}},we=function(V){for(var E=0,U=[];re(V,E);){for(var D=k(V,E+6),de=(E+=10)+D;E+8<de;){var Se=ce(V.subarray(E)),z=q(Se);z&&U.push(z),E+=Se.size+10}R(V,E)&&(E+=10)}return U},q=function(V){return V.type==="PRIV"?ye(V):V.type[0]==="W"?oe(V):J(V)},ye=function(V){if(!(V.size<2)){var E=Ee(V.data,!0),U=new Uint8Array(V.data.subarray(E.length+1));return{key:V.type,info:E,data:U.buffer}}},J=function(V){if(!(V.size<2)){if(V.type==="TXXX"){var E=1,U=Ee(V.data.subarray(E),!0);E+=U.length+1;var D=Ee(V.data.subarray(E));return{key:V.type,info:U,data:D}}var de=Ee(V.data.subarray(1));return{key:V.type,data:de}}},oe=function(V){if(V.type==="WXXX"){if(V.size<2)return;var E=1,U=Ee(V.data.subarray(E),!0);E+=U.length+1;var D=Ee(V.data.subarray(E));return{key:V.type,info:U,data:D}}var de=Ee(V.data);return{key:V.type,data:de}},K=function(V){if(V.data.byteLength===8){var E=new Uint8Array(V.data),U=1&E[3],D=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return D/=45,U&&(D+=4772185884e-2),Math.round(D)}},Ee=function(V,E){E===void 0&&(E=!1);var U=Ne();if(U){var D=U.decode(V);if(E){var de=D.indexOf("\0");return de!==-1?D.substring(0,de):D}return D.replace(/\0/g,"")}for(var Se,z,$,Le=V.length,Oe="",xe=0;xe<Le;){if((Se=V[xe++])===0&&E)return Oe;if(Se!==0&&Se!==3)switch(Se>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:Oe+=String.fromCharCode(Se);break;case 12:case 13:z=V[xe++],Oe+=String.fromCharCode((31&Se)<<6|63&z);break;case 14:z=V[xe++],$=V[xe++],Oe+=String.fromCharCode((15&Se)<<12|(63&z)<<6|(63&$)<<0)}}return Oe},ke={decodeTextFrame:J};function Ne(){return j||self.TextDecoder===void 0||(j=new self.TextDecoder("utf-8")),j}},182:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{default:()=>L});var j=B(544),re=B(851),R=B(93),g=B(729),k=B(973);function L(we){var q=new g.EventEmitter,ye=function(J,oe){we.postMessage({event:J,data:oe})};q.on(re.Events.FRAG_DECRYPTED,ye),q.on(re.Events.ERROR,ye),we.addEventListener("message",function(J){var oe=J.data;switch(oe.cmd){case"init":var K=JSON.parse(oe.config);we.transmuxer=new j.default(q,oe.typeSupported,K,oe.vendor,oe.id),(0,R.enableLogs)(K.debug,oe.id),function(){var V=function(U){R.logger[U]=function(D){ye("workerLog",{logType:U,message:D})}};for(var E in R.logger)V(E)}(),ye("init",null);break;case"configure":we.transmuxer.configure(oe.config);break;case"demux":var Ee=we.transmuxer.push(oe.data,oe.decryptdata,oe.chunkMeta,oe.state);(0,j.isPromise)(Ee)?(we.transmuxer.async=!0,Ee.then(function(V){me(we,V)}).catch(function(V){ye(re.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:V,err:V,reason:"transmuxer-worker push error"})})):(we.transmuxer.async=!1,me(we,Ee));break;case"flush":var ke=oe.chunkMeta,Ne=we.transmuxer.flush(ke);(0,j.isPromise)(Ne)||we.transmuxer.async?((0,j.isPromise)(Ne)||(Ne=Promise.resolve(Ne)),Ne.then(function(V){ce(we,V,ke)}).catch(function(V){ye(re.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:V,err:V,reason:"transmuxer-worker flush error"})})):ce(we,Ne,ke)}})}function me(we,q){if(!((ye=q.remuxResult).audio||ye.video||ye.text||ye.id3||ye.initSegment))return!1;var ye,J=[],oe=q.remuxResult,K=oe.audio,Ee=oe.video;return K&&ne(J,K),Ee&&ne(J,Ee),we.postMessage({event:"transmuxComplete",data:q},J),!0}function ne(we,q){q.data1&&we.push(q.data1.buffer),q.data2&&we.push(q.data2.buffer)}function ce(we,q,ye){q.reduce(function(J,oe){return me(we,oe)||J},!1)||we.postMessage({event:"transmuxComplete",data:q[0]}),we.postMessage({event:"flush",data:ye})}},544:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{TransmuxConfig:()=>Bt,TransmuxState:()=>ar,default:()=>It,isPromise:()=>Wt});var j=B(851),re=B(973),R=B(21),g=B(965),k=B(181),L=B(856);function me(te,N){return te===void 0&&(te=""),N===void 0&&(N=9e4),{type:te,id:-1,pid:-1,inputTimeScale:N,sequenceNumber:-1,samples:[],dropped:0}}var ne=B(63),ce=B(145),we=function(){function te(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var N=te.prototype;return N.resetInitSegment=function(T,O,C,G){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},N.resetTimeStamp=function(T){this.initPTS=T,this.resetContiguity()},N.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},N.canParse=function(T,O){return!1},N.appendFrame=function(T,O,C){},N.demux=function(T,O){this.cachedData&&(T=(0,ne.appendUint8Array)(this.cachedData,T),this.cachedData=null);var C,G=k.getID3Data(T,0),Q=G?G.length:0,Z=this._audioTrack,Te=this._id3Track,Re=G?k.getTimeStamp(G):void 0,Pe=T.length;for((this.basePTS===null||this.frameIndex===0&&(0,g.isFiniteNumber)(Re))&&(this.basePTS=q(Re,O,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),G&&G.length>0&&Te.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:G,type:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});Q<Pe;){if(this.canParse(T,Q)){var Be=this.appendFrame(Z,T,Q);Be?(this.frameIndex++,this.lastPTS=Be.sample.pts,C=Q+=Be.length):Q=Pe}else k.canParse(T,Q)?(G=k.getID3Data(T,Q),Te.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:G,type:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),C=Q+=G.length):Q++;if(Q===Pe&&C!==Pe){var We=(0,ce.sliceUint8)(T,C);this.cachedData?this.cachedData=(0,ne.appendUint8Array)(this.cachedData,We):this.cachedData=We}}return{audioTrack:Z,videoTrack:me(),id3Track:Te,textTrack:me()}},N.demuxSampleAes=function(T,O,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},N.flush=function(T){var O=this.cachedData;return O&&(this.cachedData=null,this.demux(O,0)),{audioTrack:this._audioTrack,videoTrack:me(),id3Track:this._id3Track,textTrack:me()}},N.destroy=function(){},te}(),q=function(te,N,T){return(0,g.isFiniteNumber)(te)?90*te:9e4*N+(T||0)};let ye=we;var J=B(93);function oe(te,N){return te[N]===255&&(246&te[N+1])==240}function K(te,N){return 1&te[N+1]?7:9}function Ee(te,N){return(3&te[N+3])<<11|te[N+4]<<3|(224&te[N+5])>>>5}function ke(te,N){return N+1<te.length&&oe(te,N)}function Ne(te,N){if(ke(te,N)){var T=K(te,N);if(N+T>=te.length)return!1;var O=Ee(te,N);if(O<=T)return!1;var C=N+O;return C===te.length||ke(te,C)}return!1}function V(te,N,T,O,C){if(!te.samplerate){var G=function(Q,Z,Te,Re){var Pe,Be,We,Ge,$e=navigator.userAgent.toLowerCase(),ht=Re,Dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Pe=1+((192&Z[Te+2])>>>6);var ze=(60&Z[Te+2])>>>2;if(!(ze>Dt.length-1))return We=(1&Z[Te+2])<<2,We|=(192&Z[Te+3])>>>6,J.logger.log("manifest codec:"+Re+", ADTS type:"+Pe+", samplingIndex:"+ze),/firefox/i.test($e)?ze>=6?(Pe=5,Ge=new Array(4),Be=ze-3):(Pe=2,Ge=new Array(2),Be=ze):$e.indexOf("android")!==-1?(Pe=2,Ge=new Array(2),Be=ze):(Pe=5,Ge=new Array(4),Re&&(Re.indexOf("mp4a.40.29")!==-1||Re.indexOf("mp4a.40.5")!==-1)||!Re&&ze>=6?Be=ze-3:((Re&&Re.indexOf("mp4a.40.2")!==-1&&(ze>=6&&We===1||/vivaldi/i.test($e))||!Re&&We===1)&&(Pe=2,Ge=new Array(2)),Be=ze)),Ge[0]=Pe<<3,Ge[0]|=(14&ze)>>1,Ge[1]|=(1&ze)<<7,Ge[1]|=We<<3,Pe===5&&(Ge[1]|=(14&Be)>>1,Ge[2]=(1&Be)<<7,Ge[2]|=8,Ge[3]=0),{config:Ge,samplerate:Dt[ze],channelCount:We,codec:"mp4a.40."+Pe,manifestCodec:ht};Q.trigger(j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+ze})}(N,T,O,C);if(!G)return;te.config=G.config,te.samplerate=G.samplerate,te.channelCount=G.channelCount,te.codec=G.codec,te.manifestCodec=G.manifestCodec,J.logger.log("parsed codec:"+te.codec+", rate:"+G.samplerate+", channels:"+G.channelCount)}}function E(te){return 9216e4/te}function U(te,N,T,O,C){var G,Q=O+C*E(te.samplerate),Z=function($e,ht){var Dt=K($e,ht);if(ht+Dt<=$e.length){var ze=Ee($e,ht)-Dt;if(ze>0)return{headerLength:Dt,frameLength:ze}}}(N,T);if(Z){var Te=Z.frameLength,Re=Z.headerLength,Pe=Re+Te,Be=Math.max(0,T+Pe-N.length);Be?(G=new Uint8Array(Pe-Re)).set(N.subarray(T+Re,N.length),0):G=N.subarray(T+Re,T+Pe);var We={unit:G,pts:Q};return Be||te.samples.push(We),{sample:We,length:Pe,missing:Be}}var Ge=N.length-T;return(G=new Uint8Array(Ge)).set(N.subarray(T,N.length),0),{sample:{unit:G,pts:Q},length:Ge,missing:-1}}function D(te,N){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,O){return T.__proto__=O,T},D(te,N)}let de=function(te){var N,T;function O(G,Q){var Z;return(Z=te.call(this)||this).observer=void 0,Z.config=void 0,Z.observer=G,Z.config=Q,Z}T=te,(N=O).prototype=Object.create(T.prototype),N.prototype.constructor=N,D(N,T);var C=O.prototype;return C.resetInitSegment=function(G,Q,Z,Te){te.prototype.resetInitSegment.call(this,G,Q,Z,Te),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:Q,duration:Te,inputTimeScale:9e4,dropped:0}},O.probe=function(G){if(!G)return!1;for(var Q=(k.getID3Data(G,0)||[]).length,Z=G.length;Q<Z;Q++)if(Ne(G,Q))return J.logger.log("ADTS sync word found !"),!0;return!1},C.canParse=function(G,Q){return function(Z,Te){return function(Re,Pe){return Pe+5<Re.length}(Z,Te)&&oe(Z,Te)&&Ee(Z,Te)<=Z.length-Te}(G,Q)},C.appendFrame=function(G,Q,Z){V(G,this.observer,Q,Z,G.manifestCodec);var Te=U(G,Q,Z,this.basePTS,this.frameIndex);if(Te&&Te.missing===0)return Te},O}(ye);var Se=/\/emsg[-/]ID3/i;let z=function(){function te(T,O){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=O}var N=te.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(T,O,C,G){var Q=this.videoTrack=me("video",1),Z=this.audioTrack=me("audio",1),Te=this.txtTrack=me("text",1);if(this.id3Track=me("id3",1),this.timeOffset=0,T&&T.byteLength){var Re=(0,ne.parseInitSegment)(T);if(Re.video){var Pe=Re.video,Be=Pe.id,We=Pe.timescale,Ge=Pe.codec;Q.id=Be,Q.timescale=Te.timescale=We,Q.codec=Ge}if(Re.audio){var $e=Re.audio,ht=$e.id,Dt=$e.timescale,ze=$e.codec;Z.id=ht,Z.timescale=Dt,Z.codec=ze}Te.id=ne.RemuxerTrackIdConfig.text,Q.sampleDuration=0,Q.duration=Z.duration=G}},N.resetContiguity=function(){},te.probe=function(T){return T=T.length>16384?T.subarray(0,16384):T,(0,ne.findBox)(T,["moof"]).length>0},N.demux=function(T,O){this.timeOffset=O;var C=T,G=this.videoTrack,Q=this.txtTrack;if(this.config.progressive){this.remainderData&&(C=(0,ne.appendUint8Array)(this.remainderData,T));var Z=(0,ne.segmentValidRange)(C);this.remainderData=Z.remainder,G.samples=Z.valid||new Uint8Array}else G.samples=C;var Te=this.extractID3Track(G,O);return Q.samples=(0,ne.parseSamples)(O,G),{videoTrack:G,audioTrack:this.audioTrack,id3Track:Te,textTrack:this.txtTrack}},N.flush=function(){var T=this.timeOffset,O=this.videoTrack,C=this.txtTrack;O.samples=this.remainderData||new Uint8Array,this.remainderData=null;var G=this.extractID3Track(O,this.timeOffset);return C.samples=(0,ne.parseSamples)(T,O),{videoTrack:O,audioTrack:me(),id3Track:G,textTrack:me()}},N.extractID3Track=function(T,O){var C=this.id3Track;if(T.samples.length){var G=(0,ne.findBox)(T.samples,["emsg"]);G&&G.forEach(function(Q){var Z=(0,ne.parseEmsg)(Q);if(Se.test(Z.schemeIdUri)){var Te=(0,g.isFiniteNumber)(Z.presentationTime)?Z.presentationTime/Z.timeScale:O+Z.presentationTimeDelta/Z.timeScale,Re=Z.eventDuration===4294967295?Number.POSITIVE_INFINITY:Z.eventDuration/Z.timeScale;Re<=.001&&(Re=Number.POSITIVE_INFINITY);var Pe=Z.payload;C.samples.push({data:Pe,len:Pe.byteLength,dts:Te,pts:Te,type:L.MetadataSchema.emsg,duration:Re})}})}return C},N.demuxSampleAes=function(T,O,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},te}();var $=null,Le=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Oe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],xe=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],be=[0,1,1,4];function qe(te,N,T,O,C){if(!(T+24>N.length)){var G=at(N,T);if(G&&T+G.frameLength<=N.length){var Q=O+C*(9e4*G.samplesPerFrame/G.sampleRate),Z={unit:N.subarray(T,T+G.frameLength),pts:Q,dts:Q};return te.config=[],te.channelCount=G.channelCount,te.samplerate=G.sampleRate,te.samples.push(Z),{sample:Z,length:G.frameLength,missing:0}}}}function at(te,N){var T=te[N+1]>>3&3,O=te[N+1]>>1&3,C=te[N+2]>>4&15,G=te[N+2]>>2&3;if(T!==1&&C!==0&&C!==15&&G!==3){var Q=te[N+2]>>1&1,Z=te[N+3]>>6,Te=1e3*Le[14*(T===3?3-O:O===3?3:4)+C-1],Re=Oe[3*(T===3?0:T===2?1:2)+G],Pe=Z===3?1:2,Be=xe[T][O],We=be[O],Ge=8*Be*We,$e=Math.floor(Be*Te/Re+Q)*We;if($===null){var ht=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);$=ht?parseInt(ht[1]):0}return!!$&&$<=87&&O===2&&Te>=224e3&&Z===0&&(te[N+3]=128|te[N+3]),{sampleRate:Re,channelCount:Pe,frameLength:$e,samplesPerFrame:Ge}}}function ie(te,N){return te[N]===255&&(224&te[N+1])==224&&(6&te[N+1])!=0}function pe(te,N){return N+1<te.length&&ie(te,N)}function se(te,N){if(N+1<te.length&&ie(te,N)){var T=at(te,N),O=4;T!=null&&T.frameLength&&(O=T.frameLength);var C=N+O;return C===te.length||pe(te,C)}return!1}let Ue=function(){function te(T){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=T,this.bytesAvailable=T.byteLength,this.word=0,this.bitsAvailable=0}var N=te.prototype;return N.loadWord=function(){var T=this.data,O=this.bytesAvailable,C=T.byteLength-O,G=new Uint8Array(4),Q=Math.min(4,O);if(Q===0)throw new Error("no bytes available");G.set(T.subarray(C,C+Q)),this.word=new DataView(G.buffer).getUint32(0),this.bitsAvailable=8*Q,this.bytesAvailable-=Q},N.skipBits=function(T){var O;T=Math.min(T,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>T?(this.word<<=T,this.bitsAvailable-=T):(T-=this.bitsAvailable,T-=(O=T>>3)<<3,this.bytesAvailable-=O,this.loadWord(),this.word<<=T,this.bitsAvailable-=T)},N.readBits=function(T){var O=Math.min(this.bitsAvailable,T),C=this.word>>>32-O;if(T>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0)this.word<<=O;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(O=T-O)>0&&this.bitsAvailable?C<<O|this.readBits(O):C},N.skipLZ=function(){var T;for(T=0;T<this.bitsAvailable;++T)if((this.word&2147483648>>>T)!=0)return this.word<<=T,this.bitsAvailable-=T,T;return this.loadWord(),T+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var T=this.skipLZ();return this.readBits(T+1)-1},N.readEG=function(){var T=this.readUEG();return 1&T?1+T>>>1:-1*(T>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(T){for(var O=8,C=8,G=0;G<T;G++)C!==0&&(C=(O+this.readEG()+256)%256),O=C===0?O:C},N.readSPS=function(){var T,O,C,G=0,Q=0,Z=0,Te=0,Re=this.readUByte.bind(this),Pe=this.readBits.bind(this),Be=this.readUEG.bind(this),We=this.readBoolean.bind(this),Ge=this.skipBits.bind(this),$e=this.skipEG.bind(this),ht=this.skipUEG.bind(this),Dt=this.skipScalingList.bind(this);Re();var ze=Re();if(Pe(5),Ge(3),Re(),ht(),ze===100||ze===110||ze===122||ze===244||ze===44||ze===83||ze===86||ze===118||ze===128){var Pt=Be();if(Pt===3&&Ge(1),ht(),ht(),Ge(1),We())for(O=Pt!==3?8:12,C=0;C<O;C++)We()&&Dt(C<6?16:64)}ht();var tr=Be();if(tr===0)Be();else if(tr===1)for(Ge(1),$e(),$e(),T=Be(),C=0;C<T;C++)$e();ht(),Ge(1);var jt=Be(),Ft=Be(),Ht=Pe(1);Ht===0&&Ge(1),Ge(1),We()&&(G=Be(),Q=Be(),Z=Be(),Te=Be());var rt=[1,1];if(We()&&We())switch(Re()){case 1:rt=[1,1];break;case 2:rt=[12,11];break;case 3:rt=[10,11];break;case 4:rt=[16,11];break;case 5:rt=[40,33];break;case 6:rt=[24,11];break;case 7:rt=[20,11];break;case 8:rt=[32,11];break;case 9:rt=[80,33];break;case 10:rt=[18,11];break;case 11:rt=[15,11];break;case 12:rt=[64,33];break;case 13:rt=[160,99];break;case 14:rt=[4,3];break;case 15:rt=[3,2];break;case 16:rt=[2,1];break;case 255:rt=[Re()<<8|Re(),Re()<<8|Re()]}return{width:Math.ceil(16*(jt+1)-2*G-2*Q),height:(2-Ht)*(Ft+1)*16-(Ht?2:4)*(Z+Te),pixelRatio:rt}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},te}(),H=function(){function te(T,O,C){this.keyData=void 0,this.decrypter=void 0,this.keyData=C,this.decrypter=new R.default(O,{removePKCS7Padding:!1})}var N=te.prototype;return N.decryptBuffer=function(T){return this.decrypter.decrypt(T,this.keyData.key.buffer,this.keyData.iv.buffer)},N.decryptAacSample=function(T,O,C){var G=this,Q=T[O].unit;if(!(Q.length<=16)){var Z=Q.subarray(16,Q.length-Q.length%16),Te=Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.length);this.decryptBuffer(Te).then(function(Re){var Pe=new Uint8Array(Re);Q.set(Pe,16),G.decrypter.isSync()||G.decryptAacSamples(T,O+1,C)})}},N.decryptAacSamples=function(T,O,C){for(;;O++){if(O>=T.length)return void C();if(!(T[O].unit.length<32||(this.decryptAacSample(T,O,C),this.decrypter.isSync())))return}},N.getAvcEncryptedData=function(T){for(var O=16*Math.floor((T.length-48)/160)+16,C=new Int8Array(O),G=0,Q=32;Q<T.length-16;Q+=160,G+=16)C.set(T.subarray(Q,Q+16),G);return C},N.getAvcDecryptedUnit=function(T,O){for(var C=new Uint8Array(O),G=0,Q=32;Q<T.length-16;Q+=160,G+=16)T.set(C.subarray(G,G+16),Q);return T},N.decryptAvcSample=function(T,O,C,G,Q){var Z=this,Te=(0,ne.discardEPB)(Q.data),Re=this.getAvcEncryptedData(Te);this.decryptBuffer(Re.buffer).then(function(Pe){Q.data=Z.getAvcDecryptedUnit(Te,Pe),Z.decrypter.isSync()||Z.decryptAvcSamples(T,O,C+1,G)})},N.decryptAvcSamples=function(T,O,C,G){if(T instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;O++,C=0){if(O>=T.length)return void G();for(var Q=T[O].units;!(C>=Q.length);C++){var Z=Q[C];if(!(Z.data.length<=48||Z.type!==1&&Z.type!==5||(this.decryptAvcSample(T,O,C,G,Z),this.decrypter.isSync())))return}}},te}();function ve(){return ve=Object.assign?Object.assign.bind():function(te){for(var N=1;N<arguments.length;N++){var T=arguments[N];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(te[O]=T[O])}return te},ve.apply(this,arguments)}var Ie=188;function Fe(te,N,T,O){return{key:te,frame:!1,pts:N,dts:T,units:[],debug:O,length:0}}function fe(te,N){return(31&te[N+10])<<8|te[N+11]}function Ce(te,N,T,O){var C={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},G=N+3+((15&te[N+1])<<8|te[N+2])-4;for(N+=12+((15&te[N+10])<<8|te[N+11]);N<G;){var Q=(31&te[N+1])<<8|te[N+2];switch(te[N]){case 207:if(!O){J.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=Q);break;case 21:C.id3===-1&&(C.id3=Q);break;case 219:if(!O){J.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=Q);break;case 3:case 4:T.mpeg!==!0&&T.mp3!==!0?J.logger.log("MPEG audio found, not supported in this browser"):C.audio===-1&&(C.audio=Q,C.segmentCodec="mp3");break;case 36:J.logger.warn("Unsupported HEVC stream type found")}N+=5+((15&te[N+3])<<8|te[N+4])}return C}function Ve(te){var N,T,O,C,G,Q=0,Z=te.data;if(!te||te.size===0)return null;for(;Z[0].length<19&&Z.length>1;){var Te=new Uint8Array(Z[0].length+Z[1].length);Te.set(Z[0]),Te.set(Z[1],Z[0].length),Z[0]=Te,Z.splice(1,1)}if(((N=Z[0])[0]<<16)+(N[1]<<8)+N[2]===1){if((T=(N[4]<<8)+N[5])&&T>te.size-6)return null;var Re=N[7];192&Re&&(C=536870912*(14&N[9])+4194304*(255&N[10])+16384*(254&N[11])+128*(255&N[12])+(254&N[13])/2,64&Re?C-(G=536870912*(14&N[14])+4194304*(255&N[15])+16384*(254&N[16])+128*(255&N[17])+(254&N[18])/2)>54e5&&(J.logger.warn(Math.round((C-G)/9e4)+"s delta between PTS and DTS, align them"),C=G):G=C);var Pe=(O=N[8])+9;if(te.size<=Pe)return null;te.size-=Pe;for(var Be=new Uint8Array(te.size),We=0,Ge=Z.length;We<Ge;We++){var $e=(N=Z[We]).byteLength;if(Pe){if(Pe>$e){Pe-=$e;continue}N=N.subarray(Pe),$e-=Pe,Pe=0}Be.set(N,Q),Q+=$e}return T&&(T-=O+3),{data:Be,pts:C,dts:G,len:T}}return null}function Xe(te,N){if(te.units.length&&te.frame){if(te.pts===void 0){var T=N.samples,O=T.length;if(!O)return void N.dropped++;var C=T[O-1];te.pts=C.pts,te.dts=C.dts}N.samples.push(te)}te.debug.length&&J.logger.log(te.pts+"/"+te.dts+":"+te.debug)}let it=function(){function te(T,O,C){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=T,this.config=O,this.typeSupported=C}te.probe=function(T){var O=te.syncOffset(T);return O>0&&J.logger.warn("MPEG2-TS detected but first sync word found @ offset "+O),O!==-1},te.syncOffset=function(T){for(var O=Math.min(940,T.length-376)+1,C=0;C<O;){if(T[C]===71&&T[C+Ie]===71)return C;C++}return-1},te.createTrack=function(T,O){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:ne.RemuxerTrackIdConfig[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?O:void 0}};var N=te.prototype;return N.resetInitSegment=function(T,O,C,G){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=te.createTrack("video"),this._audioTrack=te.createTrack("audio",G),this._id3Track=te.createTrack("id3"),this._txtTrack=te.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=O,this.videoCodec=C,this._duration=G},N.resetTimeStamp=function(){},N.resetContiguity=function(){var T=this._audioTrack,O=this._avcTrack,C=this._id3Track;T&&(T.pesData=null),O&&(O.pesData=null),C&&(C.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},N.demux=function(T,O,C,G){var Q;C===void 0&&(C=!1),G===void 0&&(G=!1),C||(this.sampleAes=null);var Z=this._avcTrack,Te=this._audioTrack,Re=this._id3Track,Pe=this._txtTrack,Be=Z.pid,We=Z.pesData,Ge=Te.pid,$e=Re.pid,ht=Te.pesData,Dt=Re.pesData,ze=null,Pt=this.pmtParsed,tr=this._pmtId,jt=T.length;if(this.remainderData&&(jt=(T=(0,ne.appendUint8Array)(this.remainderData,T)).length,this.remainderData=null),jt<Ie&&!G)return this.remainderData=T,{audioTrack:Te,videoTrack:Z,id3Track:Re,textTrack:Pe};var Ft=Math.max(0,te.syncOffset(T));(jt-=(jt-Ft)%Ie)<T.byteLength&&!G&&(this.remainderData=new Uint8Array(T.buffer,jt,T.buffer.byteLength-jt));for(var Ht=0,rt=Ft;rt<jt;rt+=Ie)if(T[rt]===71){var lr=!!(64&T[rt+1]),Ar=((31&T[rt+1])<<8)+T[rt+2],Kt=void 0;if((48&T[rt+3])>>4>1){if((Kt=rt+5+T[rt+4])===rt+Ie)continue}else Kt=rt+4;switch(Ar){case Be:lr&&(We&&(Q=Ve(We))&&this.parseAVCPES(Z,Pe,Q,!1),We={data:[],size:0}),We&&(We.data.push(T.subarray(Kt,rt+Ie)),We.size+=rt+Ie-Kt);break;case Ge:if(lr){if(ht&&(Q=Ve(ht)))switch(Te.segmentCodec){case"aac":this.parseAACPES(Te,Q);break;case"mp3":this.parseMPEGPES(Te,Q)}ht={data:[],size:0}}ht&&(ht.data.push(T.subarray(Kt,rt+Ie)),ht.size+=rt+Ie-Kt);break;case $e:lr&&(Dt&&(Q=Ve(Dt))&&this.parseID3PES(Re,Q),Dt={data:[],size:0}),Dt&&(Dt.data.push(T.subarray(Kt,rt+Ie)),Dt.size+=rt+Ie-Kt);break;case 0:lr&&(Kt+=T[Kt]+1),tr=this._pmtId=fe(T,Kt);break;case tr:lr&&(Kt+=T[Kt]+1);var Jt=Ce(T,Kt,this.typeSupported,C);(Be=Jt.avc)>0&&(Z.pid=Be),(Ge=Jt.audio)>0&&(Te.pid=Ge,Te.segmentCodec=Jt.segmentCodec),($e=Jt.id3)>0&&(Re.pid=$e),ze===null||Pt||(J.logger.log("unknown PID '"+ze+"' in TS found"),ze=null,rt=Ft-188),Pt=this.pmtParsed=!0;break;case 17:case 8191:break;default:ze=Ar}}else Ht++;Ht>0&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Ht+" TS packet/s that do not start with 0x47"}),Z.pesData=We,Te.pesData=ht,Re.pesData=Dt;var pr={audioTrack:Te,videoTrack:Z,id3Track:Re,textTrack:Pe};return G&&this.extractRemainingSamples(pr),pr},N.flush=function(){var T,O=this.remainderData;return this.remainderData=null,T=O?this.demux(O,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},N.extractRemainingSamples=function(T){var O,C=T.audioTrack,G=T.videoTrack,Q=T.id3Track,Z=T.textTrack,Te=G.pesData,Re=C.pesData,Pe=Q.pesData;if(Te&&(O=Ve(Te))?(this.parseAVCPES(G,Z,O,!0),G.pesData=null):G.pesData=Te,Re&&(O=Ve(Re))){switch(C.segmentCodec){case"aac":this.parseAACPES(C,O);break;case"mp3":this.parseMPEGPES(C,O)}C.pesData=null}else Re!=null&&Re.size&&J.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=Re;Pe&&(O=Ve(Pe))?(this.parseID3PES(Q,O),Q.pesData=null):Q.pesData=Pe},N.demuxSampleAes=function(T,O,C){var G=this.demux(T,C,!0,!this.config.progressive),Q=this.sampleAes=new H(this.observer,this.config,O);return this.decrypt(G,Q)},N.decrypt=function(T,O){return new Promise(function(C){var G=T.audioTrack,Q=T.videoTrack;G.samples&&G.segmentCodec==="aac"?O.decryptAacSamples(G.samples,0,function(){Q.samples?O.decryptAvcSamples(Q.samples,0,0,function(){C(T)}):C(T)}):Q.samples&&O.decryptAvcSamples(Q.samples,0,0,function(){C(T)})})},N.destroy=function(){this._duration=0},N.parseAVCPES=function(T,O,C,G){var Q,Z=this,Te=this.parseAVCNALu(T,C.data),Re=this.avcSample,Pe=!1;C.data=null,Re&&Te.length&&!T.audFound&&(Xe(Re,T),Re=this.avcSample=Fe(!1,C.pts,C.dts,"")),Te.forEach(function(Be){switch(Be.type){case 1:Q=!0,Re||(Re=Z.avcSample=Fe(!0,C.pts,C.dts,"")),Re.frame=!0;var We=Be.data;if(Pe&&We.length>4){var Ge=new Ue(We).readSliceType();Ge!==2&&Ge!==4&&Ge!==7&&Ge!==9||(Re.key=!0)}break;case 5:Q=!0,Re||(Re=Z.avcSample=Fe(!0,C.pts,C.dts,"")),Re.key=!0,Re.frame=!0;break;case 6:Q=!0,(0,ne.parseSEIMessageFromNALu)(Be.data,1,C.pts,O.samples);break;case 7:if(Q=!0,Pe=!0,!T.sps){var $e=new Ue(Be.data).readSPS();T.width=$e.width,T.height=$e.height,T.pixelRatio=$e.pixelRatio,T.sps=[Be.data],T.duration=Z._duration;for(var ht=Be.data.subarray(1,4),Dt="avc1.",ze=0;ze<3;ze++){var Pt=ht[ze].toString(16);Pt.length<2&&(Pt="0"+Pt),Dt+=Pt}T.codec=Dt}break;case 8:Q=!0,T.pps||(T.pps=[Be.data]);break;case 9:Q=!1,T.audFound=!0,Re&&Xe(Re,T),Re=Z.avcSample=Fe(!1,C.pts,C.dts,"");break;case 12:Q=!0;break;default:Q=!1,Re&&(Re.debug+="unknown NAL "+Be.type+" ")}Re&&Q&&Re.units.push(Be)}),G&&Re&&(Xe(Re,T),this.avcSample=null)},N.getLastNalUnit=function(T){var O,C,G=this.avcSample;if(G&&G.units.length!==0||(G=T[T.length-1]),(O=G)!==null&&O!==void 0&&O.units){var Q=G.units;C=Q[Q.length-1]}return C},N.parseAVCNALu=function(T,O){var C,G,Q=O.byteLength,Z=T.naluState||0,Te=Z,Re=[],Pe=0,Be=-1,We=0;for(Z===-1&&(Be=0,We=31&O[0],Z=0,Pe=1);Pe<Q;)if(C=O[Pe++],Z)if(Z!==1)if(C)if(C===1){if(Be>=0){var Ge={data:O.subarray(Be,Pe-Z-1),type:We};Re.push(Ge)}else{var $e=this.getLastNalUnit(T.samples);if($e&&(Te&&Pe<=4-Te&&$e.state&&($e.data=$e.data.subarray(0,$e.data.byteLength-Te)),(G=Pe-Z-1)>0)){var ht=new Uint8Array($e.data.byteLength+G);ht.set($e.data,0),ht.set(O.subarray(0,G),$e.data.byteLength),$e.data=ht,$e.state=0}}Pe<Q?(Be=Pe,We=31&O[Pe],Z=0):Z=-1}else Z=0;else Z=3;else Z=C?0:2;else Z=C?0:1;if(Be>=0&&Z>=0){var Dt={data:O.subarray(Be,Q),type:We,state:Z};Re.push(Dt)}if(Re.length===0){var ze=this.getLastNalUnit(T.samples);if(ze){var Pt=new Uint8Array(ze.data.byteLength+O.byteLength);Pt.set(ze.data,0),Pt.set(O,ze.data.byteLength),ze.data=Pt}}return T.naluState=Z,Re},N.parseAACPES=function(T,O){var C,G,Q,Z,Te,Re=0,Pe=this.aacOverFlow,Be=O.data;if(Pe){this.aacOverFlow=null;var We=Pe.missing,Ge=Pe.sample.unit.byteLength;if(We===-1){var $e=new Uint8Array(Ge+Be.byteLength);$e.set(Pe.sample.unit,0),$e.set(Be,Ge),Be=$e}else{var ht=Ge-We;Pe.sample.unit.set(Be.subarray(0,We),ht),T.samples.push(Pe.sample),Re=Pe.missing}}for(C=Re,G=Be.length;C<G-1&&!ke(Be,C);C++);if(C===Re||(C<G-1?(Q="AAC PES did not start with ADTS header,offset:"+C,Z=!1):(Q="no ADTS header found in AAC PES",Z=!0),J.logger.warn("parsing error:"+Q),this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:Q}),!Z)){if(V(T,this.observer,Be,C,this.audioCodec),O.pts!==void 0)Te=O.pts;else{if(!Pe)return void J.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var Dt=E(T.samplerate);Te=Pe.sample.pts+Dt}for(var ze,Pt=0;C<G;){if(C+=(ze=U(T,Be,C,Te,Pt)).length,ze.missing){this.aacOverFlow=ze;break}for(Pt++;C<G-1&&!ke(Be,C);C++);}}},N.parseMPEGPES=function(T,O){var C=O.data,G=C.length,Q=0,Z=0,Te=O.pts;if(Te!==void 0)for(;Z<G;)if(pe(C,Z)){var Re=qe(T,C,Z,Te,Q);if(!Re)break;Z+=Re.length,Q++}else Z++;else J.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},N.parseID3PES=function(T,O){if(O.pts!==void 0){var C=ve({},O,{type:this._avcTrack?L.MetadataSchema.emsg:L.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});T.samples.push(C)}else J.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},te}();function lt(te,N){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,O){return T.__proto__=O,T},lt(te,N)}let Ct=function(te){var N,T;function O(){return te.apply(this,arguments)||this}T=te,(N=O).prototype=Object.create(T.prototype),N.prototype.constructor=N,lt(N,T);var C=O.prototype;return C.resetInitSegment=function(G,Q,Z,Te){te.prototype.resetInitSegment.call(this,G,Q,Z,Te),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:Q,duration:Te,inputTimeScale:9e4,dropped:0}},O.probe=function(G){if(!G)return!1;for(var Q=(k.getID3Data(G,0)||[]).length,Z=G.length;Q<Z;Q++)if(se(G,Q))return J.logger.log("MPEG Audio sync word found !"),!0;return!1},C.canParse=function(G,Q){return function(Z,Te){return ie(Z,Te)&&4<=Z.length-Te}(G,Q)},C.appendFrame=function(G,Q,Z){if(this.basePTS!==null)return qe(G,Q,Z,this.basePTS,this.frameIndex)},O}(ye);var Rt=B(524),St=B(923);function wt(te,N){var T=te==null?void 0:te.codec;return T&&T.length>4?T:T==="hvc1"||T==="hev1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||N===St.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}let gt=function(){function te(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndTime=null}var N=te.prototype;return N.destroy=function(){},N.resetTimeStamp=function(T){this.initPTS=T,this.lastEndTime=null},N.resetNextTimestamp=function(){this.lastEndTime=null},N.resetInitSegment=function(T,O,C,G){this.audioCodec=O,this.videoCodec=C,this.generateInitSegment((0,ne.patchEncyptionData)(T,G)),this.emitInitSegment=!0},N.generateInitSegment=function(T){var O=this.audioCodec,C=this.videoCodec;if(!T||!T.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var G=this.initData=(0,ne.parseInitSegment)(T);O||(O=wt(G.audio,St.ElementaryStreamTypes.AUDIO)),C||(C=wt(G.video,St.ElementaryStreamTypes.VIDEO));var Q={};G.audio&&G.video?Q.audiovideo={container:"video/mp4",codec:O+","+C,initSegment:T,id:"main"}:G.audio?Q.audio={container:"audio/mp4",codec:O,initSegment:T,id:"audio"}:G.video?Q.video={container:"video/mp4",codec:C,initSegment:T,id:"main"}:J.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=Q},N.remux=function(T,O,C,G,Q){var Z,Te=this.initPTS,Re=this.lastEndTime,Pe={audio:void 0,video:void 0,text:G,id3:C,initSegment:void 0};(0,g.isFiniteNumber)(Re)||(Re=this.lastEndTime=Q||0);var Be=O.samples;if(!Be||!Be.length)return Pe;var We={initPTS:void 0,timescale:1},Ge=this.initData;if(Ge&&Ge.length||(this.generateInitSegment(Be),Ge=this.initData),!Ge||!Ge.length)return J.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),Pe;this.emitInitSegment&&(We.tracks=this.initTracks,this.emitInitSegment=!1);var $e=(0,ne.getStartDTS)(Ge,Be);(0,g.isFiniteNumber)(Te)||(this.initPTS=We.initPTS=Te=$e-Q);var ht=(0,ne.getDuration)(Be,Ge),Dt=T?$e-Te:Re,ze=Dt+ht;(0,ne.offsetStartDTS)(Ge,Be,Te),ht>0?this.lastEndTime=ze:(J.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var Pt=!!Ge.audio,tr=!!Ge.video,jt="";Pt&&(jt+="audio"),tr&&(jt+="video");var Ft={data1:Be,startPTS:Dt,startDTS:Dt,endPTS:ze,endDTS:ze,type:jt,hasAudio:Pt,hasVideo:tr,nb:1,dropped:0};Pe.audio=Ft.type==="audio"?Ft:void 0,Pe.video=Ft.type!=="audio"?Ft:void 0,Pe.initSegment=We;var Ht=(Z=this.initPTS)!=null?Z:0;return Pe.id3=(0,Rt.flushTextTrackMetadataCueSamples)(C,Q,Ht,Ht),G.samples.length&&(Pe.text=(0,Rt.flushTextTrackUserdataCueSamples)(G,Q,Ht)),Pe},te}();var dt;try{dt=self.performance.now.bind(self.performance)}catch{J.logger.debug("Unable to use Performance API on this environment"),dt=self.Date.now}var tt=[{demux:z,remux:gt},{demux:it,remux:Rt.default},{demux:de,remux:Rt.default},{demux:Ct,remux:Rt.default}],It=function(){function te(T,O,C,G,Q){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=T,this.typeSupported=O,this.config=C,this.vendor=G,this.id=Q}var N=te.prototype;return N.configure=function(T){this.transmuxConfig=T,this.decrypter&&this.decrypter.reset()},N.push=function(T,O,C,G){var Q=this,Z=C.transmuxing;Z.executeStart=dt();var Te=new Uint8Array(T),Re=this.currentTransmuxState,Pe=this.transmuxConfig;G&&(this.currentTransmuxState=G);var Be=G||Re,We=Be.contiguous,Ge=Be.discontinuity,$e=Be.trackSwitch,ht=Be.accurateTimeOffset,Dt=Be.timeOffset,ze=Be.initSegmentChange,Pt=Pe.audioCodec,tr=Pe.videoCodec,jt=Pe.defaultInitPts,Ft=Pe.duration,Ht=Pe.initSegmentData,rt=function(Cr,vr){var Gt=null;return Cr.byteLength>0&&vr!=null&&vr.key!=null&&vr.iv!==null&&vr.method!=null&&(Gt=vr),Gt}(Te,O);if(rt&&rt.method==="AES-128"){var lr=this.getDecrypter();if(!lr.isSync())return this.decryptionPromise=lr.webCryptoDecrypt(Te,rt.key.buffer,rt.iv.buffer).then(function(Cr){var vr=Q.push(Cr,null,C);return Q.decryptionPromise=null,vr}),this.decryptionPromise;var Ar=lr.softwareDecrypt(Te,rt.key.buffer,rt.iv.buffer);if(!Ar)return Z.executeEnd=dt(),Ut(C);Te=new Uint8Array(Ar)}var Kt=this.needsProbing(Ge,$e);Kt&&this.configureTransmuxer(Te),(Ge||$e||ze||Kt)&&this.resetInitSegment(Ht,Pt,tr,Ft,O),(Ge||ze||Kt)&&this.resetInitialTimestamp(jt),We||this.resetContiguity();var Jt=this.transmux(Te,rt,Dt,ht,C),pr=this.currentTransmuxState;return pr.contiguous=!0,pr.discontinuity=!1,pr.trackSwitch=!1,Z.executeEnd=dt(),Jt},N.flush=function(T){var O=this,C=T.transmuxing;C.executeStart=dt();var G=this.decrypter,Q=this.currentTransmuxState,Z=this.decryptionPromise;if(Z)return Z.then(function(){return O.flush(T)});var Te=[],Re=Q.timeOffset;if(G){var Pe=G.flush();Pe&&Te.push(this.push(Pe,null,T))}var Be=this.demuxer,We=this.remuxer;if(!Be||!We)return this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:re.ErrorTypes.MEDIA_ERROR,details:re.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=dt(),[Ut(T)];var Ge=Be.flush(Re);return Wt(Ge)?Ge.then(function($e){return O.flushRemux(Te,$e,T),Te}):(this.flushRemux(Te,Ge,T),Te)},N.flushRemux=function(T,O,C){var G=O.audioTrack,Q=O.videoTrack,Z=O.id3Track,Te=O.textTrack,Re=this.currentTransmuxState,Pe=Re.accurateTimeOffset,Be=Re.timeOffset;J.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var We=this.remuxer.remux(G,Q,Z,Te,Be,Pe,!0,this.id);T.push({remuxResult:We,chunkMeta:C}),C.transmuxing.executeEnd=dt()},N.resetInitialTimestamp=function(T){var O=this.demuxer,C=this.remuxer;O&&C&&(O.resetTimeStamp(T),C.resetTimeStamp(T))},N.resetContiguity=function(){var T=this.demuxer,O=this.remuxer;T&&O&&(T.resetContiguity(),O.resetNextTimestamp())},N.resetInitSegment=function(T,O,C,G,Q){var Z=this.demuxer,Te=this.remuxer;Z&&Te&&(Z.resetInitSegment(T,O,C,G),Te.resetInitSegment(T,O,C,Q))},N.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},N.transmux=function(T,O,C,G,Q){return O&&O.method==="SAMPLE-AES"?this.transmuxSampleAes(T,O,C,G,Q):this.transmuxUnencrypted(T,C,G,Q)},N.transmuxUnencrypted=function(T,O,C,G){var Q=this.demuxer.demux(T,O,!1,!this.config.progressive),Z=Q.audioTrack,Te=Q.videoTrack,Re=Q.id3Track,Pe=Q.textTrack;return{remuxResult:this.remuxer.remux(Z,Te,Re,Pe,O,C,!1,this.id),chunkMeta:G}},N.transmuxSampleAes=function(T,O,C,G,Q){var Z=this;return this.demuxer.demuxSampleAes(T,O,C).then(function(Te){return{remuxResult:Z.remuxer.remux(Te.audioTrack,Te.videoTrack,Te.id3Track,Te.textTrack,C,G,!1,Z.id),chunkMeta:Q}})},N.configureTransmuxer=function(T){for(var O,C=this.config,G=this.observer,Q=this.typeSupported,Z=this.vendor,Te=0,Re=tt.length;Te<Re;Te++)if(tt[Te].demux.probe(T)){O=tt[Te];break}O||(J.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),O={demux:z,remux:gt});var Pe=this.demuxer,Be=this.remuxer,We=O.remux,Ge=O.demux;Be&&Be instanceof We||(this.remuxer=new We(G,C,Q,Z)),Pe&&Pe instanceof Ge||(this.demuxer=new Ge(G,C,Q),this.probe=Ge.probe)},N.needsProbing=function(T,O){return!this.demuxer||!this.remuxer||T||O},N.getDecrypter=function(){var T=this.decrypter;return T||(T=this.decrypter=new R.default(this.config)),T},te}(),Ut=function(te){return{remuxResult:{},chunkMeta:te}};function Wt(te){return"then"in te&&te.then instanceof Function}var Bt=function(te,N,T,O,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=te,this.videoCodec=N,this.initSegmentData=T,this.duration=O,this.defaultInitPts=C},ar=function(te,N,T,O,C,G){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=te,this.contiguous=N,this.accurateTimeOffset=T,this.trackSwitch=O,this.timeOffset=C,this.initSegmentChange=G}},973:(ae,W,B)=>{"use strict";var j,re;B.r(W),B.d(W,{ErrorDetails:()=>re,ErrorTypes:()=>j}),function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"}(j||(j={})),function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",R.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",R.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",R.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"}(re||(re={}))},851:(ae,W,B)=>{"use strict";var j;B.r(W),B.d(W,{Events:()=>j}),function(re){re.MEDIA_ATTACHING="hlsMediaAttaching",re.MEDIA_ATTACHED="hlsMediaAttached",re.MEDIA_DETACHING="hlsMediaDetaching",re.MEDIA_DETACHED="hlsMediaDetached",re.BUFFER_RESET="hlsBufferReset",re.BUFFER_CODECS="hlsBufferCodecs",re.BUFFER_CREATED="hlsBufferCreated",re.BUFFER_APPENDING="hlsBufferAppending",re.BUFFER_APPENDED="hlsBufferAppended",re.BUFFER_EOS="hlsBufferEos",re.BUFFER_FLUSHING="hlsBufferFlushing",re.BUFFER_FLUSHED="hlsBufferFlushed",re.MANIFEST_LOADING="hlsManifestLoading",re.MANIFEST_LOADED="hlsManifestLoaded",re.MANIFEST_PARSED="hlsManifestParsed",re.LEVEL_SWITCHING="hlsLevelSwitching",re.LEVEL_SWITCHED="hlsLevelSwitched",re.LEVEL_LOADING="hlsLevelLoading",re.LEVEL_LOADED="hlsLevelLoaded",re.LEVEL_UPDATED="hlsLevelUpdated",re.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",re.LEVELS_UPDATED="hlsLevelsUpdated",re.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",re.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",re.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",re.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",re.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",re.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",re.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",re.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",re.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",re.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",re.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",re.CUES_PARSED="hlsCuesParsed",re.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",re.INIT_PTS_FOUND="hlsInitPtsFound",re.FRAG_LOADING="hlsFragLoading",re.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",re.FRAG_LOADED="hlsFragLoaded",re.FRAG_DECRYPTED="hlsFragDecrypted",re.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",re.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",re.FRAG_PARSING_METADATA="hlsFragParsingMetadata",re.FRAG_PARSED="hlsFragParsed",re.FRAG_BUFFERED="hlsFragBuffered",re.FRAG_CHANGED="hlsFragChanged",re.FPS_DROP="hlsFpsDrop",re.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",re.ERROR="hlsError",re.DESTROYING="hlsDestroying",re.KEY_LOADING="hlsKeyLoading",re.KEY_LOADED="hlsKeyLoaded",re.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",re.BACK_BUFFER_REACHED="hlsBackBufferReached"}(j||(j={}))},76:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{default:()=>ja});var j,re=B(945),R=B(965),g=B(851),k=B(973),L=B(93),me=/^(\d+)x(\d+)$/,ne=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,ce=function(){function d(e){for(var t in typeof e=="string"&&(e=d.parseAttrList(e)),e)e.hasOwnProperty(t)&&(this[t]=e[t])}var o=d.prototype;return o.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},o.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var i=new Uint8Array(t.length/2),n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(2*n,2*n+2),16);return i}return null},o.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},o.decimalFloatingPoint=function(e){return parseFloat(this[e])},o.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},o.enumeratedString=function(e){return this[e]},o.bool=function(e){return this[e]==="YES"},o.decimalResolution=function(e){var t=me.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},d.parseAttrList=function(e){var t,i={};for(ne.lastIndex=0;(t=ne.exec(e))!==null;){var n=t[2];n.indexOf('"')===0&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),i[t[1]]=n}return i},d}();function we(){return we=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},we.apply(this,arguments)}function q(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}(function(d){d.ID="ID",d.CLASS="CLASS",d.START_DATE="START-DATE",d.DURATION="DURATION",d.END_DATE="END-DATE",d.END_ON_NEXT="END-ON-NEXT",d.PLANNED_DURATION="PLANNED-DURATION",d.SCTE35_OUT="SCTE35-OUT",d.SCTE35_IN="SCTE35-IN"})(j||(j={}));var ye=function(){function d(t,i){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,i){var n=i.attr;for(var a in n)if(Object.prototype.hasOwnProperty.call(t,a)&&t[a]!==n[a]){L.logger.warn('DATERANGE tag attribute: "'+a+'" does not match for tags with ID: "'+t.ID+'"'),this._badValueForSameId=a;break}t=we(new ce({}),n,t)}if(this.attr=t,this._startDate=new Date(t[j.START_DATE]),j.END_DATE in this.attr){var r=new Date(this.attr[j.END_DATE]);(0,R.isFiniteNumber)(r.getTime())&&(this._endDate=r)}}var o,e;return o=d,(e=[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var t=this.duration;return t!==null?new Date(this._startDate.getTime()+1e3*t):null}},{key:"duration",get:function(){if(j.DURATION in this.attr){var t=this.attr.decimalFloatingPoint(j.DURATION);if((0,R.isFiniteNumber)(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return j.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(j.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(j.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&(0,R.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}])&&q(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}(),J=B(923);function oe(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var K,Ee,ke,Ne=function(){function d(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}var o,e;return d.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var i=this.lastPartSn-t.lastPartSn,n=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!n||!!i,this.advanced=this.endSN>t.endSN||i>0||i===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},o=d,(e=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&(0,R.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return(t=this.fragments)!==null&&t!==void 0&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return(t=this.partList)!==null&&t!==void 0&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&oe(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function V(d){return Uint8Array.from(atob(d),function(o){return o.charCodeAt(0)})}function E(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(o){return o.charCodeAt(0)})}function U(d){switch(d){case Ee.FAIRPLAY:return K.FAIRPLAY;case Ee.PLAYREADY:return K.PLAYREADY;case Ee.WIDEVINE:return K.WIDEVINE;case Ee.CLEARKEY:return K.CLEARKEY}}function D(d){switch(d){case K.FAIRPLAY:return Ee.FAIRPLAY;case K.PLAYREADY:return Ee.PLAYREADY;case K.WIDEVINE:return Ee.WIDEVINE;case K.CLEARKEY:return Ee.CLEARKEY}}function de(d){var o=d.drmSystems,e=d.widevineLicenseUrl,t=o?[K.FAIRPLAY,K.WIDEVINE,K.PLAYREADY,K.CLEARKEY].filter(function(i){return!!o[i]}):[];return!t[K.WIDEVINE]&&e&&t.push(K.WIDEVINE),t}(function(d){d.CLEARKEY="org.w3.clearkey",d.FAIRPLAY="com.apple.fps",d.PLAYREADY="com.microsoft.playready",d.WIDEVINE="com.widevine.alpha"})(K||(K={})),function(d){d.CLEARKEY="org.w3.clearkey",d.FAIRPLAY="com.apple.streamingkeydelivery",d.PLAYREADY="com.microsoft.playready",d.WIDEVINE="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"}(Ee||(Ee={})),function(d){d.WIDEVINE="edef8ba979d64acea3c827dcd51d21ed"}(ke||(ke={}));var Se=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null,z=B(63),$={},Le=function(){function d(e,t,i,n,a){n===void 0&&(n=[1]),a===void 0&&(a=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=a,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){$={}};var o=d.prototype;return o.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;switch(this.keyFormat){case"identity":return this.method==="SAMPLE-AES";case Ee.FAIRPLAY:case Ee.WIDEVINE:case Ee.PLAYREADY:case Ee.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},o.getDecryptData=function(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method!=="AES-128"||this.iv||L.logger.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(F){for(var P=new Uint8Array(16),X=12;X<16;X++)P[X]=F>>8*(15-X)&255;return P}(e);return new d(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=function(F){var P,X,ue=F.split(":"),_e=null;if(ue[0]==="data"&&ue.length===2){var ge=ue[1].split(";"),De=ge[ge.length-1].split(",");if(De.length===2){var He=De[0]==="base64",Je=De[1];He?(ge.splice(-1,1),_e=V(Je)):(P=E(Je).subarray(0,16),(X=new Uint8Array(16)).set(P,16-P.length),_e=X)}}return _e}(this.uri);if(i)switch(this.keyFormat){case Ee.WIDEVINE:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Ee.PLAYREADY:var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=(0,z.mp4pssh)(n,null,i);var a=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),r=String.fromCharCode.apply(null,Array.from(a)),s=r.substring(r.indexOf("<"),r.length),l=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(l){var u=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(u){var c=V(u).subarray(0,16);(function(F){var P=function(X,ue,_e){var ge=X[ue];X[ue]=X[_e],X[_e]=ge};P(F,0,3),P(F,1,2),P(F,4,5),P(F,6,7)})(c),this.keyId=c}}break;default:var v=i.subarray(0,16);if(v.length!==16){var m=new Uint8Array(16);m.set(v,16-v.length),v=m}this.keyId=v}if(!this.keyId||this.keyId.byteLength!==16){var _=$[this.uri];if(!_){var S=Object.keys($).length%Number.MAX_SAFE_INTEGER;_=new Uint8Array(16),new DataView(_.buffer,12,4).setUint32(0,S),$[this.uri]=_}this.keyId=_}return this},d}(),Oe={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function xe(d,o){return MediaSource.isTypeSupported((o||"video")+'/mp4;codecs="'+d+'"')}function be(){return be=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},be.apply(this,arguments)}var qe=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+|#EXT-X-SESSION-KEY:([^\n\r]*)[\r\n]+/g,at=/#EXT-X-MEDIA:(.*)/g,ie=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),pe=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),se=function(){function d(){}return d.findGroup=function(o,e){for(var t=0;t<o.length;t++){var i=o[t];if(i.id===e)return i}},d.convertAVC1ToAVCOTI=function(o){var e=o.split(".");if(e.length>2){var t=e.shift()+".";return(t+=parseInt(e.shift()).toString(16))+("000"+parseInt(e.shift()).toString(16)).slice(-4)}return o},d.resolve=function(o,e){return(0,re.buildAbsoluteURL)(e,o,{alwaysNormalize:!0})},d.parseMasterPlaylist=function(o,e){var t,i=[],n=[],a={},r=[],s=!1;for(qe.lastIndex=0;(t=qe.exec(o))!=null;)if(t[1]){var l,u=new ce(t[1]),c={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(t[2],e)},v=u.decimalResolution("RESOLUTION");v&&(c.width=v.width,c.height=v.height),H((u.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),c),c.videoCodec&&c.videoCodec.indexOf("avc1")!==-1&&(c.videoCodec=d.convertAVC1ToAVCOTI(c.videoCodec)),(l=c.unknownCodecs)!==null&&l!==void 0&&l.length||n.push(c),i.push(c)}else if(t[3]){var m=new ce(t[3]);m["DATA-ID"]&&(s=!0,a[m["DATA-ID"]]=m)}else if(t[4]){var _=t[4],S=Ue(_,e);S.encrypted&&S.isSupported()?r.push(S):L.logger.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+_+'"')}return{levels:n.length>0&&n.length<i.length?n:i,sessionData:s?a:null,sessionKeys:r.length?r:null}},d.parseMasterPlaylistMedia=function(o,e,t,i){var n;i===void 0&&(i=[]);var a=[],r=0;for(at.lastIndex=0;(n=at.exec(o))!==null;){var s=new ce(n[1]);if(s.TYPE===t){var l={attrs:s,bitrate:0,id:r++,groupId:s["GROUP-ID"],instreamId:s["INSTREAM-ID"],name:s.NAME||s.LANGUAGE||"",type:t,default:s.bool("DEFAULT"),autoselect:s.bool("AUTOSELECT"),forced:s.bool("FORCED"),lang:s.LANGUAGE,url:s.URI?d.resolve(s.URI,e):""};if(i.length){var u=d.findGroup(i,l.groupId)||i[0];ve(l,u,"audioCodec"),ve(l,u,"textCodec")}a.push(l)}}return a},d.parseLevelPlaylist=function(o,e,t,i,n){var a,r,s,l=new Ne(e),u=l.fragments,c=null,v=0,m=0,_=0,S=0,F=null,P=new J.Fragment(i,e),X=-1,ue=!1;for(ie.lastIndex=0,l.m3u8=o;(a=ie.exec(o))!==null;){ue&&(ue=!1,(P=new J.Fragment(i,e)).start=_,P.sn=v,P.cc=S,P.level=t,c&&(P.initSegment=c,P.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null));var _e=a[1];if(_e){P.duration=parseFloat(_e);var ge=(" "+a[2]).slice(1);P.title=ge||null,P.tagList.push(ge?["INF",_e,ge]:["INF",_e])}else if(a[3]){if((0,R.isFiniteNumber)(P.duration)){if(P.start=_,s){P.levelkeys=s;var De=l.encryptedFragments;!P.levelkeys||!Object.keys(P.levelkeys).some(function(Ir){return P.levelkeys[Ir].isCommonEncryption})||De.length&&De[De.length-1].levelkeys===s||De.push(P)}P.sn=v,P.level=t,P.cc=S,P.urlId=n,u.push(P),P.relurl=(" "+a[3]).slice(1),Ie(P,F),F=P,_+=P.duration,v++,m=0,ue=!0}}else if(a[4]){var He=(" "+a[4]).slice(1);F?P.setByteRange(He,F):P.setByteRange(He)}else if(a[5])P.rawProgramDateTime=(" "+a[5]).slice(1),P.tagList.push(["PROGRAM-DATE-TIME",P.rawProgramDateTime]),X===-1&&(X=u.length);else{if(!(a=a[0].match(pe))){L.logger.warn("No matches on slow regex match for level playlist!");continue}for(r=1;r<a.length&&a[r]===void 0;r++);var Je=(" "+a[r]).slice(1),Ae=(" "+a[r+1]).slice(1),Ke=a[r+2]?(" "+a[r+2]).slice(1):"";switch(Je){case"PLAYLIST-TYPE":l.type=Ae.toUpperCase();break;case"MEDIA-SEQUENCE":v=l.startSN=parseInt(Ae);break;case"SKIP":var je=new ce(Ae),pt=je.decimalInteger("SKIPPED-SEGMENTS");if((0,R.isFiniteNumber)(pt)){l.skippedSegments=pt;for(var Mt=pt;Mt--;)u.unshift(null);v+=pt}var yt=je.enumeratedString("RECENTLY-REMOVED-DATERANGES");yt&&(l.recentlyRemovedDateranges=yt.split(" "));break;case"TARGETDURATION":l.targetduration=parseFloat(Ae);break;case"VERSION":l.version=parseInt(Ae);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(Ae||Ke)&&P.tagList.push(Ke?[Ae,Ke]:[Ae]);break;case"DISCONTINUITY":S++,P.tagList.push(["DIS"]);break;case"GAP":P.tagList.push([Je]);break;case"BITRATE":P.tagList.push([Je,Ae]);break;case"DATERANGE":var kt=new ce(Ae),xt=new ye(kt,l.dateRanges[kt.ID]);xt.isValid||l.skippedSegments?l.dateRanges[xt.id]=xt:L.logger.warn('Ignoring invalid DATERANGE tag: "'+Ae+'"'),P.tagList.push(["EXT-X-DATERANGE",Ae]);break;case"DISCONTINUITY-SEQUENCE":S=parseInt(Ae);break;case"KEY":var ir=Ue(Ae,e);if(ir.isSupported()){if(ir.method==="NONE"){s=void 0;break}s||(s={}),s[ir.keyFormat]&&(s=be({},s)),s[ir.keyFormat]=ir}else L.logger.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+Ae+'"');break;case"START":var er=new ce(Ae).decimalFloatingPoint("TIME-OFFSET");(0,R.isFiniteNumber)(er)&&(l.startTimeOffset=er);break;case"MAP":var Yt=new ce(Ae);if(P.duration){var nr=new J.Fragment(i,e);Fe(nr,Yt,t,s),c=nr,P.initSegment=c,c.rawProgramDateTime&&!P.rawProgramDateTime&&(P.rawProgramDateTime=c.rawProgramDateTime)}else Fe(P,Yt,t,s),c=P,ue=!0;break;case"SERVER-CONTROL":var _r=new ce(Ae);l.canBlockReload=_r.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=_r.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&_r.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=_r.optionalFloat("PART-HOLD-BACK",0),l.holdBack=_r.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Jn=new ce(Ae);l.partTarget=Jn.decimalFloatingPoint("PART-TARGET");break;case"PART":var Pr=l.partList;Pr||(Pr=l.partList=[]);var Bi=m>0?Pr[Pr.length-1]:void 0,ji=m++,Gi=new J.Part(new ce(Ae),P,e,ji,Bi);Pr.push(Gi),P.duration+=Gi.duration;break;case"PRELOAD-HINT":var ct=new ce(Ae);l.preloadHint=ct;break;case"RENDITION-REPORT":var Et=new ce(Ae);l.renditionReports=l.renditionReports||[],l.renditionReports.push(Et);break;default:L.logger.warn("line parsed but not handled: "+a)}}}F&&!F.relurl?(u.pop(),_-=F.duration,l.partList&&(l.fragmentHint=F)):l.partList&&(Ie(P,F),P.cc=S,l.fragmentHint=P);var Ei=u.length,jr=u[0],Or=u[Ei-1];if((_+=l.skippedSegments*l.targetduration)>0&&Ei&&Or){l.averagetargetduration=_/Ei;var Ti=Or.sn;l.endSN=Ti!=="initSegment"?Ti:0,l.live||(Or.endList=!0),jr&&(l.startCC=jr.cc)}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(_+=l.fragmentHint.duration),l.totalduration=_,l.endCC=S,X>0&&function(Ir,Gr){for(var Qr=Ir[Gr],Dr=Gr;Dr--;){var Jr=Ir[Dr];if(!Jr)return;Jr.programDateTime=Qr.programDateTime-1e3*Jr.duration,Qr=Jr}}(u,X),l},d}();function Ue(d,o){var e,t,i=new ce(d),n=(e=i.enumeratedString("METHOD"))!=null?e:"",a=i.URI,r=i.hexadecimalInteger("IV"),s=i.enumeratedString("KEYFORMATVERSIONS"),l=(t=i.enumeratedString("KEYFORMAT"))!=null?t:"identity";a&&i.IV&&!r&&L.logger.error("Invalid IV: "+i.IV);var u=a?se.resolve(a,o):"",c=(s||"1").split("/").map(Number).filter(Number.isFinite);return new Le(n,u,l,c,r)}function H(d,o){["video","audio","text"].forEach(function(e){var t=d.filter(function(n){return function(a,r){var s=Oe[r];return!!s&&s[a.slice(0,4)]===!0}(n,e)});if(t.length){var i=t.filter(function(n){return n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0});o[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(n){return t.indexOf(n)===-1})}}),o.unknownCodecs=d}function ve(d,o,e){var t=o[e];t&&(d[e]=t)}function Ie(d,o){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):o!=null&&o.programDateTime&&(d.programDateTime=o.endProgramDateTime),(0,R.isFiniteNumber)(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function Fe(d,o,e,t){d.relurl=o.URI,o.BYTERANGE&&d.setByteRange(o.BYTERANGE),d.level=e,d.sn="initSegment",t&&(d.levelkeys=t),d.initSegment=null}var fe=B(308);function Ce(d,o){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=o.url),e}let Ve=function(){function d(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var o=d.prototype;return o.startLoad=function(e){},o.stopLoad=function(){this.destroyInternalLoaders()},o.registerListeners=function(){var e=this.hls;e.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,n=t.loader,a=new(i||n)(t);return e.loader=a,this.loaders[e.type]=a,a},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},o.onManifestLoading=function(e,t){var i=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:fe.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},o.onLevelLoading=function(e,t){var i=t.id,n=t.level,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:null,level:n,responseType:"text",type:fe.PlaylistContextType.LEVEL,url:a,deliveryDirectives:r})},o.onAudioTrackLoading=function(e,t){var i=t.id,n=t.groupId,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:n,level:null,responseType:"text",type:fe.PlaylistContextType.AUDIO_TRACK,url:a,deliveryDirectives:r})},o.onSubtitleTrackLoading=function(e,t){var i=t.id,n=t.groupId,a=t.url,r=t.deliveryDirectives;this.load({id:i,groupId:n,level:null,responseType:"text",type:fe.PlaylistContextType.SUBTITLE_TRACK,url:a,deliveryDirectives:r})},o.load=function(e){var t,i,n,a,r,s,l=this.hls.config,u=this.getInternalLoader(e);if(u){var c=u.context;if(c&&c.url===e.url)return void L.logger.trace("[playlist-loader]: playlist request ongoing");L.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),u.abort()}switch(e.type){case fe.PlaylistContextType.MANIFEST:i=l.manifestLoadingMaxRetry,n=l.manifestLoadingTimeOut,a=l.manifestLoadingRetryDelay,r=l.manifestLoadingMaxRetryTimeout;break;case fe.PlaylistContextType.LEVEL:case fe.PlaylistContextType.AUDIO_TRACK:case fe.PlaylistContextType.SUBTITLE_TRACK:i=0,n=l.levelLoadingTimeOut;break;default:i=l.levelLoadingMaxRetry,n=l.levelLoadingTimeOut,a=l.levelLoadingRetryDelay,r=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part&&(e.type===fe.PlaylistContextType.LEVEL&&e.level!==null?s=this.hls.levels[e.level].details:e.type===fe.PlaylistContextType.AUDIO_TRACK&&e.id!==null?s=this.hls.audioTracks[e.id].details:e.type===fe.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(s=this.hls.subtitleTracks[e.id].details),s)){var v=s.partTarget,m=s.targetduration;v&&m&&(n=Math.min(1e3*Math.max(3*v,.8*m),n))}var _={timeout:n,maxRetry:i,retryDelay:a,maxRetryDelay:r,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(e,_,S)},o.loadsuccess=function(e,t,i,n){n===void 0&&(n=null),this.resetInternalLoader(i.type);var a=e.data;a.indexOf("#EXTM3U")===0?(t.parsing.start=performance.now(),a.indexOf("#EXTINF:")>0||a.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,i,n):this.handleMasterPlaylist(e,t,i,n)):this.handleManifestParsingError(e,i,"no EXTM3U delimiter",n)},o.loaderror=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!1,e)},o.loadtimeout=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!0)},o.handleMasterPlaylist=function(e,t,i,n){var a=this.hls,r=e.data,s=Ce(e,i),l=se.parseMasterPlaylist(r,s),u=l.levels,c=l.sessionData,v=l.sessionKeys;if(u.length){var m=u.map(function(X){return{id:X.attrs.AUDIO,audioCodec:X.audioCodec}}),_=u.map(function(X){return{id:X.attrs.SUBTITLES,textCodec:X.textCodec}}),S=se.parseMasterPlaylistMedia(r,s,"AUDIO",m),F=se.parseMasterPlaylistMedia(r,s,"SUBTITLES",_),P=se.parseMasterPlaylistMedia(r,s,"CLOSED-CAPTIONS");S.length&&(S.some(function(X){return!X.url})||!u[0].audioCodec||u[0].attrs.AUDIO||(L.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),S.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ce({}),bitrate:0,url:""}))),a.trigger(g.Events.MANIFEST_LOADED,{levels:u,audioTracks:S,subtitles:F,captions:P,url:s,stats:t,networkDetails:n,sessionData:c,sessionKeys:v})}else this.handleManifestParsingError(e,i,"no level found in manifest",n)},o.handleTrackOrLevelPlaylist=function(e,t,i,n){var a=this.hls,r=i.id,s=i.level,l=i.type,u=Ce(e,i),c=(0,R.isFiniteNumber)(r)?r:0,v=(0,R.isFiniteNumber)(s)?s:c,m=function(F){switch(F.type){case fe.PlaylistContextType.AUDIO_TRACK:return fe.PlaylistLevelType.AUDIO;case fe.PlaylistContextType.SUBTITLE_TRACK:return fe.PlaylistLevelType.SUBTITLE;default:return fe.PlaylistLevelType.MAIN}}(i),_=se.parseLevelPlaylist(e.data,u,v,m,c);if(_.fragments.length){if(l===fe.PlaylistContextType.MANIFEST){var S={attrs:new ce({}),bitrate:0,details:_,name:"",url:u};a.trigger(g.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:u,stats:t,networkDetails:n,sessionData:null,sessionKeys:null})}t.parsing.end=performance.now(),i.levelDetails=_,this.handlePlaylistLoaded(e,t,i,n)}else a.trigger(g.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof i.level=="number"?i.level:void 0})},o.handleManifestParsingError=function(e,t,i,n){this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===fe.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:n})},o.handleNetworkError=function(e,t,i,n){i===void 0&&(i=!1),L.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var a=k.ErrorDetails.UNKNOWN,r=!1,s=this.getInternalLoader(e);switch(e.type){case fe.PlaylistContextType.MANIFEST:a=i?k.ErrorDetails.MANIFEST_LOAD_TIMEOUT:k.ErrorDetails.MANIFEST_LOAD_ERROR,r=!0;break;case fe.PlaylistContextType.LEVEL:a=i?k.ErrorDetails.LEVEL_LOAD_TIMEOUT:k.ErrorDetails.LEVEL_LOAD_ERROR,r=!1;break;case fe.PlaylistContextType.AUDIO_TRACK:a=i?k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,r=!1;break;case fe.PlaylistContextType.SUBTITLE_TRACK:a=i?k.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:k.ErrorDetails.SUBTITLE_LOAD_ERROR,r=!1}s&&this.resetInternalLoader(e.type);var l={type:k.ErrorTypes.NETWORK_ERROR,details:a,fatal:r,url:e.url,loader:s,context:e,networkDetails:t};n&&(l.response=n),this.hls.trigger(g.Events.ERROR,l)},o.handlePlaylistLoaded=function(e,t,i,n){var a=i.type,r=i.level,s=i.id,l=i.groupId,u=i.loader,c=i.levelDetails,v=i.deliveryDirectives;if(c!=null&&c.targetduration){if(u)switch(c.live&&(u.getCacheAge&&(c.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(c.ageHeader)||(c.ageHeader=0)),a){case fe.PlaylistContextType.MANIFEST:case fe.PlaylistContextType.LEVEL:this.hls.trigger(g.Events.LEVEL_LOADED,{details:c,level:r||0,id:s||0,stats:t,networkDetails:n,deliveryDirectives:v});break;case fe.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(g.Events.AUDIO_TRACK_LOADED,{details:c,id:s||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:v});break;case fe.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(g.Events.SUBTITLE_TRACK_LOADED,{details:c,id:s||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:v})}}else this.handleManifestParsingError(e,i,"invalid target duration",n)},d}();function Xe(d,o){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=d,o.dispatchEvent(e)}function it(d,o){var e=d.mode;if(e==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(o.id))try{if(d.addCue(o),!d.cues.getCueById(o.id))throw new Error("addCue is failed for: "+o)}catch(i){L.logger.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(o.startTime,o.endTime,o.text);t.id=o.id,d.addCue(t)}e==="disabled"&&(d.mode=e)}function lt(d){var o=d.mode;if(o==="disabled"&&(d.mode="hidden"),d.cues)for(var e=d.cues.length;e--;)d.removeCue(d.cues[e]);o==="disabled"&&(d.mode=o)}function Ct(d,o,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var n=function(r,s,l){var u=[],c=function(S,F){if(F<S[0].startTime)return 0;var P=S.length-1;if(F>S[P].endTime)return-1;for(var X=0,ue=P;X<=ue;){var _e=Math.floor((ue+X)/2);if(F<S[_e].startTime)ue=_e-1;else{if(!(F>S[_e].startTime&&X<P))return _e;X=_e+1}}return S[X].startTime-F<F-S[ue].startTime?X:ue}(r,s);if(c>-1)for(var v=c,m=r.length;v<m;v++){var _=r[v];if(_.startTime>=s&&_.endTime<=l)u.push(_);else if(_.startTime>l)return u}return u}(d.cues,o,e),a=0;a<n.length;a++)t&&!t(n[a])||d.removeCue(n[a]);i==="disabled"&&(d.mode=i)}var Rt=B(181),St=B(856);function wt(){return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var gt=function(){var d=wt();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function dt(d,o){return d.getTime()/1e3-o}let tt=function(){function d(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var o=d.prototype;return o.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},o._registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},o._unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},o.onMediaAttached=function(e,t){this.media=t.media},o.onMediaDetaching=function(){this.id3Track&&(lt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},o.onManifestLoading=function(){this.dateRangeCuesAppended={}},o.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},o.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Xe(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},o.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,n=i.enableEmsgMetadataCues,a=i.enableID3MetadataCues;if(n||a){var r=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var s=wt(),l=0;l<r.length;l++){var u=r[l].type;if((u!==St.MetadataSchema.emsg||n)&&a){var c=Rt.getID3Frames(r[l].data);if(c){var v=r[l].pts,m=v+r[l].duration;m>gt&&(m=gt),m-v<=0&&(m=v+.25);for(var _=0;_<c.length;_++){var S=c[_];if(!Rt.isTimeStampFrame(S)){this.updateId3CueEnds(v);var F=new s(v,m,"");F.value=S,u&&(F.type=u),this.id3Track.addCue(F)}}}}}}}},o.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)===null||t===void 0?void 0:t.cues;if(i)for(var n=i.length;n--;){var a=i[n];a.startTime<e&&a.endTime===gt&&(a.endTime=e)}},o.onBufferFlushing=function(e,t){var i=t.startOffset,n=t.endOffset,a=t.type,r=this.id3Track,s=this.hls;if(s){var l=s.config,u=l.enableEmsgMetadataCues,c=l.enableID3MetadataCues;r&&(u||c)&&Ct(r,i,n,a==="audio"?function(v){return v.type===St.MetadataSchema.audioId3&&c}:a==="video"?function(v){return v.type===St.MetadataSchema.emsg&&u}:function(v){return v.type===St.MetadataSchema.audioId3&&c||v.type===St.MetadataSchema.emsg&&u})}},o.onLevelUpdated=function(e,t){var i=this,n=t.details;if(this.media&&n.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var a=this.dateRangeCuesAppended,r=this.id3Track,s=n.dateRanges,l=Object.keys(s);if(r)for(var u=Object.keys(a).filter(function(X){return!l.includes(X)}),c=function(X){var ue=u[X];Object.keys(a[ue].cues).forEach(function(_e){r.removeCue(a[ue].cues[_e])}),delete a[ue]},v=u.length;v--;)c(v);var m=n.fragments[n.fragments.length-1];if(l.length!==0&&(0,R.isFiniteNumber)(m==null?void 0:m.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var _=m.programDateTime/1e3-m.start,S=wt(),F=function(X){var ue=l[X],_e=s[ue],ge=a[ue],De=(ge==null?void 0:ge.cues)||{},He=(ge==null?void 0:ge.durationKnown)||!1,Je=dt(_e.startDate,_),Ae=gt,Ke=_e.endDate;if(Ke)Ae=dt(Ke,_),He=!0;else if(_e.endOnNext&&!He){var je=l.reduce(function(er,Yt){var nr=s[Yt];return nr.class===_e.class&&nr.id!==Yt&&nr.startDate>_e.startDate&&er.push(nr),er},[]).sort(function(er,Yt){return er.startDate.getTime()-Yt.startDate.getTime()})[0];je&&(Ae=dt(je.startDate,_),He=!0)}for(var pt,Mt=Object.keys(_e.attr),yt=0;yt<Mt.length;yt++){var kt=Mt[yt];if(kt!==j.ID&&kt!==j.CLASS&&kt!==j.START_DATE&&kt!==j.DURATION&&kt!==j.END_DATE&&kt!==j.END_ON_NEXT){var xt=De[kt];if(xt)He&&!ge.durationKnown&&(xt.endTime=Ae);else{var ir=_e.attr[kt];xt=new S(Je,Ae,""),kt!==j.SCTE35_OUT&&kt!==j.SCTE35_IN||(pt=ir,ir=Uint8Array.from(pt.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),xt.value={key:kt,data:ir},xt.type=St.MetadataSchema.dateRange,i.id3Track.addCue(xt),De[kt]=xt}}}a[ue]={cues:De,dateRange:_e,durationKnown:He}},P=0;P<l.length;P++)F(P)}}},d}();function It(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Ut=function(){function d(i){var n=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return n.timeupdate()},this.hls=i,this.config=i.config,this.registerListeners()}var o,e,t=d.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},t.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(g.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(g.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(g.Events.ERROR,this.onError)},t.onMediaAttached=function(i,n){this.media=n.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(i,n){var a=n.details;this.levelDetails=a,a.advanced&&this.timeupdate(),!a.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},t.onError=function(i,n){n.details===k.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},t.timeupdate=function(){var i=this.media,n=this.levelDetails;if(i&&n){this.currentTime=i.currentTime;var a=this.computeLatency();if(a!==null){this._latency=a;var r=this.config,s=r.lowLatencyMode,l=r.maxLiveSyncPlaybackRate;if(s&&l!==1){var u=this.targetLatency;if(u!==null){var c=a-u,v=c<Math.min(this.maxLatency,u+n.targetduration);if(n.live&&v&&c>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,l)),_=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;i.playbackRate=Math.min(m,Math.max(1,_))}else i.playbackRate!==1&&i.playbackRate!==0&&(i.playbackRate=1)}}}}},t.estimateLiveEdge=function(){var i=this.levelDetails;return i===null?null:i.edge+i.age},t.computeLatency=function(){var i=this.estimateLiveEdge();return i===null?null:i-this.currentTime},o=d,(e=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var i=this.config,n=this.levelDetails;return i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:n?i.liveMaxLatencyDurationCount*n.targetduration:0}},{key:"targetLatency",get:function(){var i=this.levelDetails;if(i===null)return null;var n=i.holdBack,a=i.partHoldBack,r=i.targetduration,s=this.config,l=s.liveSyncDuration,u=s.liveSyncDurationCount,c=s.lowLatencyMode,v=this.hls.userConfig,m=c&&a||n;(v.liveSyncDuration||v.liveSyncDurationCount||m===0)&&(m=l!==void 0?l:u*r);var _=r;return m+Math.min(1*this.stallCount,_)}},{key:"liveSyncPosition",get:function(){var i=this.estimateLiveEdge(),n=this.targetLatency,a=this.levelDetails;if(i===null||n===null||a===null)return null;var r=a.edge,s=i-n-this.edgeStalled,l=r-a.totalduration,u=r-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(l,s),u)}},{key:"drift",get:function(){var i=this.levelDetails;return i===null?1:i.drift}},{key:"edgeStalled",get:function(){var i=this.levelDetails;if(i===null)return 0;var n=3*(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.max(i.age-n,0)}},{key:"forwardBufferLength",get:function(){var i=this.media,n=this.levelDetails;if(!i||!n)return 0;var a=i.buffered.length;return(a?i.buffered.end(a-1):n.edge)-this.currentTime}}])&&It(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function Wt(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Bt,ar=["NONE","TYPE-0","TYPE-1","TYPE-2",null];(function(d){d.No="",d.Yes="YES",d.v2="v2"})(Bt||(Bt={}));var te=function(){function d(o,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=o,this.part=e,this.skip=t}return d.prototype.addDirectives=function(o){var e=new self.URL(o);return this.msn!==void 0&&e.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href},d}(),N=function(){function d(t){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter(function(i){return i}).join(",").replace(/\.[^.,]+/g,"")}var o,e;return o=d,(e=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var i=t%this.url.length;this._urlId!==i&&(this.details=void 0,this._urlId=i)}}])&&Wt(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();function T(){return T=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},T.apply(this,arguments)}function O(d,o,e){switch(o){case"audio":d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds.push(e);break;case"text":d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds.push(e)}}function C(d){var o={};d.forEach(function(e){var t=e.groupId||"";e.id=o[t]=o[t]||0,o[t]++})}function G(d,o){var e=o.startPTS;if((0,R.isFiniteNumber)(e)){var t,i=0;o.sn>d.sn?(i=e-d.start,t=d):(i=d.start-e,t=o),t.duration!==i&&(t.duration=i)}else o.sn>d.sn?d.cc===o.cc&&d.minEndPTS?o.start=d.start+(d.minEndPTS-d.start):o.start=d.start+d.duration:o.start=Math.max(d.start-o.duration,0)}function Q(d,o,e,t,i,n){t-e<=0&&(L.logger.warn("Fragment should have a positive duration",o),t=e+o.duration,n=i+o.duration);var a=e,r=t,s=o.startPTS,l=o.endPTS;if((0,R.isFiniteNumber)(s)){var u=Math.abs(s-e);(0,R.isFiniteNumber)(o.deltaPTS)?o.deltaPTS=Math.max(u,o.deltaPTS):o.deltaPTS=u,a=Math.max(e,s),e=Math.min(e,s),i=Math.min(i,o.startDTS),r=Math.min(t,l),t=Math.max(t,l),n=Math.max(n,o.endDTS)}o.duration=t-e;var c=e-o.start;o.start=o.startPTS=e,o.maxStartPTS=a,o.startDTS=i,o.endPTS=t,o.minEndPTS=r,o.endDTS=n;var v,m=o.sn;if(!d||m<d.startSN||m>d.endSN)return 0;var _=m-d.startSN,S=d.fragments;for(S[_]=o,v=_;v>0;v--)G(S[v],S[v-1]);for(v=_;v<S.length-1;v++)G(S[v],S[v+1]);return d.fragmentHint&&G(S[S.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,c}function Z(d,o){var e=o.startSN+o.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Te(o,t[e].start)}function Te(d,o){if(o){for(var e=d.fragments,t=d.skippedSegments;t<e.length;t++)e[t].start+=o;d.fragmentHint&&(d.fragmentHint.start+=o)}}var Re=function(){function d(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=L.logger.log.bind(L.logger,t+":"),this.warn=L.logger.warn.bind(L.logger,t+":"),this.hls=e}var o=d.prototype;return o.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},o.onError=function(e,t){!t.fatal||t.type!==k.ErrorTypes.NETWORK_ERROR&&t.type!==k.ErrorTypes.KEY_SYSTEM_ERROR||this.stopLoad()},o.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},o.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.requestScheduled=-1,this.loadPlaylist()},o.stopLoad=function(){this.canLoad=!1,this.clearTimer()},o.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i)for(var n=0;n<i.length;n++){var a=i[n],r=void 0;try{r=new self.URL(a.URI,t.url).href}catch(c){L.logger.warn("Could not construct new URL for Rendition Report: "+c),r=a.URI||""}if(r===e.slice(-r.length)){var s=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn),l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}return new te(s,l>=0?l:void 0,Bt.No)}}},o.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},o.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},o.playlistLoaded=function(e,t,i){var n=this,a=t.details,r=t.stats,s=self.performance.now(),l=r.loading.first?Math.max(0,s-r.loading.first):0;if(a.advancedDateTime=Date.now()-l,a.live||i!=null&&i.live){if(a.reloaded(i),i&&this.log("live playlist "+e+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),i&&a.fragments.length>0&&function(Ke,je){for(var pt=null,Mt=Ke.fragments,yt=Mt.length-1;yt>=0;yt--){var kt=Mt[yt].initSegment;if(kt){pt=kt;break}}Ke.fragmentHint&&delete Ke.fragmentHint.endPTS;var xt,ir,er,Yt,nr,_r=0;if(function(ct,Et,Ei){for(var jr=Et.skippedSegments,Or=Math.max(ct.startSN,Et.startSN)-Et.startSN,Ti=(ct.fragmentHint?1:0)+(jr?Et.endSN:Math.min(ct.endSN,Et.endSN))-Et.startSN,Ir=Et.startSN-ct.startSN,Gr=Et.fragmentHint?Et.fragments.concat(Et.fragmentHint):Et.fragments,Qr=ct.fragmentHint?ct.fragments.concat(ct.fragmentHint):ct.fragments,Dr=Or;Dr<=Ti;Dr++){var Jr=Qr[Ir+Dr],yn=Gr[Dr];jr&&!yn&&Dr<jr&&(yn=Et.fragments[Dr]=Jr),Jr&&yn&&Ei(Jr,yn)}}(Ke,je,function(ct,Et){ct.relurl&&(_r=ct.cc-Et.cc),(0,R.isFiniteNumber)(ct.startPTS)&&(0,R.isFiniteNumber)(ct.endPTS)&&(Et.start=Et.startPTS=ct.startPTS,Et.startDTS=ct.startDTS,Et.appendedPTS=ct.appendedPTS,Et.maxStartPTS=ct.maxStartPTS,Et.endPTS=ct.endPTS,Et.endDTS=ct.endDTS,Et.minEndPTS=ct.minEndPTS,Et.duration=ct.endPTS-ct.startPTS,Et.duration&&(xt=Et),je.PTSKnown=je.alignedSliding=!0),Et.elementaryStreams=ct.elementaryStreams,Et.loader=ct.loader,Et.stats=ct.stats,Et.urlId=ct.urlId,ct.initSegment&&(Et.initSegment=ct.initSegment,pt=ct.initSegment)}),pt&&(je.fragmentHint?je.fragments.concat(je.fragmentHint):je.fragments).forEach(function(ct){var Et;ct.initSegment&&ct.initSegment.relurl!==((Et=pt)===null||Et===void 0?void 0:Et.relurl)||(ct.initSegment=pt)}),je.skippedSegments)if(je.deltaUpdateFailed=je.fragments.some(function(ct){return!ct}),je.deltaUpdateFailed){L.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var Jn=je.skippedSegments;Jn--;)je.fragments.shift();je.startSN=je.fragments[0].sn,je.startCC=je.fragments[0].cc}else je.canSkipDateRanges&&(je.dateRanges=(ir=Ke.dateRanges,er=je.dateRanges,Yt=je.recentlyRemovedDateranges,nr=T({},ir),Yt&&Yt.forEach(function(ct){delete nr[ct]}),Object.keys(er).forEach(function(ct){var Et=new ye(er[ct].attr,nr[ct]);Et.isValid?nr[ct]=Et:L.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(er[ct].attr)+'"')}),nr));var Pr=je.fragments;if(_r){L.logger.warn("discontinuity sliding from playlist, take drift into account");for(var Bi=0;Bi<Pr.length;Bi++)Pr[Bi].cc+=_r}je.skippedSegments&&(je.startCC=je.fragments[0].cc),function(ct,Et,Ei){if(ct&&Et)for(var jr=0,Or=0,Ti=ct.length;Or<=Ti;Or++){var Ir=ct[Or],Gr=Et[Or+jr];Ir&&Gr&&Ir.index===Gr.index&&Ir.fragment.sn===Gr.fragment.sn?(Qr=Ir,(Dr=Gr).elementaryStreams=Qr.elementaryStreams,Dr.stats=Qr.stats):jr--}var Qr,Dr}(Ke.partList,je.partList),xt?Q(je,xt,xt.startPTS,xt.endPTS,xt.startDTS,xt.endDTS):Z(Ke,je),Pr.length&&(je.totalduration=je.edge-Pr[0].start),je.driftStartTime=Ke.driftStartTime,je.driftStart=Ke.driftStart;var ji=je.advancedDateTime;if(je.advanced&&ji){var Gi=je.edge;je.driftStart||(je.driftStartTime=ji,je.driftStart=Gi),je.driftEndTime=ji,je.driftEnd=Gi}else je.driftEndTime=Ke.driftEndTime,je.driftEnd=Ke.driftEnd,je.advancedDateTime=Ke.advancedDateTime}(i,a),!this.canLoad||!a.live)return;var u,c=void 0,v=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var m=this.hls.config.lowLatencyMode,_=a.lastPartSn,S=a.endSN,F=a.lastPartIndex,P=_===S;F!==-1?(c=P?S+1:_,v=P?m?0:F:F+1):c=S+1;var X=a.age,ue=X+a.ageHeader,_e=Math.min(ue-a.partTarget,1.5*a.targetduration);if(_e>0){if(i&&_e>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+_e+" with playlist age: "+a.age),_e=0;else{var ge=Math.floor(_e/a.targetduration);c+=ge,v!==void 0&&(v+=Math.round(_e%a.targetduration/a.partTarget)),this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+X.toFixed(2)+"s goal: "+_e+" skip sn "+ge+" to part "+v)}a.tuneInGoal=_e}if(u=this.getDeliveryDirectives(a,t.deliveryDirectives,c,v),m||!P)return void this.loadPlaylist(u)}else u=this.getDeliveryDirectives(a,t.deliveryDirectives,c,v);var De=this.hls.mainForwardBufferInfo,He=De?De.end-De.len:0,Je=function(Ke,je){je===void 0&&(je=1/0);var pt=1e3*Ke.targetduration;if(Ke.updated){var Mt=Ke.fragments;if(Mt.length&&4*pt>je){var yt=1e3*Mt[Mt.length-1].duration;yt<pt&&(pt=yt)}}else pt/=2;return Math.round(pt)}(a,1e3*(a.edge-He));a.updated?s>this.requestScheduled+Je&&(this.requestScheduled=r.loading.start):this.requestScheduled=-1,c!==void 0&&a.canBlockReload?this.requestScheduled=r.loading.first+Je-(1e3*a.partTarget||1e3):this.requestScheduled=(this.requestScheduled===-1?s:this.requestScheduled)+Je;var Ae=this.requestScheduled-s;Ae=Math.max(0,Ae),this.log("reload live playlist "+e+" in "+Math.round(Ae)+" ms"),this.timer=self.setTimeout(function(){return n.loadPlaylist(u)},Ae)}else this.clearTimer()},o.getDeliveryDirectives=function(e,t,i,n){var a=function(r,s){var l=r.canSkipUntil,u=r.canSkipDateRanges,c=r.endSN;return l&&(s!==void 0?s-c:0)<l?u?Bt.v2:Bt.Yes:Bt.No}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,a=Bt.No),new te(i,n,a)},o.retryLoadingOrFail=function(e){var t,i=this,n=this.hls.config,a=this.retryCount<n.levelLoadingMaxRetry;if(a)if(this.requestScheduled=-1,this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&(t=e.context)!==null&&t!==void 0&&t.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return i.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return a},d}();function Pe(){return Pe=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Pe.apply(this,arguments)}function Be(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function We(d,o){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},We(d,o)}var Ge,$e=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),ht=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[level-controller]")||this)._levels=[],s._firstLevel=-1,s._startLevel=void 0,s.currentLevelIndex=-1,s.manualLevelIndex=-1,s.onParsedComplete=void 0,s._registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,We(o,e);var i,n,a=t.prototype;return a._registerListeners=function(){var r=this.hls;r.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,d.prototype.destroy.call(this)},a.startLoad=function(){this._levels.forEach(function(r){r.loadError=0}),d.prototype.startLoad.call(this)},a.onManifestLoaded=function(r,s){var l,u,c=[],v=[],m=[],_={},S=!1,F=!1,P=!1;if(s.levels.forEach(function(ge){var De=ge.attrs;S=S||!(!ge.width||!ge.height),F=F||!!ge.videoCodec,P=P||!!ge.audioCodec,$e&&ge.audioCodec&&ge.audioCodec.indexOf("mp4a.40.34")!==-1&&(ge.audioCodec=void 0);var He=ge.bitrate+"-"+ge.attrs.RESOLUTION+"-"+ge.attrs.CODECS;(u=_[He])?u.url.push(ge.url):(u=new N(ge),_[He]=u,c.push(u)),De&&(De.AUDIO&&O(u,"audio",De.AUDIO),De.SUBTITLES&&O(u,"text",De.SUBTITLES))}),(S||F)&&P&&(c=c.filter(function(ge){var De=ge.videoCodec,He=ge.width,Je=ge.height;return!!De||!(!He||!Je)})),c=c.filter(function(ge){var De=ge.audioCodec,He=ge.videoCodec;return(!De||xe(De,"audio"))&&(!He||xe(He,"video"))}),s.audioTracks&&C(v=s.audioTracks.filter(function(ge){return!ge.audioCodec||xe(ge.audioCodec,"audio")})),s.subtitles&&C(m=s.subtitles),c.length>0){l=c[0].bitrate,c.sort(function(ge,De){return ge.attrs["HDCP-LEVEL"]!==De.attrs["HDCP-LEVEL"]?(ge.attrs["HDCP-LEVEL"]||"")>(De.attrs["HDCP-LEVEL"]||"")?1:-1:ge.bitrate!==De.bitrate?ge.bitrate-De.bitrate:ge.attrs.SCORE!==De.attrs.SCORE?ge.attrs.decimalFloatingPoint("SCORE")-De.attrs.decimalFloatingPoint("SCORE"):S&&ge.height!==De.height?ge.height-De.height:0}),this._levels=c;for(var X=0;X<c.length;X++)if(c[X].bitrate===l){this._firstLevel=X,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+l);break}var ue=P&&!F,_e={levels:c,audioTracks:v,subtitleTracks:m,sessionData:s.sessionData,sessionKeys:s.sessionKeys,firstLevel:this._firstLevel,stats:s.stats,audio:P,video:F,altAudio:!ue&&v.some(function(ge){return!!ge.url})};this.hls.trigger(g.Events.MANIFEST_PARSED,_e),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:s.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(r,s){var l,u;if(d.prototype.onError.call(this,r,s),!s.fatal){var c=s.context,v=this._levels[this.currentLevelIndex];if(c&&(c.type===fe.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&c.groupId===v.audioGroupIds[v.urlId]||c.type===fe.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&c.groupId===v.textGroupIds[v.urlId]))this.redundantFailover(this.currentLevelIndex);else{var m,_=!1,S=!0;switch(s.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(s.frag){var F=s.frag.type===fe.PlaylistLevelType.MAIN?s.frag.level:this.currentLevelIndex,P=this._levels[F];P?(P.fragmentError++,P.fragmentError>this.hls.config.fragLoadingMaxRetry&&(m=F)):m=F}break;case k.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var X=v.attrs["HDCP-LEVEL"];X&&(this.hls.maxHdcpLevel=ar[ar.indexOf(X)-1],this.warn('Restricting playback to HDCP-LEVEL of "'+this.hls.maxHdcpLevel+'" or lower'));case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_SYSTEM_NO_SESSION:m=((l=s.frag)===null||l===void 0?void 0:l.type)===fe.PlaylistLevelType.MAIN?s.frag.level:this.currentLevelIndex,s.levelRetry=!1;break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:c&&(c.deliveryDirectives&&(S=!1),m=c.level),_=!0;break;case k.ErrorDetails.REMUX_ALLOC_ERROR:m=(u=s.level)!=null?u:this.currentLevelIndex,_=!0}m!==void 0&&this.recoverLevel(s,m,_,S)}}},a.recoverLevel=function(r,s,l,u){var c=r.details,v=this._levels[s];if(v.loadError++,l){if(!this.retryLoadingOrFail(r))return void(this.currentLevelIndex=-1);r.levelRetry=!0}if(u){var m=v.url.length;if(m>1&&v.loadError<m)r.levelRetry=!0,this.redundantFailover(s);else if(this.manualLevelIndex===-1){for(var _=-1,S=this._levels,F=S.length;F--;){var P=(F+this.currentLevelIndex)%S.length;if(P!==this.currentLevelIndex&&S[P].loadError===0){_=P;break}}_>-1&&this.currentLevelIndex!==_?(this.warn(c+": switch to "+_),r.levelRetry=!0,this.hls.nextAutoLevel=_):r.levelRetry===!1&&(r.fatal=!0)}}},a.redundantFailover=function(r){var s=this._levels[r],l=s.url.length;if(l>1){var u=(s.urlId+1)%l;this.warn("Switching to redundant URL-id "+u),this._levels.forEach(function(c){c.urlId=u}),this.level=r}},a.onFragLoaded=function(r,s){var l=s.frag;if(l!==void 0&&l.type===fe.PlaylistLevelType.MAIN){var u=this._levels[l.level];u!==void 0&&(u.fragmentError=0,u.loadError=0)}},a.onLevelLoaded=function(r,s){var l,u,c=s.level,v=s.details,m=this._levels[c];if(!m)return this.warn("Invalid level index "+c),void((u=s.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(v.deltaUpdateFailed=!0));c===this.currentLevelIndex?(m.fragmentError===0&&(m.loadError=0,this.retryCount=0),this.playlistLoaded(c,s,m.details)):(l=s.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(v.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(r,s){var l=this.hls.levels[this.currentLevelIndex];if(l&&l.audioGroupIds){for(var u=-1,c=this.hls.audioTracks[s.id].groupId,v=0;v<l.audioGroupIds.length;v++)if(l.audioGroupIds[v]===c){u=v;break}u!==l.urlId&&(l.urlId=u,this.startLoad())}},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.currentLevelIndex,l=this._levels[s];if(this.canLoad&&l&&l.url.length>0){var u=l.urlId,c=l.url[u];if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+s+(r?" at sn "+r.msn+" part "+r.part:"")+" with URL-id "+u+" "+c),this.clearTimer(),this.hls.trigger(g.Events.LEVEL_LOADING,{url:c,level:s,id:u,deliveryDirectives:r||null})}},a.removeLevel=function(r,s){var l=function(c,v){return v!==s},u=this._levels.filter(function(c,v){return v!==r||c.url.length>1&&s!==void 0&&(c.url=c.url.filter(l),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(l)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(l)),c.urlId=0,!0)}).map(function(c,v){var m=c.details;return m!=null&&m.fragments&&m.fragments.forEach(function(_){_.level=v}),c});this._levels=u,this.hls.trigger(g.Events.LEVELS_UPDATED,{levels:u})},i=t,(n=[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(r){var s,l=this._levels;if(l.length!==0&&(this.currentLevelIndex!==r||(s=l[r])===null||s===void 0||!s.details)){if(r<0||r>=l.length){var u=r<0;if(this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.LEVEL_SWITCH_ERROR,level:r,fatal:u,reason:"invalid level idx"}),u)return;r=Math.min(r,l.length-1)}this.clearTimer();var c=this.currentLevelIndex,v=l[c],m=l[r];this.log("switching to level "+r+" from "+c),this.currentLevelIndex=r;var _=Pe({},m,{level:r,maxBitrate:m.maxBitrate,uri:m.uri,urlId:m.urlId});delete _._urlId,this.hls.trigger(g.Events.LEVEL_SWITCHING,_);var S=m.details;if(!S||S.live){var F=this.switchParams(m.uri,v==null?void 0:v.details);this.loadPlaylist(F)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(r){this.manualLevelIndex=r,this._startLevel===void 0&&(this._startLevel=r),r!==-1&&(this.level=r)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(r){this._firstLevel=r}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var r=this.hls.config.startLevel;return r!==void 0?r:this._firstLevel}return this._startLevel},set:function(r){this._startLevel=r}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(r){this.level=r,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=r)}}])&&Be(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);(function(d){d.NOT_LOADED="NOT_LOADED",d.APPENDING="APPENDING",d.PARTIAL="PARTIAL",d.OK="OK"})(Ge||(Ge={}));var Dt=function(){function d(e){this.activeFragment=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var o=d.prototype;return o._registerListeners=function(){var e=this.hls;e.on(g.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.Events.FRAG_LOADED,this.onFragLoaded,this)},o._unregisterListeners=function(){var e=this.hls;e.off(g.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.Events.FRAG_LOADED,this.onFragLoaded,this)},o.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.activeFragment=this.activeParts=null},o.getAppendedFrag=function(e,t){if(t===fe.PlaylistLevelType.MAIN){var i=this.activeFragment,n=this.activeParts;if(!i)return null;if(n)for(var a=n.length;a--;){var r=n[a],s=r?r.end:i.appendedPTS;if(r.start<=e&&s!==void 0&&e<=s)return a>9&&(this.activeParts=n.slice(a-9)),r}else if(i.start<=e&&i.appendedPTS!==void 0&&e<=i.appendedPTS)return i}return this.getBufferedFrag(e,t)},o.getBufferedFrag=function(e,t){for(var i=this.fragments,n=Object.keys(i),a=n.length;a--;){var r=i[n[a]];if((r==null?void 0:r.body.type)===t&&r.buffered){var s=r.body;if(s.start<=e&&e<=s.end)return s}}return null},o.detectEvictedFragments=function(e,t,i){var n=this;this.timeRanges&&(this.timeRanges[e]=t),Object.keys(this.fragments).forEach(function(a){var r=n.fragments[a];if(r)if(r.buffered||r.loaded){var s=r.range[e];s&&s.time.some(function(l){var u=!n.isTimeBuffered(l.startPTS,l.endPTS,t);return u&&n.removeFragment(r.body),u})}else r.body.type===i&&n.removeFragment(r.body)})},o.detectPartialFragments=function(e){var t=this,i=this.timeRanges,n=e.frag,a=e.part;if(i&&n.sn!=="initSegment"){var r=Pt(n),s=this.fragments[r];s&&(Object.keys(i).forEach(function(l){var u=n.elementaryStreams[l];if(u){var c=i[l],v=a!==null||u.partial===!0;s.range[l]=t.getBufferedTimes(n,a,v,c)}}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,s.body.endList&&(this.endListFragments[s.body.type]=s)):this.removeFragment(s.body))}},o.fragBuffered=function(e){var t=Pt(e),i=this.fragments[t];i&&(i.loaded=null,i.buffered=!0)},o.getBufferedTimes=function(e,t,i,n){for(var a={time:[],partial:i},r=t?t.start:e.start,s=t?t.end:e.end,l=e.minEndPTS||s,u=e.maxStartPTS||r,c=0;c<n.length;c++){var v=n.start(c)-this.bufferPadding,m=n.end(c)+this.bufferPadding;if(u>=v&&l<=m){a.time.push({startPTS:Math.max(r,n.start(c)),endPTS:Math.min(s,n.end(c))});break}if(r<m&&s>v)a.partial=!0,a.time.push({startPTS:Math.max(r,n.start(c)),endPTS:Math.min(s,n.end(c))});else if(s<=v)break}return a},o.getPartialFragment=function(e){var t,i,n,a=null,r=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(u){var c=l[u];c&&ze(c)&&(i=c.body.start-s,n=c.body.end+s,e>=i&&e<=n&&(t=Math.min(e-i,n-e),r<=t&&(a=c.body,r=t)))}),a},o.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||ze(t))},o.getState=function(e){var t=Pt(e),i=this.fragments[t];return i?i.buffered?ze(i)?Ge.PARTIAL:Ge.OK:Ge.APPENDING:Ge.NOT_LOADED},o.isTimeBuffered=function(e,t,i){for(var n,a,r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,a=i.end(r)+this.bufferPadding,e>=n&&t<=a)return!0;if(t<=n)return!1}return!1},o.onFragLoaded=function(e,t){var i=t.frag,n=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest&&!n){var a=Pt(i);this.fragments[a]={body:i,loaded:t,buffered:!1,range:Object.create(null)}}},o.onBufferAppended=function(e,t){var i=this,n=t.frag,a=t.part,r=t.timeRanges;if(n.type===fe.PlaylistLevelType.MAIN)if(this.activeFragment!==n&&(this.activeFragment=n,n.appendedPTS=void 0),a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(l){var u=r[l];if(i.detectEvictedFragments(l,u),!a&&n.type===fe.PlaylistLevelType.MAIN){var c=n.elementaryStreams[l];if(!c)return;for(var v=0;v<u.length;v++){var m=u.end(v);m<=c.endPTS&&m>c.startPTS?n.appendedPTS=Math.max(m,n.appendedPTS||0):n.appendedPTS=c.endPTS}}})},o.onFragBuffered=function(e,t){this.detectPartialFragments(t)},o.hasFragment=function(e){var t=Pt(e);return!!this.fragments[t]},o.removeFragmentsInRange=function(e,t,i){var n=this;Object.keys(this.fragments).forEach(function(a){var r=n.fragments[a];if(r&&r.buffered){var s=r.body;s.type===i&&s.start<t&&s.end>e&&n.removeFragment(s)}})},o.removeFragment=function(e){var t=Pt(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),e.appendedPTS=void 0,delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},o.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activeFragment=null,this.activeParts=null},d}();function ze(d){var o,e;return d.buffered&&(((o=d.range.video)===null||o===void 0?void 0:o.partial)||((e=d.range.audio)===null||e===void 0?void 0:e.partial))}function Pt(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}function tr(d){var o=typeof Map=="function"?new Map:void 0;return tr=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return jt(e,arguments,rt(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ht(i,e)},tr(d)}function jt(d,o,e){return jt=Ft()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ht(r,n.prototype),r},jt.apply(null,arguments)}function Ft(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ht(d,o){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(d,o)}function rt(d){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},rt(d)}var lr=Math.pow(2,17),Ar=function(){function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(e,t){var i=this,n=e.url;if(!n)return Promise.reject(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(n?"part list":"url")));this.abort();var a=this.config,r=a.fLoader,s=a.loader;return new Promise(function(l,u){i.loader&&i.loader.destroy();var c=i.loader=e.loader=r?new r(a):new s(a),v=Kt(e),m={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:e.sn==="initSegment"?1/0:lr};e.stats=c.stats,c.load(v,m,{onSuccess:function(_,S,F,P){i.resetLoader(e,c);var X=_.data;F.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(X.slice(0,16)),X=X.slice(16)),l({frag:e,part:null,payload:X,networkDetails:P})},onError:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:_,networkDetails:F}))},onAbort:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:F}))},onTimeout:function(_,S,F){i.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:F}))},onProgress:function(_,S,F,P){t&&t({frag:e,part:null,payload:F,networkDetails:P})}})})},o.loadPart=function(e,t,i){var n=this;this.abort();var a=this.config,r=a.fLoader,s=a.loader;return new Promise(function(l,u){n.loader&&n.loader.destroy();var c=n.loader=e.loader=r?new r(a):new s(a),v=Kt(e,t),m={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:lr};t.stats=c.stats,c.load(v,m,{onSuccess:function(_,S,F,P){n.resetLoader(e,c),n.updateStatsFromPart(e,t);var X={frag:e,part:t,payload:_.data,networkDetails:P};i(X),l(X)},onError:function(_,S,F){n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:_,networkDetails:F}))},onAbort:function(_,S,F){e.stats.aborted=t.stats.aborted,n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:F}))},onTimeout:function(_,S,F){n.resetLoader(e,c),u(new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:F}))}})})},o.updateStatsFromPart=function(e,t){var i=e.stats,n=t.stats,a=n.total;if(i.loaded+=n.loaded,a){var r=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/a),r),l=(r-s)*Math.round(i.loaded/s);i.total=i.loaded+l}else i.total=Math.max(i.loaded,i.total);var u=i.loading,c=n.loading;u.start?u.first+=c.first-c.start:(u.start=c.start,u.first=c.first),u.end=c.end},o.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d}();function Kt(d,o){o===void 0&&(o=null);var e=o||d,t={frag:d,part:o,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,n=e.byteRangeEndOffset;if((0,R.isFiniteNumber)(i)&&(0,R.isFiniteNumber)(n)){var a,r=i,s=n;if(d.sn==="initSegment"&&((a=d.decryptdata)===null||a===void 0?void 0:a.method)==="AES-128"){var l=n-i;l%16&&(s=n+(16-l%16)),i!==0&&(t.resetIV=!0,r=i-16)}t.rangeStart=r,t.rangeEnd=s}return t}var Jt=function(d){var o,e;function t(i){for(var n,a=arguments.length,r=new Array(a>1?a-1:0),s=1;s<a;s++)r[s-1]=arguments[s];return(n=d.call.apply(d,[this].concat(r))||this).data=void 0,n.data=i,n}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ht(o,e),t}(tr(Error)),pr=function(){function d(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var o=d.prototype;return o.abort=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.abort()}},o.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},o.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},o.createKeyLoadError=function(e,t,i,n){return t===void 0&&(t=k.ErrorDetails.KEY_LOAD_ERROR),new Jt({type:k.ErrorTypes.NETWORK_ERROR,details:t,fatal:!1,frag:e,networkDetails:i})},o.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var n=e.sn,a=e.cc,r=function(l){var u=t[l];if(a<=u.cc&&(n==="initSegment"||n<u.sn))return i.emeController.selectKeySystemFormat(u).then(function(c){u.setKeyFormat(c)}),"break"},s=0;s<t.length&&r(s)!=="break";s++);},o.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(i){return t.loadInternal(e,i)}):this.loadInternal(e)},o.loadInternal=function(e,t){var i,n;t&&e.setKeyFormat(t);var a=e.decryptdata;if(!a){var r=t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading";return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,r))}var s=a.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,'Invalid key URI: "'+s+'"'));var l,u=this.keyUriToKeyInfo[s];if((i=u)!==null&&i!==void 0&&i.decryptdata.key)return a.key=u.decryptdata.key,Promise.resolve({frag:e,keyInfo:u});if((n=u)!==null&&n!==void 0&&n.keyLoadPromise)switch((l=u.mediaKeySessionContext)===null||l===void 0?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return u.keyLoadPromise}switch(u=this.keyUriToKeyInfo[s]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return a.keyFormat==="identity"?this.loadKeyHTTP(u,e):this.loadKeyEME(u,e);case"AES-128":return this.loadKeyHTTP(u,e);default:return Promise.reject(this.createKeyLoadError(e,k.ErrorDetails.KEY_LOAD_ERROR,null,'Key supplied with unsupported METHOD: "'+a.method+'"'))}},o.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(function(a){return e.mediaKeySessionContext=a,i})).catch(function(a){throw e.keyLoadPromise=null,a})}return Promise.resolve(i)},o.loadKeyHTTP=function(e,t){var i=this,n=this.config,a=new n.loader(n);return t.keyLoader=e.loader=a,e.keyLoadPromise=new Promise(function(r,s){var l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},c={onSuccess:function(v,m,_,S){var F=_.frag,P=_.keyInfo,X=_.url;if(!F.decryptdata||P!==i.keyUriToKeyInfo[X])return s(i.createKeyLoadError(F,k.ErrorDetails.KEY_LOAD_ERROR,S,"after key load, decryptdata unset or changed"));P.decryptdata.key=F.decryptdata.key=new Uint8Array(v.data),F.keyLoader=null,P.loader=null,r({frag:F,keyInfo:P})},onError:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.KEY_LOAD_ERROR,_))},onTimeout:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.KEY_LOAD_TIMEOUT,_))},onAbort:function(v,m,_){i.resetLoader(m),s(i.createKeyLoadError(t,k.ErrorDetails.INTERNAL_ABORTED,_))}};a.load(l,u,c)})},o.resetLoader=function(e){var t=e.frag,i=e.keyInfo,n=e.url,a=i.loader;t.keyLoader===a&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],a&&a.destroy()},d}(),Cr=function(){function d(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var o=d.prototype;return o.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},o.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},o.onHandlerDestroyed=function(){},o.hasInterval=function(){return!!this._tickInterval},o.hasNextTick=function(){return!!this._tickTimer},o.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},o.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},o.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},o.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},o.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},o.doTick=function(){},d}(),vr={length:0,start:function(){return 0},end:function(){return 0}},Gt=function(){function d(){}return d.isBuffered=function(o,e){try{if(o){for(var t=d.getBuffered(o),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},d.bufferInfo=function(o,e,t){try{if(o){var i,n=d.getBuffered(o),a=[];for(i=0;i<n.length;i++)a.push({start:n.start(i),end:n.end(i)});return this.bufferedInfo(a,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},d.bufferedInfo=function(o,e,t){e=Math.max(0,e),o.sort(function(S,F){return S.start-F.start||F.end-S.end});var i=[];if(t)for(var n=0;n<o.length;n++){var a=i.length;if(a){var r=i[a-1].end;o[n].start-r<t?o[n].end>r&&(i[a-1].end=o[n].end):i.push(o[n])}else i.push(o[n])}else i=o;for(var s,l=0,u=e,c=e,v=0;v<i.length;v++){var m=i[v].start,_=i[v].end;if(e+t>=m&&e<_)u=m,l=(c=_)-e;else if(e+t<m){s=m;break}}return{len:l,start:u||0,end:c||0,nextStart:s}},d.getBuffered=function(o){try{return o.buffered}catch(e){return L.logger.log("failed to get media.buffered",e),vr}},d}(),Di=function(d,o,e,t,i,n){t===void 0&&(t=0),i===void 0&&(i=-1),n===void 0&&(n=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=d,this.sn=o,this.id=e,this.size=t,this.part=i,this.partial=n};function nn(d,o){for(var e=null,t=0,i=d.length;t<i;t++){var n=d[t];if(n&&n.cc===o){e=n;break}}return e}function kr(d,o){if(d){var e=d.start+o;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function li(d,o){for(var e=o.fragments,t=0,i=e.length;t<i;t++)kr(e[t],d);o.fragmentHint&&kr(o.fragmentHint,d),o.alignedSliding=!0}function an(d,o){if(d.hasProgramDateTime&&o.hasProgramDateTime){var e=d.fragments,t=o.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],n=nn(e,i.cc)||e[Math.round(e.length/2)-1],a=i.programDateTime,r=n.programDateTime;a!==null&&r!==null&&li((r-a)/1e3-(n.start-i.start),d)}}}let sn=function(d,o){for(var e=0,t=d.length-1,i=null,n=null;e<=t;){var a=o(n=d[i=(e+t)/2|0]);if(a>0)e=i+1;else{if(!(a<0))return n;t=i-1}}return null};function ui(d,o,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(d?i=o[d.sn-o[0].sn+1]||null:e===0&&o[0].start===0&&(i=o[0]),i&&di(e,t,i)===0)return i;var n=sn(o,di.bind(null,e,t));return!n||n===d&&i?i:n}function di(d,o,e){if(d===void 0&&(d=0),o===void 0&&(o=0),e.start<=d&&e.start+e.duration>d)return 0;var t=Math.min(o,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0}function Kr(d,o,e){var t=1e3*Math.min(o,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var Zr=B(21);let wn=function(d){for(var o="",e=d.length,t=0;t<e;t++)o+="["+d.start(t).toFixed(3)+","+d.end(t).toFixed(3)+"]";return o};function on(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Hr(d,o){return Hr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hr(d,o)}var br="STOPPED",At="IDLE",ln="KEY_LOADING",qr="FRAG_LOADING",Nr="FRAG_LOADING_WAITING_RETRY",ci="WAITING_TRACK",wr="PARSING",Vr="PARSED",ei="ENDED",Lr="ERROR",Ur="WAITING_INIT_PTS",Yr="WAITING_LEVEL",hi=function(d){var o,e;function t(r,s,l,u){var c;return(c=d.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=br,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.loadedmetadata=!1,c.fragLoadError=0,c.retryDate=0,c.levels=null,c.fragmentLoader=void 0,c.keyLoader=void 0,c.levelLastLoaded=null,c.startFragRequested=!1,c.decrypter=void 0,c.initPTS=[],c.onvseeking=null,c.onvended=null,c.logPrefix="",c.log=void 0,c.warn=void 0,c.logPrefix=u,c.log=L.logger.log.bind(L.logger,u+":"),c.warn=L.logger.warn.bind(L.logger,u+":"),c.hls=r,c.fragmentLoader=new Ar(r.config),c.keyLoader=l,c.fragmentTracker=s,c.config=r.config,c.decrypter=new Zr.default(r.config),r.on(g.Events.LEVEL_SWITCHING,c.onLevelSwitching,function(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}(c)),c}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Hr(o,e);var i,n,a=t.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(r){},a.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var r=this.fragCurrent;r&&(r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=br},a._streamEnded=function(r,s){if(s.live||r.nextStart||!r.end||!this.media)return!1;var l=s.partList;if(l!=null&&l.length){var u=l[l.length-1];return Gt.isBuffered(this.media,u.start+u.duration/2)}var c=s.fragments[s.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)},a.getLevelDetails=function(){var r;if(this.levels&&this.levelLastLoaded!==null)return(r=this.levels[this.levelLastLoaded])===null||r===void 0?void 0:r.details},a.onMediaAttached=function(r,s){var l=this.media=this.mediaBuffer=s.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),l.addEventListener("seeking",this.onvseeking),l.addEventListener("ended",this.onvended);var u=this.config;this.levels&&u.autoStartLoad&&this.state===br&&this.startLoad(u.startPosition)},a.onMediaDetaching=function(){var r=this.media;r!=null&&r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),r&&this.onvseeking&&this.onvended&&(r.removeEventListener("seeking",this.onvseeking),r.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var r=this.config,s=this.fragCurrent,l=this.media,u=this.mediaBuffer,c=this.state,v=l?l.currentTime:0,m=Gt.bufferInfo(u||l,v,r.maxBufferHole);if(this.log("media seeking to "+((0,R.isFiniteNumber)(v)?v.toFixed(3):v)+", state: "+c),this.state===ei)this.resetLoadingState();else if(s){var _=r.maxFragLookUpTolerance,S=s.start-_,F=s.start+s.duration+_;if(!m.len||F<m.start||S>m.end){var P=v>F;(v<S||P)&&(P&&s.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),s.abortRequests()),this.resetLoadingState())}}l&&(this.lastCurrentTime=v),this.loadedmetadata||m.len||(this.nextLoadPosition=this.startPosition=v),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onLevelSwitching=function(r,s){this.fragLoadError=0},a.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=br,this.hls.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,d.prototype.onHandlerDestroyed.call(this)},a.loadFragment=function(r,s,l){this._loadFragForPlayback(r,s,l)},a._loadFragForPlayback=function(r,s,l){var u=this;this._doFragLoad(r,s,l,function(c){if(u.fragContextChanged(r))return u.warn("Fragment "+r.sn+(c.part?" p: "+c.part.index:"")+" of level "+r.level+" was dropped during download."),void u.fragmentTracker.removeFragment(r);r.stats.chunkCount++,u._handleFragmentLoadProgress(c)}).then(function(c){if(c){u.fragLoadError=0;var v=u.state;u.fragContextChanged(r)?(v===qr||!u.fragCurrent&&v===wr)&&(u.fragmentTracker.removeFragment(r),u.state=At):("payload"in c&&(u.log("Loaded fragment "+r.sn+" of level "+r.level),u.hls.trigger(g.Events.FRAG_LOADED,c)),u._handleFragmentLoadComplete(c))}}).catch(function(c){u.state!==br&&u.state!==Lr&&(u.warn(c),u.resetFragmentLoading(r))})},a.flushMainBuffer=function(r,s,l){if(l===void 0&&(l=null),r-s){var u={startOffset:r,endOffset:s,type:l};this.fragLoadError=0,this.hls.trigger(g.Events.BUFFER_FLUSHING,u)}},a._loadInitSegment=function(r,s){var l=this;this._doFragLoad(r,s).then(function(u){if(!u||l.fragContextChanged(r)||!l.levels)throw new Error("init load aborted");return u}).then(function(u){var c=l.hls,v=u.payload,m=r.decryptdata;if(v&&v.byteLength>0&&m&&m.key&&m.iv&&m.method==="AES-128"){var _=self.performance.now();return l.decrypter.decrypt(new Uint8Array(v),m.key.buffer,m.iv.buffer).then(function(S){var F=self.performance.now();return c.trigger(g.Events.FRAG_DECRYPTED,{frag:r,payload:S,stats:{tstart:_,tdecrypt:F}}),u.payload=S,u})}return u}).then(function(u){var c=l.fragCurrent,v=l.hls,m=l.levels;if(!m)throw new Error("init load aborted, missing levels");m[r.level].details;var _=r.stats;l.state=At,l.fragLoadError=0,r.data=new Uint8Array(u.payload),_.parsing.start=_.buffering.start=self.performance.now(),_.parsing.end=_.buffering.end=self.performance.now(),u.frag===c&&v.trigger(g.Events.FRAG_BUFFERED,{stats:_,frag:c,part:null,id:r.type}),l.tick()}).catch(function(u){l.state!==br&&l.state!==Lr&&(l.warn(u),l.resetFragmentLoading(r))})},a.fragContextChanged=function(r){var s=this.fragCurrent;return!r||!s||r.level!==s.level||r.sn!==s.sn||r.urlId!==s.urlId},a.fragBufferedComplete=function(r,s){var l,u,c=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+r.type+" sn: "+r.sn+(s?" part: "+s.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level+" "+(c?wn(Gt.getBuffered(c)):"(detached)")),this.state=At,c&&(!this.loadedmetadata&&r.type==fe.PlaylistLevelType.MAIN&&c.buffered.length&&((l=this.fragCurrent)===null||l===void 0?void 0:l.sn)===((u=this.fragPrevious)===null||u===void 0?void 0:u.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},a.seekToStartPos=function(){},a._handleFragmentLoadComplete=function(r){var s=this.transmuxer;if(s){var l=r.frag,u=r.part,c=r.partsLoaded,v=!c||c.length===0||c.some(function(_){return!_}),m=new Di(l.level,l.sn,l.stats.chunkCount+1,0,u?u.index:-1,!v);s.flush(m)}},a._handleFragmentLoadProgress=function(r){},a._doFragLoad=function(r,s,l,u){var c,v=this;if(l===void 0&&(l=null),!this.levels)throw new Error("frag load aborted, missing levels");var m=null;if(!r.encrypted||(c=r.decryptdata)!==null&&c!==void 0&&c.key?!r.encrypted&&s.encryptedFragments.length&&this.keyLoader.loadClear(r,s.encryptedFragments):(this.log("Loading key for "+r.sn+" of ["+s.startSN+"-"+s.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level),this.state=ln,this.fragCurrent=r,m=this.keyLoader.load(r).then(function(X){if(!v.fragContextChanged(X.frag))return v.hls.trigger(g.Events.KEY_LOADED,X),X}),this.hls.trigger(g.Events.KEY_LOADING,{frag:r}),this.throwIfFragContextChanged("KEY_LOADING")),l=Math.max(r.start,l||0),this.config.lowLatencyMode&&s){var _=s.partList;if(_&&u){l>r.end&&s.fragmentHint&&(r=s.fragmentHint);var S=this.getNextPart(_,r,l);if(S>-1){var F=_[S];return this.log("Loading part sn: "+r.sn+" p: "+F.index+" cc: "+r.cc+" of playlist ["+s.startSN+"-"+s.endSN+"] parts [0-"+S+"-"+(_.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(l.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=qr,this.hls.trigger(g.Events.FRAG_LOADING,{frag:r,part:_[S],targetBufferTime:l}),this.throwIfFragContextChanged("FRAG_LOADING parts"),m?m.then(function(X){return!X||v.fragContextChanged(X.frag)?null:v.doFragPartsLoad(r,_,S,u)}).catch(function(X){return v.handleFragLoadError(X)}):this.doFragPartsLoad(r,_,S,u).catch(function(X){return v.handleFragLoadError(X)})}if(!r.url||this.loadedEndOfParts(_,l))return Promise.resolve(null)}}this.log("Loading fragment "+r.sn+" cc: "+r.cc+" "+(s?"of ["+s.startSN+"-"+s.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(l.toFixed(3))),(0,R.isFiniteNumber)(r.sn)&&!this.bitrateTest&&(this.nextLoadPosition=r.start+r.duration),this.state=qr,this.hls.trigger(g.Events.FRAG_LOADING,{frag:r,targetBufferTime:l}),this.throwIfFragContextChanged("FRAG_LOADING");var P=this.config.progressive;return P&&m?m.then(function(X){return!X||v.fragContextChanged(X==null?void 0:X.frag)?null:v.fragmentLoader.load(r,u)}).catch(function(X){return v.handleFragLoadError(X)}):Promise.all([this.fragmentLoader.load(r,P?u:void 0),m]).then(function(X){var ue=X[0];return!P&&ue&&u&&u(ue),ue}).catch(function(X){return v.handleFragLoadError(X)})},a.throwIfFragContextChanged=function(r){if(this.fragCurrent===null)throw new Error("frag load aborted, context changed in "+r)},a.doFragPartsLoad=function(r,s,l,u){var c=this;return new Promise(function(v,m){var _=[];(function S(F){var P=s[F];c.fragmentLoader.loadPart(r,P,u).then(function(X){_[P.index]=X;var ue=X.part;c.hls.trigger(g.Events.FRAG_LOADED,X);var _e=s[F+1];if(!_e||_e.fragment!==r)return v({frag:r,part:ue,partsLoaded:_});S(F+1)}).catch(m)})(l)})},a.handleFragLoadError=function(r){if("data"in r){var s=r.data;r.data&&s.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(s.frag,s.part):this.hls.trigger(g.Events.ERROR,s)}else this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,err:r,fatal:!0});return null},a._handleTransmuxerFlush=function(r){var s=this.getCurrentContext(r);if(s&&this.state===wr){var l=s.frag,u=s.part,c=s.level,v=self.performance.now();l.stats.parsing.end=v,u&&(u.stats.parsing.end=v),this.updateLevelTiming(l,u,c,r.partial)}else this.fragCurrent||this.state===br||this.state===Lr||(this.state=At)},a.getCurrentContext=function(r){var s=this.levels,l=r.level,u=r.sn,c=r.part;if(!s||!s[l])return this.warn("Levels object was unset while buffering fragment "+u+" of level "+l+". The current chunk will not be buffered."),null;var v=s[l],m=c>-1?function(S,F,P){if(!S||!S.details)return null;var X=S.details.partList;if(X)for(var ue=X.length;ue--;){var _e=X[ue];if(_e.index===P&&_e.fragment.sn===F)return _e}return null}(v,u,c):null,_=m?m.fragment:function(S,F,P){if(!S||!S.details)return null;var X=S.details,ue=X.fragments[F-X.startSN];return ue||((ue=X.fragmentHint)&&ue.sn===F?ue:F<X.startSN&&P&&P.sn===F?P:null)}(v,u,this.fragCurrent);return _?{frag:_,part:m,level:v}:null},a.bufferFragmentData=function(r,s,l,u){if(r&&this.state===wr){var c=r.data1,v=r.data2,m=c;if(c&&v&&(m=(0,z.appendUint8Array)(c,v)),m&&m.length){var _={type:r.type,frag:s,part:l,chunkMeta:u,parent:s.type,data:m};this.hls.trigger(g.Events.BUFFER_APPENDING,_),r.dropped&&r.independent&&!l&&this.flushBufferGap(s)}}},a.flushBufferGap=function(r){var s=this.media;if(s)if(Gt.isBuffered(s,s.currentTime)){var l=s.currentTime,u=Gt.bufferInfo(s,l,0),c=r.duration,v=Math.min(2*this.config.maxFragLookUpTolerance,.25*c),m=Math.max(Math.min(r.start-v,u.end-v),l+v);r.start-m>v&&this.flushMainBuffer(m,r.start)}else this.flushMainBuffer(0,r.start)},a.getFwdBufferInfo=function(r,s){var l=this.config,u=this.getLoadPosition();if(!(0,R.isFiniteNumber)(u))return null;var c=Gt.bufferInfo(r,u,l.maxBufferHole);if(c.len===0&&c.nextStart!==void 0){var v=this.fragmentTracker.getBufferedFrag(u,s);if(v&&c.nextStart<v.end)return Gt.bufferInfo(r,u,Math.max(c.nextStart,l.maxBufferHole))}return c},a.getMaxBufferLength=function(r){var s,l=this.config;return s=r?Math.max(8*l.maxBufferSize/r,l.maxBufferLength):l.maxBufferLength,Math.min(s,l.maxMaxBufferLength)},a.reduceMaxBufferLength=function(r){var s=this.config,l=r||s.maxBufferLength;return s.maxMaxBufferLength>=l&&(s.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+s.maxMaxBufferLength+"s"),!0)},a.getNextFragment=function(r,s){var l=s.fragments,u=l.length;if(!u)return null;var c,v=this.config,m=l[0].start;if(s.live){var _=v.initialLiveManifestSize;if(u<_)return this.warn("Not enough fragments to start playback (have: "+u+", need: "+_+")"),null;s.PTSKnown||this.startFragRequested||this.startPosition!==-1||(c=this.getInitialLiveFragment(s,l),this.startPosition=c?this.hls.liveSyncPosition||c.start:r)}else r<=m&&(c=l[0]);if(!c){var S=v.lowLatencyMode?s.partEnd:s.fragmentEnd;c=this.getFragmentAtPosition(r,S,s)}return this.mapToInitFragWhenRequired(c)},a.mapToInitFragWhenRequired=function(r){return r==null||!r.initSegment||r!=null&&r.initSegment.data||this.bitrateTest?r:r.initSegment},a.getNextPart=function(r,s,l){for(var u=-1,c=!1,v=!0,m=0,_=r.length;m<_;m++){var S=r[m];if(v=v&&!S.independent,u>-1&&l<S.start)break;var F=S.loaded;F?u=-1:(c||S.independent||v)&&S.fragment===s&&(u=m),c=F}return u},a.loadedEndOfParts=function(r,s){var l=r[r.length-1];return l&&s>l.start&&l.loaded},a.getInitialLiveFragment=function(r,s){var l=this.fragPrevious,u=null;if(l){if(r.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+l.programDateTime),u=function(_,S,F){if(S===null||!Array.isArray(_)||!_.length||!(0,R.isFiniteNumber)(S)||S<(_[0].programDateTime||0)||S>=(_[_.length-1].endProgramDateTime||0))return null;F=F||0;for(var P=0;P<_.length;++P){var X=_[P];if(Kr(S,F,X))return X}return null}(s,l.endProgramDateTime,this.config.maxFragLookUpTolerance)),!u){var c=l.sn+1;if(c>=r.startSN&&c<=r.endSN){var v=s[c-r.startSN];l.cc===v.cc&&(u=v,this.log("Live playlist, switching playlist, load frag with next SN: "+u.sn))}u||(u=function(_,S){return sn(_,function(F){return F.cc<S?1:F.cc>S?-1:0})}(s,l.cc),u&&this.log("Live playlist, switching playlist, load frag with same CC: "+u.sn))}}else{var m=this.hls.liveSyncPosition;m!==null&&(u=this.getFragmentAtPosition(m,this.bitrateTest?r.fragmentEnd:r.edge,r))}return u},a.getFragmentAtPosition=function(r,s,l){var u,c=this.config,v=this.fragPrevious,m=l.fragments,_=l.endSN,S=l.fragmentHint,F=c.maxFragLookUpTolerance,P=!!(c.lowLatencyMode&&l.partList&&S);if(P&&S&&!this.bitrateTest&&(m=m.concat(S),_=S.sn),u=r<s?ui(v,m,r,r>s-F?0:F):m[m.length-1]){var X=u.sn-l.startSN;if(this.fragmentTracker.getState(u)===Ge.OK&&(v=u),v&&u.sn===v.sn&&!P&&v&&u.level===v.level){var ue=m[X+1];u.sn<_&&this.fragmentTracker.getState(ue)!==Ge.OK?(this.log("SN "+u.sn+" just loaded, load next one: "+ue.sn),u=ue):u=null}}return u},a.synchronizeToLiveEdge=function(r){var s=this.config,l=this.media;if(l){var u=this.hls.liveSyncPosition,c=l.currentTime,v=r.fragments[0].start,m=r.edge,_=c>=v-s.maxFragLookUpTolerance&&c<=m;if(u!==null&&l.duration>u&&(c<u||!_)){var S=s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:s.liveMaxLatencyDurationCount*r.targetduration;(!_&&l.readyState<4||c<m-S)&&(this.loadedmetadata||(this.nextLoadPosition=u),l.readyState&&(this.warn("Playback: "+c.toFixed(3)+" is located too far from the end of live sliding playlist: "+m+", reset currentTime to : "+u.toFixed(3)),l.currentTime=u))}}},a.alignPlaylists=function(r,s){var l=this.levels,u=this.levelLastLoaded,c=this.fragPrevious,v=u!==null?l[u]:null,m=r.fragments.length;if(!m)return this.warn("No fragments in live playlist"),0;var _=r.fragments[0].start,S=!s,F=r.alignedSliding&&(0,R.isFiniteNumber)(_);if(S||!F&&!_){(function(X,ue,_e){ue&&(function(ge,De,He){if(function(Ae,Ke,je){return!(!Ke.details||!(je.endCC>je.startCC||Ae&&Ae.cc<je.startCC))}(ge,He,De)){var Je=function(Ae,Ke,je){je===void 0&&(je=0);var pt=Ae.fragments,Mt=Ke.fragments;if(Mt.length&&pt.length){var yt=nn(pt,Mt[0].cc);if(yt&&(!yt||yt.startPTS))return yt;L.logger.log("No frag in previous level to align on")}else L.logger.log("No fragments to align")}(He.details,De);Je&&(0,R.isFiniteNumber)(Je.start)&&(L.logger.log("Adjusting PTS using last level due to CC increase within current level "+De.url),li(Je.start,De))}}(X,_e,ue),!_e.alignedSliding&&ue.details&&function(ge,De){if(De.fragments.length&&ge.hasProgramDateTime&&De.hasProgramDateTime){var He=De.fragments[0].programDateTime,Je=ge.fragments[0].programDateTime,Ae=(Je-He)/1e3+De.fragments[0].start;Ae&&(0,R.isFiniteNumber)(Ae)&&(L.logger.log("Adjusting PTS using programDateTime delta "+(Je-He)+"ms, sliding:"+Ae.toFixed(3)+" "+ge.url+" "),li(Ae,ge))}}(_e,ue.details),_e.alignedSliding||!ue.details||_e.skippedSegments||Z(ue.details,_e))})(c,v,r);var P=r.fragments[0].start;return this.log("Live playlist sliding: "+P.toFixed(2)+" start-sn: "+(s?s.startSN:"na")+"->"+r.startSN+" prev-sn: "+(c?c.sn:"na")+" fragments: "+m),P}return _},a.waitForCdnTuneIn=function(r){return r.live&&r.canBlockReload&&r.partTarget&&r.tuneInGoal>Math.max(r.partHoldBack,3*r.partTarget)},a.setStartPosition=function(r,s){var l=this.startPosition;if(l<s&&(l=-1),l===-1||this.lastCurrentTime===-1){var u=r.startTimeOffset;(0,R.isFiniteNumber)(u)?(l=s+u,u<0&&(l+=r.totalduration),l=Math.min(Math.max(s,l),s+r.totalduration),this.log("Start time offset "+u+" found in playlist, adjust startPosition to "+l),this.startPosition=l):r.live?l=this.hls.liveSyncPosition||s:this.startPosition=l=0,this.lastCurrentTime=l}this.nextLoadPosition=l},a.getLoadPosition=function(){var r=this.media,s=0;return this.loadedmetadata&&r?s=r.currentTime:this.nextLoadPosition&&(s=this.nextLoadPosition),s},a.handleFragLoadAborted=function(r,s){this.transmuxer&&r.sn!=="initSegment"&&r.stats.aborted&&(this.warn("Fragment "+r.sn+(s?" part"+s.index:"")+" of level "+r.level+" was aborted"),this.resetFragmentLoading(r))},a.resetFragmentLoading=function(r){this.fragCurrent&&(this.fragContextChanged(r)||this.state===Nr)||(this.state=At)},a.onFragmentOrKeyLoadError=function(r,s){if(s.fatal)return this.stopLoad(),void(this.state=Lr);var l=this.config;if(s.chunkMeta){var u=this.getCurrentContext(s.chunkMeta);u&&(s.frag=u.frag,s.levelRetry=!0,this.fragLoadError=l.fragLoadingMaxRetry)}var c=s.frag;if(c&&c.type===r)if(this.fragCurrent,this.fragLoadError+1<=l.fragLoadingMaxRetry){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var v=Math.min(Math.pow(2,this.fragLoadError)*l.fragLoadingRetryDelay,l.fragLoadingMaxRetryTimeout);this.warn("Fragment "+c.sn+" of "+r+" "+c.level+" failed to load, retrying in "+v+"ms"),this.retryDate=self.performance.now()+v,this.fragLoadError++,this.state=Nr}else s.levelRetry?(r===fe.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=At):(L.logger.error(s.details+" reaches max retry, redispatch as fatal ..."),s.fatal=!0,this.hls.stopLoad(),this.state=Lr)},a.afterBufferFlushed=function(r,s,l){if(r){var u=Gt.getBuffered(r);this.fragmentTracker.detectEvictedFragments(s,u,l),this.state===ei&&this.resetLoadingState()}},a.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=At},a.resetStartWhenNotLoaded=function(r){if(!this.loadedmetadata){this.startFragRequested=!1;var s=this.levels?this.levels[r].details:null;s!=null&&s.live?(this.startPosition=-1,this.setStartPosition(s,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},a.updateLevelTiming=function(r,s,l,u){var c=this,v=l.details;Object.keys(r.elementaryStreams).reduce(function(m,_){var S=r.elementaryStreams[_];if(S){var F=S.endPTS-S.startPTS;if(F<=0)return c.warn("Could not parse fragment "+r.sn+" "+_+" duration reliably ("+F+")"),m||!1;var P=u?0:Q(v,r,S.startPTS,S.endPTS,S.startDTS,S.endDTS);return c.hls.trigger(g.Events.LEVEL_PTS_UPDATED,{details:v,level:l,drift:P,type:_,frag:r,start:S.startPTS,end:S.endPTS}),!0}return m},!1)||(this.warn("Found no media in fragment "+r.sn+" of level "+l.id+" resetting transmuxer to fallback to playlist timing"),this.resetTransmuxer()),this.state=Vr,this.hls.trigger(g.Events.FRAG_PARSED,{frag:r,part:s})},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},i=t,(n=[{key:"state",get:function(){return this._state},set:function(r){var s=this._state;s!==r&&(this._state=r,this.log(s+"->"+r))}}])&&on(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Cr);function fi(){return self.MediaSource||self.WebKitMediaSource}function vi(){return self.SourceBuffer||self.WebKitSourceBuffer}var Li=function(){var d=ENTRY_MODULE,o={},e=function i(n){var a=o[n];if(a!==void 0)return a.exports;var r=o[n]={exports:{}};return d[n].call(r.exports,r,r.exports,i),r.exports};e.m=d,e.n=function(i){var n=i&&i.__esModule?function(){return i.default}:function(){return i};return e.d(n,{a:n}),n},e.d=function(i,n){for(var a in n)e.o(n,a)&&!e.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:n[a]})},e.o=function(i,n){return Object.prototype.hasOwnProperty.call(i,n)},e.r=function(i){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var t=e(ENTRY_MODULE);return t.default||t}.toString().split("ENTRY_MODULE"),un="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function $t(d){return(d+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function pi(d,o,e){var t={};t[e]=[];var i=o.toString().replace(/^"[^"]+"/,"function"),n=i.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||i.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!n)return t;for(var a,r=n[1],s=new RegExp("(\\\\n|\\W)"+$t(r)+un,"g");a=s.exec(i);)a[3]!=="dll-reference"&&t[e].push(a[3]);for(s=new RegExp("\\("+$t(r)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)'+un,"g");a=s.exec(i);)d[a[2]]||(t[e].push(a[1]),d[a[2]]=B(a[1]).m),t[a[2]]=t[a[2]]||[],t[a[2]].push(a[4]);for(var l,u=Object.keys(t),c=0;c<u.length;c++)for(var v=0;v<t[u[c]].length;v++)l=t[u[c]][v],isNaN(1*l)||(t[u[c]][v]=1*t[u[c]][v]);return t}function Dn(d){return Object.keys(d).reduce(function(o,e){return o||d[e].length>0},!1)}function dn(d,o,e,t){var i=d[t].map(function(n){return'"'+n+'": '+o[t][n].toString().replace(/^"[^"]+"/,"function")}).join(",");return Li[0]+"{"+i+"}"+Li[1]+'"'+e+'"'+Li[2]}var Br=B(544),Ri=B(729),ti=B.n(Ri),ri=fi()||{isTypeSupported:function(){return!1}},Ii=function(){function d(e,t,i,n){var a=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;var s=function(v,m){(m=m||{}).frag=a.frag,m.id=a.id,a.hls.trigger(v,m)};this.observer=new Ri.EventEmitter,this.observer.on(g.Events.FRAG_DECRYPTED,s),this.observer.on(g.Events.ERROR,s);var l={mp4:ri.isTypeSupported("video/mp4"),mpeg:ri.isTypeSupported("audio/mpeg"),mp3:ri.isTypeSupported('audio/mp4; codecs="mp3"')},u=navigator.vendor;if(this.useWorker&&typeof Worker!="undefined"){var c;L.logger.log("demuxing in webworker");try{c=this.worker=function(v,m){m=m||{};var _={main:B.m},S=m.all?{main:Object.keys(_.main)}:function(_e,ge){for(var De={main:[ge]},He={main:[]},Je={main:{}};Dn(De);)for(var Ae=Object.keys(De),Ke=0;Ke<Ae.length;Ke++){var je=Ae[Ke],pt=De[je].pop();if(Je[je]=Je[je]||{},!Je[je][pt]&&_e[je][pt]){Je[je][pt]=!0,He[je]=He[je]||[],He[je].push(pt);for(var Mt=pi(_e,_e[je][pt],je),yt=Object.keys(Mt),kt=0;kt<yt.length;kt++)De[yt[kt]]=De[yt[kt]]||[],De[yt[kt]]=De[yt[kt]].concat(Mt[yt[kt]])}}return He}(_,v),F="";Object.keys(S).filter(function(_e){return _e!=="main"}).forEach(function(_e){for(var ge=0;S[_e][ge];)ge++;S[_e].push(ge),_[_e][ge]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",F=F+"var "+_e+" = ("+dn(S,_,ge,modules)+`)();
|
|
9
|
+
`}),F=F+"new (("+dn(S,_,v,"main")+")())(self);";var P=new window.Blob([F],{type:"text/javascript"}),X=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(P),ue=new window.Worker(X);return ue.objectURL=X,ue}(182),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(v){a.useWorker=!1,L.logger.warn("Exception in webworker, fallback to inline"),a.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:new Error(v.message+" ("+v.filename+":"+v.lineno+")")})},c.postMessage({cmd:"init",typeSupported:l,vendor:u,id:t,config:JSON.stringify(r)})}catch(v){L.logger.warn("Error in worker:",v),L.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new Br.default(this.observer,l,r,u,t),this.worker=null}}else this.transmuxer=new Br.default(this.observer,l,r,u,t)}var o=d.prototype;return o.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null,this.onwmsg=void 0;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},o.push=function(e,t,i,n,a,r,s,l,u,c){var v,m,_=this;u.transmuxing.start=self.performance.now();var S=this.transmuxer,F=this.worker,P=r?r.start:a.start,X=a.decryptdata,ue=this.frag,_e=!(ue&&a.cc===ue.cc),ge=!(ue&&u.level===ue.level),De=ue?u.sn-ue.sn:-1,He=this.part?u.part-this.part.index:-1,Je=De===0&&u.id>1&&u.id===(ue==null?void 0:ue.stats.chunkCount),Ae=!ge&&(De===1||De===0&&(He===1||Je&&He<=0)),Ke=self.performance.now();(ge||De||a.stats.parsing.start===0)&&(a.stats.parsing.start=Ke),!r||!He&&Ae||(r.stats.parsing.start=Ke);var je=!(ue&&((v=a.initSegment)===null||v===void 0?void 0:v.url)===((m=ue.initSegment)===null||m===void 0?void 0:m.url)),pt=new Br.TransmuxState(_e,Ae,l,ge,P,je);if(!Ae||_e||je){L.logger.log("[transmuxer-interface, "+a.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+`
|
|
10
10
|
discontinuity: `+_e+`
|
|
11
11
|
trackSwitch: `+ge+`
|
|
12
12
|
contiguous: `+Ae+`
|
|
13
13
|
accurateTimeOffset: `+l+`
|
|
14
14
|
timeOffset: `+P+`
|
|
15
|
-
initSegmentChange: `+je);var Mt=new Br.TransmuxConfig(i,n,t,s,c);this.configureTransmuxer(Mt)}if(this.frag=a,this.part=r,F)F.postMessage({cmd:"demux",data:e,decryptdata:W,chunkMeta:u,state:pt},e instanceof ArrayBuffer?[e]:[]);else if(S){var mt=S.push(e,W,u,pt);(0,Br.isPromise)(mt)?(S.async=!0,mt.then(function(kt){_.handleTransmuxComplete(kt)}).catch(function(kt){_.transmuxerError(kt,u,"transmuxer-interface push error")})):(S.async=!1,this.handleTransmuxComplete(mt))}},o.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:e});else if(i){var a=i.flush(e);(0,Br.isPromise)(a)||i.async?((0,Br.isPromise)(a)||(a=Promise.resolve(a)),a.then(function(r){t.handleFlushResult(r,e)}).catch(function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},o.transmuxerError=function(e,t,i){this.hls&&this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i})},o.handleFlushResult=function(e,t){var i=this;e.forEach(function(n){i.handleTransmuxComplete(n)}),this.onFlush(t)},o.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":L.logger[t.data.logType]&&L.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},o.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},o.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d}(),cn=function(){function d(e,t,i,n){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=n}var o=d.prototype;return o.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},o.poll=function(e,t){var i=this.config,n=this.media,a=this.stalled;if(n!==null){var r=n.currentTime,s=n.seeking,l=this.seeking&&!s,u=!this.seeking&&s;if(this.seeking=s,r===e){if((u||l)&&(this.stalled=null),!(n.paused&&!s||n.ended||n.playbackRate===0)&&Gt.getBuffered(n).length){var c=Gt.bufferInfo(n,r,0),v=c.len>0,m=c.nextStart||0;if(v||m){if(s){var _=c.len>2,S=!m||t&&t.start<=r||m-r>2&&!this.fragmentTracker.getPartialFragment(r);if(_||S)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var F,P=Math.max(m,c.start||0)-r,W=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,ue=!(W==null||(F=W.details)===null||F===void 0)&&F.live?2*W.details.targetduration:2;if(P>0&&P<=ue)return void this._trySkipBufferHole(null)}var _e=self.performance.now();if(a!==null){var ge=_e-a;if(s||!(ge>=250)||(this._reportStall(c),this.media)){var De=Gt.bufferInfo(n,r,i.maxBufferHole);this._tryFixBufferStall(De,ge)}}else this.stalled=_e}}}else if(this.moved=!0,a!==null){if(this.stallReported){var He=self.performance.now()-a;L.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(He)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},o._tryFixBufferStall=function(e,t){var i=this.config,n=this.fragmentTracker,a=this.media;if(a!==null){var r=a.currentTime,s=n.getPartialFragment(r);if(s&&(this._trySkipBufferHole(s)||!this.media))return;e.len>i.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(L.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},o._reportStall=function(e){var t=this.hls,i=this.media;!this.stallReported&&i&&(this.stallReported=!0,L.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e.len}))},o._trySkipBufferHole=function(e){var t=this.config,i=this.hls,n=this.media;if(n===null)return 0;for(var a=n.currentTime,r=0,s=Gt.getBuffered(n),l=0;l<s.length;l++){var u=s.start(l);if(a+t.maxBufferHole>=r&&a<u){var c=Math.max(u+.05,n.currentTime+.1);return L.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+c),this.moved=!0,this.stalled=null,n.currentTime=c,e&&i.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+c,frag:e}),c}r=s.end(l)}return 0},o._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,n=this.nudgeRetry;if(i!==null){var a=i.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){var r=a+(n+1)*e.nudgeOffset;L.logger.warn("Nudging 'currentTime' from "+a+" to "+r),i.currentTime=r,t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else L.logger.error("Playhead still not moving while enough data buffered @"+a+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})}},d}();function Wr(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Ci(d,o){return Ci=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ci(d,o)}var Ln=function(d){var o,e;function t(r,s,l){var u;return(u=d.call(this,r,s,l,"[stream-controller]")||this).audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.couldBacktrack=!1,u.backtrackFragment=null,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ci(o,e);var i,n,a=t.prototype;return a._registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(g.Events.ERROR,this.onError,this),r.on(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(g.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(g.Events.ERROR,this.onError,this),r.off(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(g.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},a.startLoad=function(r){if(this.levels){var s=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var u=l.startLevel;u===-1&&(l.config.testBandwidth&&this.levels.length>1?(u=0,this.bitrateTest=!0):u=l.nextAutoLevel),this.level=l.nextLoadLevel=u,this.loadedmetadata=!1}s>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),r=s),this.state=At,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=br},a.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},a.doTick=function(){switch(this.state){case At:this.doTickIdle();break;case Yr:var r,s=this.levels,l=this.level,u=s==null||(r=s[l])===null||r===void 0?void 0:r.details;if(u&&(!u.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(u))break;this.state=At;break}break;case Nr:var c,v=self.performance.now(),m=this.retryDate;(!m||v>=m||(c=this.media)!==null&&c!==void 0&&c.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=At)}this.onTickEnd()},a.onTickEnd=function(){d.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},a.doTickIdle=function(){var r=this.hls,s=this.levelLastLoaded,l=this.levels,u=this.media,c=r.config,v=r.nextLoadLevel;if(s!==null&&(u||!this.startFragRequested&&c.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&l&&l[v]){var m=l[v],_=this.getMainFwdBufferInfo();if(_!==null){var S=this.getLevelDetails();if(S&&this._streamEnded(_,S)){var F={};return this.altAudio&&(F.type="video"),this.hls.trigger(g.Events.BUFFER_EOS,F),void(this.state=ei)}this.level=r.nextLoadLevel=v;var P=m.details;if(!P||this.state===Yr||P.live&&this.levelLastLoaded!==v)return this.level=v,void(this.state=Yr);if(!(_.len>=this.getMaxBufferLength(m.maxBitrate))){this.backtrackFragment&&this.backtrackFragment.start>_.end&&(this.backtrackFragment=null);var W=this.backtrackFragment?this.backtrackFragment.start:_.end,ue=this.getNextFragment(W,P);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"&&this.fragmentTracker.getState(ue)!==Ge.OK){var _e,ge=((_e=this.backtrackFragment)!=null?_e:ue).sn-P.startSN,De=P.fragments[ge-1];De&&ue.cc===De.cc&&(ue=De,this.fragmentTracker.removeFragment(De))}else this.backtrackFragment&&_.len&&(this.backtrackFragment=null);if(ue&&this.fragmentTracker.getState(ue)===Ge.OK&&this.nextLoadPosition>W){var He=this.audioOnly&&!this.altAudio?J.ElementaryStreamTypes.AUDIO:J.ElementaryStreamTypes.VIDEO,Je=(He===J.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;Je&&this.afterBufferFlushed(Je,He,fe.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,P)}ue&&(!ue.initSegment||ue.initSegment.data||this.bitrateTest||(ue=ue.initSegment),this.loadFragment(ue,P,W))}}}},a.loadFragment=function(r,s,l){var u,c=this.fragmentTracker.getState(r);this.fragCurrent=r,c===Ge.NOT_LOADED?r.sn==="initSegment"?this._loadInitSegment(r,s):this.bitrateTest?(this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r,s)):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,r,s,l)):c===Ge.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((u=this.media)===null||u===void 0?void 0:u.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},a.getAppendedFrag=function(r){var s=this.fragmentTracker.getAppendedFrag(r,fe.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},a.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,fe.PlaylistLevelType.MAIN)},a.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},a.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},a.nextLevelSwitch=function(){var r=this.levels,s=this.media;if(s!=null&&s.readyState){var l,u=this.getAppendedFrag(s.currentTime);if(u&&u.start>1&&this.flushMainBuffer(0,u.start-1),!s.paused&&r){var c=r[this.hls.nextLoadLevel],v=this.fragLastKbps;l=v&&this.fragCurrent?this.fragCurrent.duration*c.maxBitrate/(1e3*v)+1:0}else l=0;var m=this.getBufferedFrag(s.currentTime+l);if(m){var _=this.followingBufferedFrag(m);if(_){this.abortCurrentFrag();var S=_.maxStartPTS?_.maxStartPTS:_.start,F=_.duration,P=Math.max(m.end,S+Math.min(Math.max(F-this.config.maxFragLookUpTolerance,.5*F),.75*F));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},a.abortCurrentFrag=function(){var r=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,r&&r.abortRequests(),this.state){case ln:case qr:case Nr:case wr:case Vr:this.state=At}this.nextLoadPosition=this.getLoadPosition()},a.flushMainBuffer=function(r,s){d.prototype.flushMainBuffer.call(this,r,s,this.altAudio?"video":null)},a.onMediaAttached=function(r,s){d.prototype.onMediaAttached.call(this,r,s);var l=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new cn(this.config,l,this.fragmentTracker,this.hls)},a.onMediaDetaching=function(){var r=this.media;r&&this.onvplaying&&this.onvseeked&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),d.prototype.onMediaDetaching.call(this)},a.onMediaPlaying=function(){this.tick()},a.onMediaSeeked=function(){var r=this.media,s=r?r.currentTime:null;(0,R.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},a.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(g.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},a.onManifestParsed=function(r,s){var l,u,c,v=!1,m=!1;s.levels.forEach(function(_){(l=_.audioCodec)&&(l.indexOf("mp4a.40.2")!==-1&&(v=!0),l.indexOf("mp4a.40.5")!==-1&&(m=!0))}),this.audioCodecSwitch=v&&m&&typeof((c=vi())==null||(u=c.prototype)===null||u===void 0?void 0:u.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},a.onLevelLoading=function(r,s){var l=this.levels;if(l&&this.state===At){var u=l[s.level];(!u.details||u.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(u.details))&&(this.state=Yr)}},a.onLevelLoaded=function(r,s){var l,u=this.levels,c=s.level,v=s.details,m=v.totalduration;if(u){this.log("Level "+c+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+m);var _=this.fragCurrent;!_||this.state!==qr&&this.state!==Nr||_.level!==s.level&&_.loader&&(this.state=At,this.backtrackFragment=null,_.abortRequests());var S=u[c],F=0;if(v.live||(l=S.details)!==null&&l!==void 0&&l.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;F=this.alignPlaylists(v,S.details)}if(S.details=v,this.levelLastLoaded=c,this.hls.trigger(g.Events.LEVEL_UPDATED,{details:v,level:c}),this.state===Yr){if(this.waitForCdnTuneIn(v))return;this.state=At}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,F),this.tick()}else this.warn("Levels were reset while loading level "+c)},a._handleFragmentLoadProgress=function(r){var s,l=r.frag,u=r.part,c=r.payload,v=this.levels;if(v){var m=v[l.level],_=m.details;if(_){var S=m.videoCodec,F=_.PTSKnown||!_.live,P=(s=l.initSegment)===null||s===void 0?void 0:s.data,W=this._getAudioCodec(m),ue=this.transmuxer=this.transmuxer||new Ii(this.hls,fe.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),_e=u?u.index:-1,ge=_e!==-1,De=new Di(l.level,l.sn,l.stats.chunkCount,c.byteLength,_e,ge),He=this.initPTS[l.cc];ue.push(c,P,W,S,l,u,_.totalduration,F,De,He)}else this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered")},a.onAudioTrackSwitching=function(r,s){var l=this.altAudio,u=!!s.url,c=s.id;if(!u){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v&&(this.log("Switching to main audio track, cancel main fragment load"),v.abortRequests()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var m=this.hls;l&&m.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),m.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:c})}},a.onAudioTrackSwitched=function(r,s){var l=s.id,u=!!this.hls.audioTracks[l].url;if(u){var c=this.videoBuffer;c&&this.mediaBuffer!==c&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=c)}this.altAudio=u,this.tick()},a.onBufferCreated=function(r,s){var l,u,c=s.tracks,v=!1;for(var m in c){var _=c[m];if(_.id==="main"){if(u=m,l=_,m==="video"){var S=c[m];S&&(this.videoBuffer=S.buffer)}}else v=!0}v&&l?(this.log("Alternate track found, use "+u+".buffered to schedule main fragment loading"),this.mediaBuffer=l.buffer):this.mediaBuffer=this.media},a.onFragBuffered=function(r,s){var l=s.frag,u=s.part;if(!l||l.type===fe.PlaylistLevelType.MAIN){if(this.fragContextChanged(l))return this.warn("Fragment "+l.sn+(u?" p: "+u.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Vr&&(this.state=At));var c=u?u.stats:l.stats;this.fragLastKbps=Math.round(8*c.total/(c.buffering.end-c.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,u)}},a.onError=function(r,s){if(s.type!==k.ErrorTypes.KEY_SYSTEM_ERROR)switch(s.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.MAIN,s);break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==Lr&&(s.fatal?(this.warn(""+s.details),this.state=Lr):s.levelRetry||this.state!==Yr||(this.state=At));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===wr||this.state===Vr)){var l=!0,u=this.getFwdBufferInfo(this.media,fe.PlaylistLevelType.MAIN);u&&u.len>.5&&(l=!this.reduceMaxBufferLength(u.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.MAIN,s)},a.checkBuffer=function(){var r=this.media,s=this.gapController;if(r&&s&&r.readyState){if(this.loadedmetadata||!Gt.getBuffered(r).length){var l=this.state!==At?this.fragCurrent:null;s.poll(this.lastCurrentTime,l)}this.lastCurrentTime=r.currentTime}},a.onFragLoadEmergencyAborted=function(){this.state=At,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},a.onBufferFlushed=function(r,s){var l=s.type;if(l!==J.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var u=(l===J.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(u,l,fe.PlaylistLevelType.MAIN)}},a.onLevelsUpdated=function(r,s){this.levels=s.levels},a.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},a.seekToStartPos=function(){var r=this.media;if(r){var s=r.currentTime,l=this.startPosition;if(l>=0&&s<l){if(r.seeking)return void this.log("could not seek to "+l+", already seeking at "+s);var u=Gt.getBuffered(r),c=(u.length?u.start(0):0)-l;c>0&&(c<this.config.maxBufferHole||c<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+c+" to match buffer start"),l+=c,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+s),r.currentTime=l}}},a._getAudioCodec=function(r){var s=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s=s.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),s},a._loadBitrateTestFrag=function(r,s){var l=this;r.bitrateTest=!0,this._doFragLoad(r,s).then(function(u){var c=l.hls;if(u&&!c.nextLoadLevel&&!l.fragContextChanged(r)){l.fragLoadError=0,l.state=At,l.startFragRequested=!1,l.bitrateTest=!1;var v=r.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),c.trigger(g.Events.FRAG_LOADED,u),r.bitrateTest=!1}})},a._handleTransmuxComplete=function(r){var s,l="main",u=this.hls,c=r.remuxResult,v=r.chunkMeta,m=this.getCurrentContext(v);if(!m)return this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(v.level);var _=m.frag,S=m.part,F=m.level,P=c.video,W=c.text,ue=c.id3,_e=c.initSegment,ge=F.details,De=this.altAudio?void 0:c.audio;if(!this.fragContextChanged(_)){if(this.state=wr,_e){_e.tracks&&(this._bufferInitSegment(F,_e.tracks,_,v),u.trigger(g.Events.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:l,tracks:_e.tracks}));var He=_e.initPTS,Je=_e.timescale;(0,R.isFiniteNumber)(He)&&(this.initPTS[_.cc]=He,u.trigger(g.Events.INIT_PTS_FOUND,{frag:_,id:l,initPTS:He,timescale:Je}))}if(P&&c.independent!==!1){if(ge){var Ae=P.startPTS,Ke=P.endPTS,je=P.startDTS,pt=P.endDTS;if(S)S.elementaryStreams[P.type]={startPTS:Ae,endPTS:Ke,startDTS:je,endDTS:pt};else if(P.firstKeyFrame&&P.independent&&v.id===1&&(this.couldBacktrack=!0),P.dropped&&P.independent){var Mt=this.getMainFwdBufferInfo();if((Mt?Mt.end:this.getLoadPosition())+this.config.maxBufferHole<(P.firstKeyFramePTS?P.firstKeyFramePTS:Ae)-this.config.maxBufferHole)return void this.backtrack(_);_.setElementaryStreamInfo(P.type,_.start,Ke,_.start,pt,!0)}_.setElementaryStreamInfo(P.type,Ae,Ke,je,pt),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(P,_,S,v)}}else if(c.independent===!1)return void this.backtrack(_);if(De){var mt=De.startPTS,kt=De.endPTS,xt=De.startDTS,ir=De.endDTS;S&&(S.elementaryStreams[J.ElementaryStreamTypes.AUDIO]={startPTS:mt,endPTS:kt,startDTS:xt,endDTS:ir}),_.setElementaryStreamInfo(J.ElementaryStreamTypes.AUDIO,mt,kt,xt,ir),this.bufferFragmentData(De,_,S,v)}if(ge&&ue!=null&&(s=ue.samples)!==null&&s!==void 0&&s.length){var er={id:l,frag:_,details:ge,samples:ue.samples};u.trigger(g.Events.FRAG_PARSING_METADATA,er)}if(ge&&W){var Yt={id:l,frag:_,details:ge,samples:W.samples};u.trigger(g.Events.FRAG_PARSING_USERDATA,Yt)}}},a._bufferInitSegment=function(r,s,l,u){var c=this;if(this.state===wr){this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var v=s.audio,m=s.video,_=s.audiovideo;if(v){var S=r.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(S&&(S=S.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),v.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(S="mp4a.40.5")),F.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(S="mp4a.40.2",this.log("Android: force audio codec to "+S)),r.audioCodec&&r.audioCodec!==S&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+S+'"'),v.levelCodec=S,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(S||"")+"/"+(r.audioCodec||"")+"/"+v.codec+"]")}m&&(m.levelCodec=r.videoCodec,m.id="main",this.log("Init video buffer, container:"+m.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+m.codec+"]")),_&&this.log("Init audiovideo buffer, container:"+_.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+_.codec+"]"),this.hls.trigger(g.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(P){var W=s[P].initSegment;W!=null&&W.byteLength&&c.hls.trigger(g.Events.BUFFER_APPENDING,{type:P,data:W,frag:l,part:null,chunkMeta:u,parent:l.type})}),this.tick()}},a.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,fe.PlaylistLevelType.MAIN)},a.backtrack=function(r){this.couldBacktrack=!0,this.backtrackFragment=r,this.resetTransmuxer(),this.flushBufferGap(r),this.fragmentTracker.removeFragment(r),this.fragPrevious=null,this.nextLoadPosition=r.start,this.state=At},a.checkFragmentChanged=function(){var r=this.media,s=null;if(r&&r.readyState>1&&r.seeking===!1){var l=r.currentTime;if(Gt.isBuffered(r,l)?s=this.getAppendedFrag(l):Gt.isBuffered(r,l+.1)&&(s=this.getAppendedFrag(l+.1)),s){this.backtrackFragment=null;var u=this.fragPlaying,c=s.level;u&&s.sn===u.sn&&u.level===c&&s.urlId===u.urlId||(this.fragPlaying=s,this.hls.trigger(g.Events.FRAG_CHANGED,{frag:s}),u&&u.level===c||this.hls.trigger(g.Events.LEVEL_SWITCHED,{level:c}))}}},i=t,(n=[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentFrag",get:function(){var r=this.media;return r?this.fragPlaying||this.getAppendedFrag(r.currentTime):null}},{key:"currentProgramDateTime",get:function(){var r=this.media;if(r){var s=r.currentTime,l=this.currentFrag;if(l&&(0,R.isFiniteNumber)(s)&&(0,R.isFiniteNumber)(l.programDateTime)){var u=l.programDateTime+1e3*(s-l.start);return new Date(u)}}return null}},{key:"currentLevel",get:function(){var r=this.currentFrag;return r?r.level:-1}},{key:"nextBufferedFrag",get:function(){var r=this.currentFrag;return r?this.followingBufferedFrag(r):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&Wr(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(hi);let gi=function(){function d(e,t,i){t===void 0&&(t=0),i===void 0&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}var o=d.prototype;return o.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},o.getTotalWeight=function(){return this.totalWeight_},o.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},d}(),Rn=function(){function d(e,t,i){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new gi(e),this.fast_=new gi(t)}var o=d.prototype;return o.update=function(e,t){var i=this.slow_,n=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new gi(e,i.getEstimate(),i.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new gi(t,n.getEstimate(),n.getTotalWeight()))},o.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/i;this.fast_.sample(i,n),this.slow_.sample(i,n)},o.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},o.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},o.destroy=function(){},d}();function In(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}let Cn=function(){function d(i){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=i;var n=i.config;this.bwEstimator=new Rn(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate),this.registerListeners()}var o,e,t=d.prototype;return t.registerListeners=function(){var i=this.hls;i.on(g.Events.FRAG_LOADING,this.onFragLoading,this),i.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(g.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){var i=this.hls;i.off(g.Events.FRAG_LOADING,this.onFragLoading,this),i.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(g.Events.ERROR,this.onError,this)},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},t.onFragLoading=function(i,n){var a,r=n.frag;r.type===fe.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=r,this.partCurrent=(a=n.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)))},t.onLevelLoaded=function(i,n){var a=this.hls.config;n.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)},t._abandonRulesCheck=function(){var i=this.fragCurrent,n=this.partCurrent,a=this.hls,r=a.autoLevelEnabled,s=a.media;if(i&&s){var l=n?n.stats:i.stats,u=n?n.duration:i.duration;if(l.aborted||l.loaded&&l.loaded===l.total||i.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!s.paused&&s.playbackRate&&s.readyState){var c=a.mainForwardBufferInfo;if(c!==null){var v=performance.now()-l.loading.start,m=Math.abs(s.playbackRate);if(!(v<=500*u/m)){var _=l.loaded&&l.loading.first,S=this.bwEstimator.getEstimate(),F=a.levels,P=a.minAutoLevel,W=F[i.level],ue=l.total||Math.max(l.loaded,Math.round(u*W.maxBitrate/8)),_e=_?1e3*l.loaded/v:0,ge=_e?(ue-l.loaded)/_e:8*ue/S,De=c.len/m;if(!(ge<=De)){var He,Je=Number.POSITIVE_INFINITY;for(He=i.level-1;He>P;He--){var Ae=F[He].maxBitrate;if((Je=_e?u*Ae/(6.4*_e):u*Ae/S)<De)break}Je>=ge||(L.logger.warn("Fragment "+i.sn+(n?" part "+n.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+He+`
|
|
15
|
+
initSegmentChange: `+je);var Mt=new Br.TransmuxConfig(i,n,t,s,c);this.configureTransmuxer(Mt)}if(this.frag=a,this.part=r,F)F.postMessage({cmd:"demux",data:e,decryptdata:X,chunkMeta:u,state:pt},e instanceof ArrayBuffer?[e]:[]);else if(S){var yt=S.push(e,X,u,pt);(0,Br.isPromise)(yt)?(S.async=!0,yt.then(function(kt){_.handleTransmuxComplete(kt)}).catch(function(kt){_.transmuxerError(kt,u,"transmuxer-interface push error")})):(S.async=!1,this.handleTransmuxComplete(yt))}},o.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:e});else if(i){var a=i.flush(e);(0,Br.isPromise)(a)||i.async?((0,Br.isPromise)(a)||(a=Promise.resolve(a)),a.then(function(r){t.handleFlushResult(r,e)}).catch(function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},o.transmuxerError=function(e,t,i){this.hls&&this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i})},o.handleFlushResult=function(e,t){var i=this;e.forEach(function(n){i.handleTransmuxComplete(n)}),this.onFlush(t)},o.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":L.logger[t.data.logType]&&L.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},o.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},o.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d}(),cn=function(){function d(e,t,i,n){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=n}var o=d.prototype;return o.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},o.poll=function(e,t){var i=this.config,n=this.media,a=this.stalled;if(n!==null){var r=n.currentTime,s=n.seeking,l=this.seeking&&!s,u=!this.seeking&&s;if(this.seeking=s,r===e){if((u||l)&&(this.stalled=null),!(n.paused&&!s||n.ended||n.playbackRate===0)&&Gt.getBuffered(n).length){var c=Gt.bufferInfo(n,r,0),v=c.len>0,m=c.nextStart||0;if(v||m){if(s){var _=c.len>2,S=!m||t&&t.start<=r||m-r>2&&!this.fragmentTracker.getPartialFragment(r);if(_||S)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var F,P=Math.max(m,c.start||0)-r,X=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,ue=!(X==null||(F=X.details)===null||F===void 0)&&F.live?2*X.details.targetduration:2;if(P>0&&P<=ue)return void this._trySkipBufferHole(null)}var _e=self.performance.now();if(a!==null){var ge=_e-a;if(s||!(ge>=250)||(this._reportStall(c),this.media)){var De=Gt.bufferInfo(n,r,i.maxBufferHole);this._tryFixBufferStall(De,ge)}}else this.stalled=_e}}}else if(this.moved=!0,a!==null){if(this.stallReported){var He=self.performance.now()-a;L.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(He)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},o._tryFixBufferStall=function(e,t){var i=this.config,n=this.fragmentTracker,a=this.media;if(a!==null){var r=a.currentTime,s=n.getPartialFragment(r);if(s&&(this._trySkipBufferHole(s)||!this.media))return;e.len>i.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(L.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},o._reportStall=function(e){var t=this.hls,i=this.media;!this.stallReported&&i&&(this.stallReported=!0,L.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e.len}))},o._trySkipBufferHole=function(e){var t=this.config,i=this.hls,n=this.media;if(n===null)return 0;for(var a=n.currentTime,r=0,s=Gt.getBuffered(n),l=0;l<s.length;l++){var u=s.start(l);if(a+t.maxBufferHole>=r&&a<u){var c=Math.max(u+.05,n.currentTime+.1);return L.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+c),this.moved=!0,this.stalled=null,n.currentTime=c,e&&i.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+c,frag:e}),c}r=s.end(l)}return 0},o._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,n=this.nudgeRetry;if(i!==null){var a=i.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){var r=a+(n+1)*e.nudgeOffset;L.logger.warn("Nudging 'currentTime' from "+a+" to "+r),i.currentTime=r,t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else L.logger.error("Playhead still not moving while enough data buffered @"+a+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})}},d}();function Wr(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Ci(d,o){return Ci=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ci(d,o)}var Ln=function(d){var o,e;function t(r,s,l){var u;return(u=d.call(this,r,s,l,"[stream-controller]")||this).audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.couldBacktrack=!1,u.backtrackFragment=null,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ci(o,e);var i,n,a=t.prototype;return a._registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(g.Events.ERROR,this.onError,this),r.on(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(g.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(g.Events.ERROR,this.onError,this),r.off(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(g.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},a.startLoad=function(r){if(this.levels){var s=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var u=l.startLevel;u===-1&&(l.config.testBandwidth&&this.levels.length>1?(u=0,this.bitrateTest=!0):u=l.nextAutoLevel),this.level=l.nextLoadLevel=u,this.loadedmetadata=!1}s>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),r=s),this.state=At,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=br},a.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},a.doTick=function(){switch(this.state){case At:this.doTickIdle();break;case Yr:var r,s=this.levels,l=this.level,u=s==null||(r=s[l])===null||r===void 0?void 0:r.details;if(u&&(!u.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(u))break;this.state=At;break}break;case Nr:var c,v=self.performance.now(),m=this.retryDate;(!m||v>=m||(c=this.media)!==null&&c!==void 0&&c.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=At)}this.onTickEnd()},a.onTickEnd=function(){d.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},a.doTickIdle=function(){var r=this.hls,s=this.levelLastLoaded,l=this.levels,u=this.media,c=r.config,v=r.nextLoadLevel;if(s!==null&&(u||!this.startFragRequested&&c.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&l&&l[v]){var m=l[v],_=this.getMainFwdBufferInfo();if(_!==null){var S=this.getLevelDetails();if(S&&this._streamEnded(_,S)){var F={};return this.altAudio&&(F.type="video"),this.hls.trigger(g.Events.BUFFER_EOS,F),void(this.state=ei)}this.level=r.nextLoadLevel=v;var P=m.details;if(!P||this.state===Yr||P.live&&this.levelLastLoaded!==v)return this.level=v,void(this.state=Yr);if(!(_.len>=this.getMaxBufferLength(m.maxBitrate))){this.backtrackFragment&&this.backtrackFragment.start>_.end&&(this.backtrackFragment=null);var X=this.backtrackFragment?this.backtrackFragment.start:_.end,ue=this.getNextFragment(X,P);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"&&this.fragmentTracker.getState(ue)!==Ge.OK){var _e,ge=((_e=this.backtrackFragment)!=null?_e:ue).sn-P.startSN,De=P.fragments[ge-1];De&&ue.cc===De.cc&&(ue=De,this.fragmentTracker.removeFragment(De))}else this.backtrackFragment&&_.len&&(this.backtrackFragment=null);if(ue&&this.fragmentTracker.getState(ue)===Ge.OK&&this.nextLoadPosition>X){var He=this.audioOnly&&!this.altAudio?J.ElementaryStreamTypes.AUDIO:J.ElementaryStreamTypes.VIDEO,Je=(He===J.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;Je&&this.afterBufferFlushed(Je,He,fe.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,P)}ue&&(!ue.initSegment||ue.initSegment.data||this.bitrateTest||(ue=ue.initSegment),this.loadFragment(ue,P,X))}}}},a.loadFragment=function(r,s,l){var u,c=this.fragmentTracker.getState(r);this.fragCurrent=r,c===Ge.NOT_LOADED?r.sn==="initSegment"?this._loadInitSegment(r,s):this.bitrateTest?(this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r,s)):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,r,s,l)):c===Ge.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((u=this.media)===null||u===void 0?void 0:u.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},a.getAppendedFrag=function(r){var s=this.fragmentTracker.getAppendedFrag(r,fe.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},a.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,fe.PlaylistLevelType.MAIN)},a.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},a.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},a.nextLevelSwitch=function(){var r=this.levels,s=this.media;if(s!=null&&s.readyState){var l,u=this.getAppendedFrag(s.currentTime);if(u&&u.start>1&&this.flushMainBuffer(0,u.start-1),!s.paused&&r){var c=r[this.hls.nextLoadLevel],v=this.fragLastKbps;l=v&&this.fragCurrent?this.fragCurrent.duration*c.maxBitrate/(1e3*v)+1:0}else l=0;var m=this.getBufferedFrag(s.currentTime+l);if(m){var _=this.followingBufferedFrag(m);if(_){this.abortCurrentFrag();var S=_.maxStartPTS?_.maxStartPTS:_.start,F=_.duration,P=Math.max(m.end,S+Math.min(Math.max(F-this.config.maxFragLookUpTolerance,.5*F),.75*F));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},a.abortCurrentFrag=function(){var r=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,r&&r.abortRequests(),this.state){case ln:case qr:case Nr:case wr:case Vr:this.state=At}this.nextLoadPosition=this.getLoadPosition()},a.flushMainBuffer=function(r,s){d.prototype.flushMainBuffer.call(this,r,s,this.altAudio?"video":null)},a.onMediaAttached=function(r,s){d.prototype.onMediaAttached.call(this,r,s);var l=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new cn(this.config,l,this.fragmentTracker,this.hls)},a.onMediaDetaching=function(){var r=this.media;r&&this.onvplaying&&this.onvseeked&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),d.prototype.onMediaDetaching.call(this)},a.onMediaPlaying=function(){this.tick()},a.onMediaSeeked=function(){var r=this.media,s=r?r.currentTime:null;(0,R.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},a.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(g.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},a.onManifestParsed=function(r,s){var l,u,c,v=!1,m=!1;s.levels.forEach(function(_){(l=_.audioCodec)&&(l.indexOf("mp4a.40.2")!==-1&&(v=!0),l.indexOf("mp4a.40.5")!==-1&&(m=!0))}),this.audioCodecSwitch=v&&m&&typeof((c=vi())==null||(u=c.prototype)===null||u===void 0?void 0:u.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},a.onLevelLoading=function(r,s){var l=this.levels;if(l&&this.state===At){var u=l[s.level];(!u.details||u.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(u.details))&&(this.state=Yr)}},a.onLevelLoaded=function(r,s){var l,u=this.levels,c=s.level,v=s.details,m=v.totalduration;if(u){this.log("Level "+c+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+m);var _=this.fragCurrent;!_||this.state!==qr&&this.state!==Nr||_.level!==s.level&&_.loader&&(this.state=At,this.backtrackFragment=null,_.abortRequests());var S=u[c],F=0;if(v.live||(l=S.details)!==null&&l!==void 0&&l.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;F=this.alignPlaylists(v,S.details)}if(S.details=v,this.levelLastLoaded=c,this.hls.trigger(g.Events.LEVEL_UPDATED,{details:v,level:c}),this.state===Yr){if(this.waitForCdnTuneIn(v))return;this.state=At}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,F),this.tick()}else this.warn("Levels were reset while loading level "+c)},a._handleFragmentLoadProgress=function(r){var s,l=r.frag,u=r.part,c=r.payload,v=this.levels;if(v){var m=v[l.level],_=m.details;if(_){var S=m.videoCodec,F=_.PTSKnown||!_.live,P=(s=l.initSegment)===null||s===void 0?void 0:s.data,X=this._getAudioCodec(m),ue=this.transmuxer=this.transmuxer||new Ii(this.hls,fe.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),_e=u?u.index:-1,ge=_e!==-1,De=new Di(l.level,l.sn,l.stats.chunkCount,c.byteLength,_e,ge),He=this.initPTS[l.cc];ue.push(c,P,X,S,l,u,_.totalduration,F,De,He)}else this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered")},a.onAudioTrackSwitching=function(r,s){var l=this.altAudio,u=!!s.url,c=s.id;if(!u){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v&&(this.log("Switching to main audio track, cancel main fragment load"),v.abortRequests()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var m=this.hls;l&&m.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),m.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:c})}},a.onAudioTrackSwitched=function(r,s){var l=s.id,u=!!this.hls.audioTracks[l].url;if(u){var c=this.videoBuffer;c&&this.mediaBuffer!==c&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=c)}this.altAudio=u,this.tick()},a.onBufferCreated=function(r,s){var l,u,c=s.tracks,v=!1;for(var m in c){var _=c[m];if(_.id==="main"){if(u=m,l=_,m==="video"){var S=c[m];S&&(this.videoBuffer=S.buffer)}}else v=!0}v&&l?(this.log("Alternate track found, use "+u+".buffered to schedule main fragment loading"),this.mediaBuffer=l.buffer):this.mediaBuffer=this.media},a.onFragBuffered=function(r,s){var l=s.frag,u=s.part;if(!l||l.type===fe.PlaylistLevelType.MAIN){if(this.fragContextChanged(l))return this.warn("Fragment "+l.sn+(u?" p: "+u.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Vr&&(this.state=At));var c=u?u.stats:l.stats;this.fragLastKbps=Math.round(8*c.total/(c.buffering.end-c.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,u)}},a.onError=function(r,s){if(s.type!==k.ErrorTypes.KEY_SYSTEM_ERROR)switch(s.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.MAIN,s);break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==Lr&&(s.fatal?(this.warn(""+s.details),this.state=Lr):s.levelRetry||this.state!==Yr||(this.state=At));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===wr||this.state===Vr)){var l=!0,u=this.getFwdBufferInfo(this.media,fe.PlaylistLevelType.MAIN);u&&u.len>.5&&(l=!this.reduceMaxBufferLength(u.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.MAIN,s)},a.checkBuffer=function(){var r=this.media,s=this.gapController;if(r&&s&&r.readyState){if(this.loadedmetadata||!Gt.getBuffered(r).length){var l=this.state!==At?this.fragCurrent:null;s.poll(this.lastCurrentTime,l)}this.lastCurrentTime=r.currentTime}},a.onFragLoadEmergencyAborted=function(){this.state=At,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},a.onBufferFlushed=function(r,s){var l=s.type;if(l!==J.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var u=(l===J.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(u,l,fe.PlaylistLevelType.MAIN)}},a.onLevelsUpdated=function(r,s){this.levels=s.levels},a.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},a.seekToStartPos=function(){var r=this.media;if(r){var s=r.currentTime,l=this.startPosition;if(l>=0&&s<l){if(r.seeking)return void this.log("could not seek to "+l+", already seeking at "+s);var u=Gt.getBuffered(r),c=(u.length?u.start(0):0)-l;c>0&&(c<this.config.maxBufferHole||c<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+c+" to match buffer start"),l+=c,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+s),r.currentTime=l}}},a._getAudioCodec=function(r){var s=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s=s.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),s},a._loadBitrateTestFrag=function(r,s){var l=this;r.bitrateTest=!0,this._doFragLoad(r,s).then(function(u){var c=l.hls;if(u&&!c.nextLoadLevel&&!l.fragContextChanged(r)){l.fragLoadError=0,l.state=At,l.startFragRequested=!1,l.bitrateTest=!1;var v=r.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),c.trigger(g.Events.FRAG_LOADED,u),r.bitrateTest=!1}})},a._handleTransmuxComplete=function(r){var s,l="main",u=this.hls,c=r.remuxResult,v=r.chunkMeta,m=this.getCurrentContext(v);if(!m)return this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(v.level);var _=m.frag,S=m.part,F=m.level,P=c.video,X=c.text,ue=c.id3,_e=c.initSegment,ge=F.details,De=this.altAudio?void 0:c.audio;if(!this.fragContextChanged(_)){if(this.state=wr,_e){_e.tracks&&(this._bufferInitSegment(F,_e.tracks,_,v),u.trigger(g.Events.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:l,tracks:_e.tracks}));var He=_e.initPTS,Je=_e.timescale;(0,R.isFiniteNumber)(He)&&(this.initPTS[_.cc]=He,u.trigger(g.Events.INIT_PTS_FOUND,{frag:_,id:l,initPTS:He,timescale:Je}))}if(P&&c.independent!==!1){if(ge){var Ae=P.startPTS,Ke=P.endPTS,je=P.startDTS,pt=P.endDTS;if(S)S.elementaryStreams[P.type]={startPTS:Ae,endPTS:Ke,startDTS:je,endDTS:pt};else if(P.firstKeyFrame&&P.independent&&v.id===1&&(this.couldBacktrack=!0),P.dropped&&P.independent){var Mt=this.getMainFwdBufferInfo();if((Mt?Mt.end:this.getLoadPosition())+this.config.maxBufferHole<(P.firstKeyFramePTS?P.firstKeyFramePTS:Ae)-this.config.maxBufferHole)return void this.backtrack(_);_.setElementaryStreamInfo(P.type,_.start,Ke,_.start,pt,!0)}_.setElementaryStreamInfo(P.type,Ae,Ke,je,pt),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(P,_,S,v)}}else if(c.independent===!1)return void this.backtrack(_);if(De){var yt=De.startPTS,kt=De.endPTS,xt=De.startDTS,ir=De.endDTS;S&&(S.elementaryStreams[J.ElementaryStreamTypes.AUDIO]={startPTS:yt,endPTS:kt,startDTS:xt,endDTS:ir}),_.setElementaryStreamInfo(J.ElementaryStreamTypes.AUDIO,yt,kt,xt,ir),this.bufferFragmentData(De,_,S,v)}if(ge&&ue!=null&&(s=ue.samples)!==null&&s!==void 0&&s.length){var er={id:l,frag:_,details:ge,samples:ue.samples};u.trigger(g.Events.FRAG_PARSING_METADATA,er)}if(ge&&X){var Yt={id:l,frag:_,details:ge,samples:X.samples};u.trigger(g.Events.FRAG_PARSING_USERDATA,Yt)}}},a._bufferInitSegment=function(r,s,l,u){var c=this;if(this.state===wr){this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var v=s.audio,m=s.video,_=s.audiovideo;if(v){var S=r.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(S&&(S=S.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),v.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(S="mp4a.40.5")),F.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(S="mp4a.40.2",this.log("Android: force audio codec to "+S)),r.audioCodec&&r.audioCodec!==S&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+S+'"'),v.levelCodec=S,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(S||"")+"/"+(r.audioCodec||"")+"/"+v.codec+"]")}m&&(m.levelCodec=r.videoCodec,m.id="main",this.log("Init video buffer, container:"+m.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+m.codec+"]")),_&&this.log("Init audiovideo buffer, container:"+_.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+_.codec+"]"),this.hls.trigger(g.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(P){var X=s[P].initSegment;X!=null&&X.byteLength&&c.hls.trigger(g.Events.BUFFER_APPENDING,{type:P,data:X,frag:l,part:null,chunkMeta:u,parent:l.type})}),this.tick()}},a.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,fe.PlaylistLevelType.MAIN)},a.backtrack=function(r){this.couldBacktrack=!0,this.backtrackFragment=r,this.resetTransmuxer(),this.flushBufferGap(r),this.fragmentTracker.removeFragment(r),this.fragPrevious=null,this.nextLoadPosition=r.start,this.state=At},a.checkFragmentChanged=function(){var r=this.media,s=null;if(r&&r.readyState>1&&r.seeking===!1){var l=r.currentTime;if(Gt.isBuffered(r,l)?s=this.getAppendedFrag(l):Gt.isBuffered(r,l+.1)&&(s=this.getAppendedFrag(l+.1)),s){this.backtrackFragment=null;var u=this.fragPlaying,c=s.level;u&&s.sn===u.sn&&u.level===c&&s.urlId===u.urlId||(this.fragPlaying=s,this.hls.trigger(g.Events.FRAG_CHANGED,{frag:s}),u&&u.level===c||this.hls.trigger(g.Events.LEVEL_SWITCHED,{level:c}))}}},i=t,(n=[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentFrag",get:function(){var r=this.media;return r?this.fragPlaying||this.getAppendedFrag(r.currentTime):null}},{key:"currentProgramDateTime",get:function(){var r=this.media;if(r){var s=r.currentTime,l=this.currentFrag;if(l&&(0,R.isFiniteNumber)(s)&&(0,R.isFiniteNumber)(l.programDateTime)){var u=l.programDateTime+1e3*(s-l.start);return new Date(u)}}return null}},{key:"currentLevel",get:function(){var r=this.currentFrag;return r?r.level:-1}},{key:"nextBufferedFrag",get:function(){var r=this.currentFrag;return r?this.followingBufferedFrag(r):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&Wr(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(hi);let gi=function(){function d(e,t,i){t===void 0&&(t=0),i===void 0&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}var o=d.prototype;return o.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},o.getTotalWeight=function(){return this.totalWeight_},o.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},d}(),Rn=function(){function d(e,t,i){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new gi(e),this.fast_=new gi(t)}var o=d.prototype;return o.update=function(e,t){var i=this.slow_,n=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new gi(e,i.getEstimate(),i.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new gi(t,n.getEstimate(),n.getTotalWeight()))},o.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/i;this.fast_.sample(i,n),this.slow_.sample(i,n)},o.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},o.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},o.destroy=function(){},d}();function In(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}let Cn=function(){function d(i){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=i;var n=i.config;this.bwEstimator=new Rn(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate),this.registerListeners()}var o,e,t=d.prototype;return t.registerListeners=function(){var i=this.hls;i.on(g.Events.FRAG_LOADING,this.onFragLoading,this),i.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(g.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){var i=this.hls;i.off(g.Events.FRAG_LOADING,this.onFragLoading,this),i.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(g.Events.ERROR,this.onError,this)},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},t.onFragLoading=function(i,n){var a,r=n.frag;r.type===fe.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=r,this.partCurrent=(a=n.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)))},t.onLevelLoaded=function(i,n){var a=this.hls.config;n.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)},t._abandonRulesCheck=function(){var i=this.fragCurrent,n=this.partCurrent,a=this.hls,r=a.autoLevelEnabled,s=a.media;if(i&&s){var l=n?n.stats:i.stats,u=n?n.duration:i.duration;if(l.aborted||l.loaded&&l.loaded===l.total||i.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!s.paused&&s.playbackRate&&s.readyState){var c=a.mainForwardBufferInfo;if(c!==null){var v=performance.now()-l.loading.start,m=Math.abs(s.playbackRate);if(!(v<=500*u/m)){var _=l.loaded&&l.loading.first,S=this.bwEstimator.getEstimate(),F=a.levels,P=a.minAutoLevel,X=F[i.level],ue=l.total||Math.max(l.loaded,Math.round(u*X.maxBitrate/8)),_e=_?1e3*l.loaded/v:0,ge=_e?(ue-l.loaded)/_e:8*ue/S,De=c.len/m;if(!(ge<=De)){var He,Je=Number.POSITIVE_INFINITY;for(He=i.level-1;He>P;He--){var Ae=F[He].maxBitrate;if((Je=_e?u*Ae/(6.4*_e):u*Ae/S)<De)break}Je>=ge||(L.logger.warn("Fragment "+i.sn+(n?" part "+n.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+He+`
|
|
16
16
|
Current BW estimate: `+((0,R.isFiniteNumber)(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
|
|
17
17
|
Estimated load time for current fragment: `+ge.toFixed(3)+` s
|
|
18
18
|
Estimated load time for the next fragment: `+Je.toFixed(3)+` s
|
|
19
|
-
Time to underbuffer: `+De.toFixed(3)+" s"),a.nextLoadLevel=He,_&&this.bwEstimator.sample(v,l.loaded),this.clearTimer(),(i.loader||i.keyLoader)&&(this.fragCurrent=this.partCurrent=null,i.abortRequests()),a.trigger(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:n,stats:l}))}}}}}},t.onFragLoaded=function(i,n){var a=n.frag,r=n.part;if(a.type===fe.PlaylistLevelType.MAIN&&(0,R.isFiniteNumber)(a.sn)){var s=r?r.stats:a.stats,l=r?r.duration:a.duration;if(this.clearTimer(),this.lastLoadedFragLevel=a.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[a.level],c=(u.loaded?u.loaded.bytes:0)+s.loaded,v=(u.loaded?u.loaded.duration:0)+l;u.loaded={bytes:c,duration:v},u.realBitrate=Math.round(8*c/v)}if(a.bitrateTest){var m={stats:s,frag:a,part:r,id:a.type};this.onFragBuffered(g.Events.FRAG_BUFFERED,m)}}},t.onFragBuffered=function(i,n){var a=n.frag,r=n.part,s=r?r.stats:a.stats;if(!s.aborted&&a.type===fe.PlaylistLevelType.MAIN&&a.sn!=="initSegment"){var l=s.parsing.end-s.loading.start;this.bwEstimator.sample(l,s.loaded),s.bwEstimate=this.bwEstimator.getEstimate(),a.bitrateTest?this.bitrateTestDelay=l/1e3:this.bitrateTestDelay=0}},t.onError=function(i,n){var a;if(((a=n.frag)===null||a===void 0?void 0:a.type)===fe.PlaylistLevelType.MAIN){if(n.type===k.ErrorTypes.KEY_SYSTEM_ERROR)return void this.clearTimer();switch(n.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.clearTimer()}}},t.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},t.getNextABRAutoLevel=function(){var i=this.fragCurrent,n=this.partCurrent,a=this.hls,r=a.maxAutoLevel,s=a.config,l=a.minAutoLevel,u=a.media,c=n?n.duration:i?i.duration:0,v=u&&u.playbackRate!==0?Math.abs(u.playbackRate):1,m=this.bwEstimator?this.bwEstimator.getEstimate():s.abrEwmaDefaultEstimate,_=a.mainForwardBufferInfo,S=(_?_.len:0)/v,F=this.findBestLevel(m,l,r,S,s.abrBandWidthFactor,s.abrBandWidthUpFactor);if(F>=0)return F;L.logger.trace((S?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var P=c?Math.min(c,s.maxStarvationDelay):s.maxStarvationDelay,W=s.abrBandWidthFactor,ue=s.abrBandWidthUpFactor;if(!S){var _e=this.bitrateTestDelay;_e&&(P=(c?Math.min(c,s.maxLoadingDelay):s.maxLoadingDelay)-_e,L.logger.trace("bitrate test took "+Math.round(1e3*_e)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*P)+" ms"),W=ue=1)}return F=this.findBestLevel(m,l,r,S+P,W,ue),Math.max(F,0)},t.findBestLevel=function(i,n,a,r,s,l){for(var u,c=this.fragCurrent,v=this.partCurrent,m=this.lastLoadedFragLevel,_=this.hls.levels,S=_[m],F=!(S==null||(u=S.details)===null||u===void 0||!u.live),P=S==null?void 0:S.codecSet,W=v?v.duration:c?c.duration:0,ue=a;ue>=n;ue--){var _e=_[ue];if(_e&&(!P||_e.codecSet===P)){var ge,De=_e.details,He=(v?De==null?void 0:De.partTarget:De==null?void 0:De.averagetargetduration)||W;ge=ue<=m?s*i:l*i;var Je=_[ue].maxBitrate,Ae=Je*He/ge;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+ue+"/"+Math.round(ge)+"/"+Je+"/"+He+"/"+r+"/"+Ae),ge>Je&&(Ae===0||!(0,R.isFiniteNumber)(Ae)||F&&!this.bitrateTestDelay||Ae<r))return ue}}return-1},o=d,(e=[{key:"nextAutoLevel",get:function(){var i=this._nextAutoLevel,n=this.bwEstimator;if(i!==-1&&!n.canEstimate())return i;var a=this.getNextABRAutoLevel();return i!==-1&&this.hls.levels[a].loadError?i:(i!==-1&&(a=Math.min(i,a)),a)},set:function(i){this._nextAutoLevel=i}}])&&In(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();var hn=function(){function d(){this.chunks=[],this.dataLength=0}var o=d.prototype;return o.push=function(e){this.chunks.push(e),this.dataLength+=e.length},o.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(n,a){for(var r=new Uint8Array(a),s=0,l=0;l<n.length;l++){var u=n[l];r.set(u,s),s+=u.length}return r}(t,i),this.reset(),e):new Uint8Array(0)},o.reset=function(){this.chunks.length=0,this.dataLength=0},d}();function mi(){return mi=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},mi.apply(this,arguments)}function Pi(d,o){return Pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Pi(d,o)}var yi=function(d){var o,e;function t(n,a,r){var s;return(s=d.call(this,n,a,r,"[audio-stream-controller]")||this).videoBuffer=null,s.videoTrackCC=-1,s.waitingVideoCC=-1,s.audioSwitch=!1,s.trackId=-1,s.waitingData=null,s.mainDetails=null,s.bufferFlushed=!1,s.cachedTrackLoadedData=null,s._registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Pi(o,e);var i=t.prototype;return i.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var n=this.hls;n.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(g.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.on(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(g.Events.ERROR,this.onError,this),n.on(g.Events.BUFFER_RESET,this.onBufferReset,this),n.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var n=this.hls;n.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(g.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.off(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(g.Events.ERROR,this.onError,this),n.off(g.Events.BUFFER_RESET,this.onBufferReset,this),n.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onInitPtsFound=function(n,a){var r=a.frag,s=a.id,l=a.initPTS;if(s==="main"){var u=r.cc;this.initPTS[r.cc]=l,this.log("InitPTS for cc: "+u+" found from main: "+l),this.videoTrackCC=u,this.state===Ur&&this.tick()}},i.startLoad=function(n){if(!this.levels)return this.startPosition=n,void(this.state=br);var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,a>0&&n===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),n=a,this.state=At):(this.loadedmetadata=!1,this.state=ci),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()},i.doTick=function(){switch(this.state){case At:this.doTickIdle();break;case ci:var n,a=this.levels,r=this.trackId,s=a==null||(n=a[r])===null||n===void 0?void 0:n.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=Ur}break;case Nr:var l,u=performance.now(),c=this.retryDate;(!c||u>=c||(l=this.media)!==null&&l!==void 0&&l.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=At);break;case Ur:var v=this.waitingData;if(v){var m=v.frag,_=v.part,S=v.cache,F=v.complete;if(this.initPTS[m.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=qr;var P={frag:m,part:_,payload:S.flush(),networkDetails:null};this._handleFragmentLoadProgress(P),F&&d.prototype._handleFragmentLoadComplete.call(this,P)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+m.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var W=this.getLoadPosition(),ue=Gt.bufferInfo(this.mediaBuffer,W,this.config.maxBufferHole);di(ue.end,this.config.maxFragLookUpTolerance,m)<0&&(this.log("Waiting fragment cc ("+m.cc+") @ "+m.start+" cancelled because another fragment at "+ue.end+" is needed"),this.clearWaitingFragment())}}else this.state=At}this.onTickEnd()},i.clearWaitingFragment=function(){var n=this.waitingData;n&&(this.fragmentTracker.removeFragment(n.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=At)},i.resetLoadingState=function(){this.clearWaitingFragment(),d.prototype.resetLoadingState.call(this)},i.onTickEnd=function(){var n=this.media;n&&n.readyState&&(this.lastCurrentTime=n.currentTime)},i.doTickIdle=function(){var n=this.hls,a=this.levels,r=this.media,s=this.trackId,l=n.config;if(a&&a[s]&&(r||!this.startFragRequested&&l.startFragPrefetch)){var u=a[s].details;if(!u||u.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(u))this.state=ci;else{var c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,J.ElementaryStreamTypes.AUDIO,fe.PlaylistLevelType.AUDIO));var v=this.getFwdBufferInfo(c,fe.PlaylistLevelType.AUDIO);if(v!==null){var m=this.audioSwitch;if(!m&&this._streamEnded(v,u))return n.trigger(g.Events.BUFFER_EOS,{type:"audio"}),void(this.state=ei);var _=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,fe.PlaylistLevelType.MAIN);if(!(v.len>=this.getMaxBufferLength(_==null?void 0:_.len))||m){var S=u.fragments[0].start,F=v.end;if(m&&r){var P=this.getLoadPosition();F=P,u.PTSKnown&&P<S&&(v.end>S||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=S+.05)}if(!(_&&F>_.end+u.targetduration)&&(_&&_.len||!v.len)){var W=this.getNextFragment(F,u);W?this.loadFragment(W,u,F):this.bufferFlushed=!0}}}}}},i.getMaxBufferLength=function(n){var a=d.prototype.getMaxBufferLength.call(this);return n?Math.max(a,n):a},i.onMediaDetaching=function(){this.videoBuffer=null,d.prototype.onMediaDetaching.call(this)},i.onAudioTracksUpdated=function(n,a){var r=a.audioTracks;this.resetTransmuxer(),this.levels=r.map(function(s){return new N(s)})},i.onAudioTrackSwitching=function(n,a){var r=!!a.url;this.trackId=a.id;var s=this.fragCurrent;s&&s.abortRequests(),this.fragCurrent=null,this.clearWaitingFragment(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.audioSwitch=!0,this.state=At):this.state=br,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},i.onLevelLoaded=function(n,a){this.mainDetails=a.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(g.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},i.onAudioTrackLoaded=function(n,a){var r;if(this.mainDetails!=null){var s=this.levels,l=a.details,u=a.id;if(s){this.log("Track "+u+" loaded ["+l.startSN+","+l.endSN+"],duration:"+l.totalduration);var c=s[u],v=0;if(l.live||(r=c.details)!==null&&r!==void 0&&r.live){var m=this.mainDetails;if(l.fragments[0]||(l.deltaUpdateFailed=!0),l.deltaUpdateFailed||!m)return;!c.details&&l.hasProgramDateTime&&m.hasProgramDateTime?(an(l,m),v=l.fragments[0].start):v=this.alignPlaylists(l,c.details)}c.details=l,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&l.live||this.setStartPosition(c.details,v),this.state!==ci||this.waitForCdnTuneIn(l)||(this.state=At),this.tick()}else this.warn("Audio tracks were reset while loading level "+u)}else this.cachedTrackLoadedData=a},i._handleFragmentLoadProgress=function(n){var a,r=n.frag,s=n.part,l=n.payload,u=this.config,c=this.trackId,v=this.levels;if(v){var m=v[c],_=m.details,S=u.defaultAudioCodec||m.audioCodec||"mp4a.40.2",F=this.transmuxer;F||(F=this.transmuxer=new Ii(this.hls,fe.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var P=this.initPTS[r.cc],W=(a=r.initSegment)===null||a===void 0?void 0:a.data;if(P!==void 0){var ue=s?s.index:-1,_e=ue!==-1,ge=new Di(r.level,r.sn,r.stats.chunkCount,l.byteLength,ue,_e);F.push(l,W,S,"",r,s,_.totalduration,!1,ge,P)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+c),(this.waitingData=this.waitingData||{frag:r,part:s,cache:new hn,complete:!1}).cache.push(new Uint8Array(l)),this.waitingVideoCC=this.videoTrackCC,this.state=Ur}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},i._handleFragmentLoadComplete=function(n){this.waitingData?this.waitingData.complete=!0:d.prototype._handleFragmentLoadComplete.call(this,n)},i.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},i.onBufferCreated=function(n,a){var r=a.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer||null)},i.onFragBuffered=function(n,a){var r,s=a.frag,l=a.part;s.type===fe.PlaylistLevelType.AUDIO?this.fragContextChanged(s)?this.warn("Fragment "+s.sn+(l?" p: "+l.index:"")+" of level "+s.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):(s.sn!=="initSegment"&&(this.fragPrevious=s,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(s,l)):this.loadedmetadata||s.type!==fe.PlaylistLevelType.MAIN||(r=this.videoBuffer||this.media)!==null&&r!==void 0&&r.buffered.length&&(this.loadedmetadata=!0)},i.onError=function(n,a){if(a.type!==k.ErrorTypes.KEY_SYSTEM_ERROR)switch(a.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.AUDIO,a);break;case k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==Lr&&this.state!==br&&(this.state=a.fatal?Lr:At,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===wr||this.state===Vr)){var r=!0,s=this.getFwdBufferInfo(this.mediaBuffer,fe.PlaylistLevelType.AUDIO);s&&s.len>.5&&(r=!this.reduceMaxBufferLength(s.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.AUDIO,a)},i.onBufferFlushed=function(n,a){a.type===J.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0,this.state===ei&&(this.state=At))},i._handleTransmuxComplete=function(n){var a,r="audio",s=this.hls,l=n.remuxResult,u=n.chunkMeta,c=this.getCurrentContext(u);if(!c)return this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(u.level);var v=c.frag,m=c.part,_=c.level.details,S=l.audio,F=l.text,P=l.id3,W=l.initSegment;if(!this.fragContextChanged(v)&&_){if(this.state=wr,this.audioSwitch&&S&&this.completeAudioSwitch(),W!=null&&W.tracks&&(this._bufferInitSegment(W.tracks,v,u),s.trigger(g.Events.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:W.tracks})),S){var ue=S.startPTS,_e=S.endPTS,ge=S.startDTS,De=S.endDTS;m&&(m.elementaryStreams[J.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:_e,startDTS:ge,endDTS:De}),v.setElementaryStreamInfo(J.ElementaryStreamTypes.AUDIO,ue,_e,ge,De),this.bufferFragmentData(S,v,m,u)}if(P!=null&&(a=P.samples)!==null&&a!==void 0&&a.length){var He=mi({id:r,frag:v,details:_},P);s.trigger(g.Events.FRAG_PARSING_METADATA,He)}if(F){var Je=mi({id:r,frag:v,details:_},F);s.trigger(g.Events.FRAG_PARSING_USERDATA,Je)}}},i._bufferInitSegment=function(n,a,r){if(this.state===wr){n.video&&delete n.video;var s=n.audio;if(s){s.levelCodec=s.codec,s.id="audio",this.log("Init audio buffer, container:"+s.container+", codecs[parsed]=["+s.codec+"]"),this.hls.trigger(g.Events.BUFFER_CODECS,n);var l=s.initSegment;if(l!=null&&l.byteLength){var u={type:"audio",frag:a,part:null,chunkMeta:r,parent:a.type,data:l};this.hls.trigger(g.Events.BUFFER_APPENDING,u)}this.tick()}}},i.loadFragment=function(n,a,r){var s=this.fragmentTracker.getState(n);this.fragCurrent=n,(this.audioSwitch||s===Ge.NOT_LOADED||s===Ge.PARTIAL)&&(n.sn==="initSegment"?this._loadInitSegment(n,a):a.live&&!(0,R.isFiniteNumber)(this.initPTS[n.cc])?(this.log("Waiting for video PTS in continuity counter "+n.cc+" of live stream before loading audio fragment "+n.sn+" of level "+this.trackId),this.state=Ur):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,n,a,r)))},i.completeAudioSwitch=function(){var n=this.hls,a=this.media,r=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,n.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:r})},t}(hi);let Oi=yi;function fn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function ii(d,o){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ii(d,o)}let Pn=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[audio-track-controller]")||this).tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,ii(o,e);var i,n,a=t.prototype;return a.registerListeners=function(){var r=this.hls;r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,d.prototype.destroy.call(this)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},a.onManifestParsed=function(r,s){this.tracks=s.audioTracks||[]},a.onAudioTrackLoaded=function(r,s){var l=s.id,u=s.details,c=this.tracksInGroup[l];if(c){var v=c.details;c.details=s.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,v))}else this.warn("Invalid audio track id "+l)},a.onLevelLoading=function(r,s){this.switchLevel(s.level)},a.onLevelSwitching=function(r,s){this.switchLevel(s.level)},a.switchLevel=function(r){var s=this.hls.levels[r];if(s!=null&&s.audioGroupIds){var l=s.audioGroupIds[s.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!u.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var c={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(g.Events.AUDIO_TRACKS_UPDATED,c),this.selectInitialTrack()}}},a.onError=function(r,s){d.prototype.onError.call(this,r,s),!s.fatal&&s.context&&s.context.type===fe.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},a.setAudioTrack=function(r){var s=this.tracksInGroup;if(r<0||r>=s.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var l=s[this.trackId];this.log("Now switching to audio-track index "+r);var u=s[r],c=u.id,v=u.groupId,m=v===void 0?"":v,_=u.name,S=u.type,F=u.url;if(this.trackId=r,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(g.Events.AUDIO_TRACK_SWITCHING,{id:c,groupId:m,name:_,type:S,url:F}),!u.details||u.details.live){var P=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(P)}}},a.selectInitialTrack=function(){this.tracksInGroup;var r=this.trackName,s=this.findTrackId(r)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},a.findTrackId=function(r){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var u=s[l];if((!this.selectDefaultTrack||u.default)&&(!r||r===u.name))return u.id}return-1},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,u=s.groupId,c=s.url;if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(g.Events.AUDIO_TRACK_LOADING,{url:c,id:l,groupId:u,deliveryDirectives:r||null})}},i=t,(n=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1,this.setAudioTrack(r)}}])&&fn(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);function On(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function xi(d,o){return xi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xi(d,o)}var xn=function(d){var o,e;function t(r,s,l){var u;return(u=d.call(this,r,s,l,"[subtitle-stream-controller]")||this).levels=[],u.currentTrackId=-1,u.tracksBuffered=[],u.mainDetails=null,u._registerListeners(),u}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,xi(o,e);var i,n,a=t.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.ERROR,this.onError,this),r.on(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.on(g.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),r.on(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(g.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),r.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.ERROR,this.onError,this),r.off(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(g.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),r.off(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(g.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),r.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.startLoad=function(r){this.stopLoad(),this.state=At,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},a.onLevelLoaded=function(r,s){this.mainDetails=s.details},a.onSubtitleFragProcessed=function(r,s){var l=s.frag,u=s.success;if(this.fragPrevious=l,this.state=At,u){var c=this.tracksBuffered[this.currentTrackId];if(c){for(var v,m=l.start,_=0;_<c.length;_++)if(m>=c[_].start&&m<=c[_].end){v=c[_];break}var S=l.start+l.duration;v?v.end=S:(v={start:m,end:S},c.push(v)),this.fragmentTracker.fragBuffered(l)}}},a.onBufferFlushing=function(r,s){var l=s.startOffset,u=s.endOffset;if(l===0&&u!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,v=this.levels;if(!v.length||!v[c]||!v[c].details)return;var m=u-v[c].details.targetduration;if(m<=0)return;s.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(_){for(var S=0;S<_.length;)if(_[S].end<=m)_.shift();else{if(!(_[S].start<m))break;_[S].start=m,S++}}),this.fragmentTracker.removeFragmentsInRange(l,m,fe.PlaylistLevelType.SUBTITLE)}},a.onFragBuffered=function(r,s){var l;this.loadedmetadata||s.frag.type!==fe.PlaylistLevelType.MAIN||(l=this.media)!==null&&l!==void 0&&l.buffered.length&&(this.loadedmetadata=!0)},a.onError=function(r,s){var l=s.frag;l&&l.type===fe.PlaylistLevelType.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state=At)},a.onSubtitleTracksUpdated=function(r,s){var l=this,u=s.subtitleTracks;this.tracksBuffered=[],this.levels=u.map(function(c){return new N(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){l.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},a.onSubtitleTrackSwitch=function(r,s){if(this.currentTrackId=s.id,this.levels.length&&this.currentTrackId!==-1){var l=this.levels[this.currentTrackId];l!=null&&l.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,l&&this.setInterval(500)}else this.clearInterval()},a.onSubtitleTrackLoaded=function(r,s){var l,u=s.details,c=s.id,v=this.currentTrackId,m=this.levels;if(m.length){var _=m[v];if(!(c>=m.length||c!==v)&&_){this.mediaBuffer=this.mediaBufferTimeRanges;var S=0;if(u.live||(l=_.details)!==null&&l!==void 0&&l.live){var F=this.mainDetails;if(u.deltaUpdateFailed||!F)return;var P=F.fragments[0];_.details?(S=this.alignPlaylists(u,_.details))===0&&P&&Te(u,S=P.start):u.hasProgramDateTime&&F.hasProgramDateTime?(an(u,F),S=u.fragments[0].start):P&&Te(u,S=P.start)}_.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(_.details,S),this.tick(),u.live&&!this.fragCurrent&&this.media&&this.state===At&&(ui(null,u.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.details=void 0))}}},a._handleFragmentLoadComplete=function(r){var s=this,l=r.frag,u=r.payload,c=l.decryptdata,v=this.hls;if(!this.fragContextChanged(l)&&u&&u.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var m=performance.now();this.decrypter.decrypt(new Uint8Array(u),c.key.buffer,c.iv.buffer).then(function(_){var S=performance.now();v.trigger(g.Events.FRAG_DECRYPTED,{frag:l,payload:_,stats:{tstart:m,tdecrypt:S}})}).catch(function(_){s.warn(_.name+": "+_.message),s.state=At})}},a.doTick=function(){if(this.media){if(this.state===At){var r=this.currentTrackId,s=this.levels;if(!s.length||!s[r]||!s[r].details)return;var l=s[r].details,u=l.targetduration,c=this.config,v=this.getLoadPosition(),m=Gt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],v-u,c.maxBufferHole),_=m.end,S=m.len,F=this.getFwdBufferInfo(this.media,fe.PlaylistLevelType.MAIN);if(S>this.getMaxBufferLength(F==null?void 0:F.len)+u)return;var P=l.fragments,W=P.length,ue=l.edge,_e=null,ge=this.fragPrevious;if(_<ue){var De=c.maxFragLookUpTolerance;!(_e=ui(ge,P,Math.max(P[0].start,_),De))&&ge&&ge.start<P[0].start&&(_e=P[0])}else _e=P[W-1];if(!_e)return;_e=this.mapToInitFragWhenRequired(_e),this.fragmentTracker.getState(_e)===Ge.NOT_LOADED&&this.loadFragment(_e,l,_)}}else this.state=At},a.getMaxBufferLength=function(r){var s=d.prototype.getMaxBufferLength.call(this);return r?Math.max(s,r):s},a.loadFragment=function(r,s,l){this.fragCurrent=r,r.sn==="initSegment"?this._loadInitSegment(r,s):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,r,s,l))},i=t,(n=[{key:"mediaBufferTimeRanges",get:function(){return new Mn(this.tracksBuffered[this.currentTrackId]||[])}}])&&On(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(hi),Mn=function(d){this.buffered=void 0;var o=function(e,t,i){if((t>>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+i+")");return d[t][e]};this.buffered={get length(){return d.length},end:function(e){return o("end",e,d.length)},start:function(e){return o("start",e,d.length)}}};function Fn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Mi(d,o){return Mi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mi(d,o)}function Fi(d){for(var o=[],e=0;e<d.length;e++){var t=d[e];t.kind==="subtitles"&&t.label&&o.push(d[e])}return o}let Nn=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[subtitle-track-controller]")||this).media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s._subtitleDisplay=!0,s.registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Mi(o,e);var i,n,a=t.prototype;return a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},a.registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.onMediaAttached=function(r,s){this.media=s.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Fi(this.media.textTracks).forEach(function(r){lt(r)}),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(r,s){this.tracks=s.subtitleTracks},a.onSubtitleTrackLoaded=function(r,s){var l=s.id,u=s.details,c=this.trackId,v=this.tracksInGroup[c];if(v){var m=v.details;v.details=s.details,this.log("subtitle track "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,m))}else this.warn("Invalid subtitle track id "+l)},a.onLevelLoading=function(r,s){this.switchLevel(s.level)},a.onLevelSwitching=function(r,s){this.switchLevel(s.level)},a.switchLevel=function(r){var s=this.hls.levels[r];if(s!=null&&s.textGroupIds){var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(_){return!l||_.groupId===l});this.tracksInGroup=c;var v=this.findTrackId(u==null?void 0:u.name)||this.findTrackId();this.groupId=l;var m={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(g.Events.SUBTITLE_TRACKS_UPDATED,m),v!==-1&&this.setSubtitleTrack(v,u)}}},a.findTrackId=function(r){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var u=s[l];if((!this.selectDefaultTrack||u.default)&&(!r||r===u.name))return u.id}return-1},a.onError=function(r,s){d.prototype.onError.call(this,r,s),!s.fatal&&s.context&&s.context.type===fe.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,u=s.groupId,c=s.url;if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(g.Events.SUBTITLE_TRACK_LOADING,{url:c,id:l,groupId:u,deliveryDirectives:r||null})}},a.toggleTrackModes=function(r){var s=this,l=this.media,u=this.trackId;if(l){var c=Fi(l.textTracks),v=c.filter(function(S){return S.groupId===s.groupId});if(r===-1)[].slice.call(c).forEach(function(S){S.mode="disabled"});else{var m=v[u];m&&(m.mode="disabled")}var _=v[r];_&&(_.mode=this.subtitleDisplay?"showing":"hidden")}},a.setSubtitleTrack=function(r,s){var l,u=this.tracksInGroup;if(this.media){if(this.trackId!==r&&this.toggleTrackModes(r),!(this.trackId===r&&(r===-1||(l=u[r])!==null&&l!==void 0&&l.details)||r<-1||r>=u.length)){this.clearTimer();var c=u[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,c){var v=c.id,m=c.groupId,_=m===void 0?"":m,S=c.name,F=c.type,P=c.url;this.hls.trigger(g.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:_,name:S,type:F,url:P});var W=this.switchParams(c.url,s==null?void 0:s.details);this.loadPlaylist(W)}else this.hls.trigger(g.Events.SUBTITLE_TRACK_SWITCH,{id:r})}}else this.queuedDefaultTrack=r},a.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var r=-1,s=Fi(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")r=l;else if(s[l].mode==="showing"){r=l;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)}},i=t,(n=[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(r){this._subtitleDisplay=r,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,s)}}])&&Fn(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);var Et,gr=function(){function d(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var o=d.prototype;return o.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},o.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},o.appendBlocker=function(e){var t,i=new Promise(function(a){t=a}),n={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,e),i},o.executeNext=function(e){var t=this.buffers,i=this.queues,n=t[e],a=i[e];if(a.length){var r=a[0];try{r.execute()}catch(s){L.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),r.onError(s),n&&n.updating||(a.shift(),this.executeNext(e))}}},o.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},o.current=function(e){return this.queues[e][0]},d}(),Xr=fi(),vn=/([ha]vc.)(?:\.[^.,]+)+/,Un=function(){function d(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var i=t.hls,n=t.media,a=t.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),n&&(t.updateMediaElementDuration(),i.trigger(g.Events.MEDIA_ATTACHED,{media:n})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){L.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){L.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var o=d.prototype;return o.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},o.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},o.registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.Events.BUFFER_RESET,this.onBufferReset,this),e.on(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.Events.BUFFER_EOS,this.onBufferEos,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.Events.FRAG_PARSED,this.onFragParsed,this),e.on(g.Events.FRAG_CHANGED,this.onFragChanged,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.Events.BUFFER_RESET,this.onBufferReset,this),e.off(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.Events.BUFFER_EOS,this.onBufferEos,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.Events.FRAG_PARSED,this.onFragParsed,this),e.off(g.Events.FRAG_CHANGED,this.onFragChanged,this)},o._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new gr(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},o.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},o.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Xr){var n=this.mediaSource=new Xr;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(n),this._objectUrl=i.src}},o.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(L.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(n){L.logger.warn("[buffer-controller]: onMediaDetaching: "+n.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):L.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(g.Events.MEDIA_DETACHED,void 0)},o.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(n){L.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",n)}}),this._initSourceBuffer()},o.onBufferCodecs=function(e,t){var i=this,n=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(a){if(n){var r=i.tracks[a];if(r&&typeof r.buffer.changeType=="function"){var s=t[a],l=s.id,u=s.codec,c=s.levelCodec,v=s.container,m=s.metadata,_=(r.levelCodec||r.codec).replace(vn,"$1"),S=(c||u).replace(vn,"$1");if(_!==S){var F=v+";codecs="+(c||u);i.appendChangeType(a,F),L.logger.log("[buffer-controller]: switching codec "+_+" to "+S),i.tracks[a]={buffer:r.buffer,codec:u,container:v,levelCodec:c,metadata:m,id:l}}}}else i.pendingTracks[a]=t[a]}),n||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},o.appendChangeType=function(e,t){var i=this,n=this.operationQueue,a={execute:function(){var r=i.sourceBuffer[e];r&&(L.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),r.changeType(t)),n.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(r){L.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",r)}};n.append(a,e)},o.onBufferAppending=function(e,t){var i=this,n=this.hls,a=this.operationQueue,r=this.tracks,s=t.data,l=t.type,u=t.frag,c=t.part,v=t.chunkMeta,m=v.buffering[l],_=self.performance.now();m.start=_;var S=u.stats.buffering,F=c?c.stats.buffering:null;S.start===0&&(S.start=_),F&&F.start===0&&(F.start=_);var P=r.audio,W=!1;l==="audio"&&(P==null?void 0:P.container)==="audio/mpeg"&&(W=!this.lastMpegAudioChunk||v.id===1||this.lastMpegAudioChunk.sn!==v.sn,this.lastMpegAudioChunk=v);var ue=u.start,_e={execute:function(){if(m.executeStart=self.performance.now(),W){var ge=i.sourceBuffer[l];if(ge){var De=ue-ge.timestampOffset;Math.abs(De)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+ue+" (delta: "+De+") sn: "+u.sn+")"),ge.timestampOffset=ue)}}i.appendExecutor(s,l)},onStart:function(){},onComplete:function(){var ge=self.performance.now();m.executeEnd=m.end=ge,S.first===0&&(S.first=ge),F&&F.first===0&&(F.first=ge);var De=i.sourceBuffer,He={};for(var Je in De)He[Je]=Gt.getBuffered(De[Je]);i.appendError=0,i.hls.trigger(g.Events.BUFFER_APPENDED,{type:l,frag:u,part:c,chunkMeta:v,parent:u.type,timeRanges:He})},onError:function(ge){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+l+" SourceBuffer",ge);var De={type:k.ErrorTypes.MEDIA_ERROR,parent:u.type,details:k.ErrorDetails.BUFFER_APPEND_ERROR,err:ge,fatal:!1};ge.code===DOMException.QUOTA_EXCEEDED_ERR?De.details=k.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,De.details=k.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>n.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),De.fatal=!0,n.stopLoad())),n.trigger(g.Events.ERROR,De)}};a.append(_e,l)},o.onBufferFlushing=function(e,t){var i=this,n=this.operationQueue,a=function(r){return{execute:i.removeExecutor.bind(i,r,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(g.Events.BUFFER_FLUSHED,{type:r})},onError:function(s){L.logger.warn("[buffer-controller]: Failed to remove from "+r+" SourceBuffer",s)}}};t.type?n.append(a(t.type),t.type):this.getSourceBufferTypes().forEach(function(r){n.append(a(r),r)})},o.onFragParsed=function(e,t){var i=this,n=t.frag,a=t.part,r=[],s=a?a.elementaryStreams:n.elementaryStreams;s[J.ElementaryStreamTypes.AUDIOVIDEO]?r.push("audiovideo"):(s[J.ElementaryStreamTypes.AUDIO]&&r.push("audio"),s[J.ElementaryStreamTypes.VIDEO]&&r.push("video")),r.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers(function(){var l=self.performance.now();n.stats.buffering.end=l,a&&(a.stats.buffering.end=l);var u=a?a.stats:n.stats;i.hls.trigger(g.Events.FRAG_BUFFERED,{frag:n,part:a,stats:u,id:n.type})},r)},o.onFragChanged=function(e,t){this.flushBackBuffer()},o.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(n,a){var r=i.sourceBuffer[a];return!r||t.type&&t.type!==a||(r.ending=!0,r.ended||(r.ended=!0,L.logger.log("[buffer-controller]: "+a+" sourceBuffer now EOS"))),n&&!(r&&!r.ended)},!0)&&(L.logger.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(a){var r=i.sourceBuffer[a];r&&(r.ending=!1)});var n=i.mediaSource;n&&n.readyState==="open"?(L.logger.log("[buffer-controller]: Calling mediaSource.endOfStream()"),n.endOfStream()):n&&L.logger.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+n.readyState)}))},o.onLevelUpdated=function(e,t){var i=t.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},o.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,n=this.sourceBuffer;if(i&&t!==null){var a=this.getSourceBufferTypes();if(a.length){var r=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if((0,R.isFiniteNumber)(r)&&!(r<0)){var s=i.currentTime,l=t.levelTargetDuration,u=Math.max(r,l),c=Math.floor(s/l)*l-u;a.forEach(function(v){var m=n[v];if(m){var _=Gt.getBuffered(m);if(_.length>0&&c>_.start(0)){if(e.trigger(g.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),t.live)e.trigger(g.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c});else if(m.ended&&_.end(_.length-1)-s<2*l)return void L.logger.info("[buffer-controller]: Cannot flush "+v+" back buffer while SourceBuffer is in ended state");e.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:v})}}})}}}},o.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,n=this.mediaSource,a=e.fragments[0].start+e.totalduration,r=i.duration,s=(0,R.isFiniteNumber)(n.duration)?n.duration:0;e.live&&t.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(e)):(a>s&&a>r||!(0,R.isFiniteNumber)(r))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),n.duration=a)}},o.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var n=Math.max(0,i[0].start),a=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,a)}},o.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,n=Object.keys(i).length;if(n&&!e||n===2){this.createSourceBuffers(i),this.pendingTracks={};var a=this.getSourceBufferTypes();if(a.length===0)return void this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach(function(r){t.executeNext(r)})}},o.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var n=0;for(var a in e)if(!t[a]){var r=e[a];if(!r)throw Error("source buffer exists for track "+a+", however track does not");var s=r.levelCodec||r.codec,l=r.container+";codecs="+s;L.logger.log("[buffer-controller]: creating sourceBuffer("+l+")");try{var u=t[a]=i.addSourceBuffer(l),c=a;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[a]={buffer:u,codec:s,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id},n++}catch(v){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+v.message),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,mimeType:l})}}n&&this.hls.trigger(g.Events.BUFFER_CREATED,{tracks:this.tracks})},o._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},o._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},o._onSBUpdateError=function(e,t){L.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(e);i&&i.onError(t)},o.removeExecutor=function(e,t,i){var n=this.media,a=this.mediaSource,r=this.operationQueue,s=this.sourceBuffer[e];if(!n||!a||!s)return L.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(e);var l=(0,R.isFiniteNumber)(n.duration)?n.duration:1/0,u=(0,R.isFiniteNumber)(a.duration)?a.duration:1/0,c=Math.max(0,t),v=Math.min(i,l,u);v>c&&!s.ending?(s.ended=!1,L.logger.log("[buffer-controller]: Removing ["+c+","+v+"] from the "+e+" SourceBuffer"),s.remove(c,v)):r.shiftAndExecuteNext(e)},o.appendExecutor=function(e,t){var i=this.operationQueue,n=this.sourceBuffer[t];if(!n)return L.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);n.ended=!1,n.appendBuffer(e)},o.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var n=this.operationQueue,a=t.map(function(r){return n.appendBlocker(r)});Promise.all(a).then(function(){e(),t.forEach(function(r){var s=i.sourceBuffer[r];s&&s.updating||n.shiftAndExecuteNext(r)})})},o.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},o.addBufferListener=function(e,t,i){var n=this.sourceBuffer[e];if(n){var a=i.bind(this,e);this.listeners[e].push({event:t,listener:a}),n.addEventListener(t,a)}},o.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},d}(),p={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},h=function(d){var o=d;return p.hasOwnProperty(d)&&(o=p[d]),String.fromCharCode(o)},f=15,y=100,b={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},M={17:2,18:4,21:6,22:8,23:10,19:13,20:15},I={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Y={25:2,26:4,29:6,30:8,31:10,27:13,28:15},he=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(Et||(Et={}));var ee=function(){function d(){this.time=null,this.verboseLevel=Et.ERROR}return d.prototype.log=function(o,e){if(this.verboseLevel>=o){var t=typeof e=="function"?e():e;L.logger.log(this.time+" ["+o+"] "+t)}},d}(),Me=function(d){for(var o=[],e=0;e<d.length;e++)o.push(d[e].toString(16));return o},ut=function(){function d(e,t,i,n,a){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=n||"black",this.flash=a||!1}var o=d.prototype;return o.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},o.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}},o.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},o.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},o.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},o.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),Ze=function(){function d(e,t,i,n,a,r){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new ut(t,i,n,a,r)}var o=d.prototype;return o.reset=function(){this.uchar=" ",this.penState.reset()},o.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},o.setPenState=function(e){this.penState.copy(e)},o.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},o.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},o.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),st=function(){function d(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<y;t++)this.chars.push(new Ze);this.logger=e,this.pos=0,this.currPenState=new ut}var o=d.prototype;return o.equals=function(e){for(var t=!0,i=0;i<y;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},o.copy=function(e){for(var t=0;t<y;t++)this.chars[t].copy(e.chars[t])},o.isEmpty=function(){for(var e=!0,t=0;t<y;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},o.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(Et.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>y&&(this.logger.log(Et.DEBUG,"Too large cursor position "+this.pos),this.pos=y)},o.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},o.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},o.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=h(e);this.pos>=y?this.logger.log(Et.ERROR,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},o.clearFromPos=function(e){var t;for(t=e;t<y;t++)this.chars[t].reset()},o.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},o.clearToEndOfRow=function(){this.clearFromPos(this.pos)},o.getTextString=function(){for(var e=[],t=!0,i=0;i<y;i++){var n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")},o.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),Qe=function(){function d(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<f;t++)this.rows.push(new st(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var o=d.prototype;return o.reset=function(){for(var e=0;e<f;e++)this.rows[e].clear();this.currRow=14},o.equals=function(e){for(var t=!0,i=0;i<f;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},o.copy=function(e){for(var t=0;t<f;t++)this.rows[t].copy(e.rows[t])},o.isEmpty=function(){for(var e=!0,t=0;t<f;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},o.backSpace=function(){this.rows[this.currRow].backSpace()},o.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},o.insertChar=function(e){this.rows[this.currRow].insertChar(e)},o.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},o.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},o.setCursor=function(e){this.logger.log(Et.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},o.setPAC=function(e){this.logger.log(Et.INFO,function(){return"pacData = "+JSON.stringify(e)});var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<f;i++)this.rows[i].clear();var n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var r=a.rows[n].cueStartTime,s=this.logger.time;if(r&&s!==null&&r<s)for(var l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(a.rows[n+l])}}this.currRow=t;var u=this.rows[this.currRow];if(e.indent!==null){var c=e.indent,v=Math.max(c-1,0);u.setCursor(e.indent),e.color=u.chars[v].penState.foreground}var m={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(m)},o.setBkgData=function(e){this.logger.log(Et.INFO,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},o.setRollUpRows=function(e){this.nrRollUpRows=e},o.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(Et.TEXT,function(){return e.getDisplayText()});var t=this.currRow+1-this.nrRollUpRows,i=this.rows.splice(t,1)[0];i.clear(),this.rows.splice(this.currRow,0,i),this.logger.log(Et.INFO,"Rolling up")}else this.logger.log(Et.DEBUG,"roll_up but nrRollUpRows not set yet")},o.getDisplayText=function(e){e=e||!1;for(var t=[],i="",n=-1,a=0;a<f;a++){var r=this.rows[a].getTextString();r&&(n=a+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
20
|
-
`)),i},o.getTextAndFormat=function(){return this.rows},d}(),ot=function(){function d(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Qe(i),this.nonDisplayedMemory=new Qe(i),this.lastOutputScreen=new Qe(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var o=d.prototype;return o.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},o.getHandler=function(){return this.outputFilter},o.setHandler=function(e){this.outputFilter=e},o.setPAC=function(e){this.writeScreen.setPAC(e)},o.setBkgData=function(e){this.writeScreen.setBkgData(e)},o.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(Et.INFO,function(){return"MODE="+e}),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},o.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(Et.INFO,function(){return n+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(Et.TEXT,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},o.ccRCL=function(){this.logger.log(Et.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},o.ccBS=function(){this.logger.log(Et.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},o.ccAOF=function(){},o.ccAON=function(){},o.ccDER=function(){this.logger.log(Et.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},o.ccRU=function(e){this.logger.log(Et.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},o.ccFON=function(){this.logger.log(Et.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},o.ccRDC=function(){this.logger.log(Et.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},o.ccTR=function(){this.logger.log(Et.INFO,"TR"),this.setMode("MODE_TEXT")},o.ccRTD=function(){this.logger.log(Et.INFO,"RTD"),this.setMode("MODE_TEXT")},o.ccEDM=function(){this.logger.log(Et.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},o.ccCR=function(){this.logger.log(Et.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},o.ccENM=function(){this.logger.log(Et.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},o.ccEOC=function(){var e=this;if(this.logger.log(Et.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(Et.TEXT,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},o.ccTO=function(e){this.logger.log(Et.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},o.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var i=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(Et.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},o.outputDataUpdate=function(e){e===void 0&&(e=!1);var t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},o.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},d}(),Ot=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var n=new ee;this.channels=[null,new ot(e,t,n),new ot(e+1,i,n)],this.cmdHistory={a:null,b:null},this.logger=n}var o=d.prototype;return o.getHandler=function(e){return this.channels[e].getHandler()},o.setHandler=function(e,t){this.channels[e].setHandler(t)},o.addData=function(e,t){var i,n,a,r=!1;this.logger.time=e;for(var s=0;s<t.length;s+=2)if(n=127&t[s],a=127&t[s+1],n!==0||a!==0){if(this.logger.log(Et.DATA,"["+Me([t[s],t[s+1]])+"] -> ("+Me([n,a])+")"),(i=this.parseCmd(n,a))||(i=this.parseMidrow(n,a)),i||(i=this.parsePAC(n,a)),i||(i=this.parseBackgroundAttributes(n,a)),!i&&(r=this.parseChars(n,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(r):this.logger.log(Et.WARNING,"No channel found yet. TEXT-MODE?")}i||r||this.logger.log(Et.WARNING,"Couldn't parse cleaned data "+Me([n,a])+" orig: "+Me([t[s],t[s+1]]))}},o.parseCmd=function(e,t){var i=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;if(rr(e,t,i))return qt(null,null,i),this.logger.log(Et.DEBUG,"Repeated command ("+Me([e,t])+") is dropped"),!0;var n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),qt(e,t,i),this.currentChannel=n,!0},o.parseMidrow=function(e,t){var i=0;if((e===17||e===25)&&t>=32&&t<=47){if((i=e===17?1:2)!==this.currentChannel)return this.logger.log(Et.ERROR,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(Et.DEBUG,"MIDROW ("+Me([e,t])+")"),!0)}return!1},o.parsePAC=function(e,t){var i,n=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;if(rr(e,t,n))return qt(null,null,n),!0;var a=e<=23?1:2;i=t>=64&&t<=95?a===1?b[e]:I[e]:a===1?M[e]:Y[e];var r=this.channels[a];return!!r&&(r.setPAC(this.interpretPAC(i,t)),qt(e,t,n),this.currentChannel=a,!0)},o.interpretPAC=function(e,t){var i,n={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,n.underline=(1&i)==1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((i-16)/2),n},o.parseChars=function(e,t){var i,n,a=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19?(n=r===17?t+80:r===18?t+112:t+144,this.logger.log(Et.INFO,"Special char '"+h(n)+"' in channel "+i),a=[n]):e>=32&&e<=127&&(a=t===0?[e]:[e,t]),a){var s=Me(a);this.logger.log(Et.DEBUG,"Char codes = "+s.join(",")),qt(e,t,this.cmdHistory)}return a},o.parseBackgroundAttributes=function(e,t){var i;if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;var n={};e===16||e===24?(i=Math.floor((t-32)/2),n.background=he[i],t%2==1&&(n.background=n.background+"_semi")):t===45?n.background="transparent":(n.foreground="black",t===47&&(n.underline=!0));var a=e<=23?1:2;return this.channels[a].setBkgData(n),qt(e,t,this.cmdHistory),!0},o.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},o.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},d}();function qt(d,o,e){e.a=d,e.b=o}function rr(d,o,e){return e.a===d&&e.b===o}let ur=Ot;var Tt=function(){function d(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var o=d.prototype;return o.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},o.newCue=function(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},o.reset=function(){this.cueRanges=[],this.startTime=null},d}();let Zt=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var d=["","lr","rl"],o=["start","middle","end","left","right"];function e(a,r){if(typeof r!="string"||!Array.isArray(a))return!1;var s=r.toLowerCase();return!!~a.indexOf(s)&&s}function t(a){return e(o,a)}function i(a){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;l<r;l++)s[l-1]=arguments[l];for(var u=1;u<arguments.length;u++){var c=arguments[u];for(var v in c)a[v]=c[v]}return a}function n(a,r,s){var l=this,u={enumerable:!0};l.hasBeenReset=!1;var c="",v=!1,m=a,_=r,S=s,F=null,P="",W=!0,ue="auto",_e="start",ge=50,De="middle",He=50,Je="middle";Object.defineProperty(l,"id",i({},u,{get:function(){return c},set:function(Ae){c=""+Ae}})),Object.defineProperty(l,"pauseOnExit",i({},u,{get:function(){return v},set:function(Ae){v=!!Ae}})),Object.defineProperty(l,"startTime",i({},u,{get:function(){return m},set:function(Ae){if(typeof Ae!="number")throw new TypeError("Start time must be set to a number.");m=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"endTime",i({},u,{get:function(){return _},set:function(Ae){if(typeof Ae!="number")throw new TypeError("End time must be set to a number.");_=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"text",i({},u,{get:function(){return S},set:function(Ae){S=""+Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",i({},u,{get:function(){return F},set:function(Ae){F=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",i({},u,{get:function(){return P},set:function(Ae){var Ke=function(je){return e(d,je)}(Ae);if(Ke===!1)throw new SyntaxError("An invalid or illegal string was specified.");P=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",i({},u,{get:function(){return W},set:function(Ae){W=!!Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",i({},u,{get:function(){return ue},set:function(Ae){if(typeof Ae!="number"&&Ae!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ue=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",i({},u,{get:function(){return _e},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");_e=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",i({},u,{get:function(){return ge},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Position must be between 0 and 100.");ge=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",i({},u,{get:function(){return De},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");De=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",i({},u,{get:function(){return He},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Size must be between 0 and 100.");He=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",i({},u,{get:function(){return Je},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");Je=Ke,this.hasBeenReset=!0}})),l.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();var sr=function(){function d(){}return d.prototype.decode=function(o,e){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},d}();function Lt(d){function o(t,i,n,a){return 3600*(0|t)+60*(0|i)+(0|n)+parseFloat(a||0)}var e=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?o(e[2],e[3],0,e[4]):o(e[1],e[2],e[3],e[4]):null}var nt=function(){function d(){this.values=Object.create(null)}var o=d.prototype;return o.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},o.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},o.has=function(e){return e in this.values},o.alt=function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},o.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},o.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1},d}();function vt(d,o,e,t){var i=t?d.split(t):[d];for(var n in i)if(typeof i[n]=="string"){var a=i[n].split(e);a.length===2&&o(a[0],a[1])}}var et=new Zt(0,0,""),ft=et.align==="middle"?"middle":"center";function Vt(d,o,e){var t=d;function i(){var a=Lt(d);if(a===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),a}function n(){d=d.replace(/^\s+/,"")}if(n(),o.startTime=i(),n(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),n(),o.endTime=i(),n(),function(a,r){var s=new nt;vt(a,function(c,v){var m;switch(c){case"region":for(var _=e.length-1;_>=0;_--)if(e[_].id===v){s.set(c,e[_].region);break}break;case"vertical":s.alt(c,v,["rl","lr"]);break;case"line":m=v.split(","),s.integer(c,m[0]),s.percent(c,m[0])&&s.set("snapToLines",!1),s.alt(c,m[0],["auto"]),m.length===2&&s.alt("lineAlign",m[1],["start",ft,"end"]);break;case"position":m=v.split(","),s.percent(c,m[0]),m.length===2&&s.alt("positionAlign",m[1],["start",ft,"end","line-left","line-right","auto"]);break;case"size":s.percent(c,v);break;case"align":s.alt(c,v,["start",ft,"end","left","right"])}},/:/,/\s/),r.region=s.get("region",null),r.vertical=s.get("vertical","");var l=s.get("line","auto");l==="auto"&&et.line===-1&&(l=-1),r.line=l,r.lineAlign=s.get("lineAlign","start"),r.snapToLines=s.get("snapToLines",!0),r.size=s.get("size",100),r.align=s.get("align",ft);var u=s.get("position","auto");u==="auto"&&et.position===50&&(u=r.align==="start"||r.align==="left"?0:r.align==="end"||r.align==="right"?100:50),r.position=u}(d,o)}function Xt(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
19
|
+
Time to underbuffer: `+De.toFixed(3)+" s"),a.nextLoadLevel=He,_&&this.bwEstimator.sample(v,l.loaded),this.clearTimer(),(i.loader||i.keyLoader)&&(this.fragCurrent=this.partCurrent=null,i.abortRequests()),a.trigger(g.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:n,stats:l}))}}}}}},t.onFragLoaded=function(i,n){var a=n.frag,r=n.part;if(a.type===fe.PlaylistLevelType.MAIN&&(0,R.isFiniteNumber)(a.sn)){var s=r?r.stats:a.stats,l=r?r.duration:a.duration;if(this.clearTimer(),this.lastLoadedFragLevel=a.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[a.level],c=(u.loaded?u.loaded.bytes:0)+s.loaded,v=(u.loaded?u.loaded.duration:0)+l;u.loaded={bytes:c,duration:v},u.realBitrate=Math.round(8*c/v)}if(a.bitrateTest){var m={stats:s,frag:a,part:r,id:a.type};this.onFragBuffered(g.Events.FRAG_BUFFERED,m)}}},t.onFragBuffered=function(i,n){var a=n.frag,r=n.part,s=r?r.stats:a.stats;if(!s.aborted&&a.type===fe.PlaylistLevelType.MAIN&&a.sn!=="initSegment"){var l=s.parsing.end-s.loading.start;this.bwEstimator.sample(l,s.loaded),s.bwEstimate=this.bwEstimator.getEstimate(),a.bitrateTest?this.bitrateTestDelay=l/1e3:this.bitrateTestDelay=0}},t.onError=function(i,n){var a;if(((a=n.frag)===null||a===void 0?void 0:a.type)===fe.PlaylistLevelType.MAIN){if(n.type===k.ErrorTypes.KEY_SYSTEM_ERROR)return void this.clearTimer();switch(n.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.clearTimer()}}},t.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},t.getNextABRAutoLevel=function(){var i=this.fragCurrent,n=this.partCurrent,a=this.hls,r=a.maxAutoLevel,s=a.config,l=a.minAutoLevel,u=a.media,c=n?n.duration:i?i.duration:0,v=u&&u.playbackRate!==0?Math.abs(u.playbackRate):1,m=this.bwEstimator?this.bwEstimator.getEstimate():s.abrEwmaDefaultEstimate,_=a.mainForwardBufferInfo,S=(_?_.len:0)/v,F=this.findBestLevel(m,l,r,S,s.abrBandWidthFactor,s.abrBandWidthUpFactor);if(F>=0)return F;L.logger.trace((S?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var P=c?Math.min(c,s.maxStarvationDelay):s.maxStarvationDelay,X=s.abrBandWidthFactor,ue=s.abrBandWidthUpFactor;if(!S){var _e=this.bitrateTestDelay;_e&&(P=(c?Math.min(c,s.maxLoadingDelay):s.maxLoadingDelay)-_e,L.logger.trace("bitrate test took "+Math.round(1e3*_e)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*P)+" ms"),X=ue=1)}return F=this.findBestLevel(m,l,r,S+P,X,ue),Math.max(F,0)},t.findBestLevel=function(i,n,a,r,s,l){for(var u,c=this.fragCurrent,v=this.partCurrent,m=this.lastLoadedFragLevel,_=this.hls.levels,S=_[m],F=!(S==null||(u=S.details)===null||u===void 0||!u.live),P=S==null?void 0:S.codecSet,X=v?v.duration:c?c.duration:0,ue=a;ue>=n;ue--){var _e=_[ue];if(_e&&(!P||_e.codecSet===P)){var ge,De=_e.details,He=(v?De==null?void 0:De.partTarget:De==null?void 0:De.averagetargetduration)||X;ge=ue<=m?s*i:l*i;var Je=_[ue].maxBitrate,Ae=Je*He/ge;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+ue+"/"+Math.round(ge)+"/"+Je+"/"+He+"/"+r+"/"+Ae),ge>Je&&(Ae===0||!(0,R.isFiniteNumber)(Ae)||F&&!this.bitrateTestDelay||Ae<r))return ue}}return-1},o=d,(e=[{key:"nextAutoLevel",get:function(){var i=this._nextAutoLevel,n=this.bwEstimator;if(i!==-1&&!n.canEstimate())return i;var a=this.getNextABRAutoLevel();return i!==-1&&this.hls.levels[a].loadError?i:(i!==-1&&(a=Math.min(i,a)),a)},set:function(i){this._nextAutoLevel=i}}])&&In(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}();var hn=function(){function d(){this.chunks=[],this.dataLength=0}var o=d.prototype;return o.push=function(e){this.chunks.push(e),this.dataLength+=e.length},o.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(n,a){for(var r=new Uint8Array(a),s=0,l=0;l<n.length;l++){var u=n[l];r.set(u,s),s+=u.length}return r}(t,i),this.reset(),e):new Uint8Array(0)},o.reset=function(){this.chunks.length=0,this.dataLength=0},d}();function mi(){return mi=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},mi.apply(this,arguments)}function Pi(d,o){return Pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Pi(d,o)}var yi=function(d){var o,e;function t(n,a,r){var s;return(s=d.call(this,n,a,r,"[audio-stream-controller]")||this).videoBuffer=null,s.videoTrackCC=-1,s.waitingVideoCC=-1,s.audioSwitch=!1,s.trackId=-1,s.waitingData=null,s.mainDetails=null,s.bufferFlushed=!1,s.cachedTrackLoadedData=null,s._registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Pi(o,e);var i=t.prototype;return i.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var n=this.hls;n.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(g.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.on(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(g.Events.ERROR,this.onError,this),n.on(g.Events.BUFFER_RESET,this.onBufferReset,this),n.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var n=this.hls;n.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(g.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.off(g.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(g.Events.ERROR,this.onError,this),n.off(g.Events.BUFFER_RESET,this.onBufferReset,this),n.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(g.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onInitPtsFound=function(n,a){var r=a.frag,s=a.id,l=a.initPTS;if(s==="main"){var u=r.cc;this.initPTS[r.cc]=l,this.log("InitPTS for cc: "+u+" found from main: "+l),this.videoTrackCC=u,this.state===Ur&&this.tick()}},i.startLoad=function(n){if(!this.levels)return this.startPosition=n,void(this.state=br);var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,a>0&&n===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),n=a,this.state=At):(this.loadedmetadata=!1,this.state=ci),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()},i.doTick=function(){switch(this.state){case At:this.doTickIdle();break;case ci:var n,a=this.levels,r=this.trackId,s=a==null||(n=a[r])===null||n===void 0?void 0:n.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=Ur}break;case Nr:var l,u=performance.now(),c=this.retryDate;(!c||u>=c||(l=this.media)!==null&&l!==void 0&&l.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=At);break;case Ur:var v=this.waitingData;if(v){var m=v.frag,_=v.part,S=v.cache,F=v.complete;if(this.initPTS[m.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=qr;var P={frag:m,part:_,payload:S.flush(),networkDetails:null};this._handleFragmentLoadProgress(P),F&&d.prototype._handleFragmentLoadComplete.call(this,P)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+m.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var X=this.getLoadPosition(),ue=Gt.bufferInfo(this.mediaBuffer,X,this.config.maxBufferHole);di(ue.end,this.config.maxFragLookUpTolerance,m)<0&&(this.log("Waiting fragment cc ("+m.cc+") @ "+m.start+" cancelled because another fragment at "+ue.end+" is needed"),this.clearWaitingFragment())}}else this.state=At}this.onTickEnd()},i.clearWaitingFragment=function(){var n=this.waitingData;n&&(this.fragmentTracker.removeFragment(n.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=At)},i.resetLoadingState=function(){this.clearWaitingFragment(),d.prototype.resetLoadingState.call(this)},i.onTickEnd=function(){var n=this.media;n&&n.readyState&&(this.lastCurrentTime=n.currentTime)},i.doTickIdle=function(){var n=this.hls,a=this.levels,r=this.media,s=this.trackId,l=n.config;if(a&&a[s]&&(r||!this.startFragRequested&&l.startFragPrefetch)){var u=a[s].details;if(!u||u.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(u))this.state=ci;else{var c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,J.ElementaryStreamTypes.AUDIO,fe.PlaylistLevelType.AUDIO));var v=this.getFwdBufferInfo(c,fe.PlaylistLevelType.AUDIO);if(v!==null){var m=this.audioSwitch;if(!m&&this._streamEnded(v,u))return n.trigger(g.Events.BUFFER_EOS,{type:"audio"}),void(this.state=ei);var _=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,fe.PlaylistLevelType.MAIN);if(!(v.len>=this.getMaxBufferLength(_==null?void 0:_.len))||m){var S=u.fragments[0].start,F=v.end;if(m&&r){var P=this.getLoadPosition();F=P,u.PTSKnown&&P<S&&(v.end>S||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=S+.05)}if(!(_&&F>_.end+u.targetduration)&&(_&&_.len||!v.len)){var X=this.getNextFragment(F,u);X?this.loadFragment(X,u,F):this.bufferFlushed=!0}}}}}},i.getMaxBufferLength=function(n){var a=d.prototype.getMaxBufferLength.call(this);return n?Math.max(a,n):a},i.onMediaDetaching=function(){this.videoBuffer=null,d.prototype.onMediaDetaching.call(this)},i.onAudioTracksUpdated=function(n,a){var r=a.audioTracks;this.resetTransmuxer(),this.levels=r.map(function(s){return new N(s)})},i.onAudioTrackSwitching=function(n,a){var r=!!a.url;this.trackId=a.id;var s=this.fragCurrent;s&&s.abortRequests(),this.fragCurrent=null,this.clearWaitingFragment(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.audioSwitch=!0,this.state=At):this.state=br,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},i.onLevelLoaded=function(n,a){this.mainDetails=a.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(g.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},i.onAudioTrackLoaded=function(n,a){var r;if(this.mainDetails!=null){var s=this.levels,l=a.details,u=a.id;if(s){this.log("Track "+u+" loaded ["+l.startSN+","+l.endSN+"],duration:"+l.totalduration);var c=s[u],v=0;if(l.live||(r=c.details)!==null&&r!==void 0&&r.live){var m=this.mainDetails;if(l.fragments[0]||(l.deltaUpdateFailed=!0),l.deltaUpdateFailed||!m)return;!c.details&&l.hasProgramDateTime&&m.hasProgramDateTime?(an(l,m),v=l.fragments[0].start):v=this.alignPlaylists(l,c.details)}c.details=l,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&l.live||this.setStartPosition(c.details,v),this.state!==ci||this.waitForCdnTuneIn(l)||(this.state=At),this.tick()}else this.warn("Audio tracks were reset while loading level "+u)}else this.cachedTrackLoadedData=a},i._handleFragmentLoadProgress=function(n){var a,r=n.frag,s=n.part,l=n.payload,u=this.config,c=this.trackId,v=this.levels;if(v){var m=v[c],_=m.details,S=u.defaultAudioCodec||m.audioCodec||"mp4a.40.2",F=this.transmuxer;F||(F=this.transmuxer=new Ii(this.hls,fe.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var P=this.initPTS[r.cc],X=(a=r.initSegment)===null||a===void 0?void 0:a.data;if(P!==void 0){var ue=s?s.index:-1,_e=ue!==-1,ge=new Di(r.level,r.sn,r.stats.chunkCount,l.byteLength,ue,_e);F.push(l,X,S,"",r,s,_.totalduration,!1,ge,P)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+c),(this.waitingData=this.waitingData||{frag:r,part:s,cache:new hn,complete:!1}).cache.push(new Uint8Array(l)),this.waitingVideoCC=this.videoTrackCC,this.state=Ur}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},i._handleFragmentLoadComplete=function(n){this.waitingData?this.waitingData.complete=!0:d.prototype._handleFragmentLoadComplete.call(this,n)},i.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},i.onBufferCreated=function(n,a){var r=a.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer||null)},i.onFragBuffered=function(n,a){var r,s=a.frag,l=a.part;s.type===fe.PlaylistLevelType.AUDIO?this.fragContextChanged(s)?this.warn("Fragment "+s.sn+(l?" p: "+l.index:"")+" of level "+s.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):(s.sn!=="initSegment"&&(this.fragPrevious=s,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(s,l)):this.loadedmetadata||s.type!==fe.PlaylistLevelType.MAIN||(r=this.videoBuffer||this.media)!==null&&r!==void 0&&r.buffered.length&&(this.loadedmetadata=!0)},i.onError=function(n,a){if(a.type!==k.ErrorTypes.KEY_SYSTEM_ERROR)switch(a.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.FRAG_PARSING_ERROR:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.AUDIO,a);break;case k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==Lr&&this.state!==br&&(this.state=a.fatal?Lr:At,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===wr||this.state===Vr)){var r=!0,s=this.getFwdBufferInfo(this.mediaBuffer,fe.PlaylistLevelType.AUDIO);s&&s.len>.5&&(r=!this.reduceMaxBufferLength(s.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(fe.PlaylistLevelType.AUDIO,a)},i.onBufferFlushed=function(n,a){a.type===J.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0,this.state===ei&&(this.state=At))},i._handleTransmuxComplete=function(n){var a,r="audio",s=this.hls,l=n.remuxResult,u=n.chunkMeta,c=this.getCurrentContext(u);if(!c)return this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(u.level);var v=c.frag,m=c.part,_=c.level.details,S=l.audio,F=l.text,P=l.id3,X=l.initSegment;if(!this.fragContextChanged(v)&&_){if(this.state=wr,this.audioSwitch&&S&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,v,u),s.trigger(g.Events.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:X.tracks})),S){var ue=S.startPTS,_e=S.endPTS,ge=S.startDTS,De=S.endDTS;m&&(m.elementaryStreams[J.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:_e,startDTS:ge,endDTS:De}),v.setElementaryStreamInfo(J.ElementaryStreamTypes.AUDIO,ue,_e,ge,De),this.bufferFragmentData(S,v,m,u)}if(P!=null&&(a=P.samples)!==null&&a!==void 0&&a.length){var He=mi({id:r,frag:v,details:_},P);s.trigger(g.Events.FRAG_PARSING_METADATA,He)}if(F){var Je=mi({id:r,frag:v,details:_},F);s.trigger(g.Events.FRAG_PARSING_USERDATA,Je)}}},i._bufferInitSegment=function(n,a,r){if(this.state===wr){n.video&&delete n.video;var s=n.audio;if(s){s.levelCodec=s.codec,s.id="audio",this.log("Init audio buffer, container:"+s.container+", codecs[parsed]=["+s.codec+"]"),this.hls.trigger(g.Events.BUFFER_CODECS,n);var l=s.initSegment;if(l!=null&&l.byteLength){var u={type:"audio",frag:a,part:null,chunkMeta:r,parent:a.type,data:l};this.hls.trigger(g.Events.BUFFER_APPENDING,u)}this.tick()}}},i.loadFragment=function(n,a,r){var s=this.fragmentTracker.getState(n);this.fragCurrent=n,(this.audioSwitch||s===Ge.NOT_LOADED||s===Ge.PARTIAL)&&(n.sn==="initSegment"?this._loadInitSegment(n,a):a.live&&!(0,R.isFiniteNumber)(this.initPTS[n.cc])?(this.log("Waiting for video PTS in continuity counter "+n.cc+" of live stream before loading audio fragment "+n.sn+" of level "+this.trackId),this.state=Ur):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,n,a,r)))},i.completeAudioSwitch=function(){var n=this.hls,a=this.media,r=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,n.trigger(g.Events.AUDIO_TRACK_SWITCHED,{id:r})},t}(hi);let Oi=yi;function fn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function ii(d,o){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ii(d,o)}let Pn=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[audio-track-controller]")||this).tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,ii(o,e);var i,n,a=t.prototype;return a.registerListeners=function(){var r=this.hls;r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(g.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,d.prototype.destroy.call(this)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},a.onManifestParsed=function(r,s){this.tracks=s.audioTracks||[]},a.onAudioTrackLoaded=function(r,s){var l=s.id,u=s.details,c=this.tracksInGroup[l];if(c){var v=c.details;c.details=s.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,v))}else this.warn("Invalid audio track id "+l)},a.onLevelLoading=function(r,s){this.switchLevel(s.level)},a.onLevelSwitching=function(r,s){this.switchLevel(s.level)},a.switchLevel=function(r){var s=this.hls.levels[r];if(s!=null&&s.audioGroupIds){var l=s.audioGroupIds[s.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!u.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var c={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(g.Events.AUDIO_TRACKS_UPDATED,c),this.selectInitialTrack()}}},a.onError=function(r,s){d.prototype.onError.call(this,r,s),!s.fatal&&s.context&&s.context.type===fe.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},a.setAudioTrack=function(r){var s=this.tracksInGroup;if(r<0||r>=s.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var l=s[this.trackId];this.log("Now switching to audio-track index "+r);var u=s[r],c=u.id,v=u.groupId,m=v===void 0?"":v,_=u.name,S=u.type,F=u.url;if(this.trackId=r,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(g.Events.AUDIO_TRACK_SWITCHING,{id:c,groupId:m,name:_,type:S,url:F}),!u.details||u.details.live){var P=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(P)}}},a.selectInitialTrack=function(){this.tracksInGroup;var r=this.trackName,s=this.findTrackId(r)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},a.findTrackId=function(r){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var u=s[l];if((!this.selectDefaultTrack||u.default)&&(!r||r===u.name))return u.id}return-1},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,u=s.groupId,c=s.url;if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(g.Events.AUDIO_TRACK_LOADING,{url:c,id:l,groupId:u,deliveryDirectives:r||null})}},i=t,(n=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1,this.setAudioTrack(r)}}])&&fn(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);function On(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function xi(d,o){return xi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xi(d,o)}var xn=function(d){var o,e;function t(r,s,l){var u;return(u=d.call(this,r,s,l,"[subtitle-stream-controller]")||this).levels=[],u.currentTrackId=-1,u.tracksBuffered=[],u.mainDetails=null,u._registerListeners(),u}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,xi(o,e);var i,n,a=t.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(g.Events.ERROR,this.onError,this),r.on(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.on(g.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),r.on(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(g.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),r.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(g.Events.ERROR,this.onError,this),r.off(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(g.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),r.off(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(g.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),r.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(g.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.startLoad=function(r){this.stopLoad(),this.state=At,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},a.onLevelLoaded=function(r,s){this.mainDetails=s.details},a.onSubtitleFragProcessed=function(r,s){var l=s.frag,u=s.success;if(this.fragPrevious=l,this.state=At,u){var c=this.tracksBuffered[this.currentTrackId];if(c){for(var v,m=l.start,_=0;_<c.length;_++)if(m>=c[_].start&&m<=c[_].end){v=c[_];break}var S=l.start+l.duration;v?v.end=S:(v={start:m,end:S},c.push(v)),this.fragmentTracker.fragBuffered(l)}}},a.onBufferFlushing=function(r,s){var l=s.startOffset,u=s.endOffset;if(l===0&&u!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,v=this.levels;if(!v.length||!v[c]||!v[c].details)return;var m=u-v[c].details.targetduration;if(m<=0)return;s.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(_){for(var S=0;S<_.length;)if(_[S].end<=m)_.shift();else{if(!(_[S].start<m))break;_[S].start=m,S++}}),this.fragmentTracker.removeFragmentsInRange(l,m,fe.PlaylistLevelType.SUBTITLE)}},a.onFragBuffered=function(r,s){var l;this.loadedmetadata||s.frag.type!==fe.PlaylistLevelType.MAIN||(l=this.media)!==null&&l!==void 0&&l.buffered.length&&(this.loadedmetadata=!0)},a.onError=function(r,s){var l=s.frag;l&&l.type===fe.PlaylistLevelType.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state=At)},a.onSubtitleTracksUpdated=function(r,s){var l=this,u=s.subtitleTracks;this.tracksBuffered=[],this.levels=u.map(function(c){return new N(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){l.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},a.onSubtitleTrackSwitch=function(r,s){if(this.currentTrackId=s.id,this.levels.length&&this.currentTrackId!==-1){var l=this.levels[this.currentTrackId];l!=null&&l.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,l&&this.setInterval(500)}else this.clearInterval()},a.onSubtitleTrackLoaded=function(r,s){var l,u=s.details,c=s.id,v=this.currentTrackId,m=this.levels;if(m.length){var _=m[v];if(!(c>=m.length||c!==v)&&_){this.mediaBuffer=this.mediaBufferTimeRanges;var S=0;if(u.live||(l=_.details)!==null&&l!==void 0&&l.live){var F=this.mainDetails;if(u.deltaUpdateFailed||!F)return;var P=F.fragments[0];_.details?(S=this.alignPlaylists(u,_.details))===0&&P&&Te(u,S=P.start):u.hasProgramDateTime&&F.hasProgramDateTime?(an(u,F),S=u.fragments[0].start):P&&Te(u,S=P.start)}_.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(_.details,S),this.tick(),u.live&&!this.fragCurrent&&this.media&&this.state===At&&(ui(null,u.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.details=void 0))}}},a._handleFragmentLoadComplete=function(r){var s=this,l=r.frag,u=r.payload,c=l.decryptdata,v=this.hls;if(!this.fragContextChanged(l)&&u&&u.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var m=performance.now();this.decrypter.decrypt(new Uint8Array(u),c.key.buffer,c.iv.buffer).then(function(_){var S=performance.now();v.trigger(g.Events.FRAG_DECRYPTED,{frag:l,payload:_,stats:{tstart:m,tdecrypt:S}})}).catch(function(_){s.warn(_.name+": "+_.message),s.state=At})}},a.doTick=function(){if(this.media){if(this.state===At){var r=this.currentTrackId,s=this.levels;if(!s.length||!s[r]||!s[r].details)return;var l=s[r].details,u=l.targetduration,c=this.config,v=this.getLoadPosition(),m=Gt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],v-u,c.maxBufferHole),_=m.end,S=m.len,F=this.getFwdBufferInfo(this.media,fe.PlaylistLevelType.MAIN);if(S>this.getMaxBufferLength(F==null?void 0:F.len)+u)return;var P=l.fragments,X=P.length,ue=l.edge,_e=null,ge=this.fragPrevious;if(_<ue){var De=c.maxFragLookUpTolerance;!(_e=ui(ge,P,Math.max(P[0].start,_),De))&&ge&&ge.start<P[0].start&&(_e=P[0])}else _e=P[X-1];if(!_e)return;_e=this.mapToInitFragWhenRequired(_e),this.fragmentTracker.getState(_e)===Ge.NOT_LOADED&&this.loadFragment(_e,l,_)}}else this.state=At},a.getMaxBufferLength=function(r){var s=d.prototype.getMaxBufferLength.call(this);return r?Math.max(s,r):s},a.loadFragment=function(r,s,l){this.fragCurrent=r,r.sn==="initSegment"?this._loadInitSegment(r,s):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,r,s,l))},i=t,(n=[{key:"mediaBufferTimeRanges",get:function(){return new Mn(this.tracksBuffered[this.currentTrackId]||[])}}])&&On(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(hi),Mn=function(d){this.buffered=void 0;var o=function(e,t,i){if((t>>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+i+")");return d[t][e]};this.buffered={get length(){return d.length},end:function(e){return o("end",e,d.length)},start:function(e){return o("start",e,d.length)}}};function Fn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Mi(d,o){return Mi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mi(d,o)}function Fi(d){for(var o=[],e=0;e<d.length;e++){var t=d[e];t.kind==="subtitles"&&t.label&&o.push(d[e])}return o}let Nn=function(d){var o,e;function t(r){var s;return(s=d.call(this,r,"[subtitle-track-controller]")||this).media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s._subtitleDisplay=!0,s.registerListeners(),s}e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Mi(o,e);var i,n,a=t.prototype;return a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},a.registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(g.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(g.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(g.Events.ERROR,this.onError,this)},a.onMediaAttached=function(r,s){this.media=s.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Fi(this.media.textTracks).forEach(function(r){lt(r)}),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(r,s){this.tracks=s.subtitleTracks},a.onSubtitleTrackLoaded=function(r,s){var l=s.id,u=s.details,c=this.trackId,v=this.tracksInGroup[c];if(v){var m=v.details;v.details=s.details,this.log("subtitle track "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,m))}else this.warn("Invalid subtitle track id "+l)},a.onLevelLoading=function(r,s){this.switchLevel(s.level)},a.onLevelSwitching=function(r,s){this.switchLevel(s.level)},a.switchLevel=function(r){var s=this.hls.levels[r];if(s!=null&&s.textGroupIds){var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(_){return!l||_.groupId===l});this.tracksInGroup=c;var v=this.findTrackId(u==null?void 0:u.name)||this.findTrackId();this.groupId=l;var m={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(g.Events.SUBTITLE_TRACKS_UPDATED,m),v!==-1&&this.setSubtitleTrack(v,u)}}},a.findTrackId=function(r){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var u=s[l];if((!this.selectDefaultTrack||u.default)&&(!r||r===u.name))return u.id}return-1},a.onError=function(r,s){d.prototype.onError.call(this,r,s),!s.fatal&&s.context&&s.context.type===fe.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},a.loadPlaylist=function(r){d.prototype.loadPlaylist.call(this);var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,u=s.groupId,c=s.url;if(r)try{c=r.addDirectives(c)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(g.Events.SUBTITLE_TRACK_LOADING,{url:c,id:l,groupId:u,deliveryDirectives:r||null})}},a.toggleTrackModes=function(r){var s=this,l=this.media,u=this.trackId;if(l){var c=Fi(l.textTracks),v=c.filter(function(S){return S.groupId===s.groupId});if(r===-1)[].slice.call(c).forEach(function(S){S.mode="disabled"});else{var m=v[u];m&&(m.mode="disabled")}var _=v[r];_&&(_.mode=this.subtitleDisplay?"showing":"hidden")}},a.setSubtitleTrack=function(r,s){var l,u=this.tracksInGroup;if(this.media){if(this.trackId!==r&&this.toggleTrackModes(r),!(this.trackId===r&&(r===-1||(l=u[r])!==null&&l!==void 0&&l.details)||r<-1||r>=u.length)){this.clearTimer();var c=u[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,c){var v=c.id,m=c.groupId,_=m===void 0?"":m,S=c.name,F=c.type,P=c.url;this.hls.trigger(g.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:_,name:S,type:F,url:P});var X=this.switchParams(c.url,s==null?void 0:s.details);this.loadPlaylist(X)}else this.hls.trigger(g.Events.SUBTITLE_TRACK_SWITCH,{id:r})}}else this.queuedDefaultTrack=r},a.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var r=-1,s=Fi(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")r=l;else if(s[l].mode==="showing"){r=l;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)}},i=t,(n=[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(r){this._subtitleDisplay=r,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,s)}}])&&Fn(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(Re);var Tt,gr=function(){function d(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var o=d.prototype;return o.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},o.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},o.appendBlocker=function(e){var t,i=new Promise(function(a){t=a}),n={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,e),i},o.executeNext=function(e){var t=this.buffers,i=this.queues,n=t[e],a=i[e];if(a.length){var r=a[0];try{r.execute()}catch(s){L.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),r.onError(s),n&&n.updating||(a.shift(),this.executeNext(e))}}},o.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},o.current=function(e){return this.queues[e][0]},d}(),Xr=fi(),vn=/([ha]vc.)(?:\.[^.,]+)+/,Un=function(){function d(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var i=t.hls,n=t.media,a=t.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),n&&(t.updateMediaElementDuration(),i.trigger(g.Events.MEDIA_ATTACHED,{media:n})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){L.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){L.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var o=d.prototype;return o.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},o.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},o.registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.Events.BUFFER_RESET,this.onBufferReset,this),e.on(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.Events.BUFFER_EOS,this.onBufferEos,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.Events.FRAG_PARSED,this.onFragParsed,this),e.on(g.Events.FRAG_CHANGED,this.onFragChanged,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.Events.BUFFER_RESET,this.onBufferReset,this),e.off(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.Events.BUFFER_EOS,this.onBufferEos,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.Events.FRAG_PARSED,this.onFragParsed,this),e.off(g.Events.FRAG_CHANGED,this.onFragChanged,this)},o._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new gr(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},o.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},o.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Xr){var n=this.mediaSource=new Xr;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(n),this._objectUrl=i.src}},o.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(L.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(n){L.logger.warn("[buffer-controller]: onMediaDetaching: "+n.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):L.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(g.Events.MEDIA_DETACHED,void 0)},o.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(n){L.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",n)}}),this._initSourceBuffer()},o.onBufferCodecs=function(e,t){var i=this,n=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(a){if(n){var r=i.tracks[a];if(r&&typeof r.buffer.changeType=="function"){var s=t[a],l=s.id,u=s.codec,c=s.levelCodec,v=s.container,m=s.metadata,_=(r.levelCodec||r.codec).replace(vn,"$1"),S=(c||u).replace(vn,"$1");if(_!==S){var F=v+";codecs="+(c||u);i.appendChangeType(a,F),L.logger.log("[buffer-controller]: switching codec "+_+" to "+S),i.tracks[a]={buffer:r.buffer,codec:u,container:v,levelCodec:c,metadata:m,id:l}}}}else i.pendingTracks[a]=t[a]}),n||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},o.appendChangeType=function(e,t){var i=this,n=this.operationQueue,a={execute:function(){var r=i.sourceBuffer[e];r&&(L.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),r.changeType(t)),n.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(r){L.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",r)}};n.append(a,e)},o.onBufferAppending=function(e,t){var i=this,n=this.hls,a=this.operationQueue,r=this.tracks,s=t.data,l=t.type,u=t.frag,c=t.part,v=t.chunkMeta,m=v.buffering[l],_=self.performance.now();m.start=_;var S=u.stats.buffering,F=c?c.stats.buffering:null;S.start===0&&(S.start=_),F&&F.start===0&&(F.start=_);var P=r.audio,X=!1;l==="audio"&&(P==null?void 0:P.container)==="audio/mpeg"&&(X=!this.lastMpegAudioChunk||v.id===1||this.lastMpegAudioChunk.sn!==v.sn,this.lastMpegAudioChunk=v);var ue=u.start,_e={execute:function(){if(m.executeStart=self.performance.now(),X){var ge=i.sourceBuffer[l];if(ge){var De=ue-ge.timestampOffset;Math.abs(De)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+ue+" (delta: "+De+") sn: "+u.sn+")"),ge.timestampOffset=ue)}}i.appendExecutor(s,l)},onStart:function(){},onComplete:function(){var ge=self.performance.now();m.executeEnd=m.end=ge,S.first===0&&(S.first=ge),F&&F.first===0&&(F.first=ge);var De=i.sourceBuffer,He={};for(var Je in De)He[Je]=Gt.getBuffered(De[Je]);i.appendError=0,i.hls.trigger(g.Events.BUFFER_APPENDED,{type:l,frag:u,part:c,chunkMeta:v,parent:u.type,timeRanges:He})},onError:function(ge){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+l+" SourceBuffer",ge);var De={type:k.ErrorTypes.MEDIA_ERROR,parent:u.type,details:k.ErrorDetails.BUFFER_APPEND_ERROR,err:ge,fatal:!1};ge.code===DOMException.QUOTA_EXCEEDED_ERR?De.details=k.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,De.details=k.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>n.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),De.fatal=!0,n.stopLoad())),n.trigger(g.Events.ERROR,De)}};a.append(_e,l)},o.onBufferFlushing=function(e,t){var i=this,n=this.operationQueue,a=function(r){return{execute:i.removeExecutor.bind(i,r,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(g.Events.BUFFER_FLUSHED,{type:r})},onError:function(s){L.logger.warn("[buffer-controller]: Failed to remove from "+r+" SourceBuffer",s)}}};t.type?n.append(a(t.type),t.type):this.getSourceBufferTypes().forEach(function(r){n.append(a(r),r)})},o.onFragParsed=function(e,t){var i=this,n=t.frag,a=t.part,r=[],s=a?a.elementaryStreams:n.elementaryStreams;s[J.ElementaryStreamTypes.AUDIOVIDEO]?r.push("audiovideo"):(s[J.ElementaryStreamTypes.AUDIO]&&r.push("audio"),s[J.ElementaryStreamTypes.VIDEO]&&r.push("video")),r.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers(function(){var l=self.performance.now();n.stats.buffering.end=l,a&&(a.stats.buffering.end=l);var u=a?a.stats:n.stats;i.hls.trigger(g.Events.FRAG_BUFFERED,{frag:n,part:a,stats:u,id:n.type})},r)},o.onFragChanged=function(e,t){this.flushBackBuffer()},o.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(n,a){var r=i.sourceBuffer[a];return!r||t.type&&t.type!==a||(r.ending=!0,r.ended||(r.ended=!0,L.logger.log("[buffer-controller]: "+a+" sourceBuffer now EOS"))),n&&!(r&&!r.ended)},!0)&&(L.logger.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(a){var r=i.sourceBuffer[a];r&&(r.ending=!1)});var n=i.mediaSource;n&&n.readyState==="open"?(L.logger.log("[buffer-controller]: Calling mediaSource.endOfStream()"),n.endOfStream()):n&&L.logger.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+n.readyState)}))},o.onLevelUpdated=function(e,t){var i=t.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},o.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,n=this.sourceBuffer;if(i&&t!==null){var a=this.getSourceBufferTypes();if(a.length){var r=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if((0,R.isFiniteNumber)(r)&&!(r<0)){var s=i.currentTime,l=t.levelTargetDuration,u=Math.max(r,l),c=Math.floor(s/l)*l-u;a.forEach(function(v){var m=n[v];if(m){var _=Gt.getBuffered(m);if(_.length>0&&c>_.start(0)){if(e.trigger(g.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),t.live)e.trigger(g.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c});else if(m.ended&&_.end(_.length-1)-s<2*l)return void L.logger.info("[buffer-controller]: Cannot flush "+v+" back buffer while SourceBuffer is in ended state");e.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:v})}}})}}}},o.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,n=this.mediaSource,a=e.fragments[0].start+e.totalduration,r=i.duration,s=(0,R.isFiniteNumber)(n.duration)?n.duration:0;e.live&&t.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(e)):(a>s&&a>r||!(0,R.isFiniteNumber)(r))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),n.duration=a)}},o.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var n=Math.max(0,i[0].start),a=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,a)}},o.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,n=Object.keys(i).length;if(n&&!e||n===2){this.createSourceBuffers(i),this.pendingTracks={};var a=this.getSourceBufferTypes();if(a.length===0)return void this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach(function(r){t.executeNext(r)})}},o.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var n=0;for(var a in e)if(!t[a]){var r=e[a];if(!r)throw Error("source buffer exists for track "+a+", however track does not");var s=r.levelCodec||r.codec,l=r.container+";codecs="+s;L.logger.log("[buffer-controller]: creating sourceBuffer("+l+")");try{var u=t[a]=i.addSourceBuffer(l),c=a;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[a]={buffer:u,codec:s,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id},n++}catch(v){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+v.message),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,mimeType:l})}}n&&this.hls.trigger(g.Events.BUFFER_CREATED,{tracks:this.tracks})},o._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},o._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},o._onSBUpdateError=function(e,t){L.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(e);i&&i.onError(t)},o.removeExecutor=function(e,t,i){var n=this.media,a=this.mediaSource,r=this.operationQueue,s=this.sourceBuffer[e];if(!n||!a||!s)return L.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(e);var l=(0,R.isFiniteNumber)(n.duration)?n.duration:1/0,u=(0,R.isFiniteNumber)(a.duration)?a.duration:1/0,c=Math.max(0,t),v=Math.min(i,l,u);v>c&&!s.ending?(s.ended=!1,L.logger.log("[buffer-controller]: Removing ["+c+","+v+"] from the "+e+" SourceBuffer"),s.remove(c,v)):r.shiftAndExecuteNext(e)},o.appendExecutor=function(e,t){var i=this.operationQueue,n=this.sourceBuffer[t];if(!n)return L.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);n.ended=!1,n.appendBuffer(e)},o.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var n=this.operationQueue,a=t.map(function(r){return n.appendBlocker(r)});Promise.all(a).then(function(){e(),t.forEach(function(r){var s=i.sourceBuffer[r];s&&s.updating||n.shiftAndExecuteNext(r)})})},o.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},o.addBufferListener=function(e,t,i){var n=this.sourceBuffer[e];if(n){var a=i.bind(this,e);this.listeners[e].push({event:t,listener:a}),n.addEventListener(t,a)}},o.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},d}(),p={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},h=function(d){var o=d;return p.hasOwnProperty(d)&&(o=p[d]),String.fromCharCode(o)},f=15,y=100,b={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},M={17:2,18:4,21:6,22:8,23:10,19:13,20:15},I={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Y={25:2,26:4,29:6,30:8,31:10,27:13,28:15},he=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(Tt||(Tt={}));var ee=function(){function d(){this.time=null,this.verboseLevel=Tt.ERROR}return d.prototype.log=function(o,e){if(this.verboseLevel>=o){var t=typeof e=="function"?e():e;L.logger.log(this.time+" ["+o+"] "+t)}},d}(),Me=function(d){for(var o=[],e=0;e<d.length;e++)o.push(d[e].toString(16));return o},ut=function(){function d(e,t,i,n,a){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=n||"black",this.flash=a||!1}var o=d.prototype;return o.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},o.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}},o.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},o.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},o.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},o.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),Ze=function(){function d(e,t,i,n,a,r){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new ut(t,i,n,a,r)}var o=d.prototype;return o.reset=function(){this.uchar=" ",this.penState.reset()},o.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},o.setPenState=function(e){this.penState.copy(e)},o.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},o.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},o.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),st=function(){function d(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<y;t++)this.chars.push(new Ze);this.logger=e,this.pos=0,this.currPenState=new ut}var o=d.prototype;return o.equals=function(e){for(var t=!0,i=0;i<y;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},o.copy=function(e){for(var t=0;t<y;t++)this.chars[t].copy(e.chars[t])},o.isEmpty=function(){for(var e=!0,t=0;t<y;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},o.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(Tt.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>y&&(this.logger.log(Tt.DEBUG,"Too large cursor position "+this.pos),this.pos=y)},o.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},o.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},o.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=h(e);this.pos>=y?this.logger.log(Tt.ERROR,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},o.clearFromPos=function(e){var t;for(t=e;t<y;t++)this.chars[t].reset()},o.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},o.clearToEndOfRow=function(){this.clearFromPos(this.pos)},o.getTextString=function(){for(var e=[],t=!0,i=0;i<y;i++){var n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")},o.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),Qe=function(){function d(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<f;t++)this.rows.push(new st(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var o=d.prototype;return o.reset=function(){for(var e=0;e<f;e++)this.rows[e].clear();this.currRow=14},o.equals=function(e){for(var t=!0,i=0;i<f;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},o.copy=function(e){for(var t=0;t<f;t++)this.rows[t].copy(e.rows[t])},o.isEmpty=function(){for(var e=!0,t=0;t<f;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},o.backSpace=function(){this.rows[this.currRow].backSpace()},o.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},o.insertChar=function(e){this.rows[this.currRow].insertChar(e)},o.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},o.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},o.setCursor=function(e){this.logger.log(Tt.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},o.setPAC=function(e){this.logger.log(Tt.INFO,function(){return"pacData = "+JSON.stringify(e)});var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<f;i++)this.rows[i].clear();var n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var r=a.rows[n].cueStartTime,s=this.logger.time;if(r&&s!==null&&r<s)for(var l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(a.rows[n+l])}}this.currRow=t;var u=this.rows[this.currRow];if(e.indent!==null){var c=e.indent,v=Math.max(c-1,0);u.setCursor(e.indent),e.color=u.chars[v].penState.foreground}var m={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(m)},o.setBkgData=function(e){this.logger.log(Tt.INFO,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},o.setRollUpRows=function(e){this.nrRollUpRows=e},o.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(Tt.TEXT,function(){return e.getDisplayText()});var t=this.currRow+1-this.nrRollUpRows,i=this.rows.splice(t,1)[0];i.clear(),this.rows.splice(this.currRow,0,i),this.logger.log(Tt.INFO,"Rolling up")}else this.logger.log(Tt.DEBUG,"roll_up but nrRollUpRows not set yet")},o.getDisplayText=function(e){e=e||!1;for(var t=[],i="",n=-1,a=0;a<f;a++){var r=this.rows[a].getTextString();r&&(n=a+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
20
|
+
`)),i},o.getTextAndFormat=function(){return this.rows},d}(),ot=function(){function d(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Qe(i),this.nonDisplayedMemory=new Qe(i),this.lastOutputScreen=new Qe(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var o=d.prototype;return o.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},o.getHandler=function(){return this.outputFilter},o.setHandler=function(e){this.outputFilter=e},o.setPAC=function(e){this.writeScreen.setPAC(e)},o.setBkgData=function(e){this.writeScreen.setBkgData(e)},o.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(Tt.INFO,function(){return"MODE="+e}),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},o.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(Tt.INFO,function(){return n+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(Tt.TEXT,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},o.ccRCL=function(){this.logger.log(Tt.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},o.ccBS=function(){this.logger.log(Tt.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},o.ccAOF=function(){},o.ccAON=function(){},o.ccDER=function(){this.logger.log(Tt.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},o.ccRU=function(e){this.logger.log(Tt.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},o.ccFON=function(){this.logger.log(Tt.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},o.ccRDC=function(){this.logger.log(Tt.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},o.ccTR=function(){this.logger.log(Tt.INFO,"TR"),this.setMode("MODE_TEXT")},o.ccRTD=function(){this.logger.log(Tt.INFO,"RTD"),this.setMode("MODE_TEXT")},o.ccEDM=function(){this.logger.log(Tt.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},o.ccCR=function(){this.logger.log(Tt.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},o.ccENM=function(){this.logger.log(Tt.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},o.ccEOC=function(){var e=this;if(this.logger.log(Tt.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(Tt.TEXT,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},o.ccTO=function(e){this.logger.log(Tt.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},o.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var i=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(Tt.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},o.outputDataUpdate=function(e){e===void 0&&(e=!1);var t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},o.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},d}(),Ot=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var n=new ee;this.channels=[null,new ot(e,t,n),new ot(e+1,i,n)],this.cmdHistory={a:null,b:null},this.logger=n}var o=d.prototype;return o.getHandler=function(e){return this.channels[e].getHandler()},o.setHandler=function(e,t){this.channels[e].setHandler(t)},o.addData=function(e,t){var i,n,a,r=!1;this.logger.time=e;for(var s=0;s<t.length;s+=2)if(n=127&t[s],a=127&t[s+1],n!==0||a!==0){if(this.logger.log(Tt.DATA,"["+Me([t[s],t[s+1]])+"] -> ("+Me([n,a])+")"),(i=this.parseCmd(n,a))||(i=this.parseMidrow(n,a)),i||(i=this.parsePAC(n,a)),i||(i=this.parseBackgroundAttributes(n,a)),!i&&(r=this.parseChars(n,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(r):this.logger.log(Tt.WARNING,"No channel found yet. TEXT-MODE?")}i||r||this.logger.log(Tt.WARNING,"Couldn't parse cleaned data "+Me([n,a])+" orig: "+Me([t[s],t[s+1]]))}},o.parseCmd=function(e,t){var i=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;if(rr(e,t,i))return qt(null,null,i),this.logger.log(Tt.DEBUG,"Repeated command ("+Me([e,t])+") is dropped"),!0;var n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),qt(e,t,i),this.currentChannel=n,!0},o.parseMidrow=function(e,t){var i=0;if((e===17||e===25)&&t>=32&&t<=47){if((i=e===17?1:2)!==this.currentChannel)return this.logger.log(Tt.ERROR,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(Tt.DEBUG,"MIDROW ("+Me([e,t])+")"),!0)}return!1},o.parsePAC=function(e,t){var i,n=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;if(rr(e,t,n))return qt(null,null,n),!0;var a=e<=23?1:2;i=t>=64&&t<=95?a===1?b[e]:I[e]:a===1?M[e]:Y[e];var r=this.channels[a];return!!r&&(r.setPAC(this.interpretPAC(i,t)),qt(e,t,n),this.currentChannel=a,!0)},o.interpretPAC=function(e,t){var i,n={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,n.underline=(1&i)==1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((i-16)/2),n},o.parseChars=function(e,t){var i,n,a=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19?(n=r===17?t+80:r===18?t+112:t+144,this.logger.log(Tt.INFO,"Special char '"+h(n)+"' in channel "+i),a=[n]):e>=32&&e<=127&&(a=t===0?[e]:[e,t]),a){var s=Me(a);this.logger.log(Tt.DEBUG,"Char codes = "+s.join(",")),qt(e,t,this.cmdHistory)}return a},o.parseBackgroundAttributes=function(e,t){var i;if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;var n={};e===16||e===24?(i=Math.floor((t-32)/2),n.background=he[i],t%2==1&&(n.background=n.background+"_semi")):t===45?n.background="transparent":(n.foreground="black",t===47&&(n.underline=!0));var a=e<=23?1:2;return this.channels[a].setBkgData(n),qt(e,t,this.cmdHistory),!0},o.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},o.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},d}();function qt(d,o,e){e.a=d,e.b=o}function rr(d,o,e){return e.a===d&&e.b===o}let ur=Ot;var bt=function(){function d(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var o=d.prototype;return o.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},o.newCue=function(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},o.reset=function(){this.cueRanges=[],this.startTime=null},d}();let Zt=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var d=["","lr","rl"],o=["start","middle","end","left","right"];function e(a,r){if(typeof r!="string"||!Array.isArray(a))return!1;var s=r.toLowerCase();return!!~a.indexOf(s)&&s}function t(a){return e(o,a)}function i(a){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;l<r;l++)s[l-1]=arguments[l];for(var u=1;u<arguments.length;u++){var c=arguments[u];for(var v in c)a[v]=c[v]}return a}function n(a,r,s){var l=this,u={enumerable:!0};l.hasBeenReset=!1;var c="",v=!1,m=a,_=r,S=s,F=null,P="",X=!0,ue="auto",_e="start",ge=50,De="middle",He=50,Je="middle";Object.defineProperty(l,"id",i({},u,{get:function(){return c},set:function(Ae){c=""+Ae}})),Object.defineProperty(l,"pauseOnExit",i({},u,{get:function(){return v},set:function(Ae){v=!!Ae}})),Object.defineProperty(l,"startTime",i({},u,{get:function(){return m},set:function(Ae){if(typeof Ae!="number")throw new TypeError("Start time must be set to a number.");m=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"endTime",i({},u,{get:function(){return _},set:function(Ae){if(typeof Ae!="number")throw new TypeError("End time must be set to a number.");_=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"text",i({},u,{get:function(){return S},set:function(Ae){S=""+Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",i({},u,{get:function(){return F},set:function(Ae){F=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",i({},u,{get:function(){return P},set:function(Ae){var Ke=function(je){return e(d,je)}(Ae);if(Ke===!1)throw new SyntaxError("An invalid or illegal string was specified.");P=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",i({},u,{get:function(){return X},set:function(Ae){X=!!Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",i({},u,{get:function(){return ue},set:function(Ae){if(typeof Ae!="number"&&Ae!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ue=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",i({},u,{get:function(){return _e},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");_e=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",i({},u,{get:function(){return ge},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Position must be between 0 and 100.");ge=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",i({},u,{get:function(){return De},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");De=Ke,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",i({},u,{get:function(){return He},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Size must be between 0 and 100.");He=Ae,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",i({},u,{get:function(){return Je},set:function(Ae){var Ke=t(Ae);if(!Ke)throw new SyntaxError("An invalid or illegal string was specified.");Je=Ke,this.hasBeenReset=!0}})),l.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();var sr=function(){function d(){}return d.prototype.decode=function(o,e){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},d}();function Lt(d){function o(t,i,n,a){return 3600*(0|t)+60*(0|i)+(0|n)+parseFloat(a||0)}var e=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?o(e[2],e[3],0,e[4]):o(e[1],e[2],e[3],e[4]):null}var nt=function(){function d(){this.values=Object.create(null)}var o=d.prototype;return o.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},o.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},o.has=function(e){return e in this.values},o.alt=function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},o.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},o.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1},d}();function vt(d,o,e,t){var i=t?d.split(t):[d];for(var n in i)if(typeof i[n]=="string"){var a=i[n].split(e);a.length===2&&o(a[0],a[1])}}var et=new Zt(0,0,""),ft=et.align==="middle"?"middle":"center";function Vt(d,o,e){var t=d;function i(){var a=Lt(d);if(a===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),a}function n(){d=d.replace(/^\s+/,"")}if(n(),o.startTime=i(),n(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),n(),o.endTime=i(),n(),function(a,r){var s=new nt;vt(a,function(c,v){var m;switch(c){case"region":for(var _=e.length-1;_>=0;_--)if(e[_].id===v){s.set(c,e[_].region);break}break;case"vertical":s.alt(c,v,["rl","lr"]);break;case"line":m=v.split(","),s.integer(c,m[0]),s.percent(c,m[0])&&s.set("snapToLines",!1),s.alt(c,m[0],["auto"]),m.length===2&&s.alt("lineAlign",m[1],["start",ft,"end"]);break;case"position":m=v.split(","),s.percent(c,m[0]),m.length===2&&s.alt("positionAlign",m[1],["start",ft,"end","line-left","line-right","auto"]);break;case"size":s.percent(c,v);break;case"align":s.alt(c,v,["start",ft,"end","left","right"])}},/:/,/\s/),r.region=s.get("region",null),r.vertical=s.get("vertical","");var l=s.get("line","auto");l==="auto"&&et.line===-1&&(l=-1),r.line=l,r.lineAlign=s.get("lineAlign","start"),r.snapToLines=s.get("snapToLines",!0),r.size=s.get("size",100),r.align=s.get("align",ft);var u=s.get("position","auto");u==="auto"&&et.position===50&&(u=r.align==="start"||r.align==="left"?0:r.align==="end"||r.align==="right"?100:50),r.position=u}(d,o)}function Xt(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
21
21
|
`)}var dr=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new sr,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var o=d.prototype;return o.parse=function(e){var t=this;function i(){var l=t.buffer,u=0;for(l=Xt(l);u<l.length&&l[u]!=="\r"&&l[u]!==`
|
|
22
22
|
`;)++u;var c=l.slice(0,u);return l[u]==="\r"&&++u,l[u]===`
|
|
23
23
|
`&&++u,t.buffer=l.slice(u),c}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var a=(n=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var r=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:n=i(),t.state){case"HEADER":/:/.test(n)?vt(n,function(l,u){},/:/):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Zt(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Vt(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=n.indexOf("-->")!==-1;if(!n||s&&(r=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
24
24
|
`),t.cue.text+=n;continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},o.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
|
25
25
|
|
|
26
|
-
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},d}(),or=B(673),mr=B(524),cr=/\r\n|\n\r|\n|\r/g,yr=function(d,o,e){return e===void 0&&(e=0),d.slice(e,e+o.length)===o},Qt=function(d){for(var o=5381,e=d.length;e;)o=33*o^d.charCodeAt(--e);return(o>>>0).toString()};function hr(d,o,e){return Qt(d.toString())+Qt(o.toString())+Qt(e)}function ni(){return ni=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},ni.apply(this,arguments)}var Er="stpp.ttml.im1t",zr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,pn=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ks={left:"start",center:"center",right:"end",start:"start",end:"end"};function Aa(d,o,e,t,i){var n=(0,z.findBox)(new Uint8Array(d),["mdat"]);if(n.length!==0){var a=n.map(function(s){return(0,Rt.utf8ArrayToStr)(s)}),r=(0,or.toTimescaleFromScale)(o,1,e);try{a.forEach(function(s){return t(function(l,u){var c=new DOMParser().parseFromString(l,"text/xml").getElementsByTagName("tt")[0];if(!c)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(v).reduce(function(
|
|
27
|
-
`:(n=t.childNodes)!==null&&n!==void 0&&n.length?wa(t,o):o?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function jn(d,o,e){return d&&d.hasAttributeNS(o,e)?d.getAttributeNS(o,e):null}function Da(d){return new Error("Could not parse ttml timestamp "+d)}function Gn(d,o){if(!d)return null;var e=Lt(d);return e===null&&(zr.test(d)?e=function(t,i){var n=zr.exec(t),a=(0|n[4])+(0|n[5])/i.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+a/i.frameRate}(d,o):pn.test(d)&&(e=function(t,i){var n=pn.exec(t),a=Number(n[1]);switch(n[2]){case"h":return 3600*a;case"m":return 60*a;case"ms":return 1e3*a;case"f":return a/i.frameRate;case"t":return a/i.tickRate}return a}(d,o))),e}var ws=function(){function d(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var t=new
|
|
26
|
+
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},d}(),or=B(673),mr=B(524),cr=/\r\n|\n\r|\n|\r/g,yr=function(d,o,e){return e===void 0&&(e=0),d.slice(e,e+o.length)===o},Qt=function(d){for(var o=5381,e=d.length;e;)o=33*o^d.charCodeAt(--e);return(o>>>0).toString()};function hr(d,o,e){return Qt(d.toString())+Qt(o.toString())+Qt(e)}function ni(){return ni=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},ni.apply(this,arguments)}var Er="stpp.ttml.im1t",zr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,pn=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ks={left:"start",center:"center",right:"end",start:"start",end:"end"};function Aa(d,o,e,t,i){var n=(0,z.findBox)(new Uint8Array(d),["mdat"]);if(n.length!==0){var a=n.map(function(s){return(0,Rt.utf8ArrayToStr)(s)}),r=(0,or.toTimescaleFromScale)(o,1,e);try{a.forEach(function(s){return t(function(l,u){var c=new DOMParser().parseFromString(l,"text/xml").getElementsByTagName("tt")[0];if(!c)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(v).reduce(function(X,ue){return X[ue]=c.getAttribute("ttp:"+ue)||v[ue],X},{}),_=c.getAttribute("xml:space")!=="preserve",S=ka(Bn(c,"styling","style")),F=ka(Bn(c,"layout","region")),P=Bn(c,"body","[begin]");return[].map.call(P,function(X){var ue=wa(X,_);if(!ue||!X.hasAttribute("begin"))return null;var _e=Gn(X.getAttribute("begin"),m),ge=Gn(X.getAttribute("dur"),m),De=Gn(X.getAttribute("end"),m);if(_e===null)throw Da(X);if(De===null){if(ge===null)throw Da(X);De=_e+ge}var He=new Zt(_e-u,De-u,ue);He.id=hr(He.startTime,He.endTime,He.text);var Je=function(je,pt,Mt){var yt="http://www.w3.org/ns/ttml#styling",kt=null,xt=je!=null&&je.hasAttribute("style")?je.getAttribute("style"):null;return xt&&Mt.hasOwnProperty(xt)&&(kt=Mt[xt]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(ir,er){var Yt=jn(pt,yt,er)||jn(je,yt,er)||jn(kt,yt,er);return Yt&&(ir[er]=Yt),ir},{})}(F[X.getAttribute("region")],S[X.getAttribute("style")],S),Ae=Je.textAlign;if(Ae){var Ke=ks[Ae];Ke&&(He.lineAlign=Ke),He.align=Ae}return ni(He,Je),He}).filter(function(X){return X!==null})}(s,r))})}catch(s){i(s)}}else i(new Error("Could not parse IMSC1 mdat"))}function Bn(d,o,e){var t=d.getElementsByTagName(o)[0];return t?[].slice.call(t.querySelectorAll(e)):[]}function ka(d){return d.reduce(function(o,e){var t=e.getAttribute("xml:id");return t&&(o[t]=e),o},{})}function wa(d,o){return[].slice.call(d.childNodes).reduce(function(e,t,i){var n;return t.nodeName==="br"&&i?e+`
|
|
27
|
+
`:(n=t.childNodes)!==null&&n!==void 0&&n.length?wa(t,o):o?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function jn(d,o,e){return d&&d.hasAttributeNS(o,e)?d.getAttributeNS(o,e):null}function Da(d){return new Error("Could not parse ttml timestamp "+d)}function Gn(d,o){if(!d)return null;var e=Lt(d);return e===null&&(zr.test(d)?e=function(t,i){var n=zr.exec(t),a=(0|n[4])+(0|n[5])/i.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+a/i.frameRate}(d,o):pn.test(d)&&(e=function(t,i){var n=pn.exec(t),a=Number(n[1]);switch(n[2]){case"h":return 3600*a;case"m":return 60*a;case"ms":return 1e3*a;case"f":return a/i.frameRate;case"t":return a/i.tickRate}return a}(d,o))),e}var ws=function(){function d(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var t=new bt(this,"textTrack1"),i=new bt(this,"textTrack2"),n=new bt(this,"textTrack3"),a=new bt(this,"textTrack4");this.cea608Parser1=new ur(1,t,i),this.cea608Parser2=new ur(3,n,a)}e.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.Events.FRAG_LOADING,this.onFragLoading,this),e.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(g.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(g.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.Events.FRAG_LOADING,this.onFragLoading,this),e.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(g.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(g.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(e,t,i,n,a){for(var r,s,l,u,c=!1,v=a.length;v--;){var m=a[v],_=(r=m[0],s=m[1],l=t,u=i,Math.min(s,u)-Math.max(r,l));if(_>=0&&(m[0]=Math.min(m[0],t),m[1]=Math.max(m[1],i),c=!0,_/(i-t)>.5))return}if(c||a.push([t,i]),this.config.renderTextTracksNatively){var S=this.captionsTracks[e];this.Cues.newCue(S,t,i,n)}else{var F=this.Cues.newCue(null,t,i,n);this.hls.trigger(g.Events.CUES_PARSED,{type:"captions",cues:F,track:e})}},o.onInitPtsFound=function(e,t){var i=this,n=t.frag,a=t.id,r=t.initPTS,s=t.timescale,l=this.unparsedVttFrags;a==="main"&&(this.initPTS[n.cc]=r,this.timescale[n.cc]=s),l.length&&(this.unparsedVttFrags=[],l.forEach(function(u){i.onFragLoaded(g.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var n=t.textTracks[i];if(n[e])return n}return null},o.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},o.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,i=this.captionsTracks,n=this.media,a=t[e],r=a.label,s=a.languageCode,l=this.getExistingTrack(e);if(l)i[e]=l,lt(i[e]),Xe(i[e],n);else{var u=this.createTextTrack("captions",r,s);u&&(u[e]=!0,i[e]=u)}}},o.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(g.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},o.createTextTrack=function(e,t,i){var n=this.media;if(n)return n.addTextTrack(e,t,i)},o.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},o.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){lt(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)lt(t[i])}},o.onSubtitleTracksUpdated=function(e,t){var i=this;this.textTracks=[];var n=t.subtitleTracks||[],a=n.some(function(u){return u.textCodec===Er});if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var r=this.tracks&&n&&this.tracks.length===n.length;if(this.tracks=n||[],this.config.renderTextTracksNatively){var s=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,c){var v;if(c<s.length){for(var m=null,_=0;_<s.length;_++)if(Ds(s[_],u)){m=s[_];break}m&&(v=m)}if(v)lt(v);else{var S=i._captionsOrSubtitlesFromCharacteristics(u);(v=i.createTextTrack(S,u.name,u.lang))&&(v.mode="disabled")}v&&(v.groupId=u.groupId,i.textTracks.push(v))})}else if(!r&&this.tracks&&this.tracks.length){var l=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(g.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:l})}}},o._captionsOrSubtitlesFromCharacteristics=function(e){var t;if((t=e.attrs)!==null&&t!==void 0&&t.CHARACTERISTICS){var i=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),n=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(i&&n)return"captions"}return"subtitles"},o.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(n){var a=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(a){var r="textTrack"+a[1],s=i.captionsProperties[r];s&&(s.label=n.name,n.lang&&(s.languageCode=n.lang),s.media=n)}})},o.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]},o.onFragLoading=function(e,t){var i=this.cea608Parser1,n=this.cea608Parser2,a=this.lastSn,r=this.lastPartIndex;if(this.enabled&&i&&n&&t.frag.type===fe.PlaylistLevelType.MAIN){var s,l,u=t.frag.sn,c=(s=t==null||(l=t.part)===null||l===void 0?void 0:l.index)!=null?s:-1;u===a+1||u===a&&c===r+1||(i.reset(),n.reset()),this.lastSn=u,this.lastPartIndex=c}},o.onFragLoaded=function(e,t){var i=t.frag,n=t.payload,a=this.initPTS,r=this.unparsedVttFrags;if(i.type===fe.PlaylistLevelType.SUBTITLE)if(n.byteLength){if(!(0,R.isFiniteNumber)(a[i.cc]))return r.push(t),void(a.length&&this.hls.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var s=i.decryptdata,l="stats"in t;if(s==null||!s.encrypted||l){var u=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),u&&u.textCodec===Er?this._parseIMSC1(i,n):this._parseVTTs(i,n,c)}}else this.hls.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(e,t){var i=this,n=this.hls;Aa(t,this.initPTS[e.cc],this.timescale[e.cc],function(a){i._appendCues(a,e.level),n.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(a){L.logger.log("Failed to parse IMSC1: "+a),n.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:a})})},o._parseVTTs=function(e,t,i){var n,a=this,r=this.hls;(function(s,l,u,c,v,m,_,S){var F,P=new dr,X=(0,Rt.utf8ArrayToStr)(new Uint8Array(s)).trim().replace(cr,`
|
|
28
28
|
`).split(`
|
|
29
|
-
`),ue=[],_e=(0,or.toMpegTsClockFromTimescale)(l,u),ge="00:00.000",De=0,He=0,Je=!0;P.oncue=function(Ae){var Ke=c[v],je=c.ccOffset,pt=(De-_e)/9e4;Ke!=null&&Ke.new&&(He!==void 0?je=c.ccOffset=Ke.start:function(xt,ir,er){var Yt=xt[ir],nr=xt[Yt.prevCC];if(!nr||!nr.new&&Yt.new)return xt.ccOffset=xt.presentationOffset=Yt.start,void(Yt.new=!1);for(;(_r=nr)!==null&&_r!==void 0&&_r.new;){var _r;xt.ccOffset+=Yt.start-nr.start,Yt.new=!1,nr=xt[(Yt=nr).prevCC]}xt.presentationOffset=er}(c,v,pt)),pt&&(je=pt-c.presentationOffset);var Mt=Ae.endTime-Ae.startTime,
|
|
30
|
-
`)}),P.flush()})((n=e.initSegment)!==null&&n!==void 0&&n.data?(0,z.appendUint8Array)(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],this.timescale[e.cc],i,e.cc,e.start,function(s){a._appendCues(s,e.level),r.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(s){a._fallbackToIMSC1(e,t),L.logger.log("Failed to parse VTT cue: "+s),r.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})},o._fallbackToIMSC1=function(e,t){var i=this,n=this.tracks[e.level];n.textCodec||Aa(t,this.initPTS[e.cc],this.timescale[e.cc],function(){n.textCodec=Er,i._parseIMSC1(e,t)},function(){n.textCodec="wvtt"})},o._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(function(s){return it(n,s)})}else{var a=this.tracks[t];if(!a)return;var r=a.default?"default":"subtitles"+t;i.trigger(g.Events.CUES_PARSED,{type:"subtitles",cues:e,track:r})}},o.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===fe.PlaylistLevelType.SUBTITLE){if(!(0,R.isFiniteNumber)(this.initPTS[i.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(g.Events.FRAG_LOADED,t)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&i&&n){var a=t.frag,r=t.samples;if(a.type!==fe.PlaylistLevelType.MAIN||this.closedCaptionsForLevel(a)!=="NONE")for(var s=0;s<r.length;s++){var l=r[s].bytes;if(l){var u=this.extractCea608Data(l);i.addData(r[s].pts,u[0]),n.addData(r[s].pts,u[1])}}}},o.onBufferFlushing=function(e,t){var i=t.startOffset,n=t.endOffset,a=t.endOffsetSubtitles,r=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!r||r==="video"){var l=this.captionsTracks;Object.keys(l).forEach(function(c){return Ct(l[c],i,n)})}if(this.config.renderTextTracksNatively&&i===0&&a!==void 0){var u=this.textTracks;Object.keys(u).forEach(function(c){return Ct(u[c],i,a)})}}},o.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],n=2,a=0;a<i;a++){var r=e[n++],s=127&e[n++],l=127&e[n++];if((s!==0||l!==0)&&(4&r)!=0){var u=3&r;u!==0&&u!==1||(t[u].push(s),t[u].push(l))}}return t},d}();function Ds(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function Ls(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}let Rs=function(){function d(i){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=i,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var o,e,t=d.prototype;return t.setStreamController=function(i){this.streamController=i},t.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},t.registerListeners=function(){var i=this.hls;i.on(g.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListener=function(){var i=this.hls;i.off(g.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.onFpsDropLevelCapping=function(i,n){d.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},t.onMediaAttaching=function(i,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null},t.onManifestParsed=function(i,n){var a=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,a.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onBufferCodecs=function(i,n){this.hls.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping()},t.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var i=this.hls.levels;if(i.length){var n=this.hls;n.autoLevelCapping=this.getMaxLevel(i.length-1),n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}},t.getMaxLevel=function(i){var n=this,a=this.hls.levels;if(!a.length)return-1;var r=a.filter(function(s,l){return d.isLevelAllowed(l,n.restrictedLevels)&&l<=i});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var i=this.media,n={width:0,height:0};if(i){var a=i.getBoundingClientRect();n.width=a.width,n.height=a.height,n.width||n.height||(n.width=a.right-a.left||i.width||0,n.height=a.bottom-a.top||i.height||0)}return this.clientRect=n,n},d.isLevelAllowed=function(i,n){return n===void 0&&(n=[]),n.indexOf(i)===-1},d.getMaxLevelByMediaSize=function(i,n,a){if(!i||!i.length)return-1;for(var r,s,l=i.length-1,u=0;u<i.length;u+=1){var c=i[u];if((c.width>=n||c.height>=a)&&(r=c,!(s=i[u+1])||r.width!==s.width||r.height!==s.height)){l=u;break}}return l},o=d,(e=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var i=1;if(!this.hls.config.ignoreDevicePixelRatio)try{i=self.devicePixelRatio}catch{}return i}}])&&Ls(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}(),Is=function(){function d(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var o=d.prototype;return o.setStreamController=function(e){this.streamController=e},o.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},o.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching)},o.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},o.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},o.checkFPS=function(e,t,i){var n=performance.now();if(t){if(this.lastTime){var a=n-this.lastTime,r=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,l=1e3*r/a,u=this.hls;if(u.trigger(g.Events.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:i}),l>0&&r>u.config.fpsDroppedMonitoringThreshold*s){var c=u.currentLevel;L.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=c)&&(c-=1,u.trigger(g.Events.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:u.currentLevel}),u.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},o.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},d}();var ai=B(300);function Kn(d){var o=typeof Map=="function"?new Map:void 0;return Kn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return Hn(e,arguments,qn(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ni(i,e)},Kn(d)}function Hn(d,o,e){return Hn=Cs()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ni(r,n.prototype),r},Hn.apply(null,arguments)}function Cs(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ni(d,o){return Ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ni(d,o)}function qn(d){return qn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},qn(d)}var gn="[eme]",La=function(){function d(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=d.CDMCleanupPromise?[d.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=L.logger.debug.bind(L.logger,gn),this.log=L.logger.log.bind(L.logger,gn),this.warn=L.logger.warn.bind(L.logger,gn),this.error=L.logger.error.bind(L.logger,gn),this.hls=e,this.config=e.config,this.registerListeners()}var o=d.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},o.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,n=t.widevineLicenseUrl,a=i[e];if(a)return a.licenseUrl;if(e===K.WIDEVINE&&n)return n;throw new Error('no license server URL configured for key-system "'+e+'"')},o.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},o.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,n=function(s,l,u){return!!s&&u.indexOf(s)===l},a=i.map(function(s){return s.audioCodec}).filter(n),r=i.map(function(s){return s.videoCodec}).filter(n);return a.length+r.length===0&&r.push("avc1.42e01e"),new Promise(function(s,l){(function u(c){var v=c.shift();t.getMediaKeysPromise(v,a,r).then(function(m){return s({keySystem:v,mediaKeys:m})}).catch(function(m){c.length?u(c):l(m instanceof Rr?m:new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:m,fatal:!0},m.message))})})(e)})},o.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var n="Configured requestMediaKeySystemAccess is not a function "+i;return Se===null&&self.location.protocol==="http:"&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(n))}return i(e,t)},o.getMediaKeysPromise=function(e,t,i){var n=this,a=function(u,c,v,m){var _;switch(u){case K.FAIRPLAY:_=["cenc","sinf"];break;case K.WIDEVINE:case K.PLAYREADY:_=["cenc"];break;case K.CLEARKEY:_=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+u)}return function(S,F,P,W){return[{initDataTypes:S,persistentState:W.persistentState||"not-allowed",distinctiveIdentifier:W.distinctiveIdentifier||"not-allowed",sessionTypes:W.sessionTypes||[W.sessionType||"temporary"],audioCapabilities:F.map(function(ue){return{contentType:'audio/mp4; codecs="'+ue+'"',robustness:W.audioRobustness||"",encryptionScheme:W.audioEncryptionScheme||null}}),videoCapabilities:P.map(function(ue){return{contentType:'video/mp4; codecs="'+ue+'"',robustness:W.videoRobustness||"",encryptionScheme:W.videoEncryptionScheme||null}})}]}(_,c,v,m)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e],s=r==null?void 0:r.keySystemAccess;if(!s){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(a)),s=this.requestMediaKeySystemAccess(e,a);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(function(u){n.log('Failed to obtain access to key-system "'+e+'": '+u)}),s.then(function(u){n.log('Access for key-system "'+u.keySystem+'" obtained');var c=n.fetchServerCertificate(e);return n.log('Create media-keys for "'+e+'"'),l.mediaKeys=u.createMediaKeys().then(function(v){return n.log('Media-keys created for "'+e+'"'),c.then(function(m){return m?n.setMediaKeysServerCertificate(v,e,m):v})}),l.mediaKeys.catch(function(v){n.error('Failed to create media-keys for "'+e+'"}: '+v)}),l.mediaKeys})}return s.then(function(){return r.mediaKeys})},o.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,n=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+ai.default.hexDump(t.keyId||[]));var a=n.createSession(),r={decryptdata:t,keySystem:i,mediaKeys:n,mediaKeysSession:a,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r},o.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t);this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},o.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return ai.default.hexDump(e.keyId)},o.updateKeySession=function(e,t){var i,n=e.mediaKeysSession;return this.log('Updating key-session "'+n.sessionId+'" for keyID '+ai.default.hexDump(((i=e.decryptdata)===null||i===void 0?void 0:i.keyId)||[])+`
|
|
31
|
-
} (data length: `+(t&&t.byteLength)+")"),n.update(t)},o.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},o.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,n){var a=de(t.config),r=e.map(U).filter(function(s){return!!s&&a.indexOf(s)!==-1});return t.getKeySystemSelectionPromise(r).then(function(s){var l=s.keySystem,u=D(l);u?i(u):n(new Error('Unable to find format for key-system "'+l+'"'))}).catch(n)})},o.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,n=this.getKeyIdString(i),a="(keyId: "+n+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+a);var r=this.keyIdToKeySessionPromise[n];return r||(r=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(i).then(function(s){var l=s.keySystem,u=s.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+a),t.attemptSetMediaKeys(l,u).then(function(){t.throwIfDestroyed();var c=t.createMediaKeySessionContext({keySystem:l,mediaKeys:u,decryptdata:i});return t.generateRequestWithPreferredKeySession(c,"cenc",i.pssh,"playlist-key")})})).catch(function(s){return t.handleError(s)}),r},o.throwIfDestroyed=function(e){if(e===void 0&&(e="Invalid state"),!this.hls)throw new Error("invalid state")},o.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Rr?this.hls.trigger(g.Events.ERROR,e.data):this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},o.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var n=U(e.keyFormat),a=n?[n]:de(this.config);return this.attemptKeySystemAccess(a)}return i},o.getKeySystemSelectionPromise=function(e){if(e.length||(e=de(this.config)),e.length===0)throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},o._onMediaEncrypted=function(e){var t=this,i=e.initDataType,n=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),n!==null){var a,r;if(i==="sinf"&&this.config.drmSystems[K.FAIRPLAY]){var s=(0,z.bin2str)(new Uint8Array(n));try{var l=V(JSON.parse(s).sinf),u=(0,z.parseSinf)(new Uint8Array(l));if(!u)return;a=u.subarray(8,24),r=K.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var c=(0,z.parsePssh)(n);if(c===null)return;c.version===0&&c.systemId===ke.WIDEVINE&&c.data&&(a=c.data.subarray(8,24)),r=function(ue){if(ue===ke.WIDEVINE)return K.WIDEVINE}(c.systemId)}if(r&&a){for(var v=ai.default.hexDump(a),m=this.keyIdToKeySessionPromise,_=this.mediaKeySessions,S=m[v],F=function(ue){var _e=_[ue],ge=_e.decryptdata;if(ge.pssh||!ge.keyId)return"continue";var De=ai.default.hexDump(ge.keyId);return v===De||ge.uri.replace(/-/g,"").indexOf(v)!==-1?(S=m[De],delete m[De],ge.pssh=new Uint8Array(n),ge.keyId=a,S=m[v]=S.then(function(){return t.generateRequestWithPreferredKeySession(_e,i,n,"encrypted-event-key-match")}),"break"):void 0},P=0;P<_.length;P++){var W=F(P);if(W!=="continue"&&W==="break")break}S||(S=m[v]=this.getKeySystemSelectionPromise([r]).then(function(ue){var _e,ge=ue.keySystem,De=ue.mediaKeys;t.throwIfDestroyed();var He=new Le("ISO-23001-7",v,(_e=D(ge))!=null?_e:"");return He.pssh=new Uint8Array(n),He.keyId=a,t.attemptSetMediaKeys(ge,De).then(function(){t.throwIfDestroyed();var Je=t.createMediaKeySessionContext({decryptdata:He,keySystem:ge,mediaKeys:De});return t.generateRequestWithPreferredKeySession(Je,i,n,"encrypted-event-no-match")})})),S.catch(function(ue){return t.handleError(ue)})}}},o._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},o.attemptSetMediaKeys=function(e,t){var i=this,n=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var a=Promise.all(n).then(function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(a),a.then(function(){i.log('Media-keys set for "'+e+'"'),n.push(a),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(r){return n.indexOf(r)===-1})})},o.generateRequestWithPreferredKeySession=function(e,t,i,n){var a,r,s=this,l=(a=this.config.drmSystems)===null||a===void 0||(r=a[e.keySystem])===null||r===void 0?void 0:r.generateRequest;if(l)try{var u=l.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(S){var c;if(this.warn(S.message),(c=this.hls)!==null&&c!==void 0&&c.config.debug)throw S}if(i===null)return this.log('Skipping key-session request for "'+n+'" (no initData)'),Promise.resolve(e);var v=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+n+'": '+v+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var m=new(ti());e.mediaKeysSession.onmessage=function(S){var F=e.mediaKeysSession;if(F){var P=S.messageType,W=S.message;s.log('"'+P+'" message event for session "'+F.sessionId+'" message size: '+W.byteLength),P==="license-request"||P==="license-renewal"?s.renewLicense(e,W).catch(function(ue){s.handleError(ue),m.emit("error",ue)}):P==="license-release"?e.keySystem===K.FAIRPLAY&&(s.updateKeySession(e,E("acknowledged")),s.removeSession(e)):s.warn('unhandled media key message type "'+P+'"')}else m.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(S){if(e.mediaKeysSession){s.onKeyStatusChange(e);var F=e.keyStatus;m.emit("keyStatus",F),F==="expired"&&(s.warn(e.keySystem+" expired for key "+v),s.renewKeySession(e))}else m.emit("error",new Error("invalid state"))};var _=new Promise(function(S,F){m.on("error",F),m.on("keyStatus",function(P){P.startsWith("usable")?S():P==="output-restricted"?F(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):P==="internal-error"?F(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+P+'"')):P==="expired"?F(new Error("key expired while generating request")):s.warn('unhandled key status change "'+P+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var S;s.log('Request generated for key-session "'+((S=e.mediaKeysSession)===null||S===void 0?void 0:S.sessionId)+'" keyId: '+v)}).catch(function(S){throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:S,fatal:!1},"Error generating key-session request: "+S)}).then(function(){return _}).catch(function(S){throw m.removeAllListeners(),s.removeSession(e),S}).then(function(){return m.removeAllListeners(),e})},o.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,n){t.log('key status change "'+i+'" for keyStatuses keyId: '+ai.default.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))+" session keyId: "+ai.default.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},o.fetchServerCertificate=function(e){var t=this;return new Promise(function(i,n){var a=t.getServerCertificateUrl(e);if(!a)return i();t.log('Fetching serverCertificate for "'+e+'"');var r=new XMLHttpRequest;r.open("GET",a,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&(r.status===200?i(r.response):n(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r},'"'+e+'" certificate request XHR failed ('+a+"). Status: "+r.status+" ("+r.statusText+")")))},r.send()})},o.setMediaKeysServerCertificate=function(e,t,i){var n=this;return new Promise(function(a,r){e.setServerCertificate(i).then(function(s){n.log("setServerCertificate "+(s?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),a(e)}).catch(function(s){r(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})},o.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(n){return i.updateKeySession(e,new Uint8Array(n)).catch(function(a){throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:a,fatal:!0},a.message)})})},o.setupLicenseXHR=function(e,t,i,n){var a=this,r=this.config.licenseXhrSetup;return r?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return r.call(a.hls,e,t,i,n)}).catch(function(s){if(!i.decryptdata)throw s;return e.open("POST",t,!0),r.call(a.hls,e,t,i,n)}).then(function(s){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||n}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))},o.requestLicense=function(e,t){var i=this;return new Promise(function(n,a){var r=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+r);var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(s.readyState===4)if(s.status===200){i._requestLicenseFailureCount=0;var l=s.response;i.log("License received "+(l instanceof ArrayBuffer?l.byteLength:l));var u=i.config.licenseResponseCallback;if(u)try{l=u.call(i.hls,s,r,e)}catch(v){i.error(v)}n(l)}else if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>3||s.status>=400&&s.status<500)a(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:s},"License Request XHR failed ("+r+"). Status: "+s.status+" ("+s.statusText+")"));else{var c=3-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+c+" attempts left"),i.requestLicense(e,t).then(n,a)}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=s,i.setupLicenseXHR(s,r,e,t).then(function(l){var u=l.xhr,c=l.licenseChallenge;u.send(c)})})},o.onMediaAttached=function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}},o.onMediaDetached=function(){var e=this,t=this.media,i=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Le.clearKeyUriToKeyIdMap();var n=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(a){return e.removeSession(a)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(a){e.log("Could not clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))}))).then(function(){n&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(a){e.log("Could not close sessions and clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))})},o.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var n=i.reduce(function(a,r){return a.indexOf(r.keyFormat)===-1&&a.push(r.keyFormat),a},[]);this.log("Selecting key-system from session-keys "+n.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(n)}},o.removeSession=function(e){var t=this,i=e.mediaKeysSession,n=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var a=this.mediaKeySessions.indexOf(e);return a>-1&&this.mediaKeySessions.splice(a,1),i.remove().catch(function(r){t.log("Could not remove session: "+r)}).then(function(){return i.close()}).catch(function(r){t.log("Could not close session: "+r)})}},d}();La.CDMCleanupPromise=void 0;var Rr=function(d){var o,e;function t(i,n){var a;return(a=d.call(this,n)||this).data=void 0,a.data=i,i.err=i.error,a}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ni(o,e),t}(Kn(Error));let Ps=La;var fr,Vn,Ra;function Ia(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Ca(d,o,e){return o&&Ia(d.prototype,o),e&&Ia(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function Pa(d,o){var e=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(i,n){if(i){if(typeof i=="string")return Oa(i,n);var a=Object.prototype.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Oa(i,n):void 0}}(d))||o&&d&&typeof d.length=="number"){e&&(d=e);var t=0;return function(){return t>=d.length?{done:!0}:{done:!1,value:d[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
32
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oa(d,o){(o==null||o>d.length)&&(o=d.length);for(var e=0,t=new Array(o);e<o;e++)t[e]=d[e];return t}function mn(){return mn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},mn.apply(this,arguments)}(function(d){d.MANIFEST="m",d.AUDIO="a",d.VIDEO="v",d.MUXED="av",d.INIT="i",d.CAPTION="c",d.TIMED_TEXT="tt",d.KEY="k",d.OTHER="o"})(fr||(fr={})),function(d){d.DASH="d",d.HLS="h",d.SMOOTH="s",d.OTHER="o"}(Vn||(Vn={})),function(d){d.VOD="v",d.LIVE="l"}(Ra||(Ra={}));var Os=function(){function d(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(a){try{t.apply(a,{ot:fr.MANIFEST,su:!t.initialized})}catch(r){L.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=function(a){try{var r=a.frag,s=t.hls.levels[r.level],l=t.getObjectType(r),u={d:1e3*r.duration,ot:l};l!==fr.VIDEO&&l!==fr.AUDIO&&l!=fr.MUXED||(u.br=s.bitrate/1e3,u.tb=t.getTopBandwidth(l)/1e3,u.bl=t.getBufferLength(l)),t.apply(a,u)}catch(c){L.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=e;var i=this.config=e.config,n=i.cmcd;n!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||d.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var o=d.prototype;return o.registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},o.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},o.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},o.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},o.onBufferCreated=function(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)===null||n===void 0?void 0:n.buffer},o.createData=function(){var e;return{v:1,sf:Vn.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},o.apply=function(e,t){t===void 0&&(t={}),mn(t,this.createData());var i=t.ot===fr.INIT||t.ot===fr.VIDEO||t.ot===fr.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var n=d.toHeaders(t);if(!Object.keys(n).length)return;e.headers||(e.headers={}),mn(e.headers,n)}else{var a=d.toQuery(t);if(!a)return;e.url=d.appendQueryToUri(e.url,a)}},o.getObjectType=function(e){var t=e.type;return t==="subtitle"?fr.TIMED_TEXT:e.sn==="initSegment"?fr.INIT:t==="audio"?fr.AUDIO:t==="main"?this.hls.audioTracks.length?fr.VIDEO:fr.MUXED:void 0},o.getTopBandwidth=function(e){var t,i=0,n=this.hls;if(e===fr.AUDIO)t=n.audioTracks;else{var a=n.maxAutoLevel,r=a>-1?a+1:n.levels.length;t=n.levels.slice(0,r)}for(var s,l=Pa(t);!(s=l()).done;){var u=s.value;u.bitrate>i&&(i=u.bitrate)}return i>0?i:NaN},o.getBufferLength=function(e){var t=this.hls.media,i=e===fr.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*Gt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},o.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},Ca(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},o.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},Ca(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],n=function(S){return!Number.isNaN(S)&&S!=null&&S!==""&&S!==!1},a=function(S){return Math.round(S)},r=function(S){return 100*a(S/100)},s={br:a,d:a,bl:r,dl:r,mtp:r,nor:function(S){return encodeURIComponent(S)},rtp:r,tb:a},l=Pa(Object.keys(e||{}).sort());!(t=l()).done;){var u=t.value,c=e[u];if(n(c)&&!(u==="v"&&c===1||u=="pr"&&c===1)){var v=s[u];v&&(c=v(c));var m,_=typeof c;m=u==="ot"||u==="sf"||u==="st"?u+"="+c:_==="boolean"?u:_==="number"?u+"="+c:u+"="+JSON.stringify(c),i.push(m)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},r=0,s=Object.keys(e);r<s.length;r++){var l=s[r];n[a[l]!=null?a[l]:1][l]=e[l]}for(var u=0;u<n.length;u++){var c=d.serialize(n[u]);c&&(t["CMCD-"+i[u]]=c)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),xa=B(408),xs=/^age:\s*[\d.]+\s*$/m;let Ma=function(){function d(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new xa.LoadStats,this.retryDelay=0}var o=d.prototype;return o.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},o.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},o.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},o.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var a=this.xhrSetup;try{if(a)try{a(i,t.url)}catch{i.open("GET",t.url,!0),a(i,t.url)}i.readyState||i.open("GET",t.url,!0);var r=this.context.headers;if(r)for(var s in r)i.setRequestHeader(s,r[s])}catch(l){return void this.callbacks.onError({code:i.status,text:l.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},o.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var n=t.readyState,a=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),n===4){t.onreadystatechange=null,t.onprogress=null;var r=t.status,s=t.responseType==="arraybuffer";if(r>=200&&r<300&&(s&&t.response||t.responseText!==null)){var l,u;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),u=s?(l=t.response).byteLength:(l=t.responseText).length,i.loaded=i.total=u,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,e,l,t),!this.callbacks)return;var v={url:t.responseURL,data:l};this.callbacks.onSuccess(v,i,e,t)}else i.retry>=a.maxRetry||r>=400&&r<499?(L.logger.error(r+" while loading "+e.url),this.callbacks.onError({code:r,text:t.statusText},e,t)):(L.logger.warn(r+" while loading "+e.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},o.loadtimeout=function(){L.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},o.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},o.getCacheAge=function(){var e=null;if(this.loader&&xs.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},d}();function Yn(d){var o=typeof Map=="function"?new Map:void 0;return Yn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return Wn(e,arguments,Xn(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ui(i,e)},Yn(d)}function Wn(d,o,e){return Wn=Ms()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ui(r,n.prototype),r},Wn.apply(null,arguments)}function Ms(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ui(d,o){return Ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ui(d,o)}function Xn(d){return Xn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},Xn(d)}function zn(){return zn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},zn.apply(this,arguments)}var Fs=function(){function d(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Ns,this.controller=new self.AbortController,this.stats=new xa.LoadStats}var o=d.prototype;return o.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},o.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},o.load=function(e,t,i){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var r=function(c,v){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(zn({},c.headers))};return c.rangeEnd&&m.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),m}(e,this.controller.signal),s=i.onProgress,l=e.responseType==="arraybuffer",u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){n.abortInternal(),i.onTimeout(a,e,n.response)},t.timeout),self.fetch(this.request).then(function(c){if(n.response=n.loader=c,!c.ok){var v=c.status,m=c.statusText;throw new Us(m||"fetch, bad network response",v,c)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(c.headers.get("Content-Length")||"0"),s&&(0,R.isFiniteNumber)(t.highWaterMark)?n.loadProgressively(c,a,e,t.highWaterMark,s):l?c.arrayBuffer():c.text()}).then(function(c){var v=n.response;self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var m=c[u];m&&(a.loaded=a.total=m);var _={url:v.url,data:c};s&&!(0,R.isFiniteNumber)(t.highWaterMark)&&s(a,e,c,v),i.onSuccess(_,a,e,v)}).catch(function(c){if(self.clearTimeout(n.requestTimeout),!a.aborted){var v=c&&c.code||0,m=c?c.message:null;i.onError({code:v,text:m},e,c?c.details:null)}})},o.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},o.loadProgressively=function(e,t,i,n,a){n===void 0&&(n=0);var r=new hn,s=e.body.getReader();return function l(){return s.read().then(function(u){if(u.done)return r.dataLength&&a(t,i,r.flush(),e),Promise.resolve(new ArrayBuffer(0));var c=u.value,v=c.length;return t.loaded+=v,v<n||r.dataLength?(r.push(c),r.dataLength>=n&&a(t,i,r.flush(),e)):a(t,i,c,e),l()}).catch(function(){return Promise.reject()})}()},d}();function Ns(d,o){return new self.Request(d.url,o)}var Us=function(d){var o,e;function t(i,n,a){var r;return(r=d.call(this,i)||this).code=void 0,r.details=void 0,r.code=n,r.details=a,r}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ui(o,e),t}(Yn(Error));let Fa=Fs;var Bs=/\s/;function Qn(){return Qn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Qn.apply(this,arguments)}function Na(d,o){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);o&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function Ua(d){for(var o=1;o<arguments.length;o++){var e=arguments[o]!=null?arguments[o]:{};o%2?Na(Object(e),!0).forEach(function(t){js(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Na(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function js(d,o,e){return(o=function(t){var i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return typeof i=="symbol"?i:String(i)}(o))in d?Object.defineProperty(d,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[o]=e,d}var Gs=Ua(Ua({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ma,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Cn,bufferController:Un,capLevelController:Rs,fpsController:Is,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Se,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(d,o,e,t){for(var i,n,a,r,s,l=[],u=self.VTTCue||self.TextTrackCue,c=0;c<t.rows.length;c++)if(a=!0,r=0,s="",!(i=t.rows[c]).isEmpty()){for(var v=0;v<i.chars.length;v++)Bs.test(i.chars[v].uchar)&&a?r++:(s+=i.chars[v].uchar,a=!1);i.cueStartTime=o,o===e&&(e+=1e-4),r>=16?r--:r++;var m=Xt(s.trim()),_=hr(o,e,m);d&&d.cues&&d.cues.getCueById(_)||((n=new u(o,e,m)).id=_,n.line=c+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*r/32)),l.push(n))}return d&&l.length&&(l.sort(function(S,F){return S.line==="auto"||F.line==="auto"?0:S.line>8&&F.line>8?F.line-S.line:S.line-F.line}),l.forEach(function(S){return it(d,S)})),l}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:xn,subtitleTrackController:Nn,timelineController:ws,audioStreamController:Oi,audioTrackController:Pn,emeController:Ps,cmcdController:Os});function Ba(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var ja=function(){function d(n){n===void 0&&(n={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ri.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=function(Ae,Ke){if((Ke.liveSyncDurationCount||Ke.liveMaxLatencyDurationCount)&&(Ke.liveSyncDuration||Ke.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(Ke.liveMaxLatencyDurationCount!==void 0&&(Ke.liveSyncDurationCount===void 0||Ke.liveMaxLatencyDurationCount<=Ke.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(Ke.liveMaxLatencyDuration!==void 0&&(Ke.liveSyncDuration===void 0||Ke.liveMaxLatencyDuration<=Ke.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return Qn({},Ae,Ke)}(d.DefaultConfig,n);this.userConfig=n,(0,L.enableLogs)(a.debug,"Hls instance"),this._autoLevelCapping=-1,a.progressive&&function(Ae){var Ke=Ae.loader;Ke!==Fa&&Ke!==Ma?(L.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),Ae.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(Ae.loader=Fa,Ae.progressive=!0,Ae.enableSoftwareAES=!0,L.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(a);var r=a.abrController,s=a.bufferController,l=a.capLevelController,u=a.fpsController,c=this.abrController=new r(this),v=this.bufferController=new s(this),m=this.capLevelController=new l(this),_=new u(this),S=new Ve(this),F=new tt(this),P=this.levelController=new ht(this),W=new Dt(this),ue=new pr(this.config),_e=this.streamController=new Ln(this,W,ue);m.setStreamController(_e),_.setStreamController(_e);var ge=[S,P,_e];this.networkControllers=ge;var De=[c,v,m,_,F,W];this.audioTrackController=this.createController(a.audioTrackController,ge);var He=a.audioStreamController;He&&ge.push(new He(this,W,ue)),this.subtitleTrackController=this.createController(a.subtitleTrackController,ge);var Je=a.subtitleStreamController;Je&&ge.push(new Je(this,W,ue)),this.createController(a.timelineController,De),ue.emeController=this.emeController=this.createController(a.emeController,De),this.cmcdController=this.createController(a.cmcdController,De),this.latencyController=this.createController(Ut,De),this.coreComponents=De}d.isSupported=function(){return function(){var n=fi();if(!n)return!1;var a=vi(),r=n&&typeof n.isTypeSupported=="function"&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!a||a.prototype&&typeof a.prototype.appendBuffer=="function"&&typeof a.prototype.remove=="function";return!!r&&!!s}()};var o,e,t,i=d.prototype;return i.createController=function(n,a){if(n){var r=new n(this);return a&&a.push(r),r}return null},i.on=function(n,a,r){r===void 0&&(r=this),this._emitter.on(n,a,r)},i.once=function(n,a,r){r===void 0&&(r=this),this._emitter.once(n,a,r)},i.removeAllListeners=function(n){this._emitter.removeAllListeners(n)},i.off=function(n,a,r,s){r===void 0&&(r=this),this._emitter.off(n,a,r,s)},i.listeners=function(n){return this._emitter.listeners(n)},i.emit=function(n,a,r){return this._emitter.emit(n,a,r)},i.trigger=function(n,a){if(this.config.debug)return this.emit(n,n,a);try{return this.emit(n,n,a)}catch(r){L.logger.error("An internal error happened while handling event "+n+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:n,error:r})}return!1},i.listenerCount=function(n){return this._emitter.listenerCount(n)},i.destroy=function(){L.logger.log("destroy"),this.trigger(g.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(n){return n.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(n){return n.destroy()}),this.coreComponents.length=0},i.attachMedia=function(n){L.logger.log("attachMedia"),this._media=n,this.trigger(g.Events.MEDIA_ATTACHING,{media:n})},i.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},i.loadSource=function(n){this.stopLoad();var a=this.media,r=this.url,s=this.url=re.buildAbsoluteURL(self.location.href,n,{alwaysNormalize:!0});L.logger.log("loadSource:"+s),a&&r&&r!==s&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(a)),this.trigger(g.Events.MANIFEST_LOADING,{url:n})},i.startLoad=function(n){n===void 0&&(n=-1),L.logger.log("startLoad("+n+")"),this.networkControllers.forEach(function(a){a.startLoad(n)})},i.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(n){n.stopLoad()})},i.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},i.recoverMediaError=function(){L.logger.log("recoverMediaError");var n=this._media;this.detachMedia(),n&&this.attachMedia(n)},i.removeLevel=function(n,a){a===void 0&&(a=0),this.levelController.removeLevel(n,a)},o=d,t=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return k.ErrorTypes}},{key:"ErrorDetails",get:function(){return k.ErrorDetails}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Gs},set:function(n){d.defaultConfig=n}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(n){L.logger.log("set currentLevel:"+n),this.loadLevel=n,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(n){L.logger.log("set nextLevel:"+n),this.levelController.manualLevel=n,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(n){L.logger.log("set loadLevel:"+n),this.levelController.manualLevel=n}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(n){this.levelController.nextLoadLevel=n}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(n){L.logger.log("set firstLevel:"+n),this.levelController.firstLevel=n}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(n){L.logger.log("set startLevel:"+n),n!==-1&&(n=Math.max(n,this.minAutoLevel)),this.levelController.startLevel=n}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(n){var a=!!n;a!==this.config.capLevelToPlayerSize&&(a?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=a)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(n){this._autoLevelCapping!==n&&(L.logger.log("set autoLevelCapping:"+n),this._autoLevelCapping=n)}},{key:"bandwidthEstimate",get:function(){var n=this.abrController.bwEstimator;return n?n.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(n){ar.indexOf(n)>-1&&(this._maxHdcpLevel=n)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var n=this.levels,a=this.config.minAutoBitrate;if(!n)return 0;for(var r=n.length,s=0;s<r;s++)if(n[s].maxBitrate>=a)return s;return 0}},{key:"maxAutoLevel",get:function(){var n,a=this.levels,r=this.autoLevelCapping,s=this.maxHdcpLevel;if(n=r===-1&&a&&a.length?a.length-1:r,s)for(var l=n;l--;){var u=a[l].attrs["HDCP-LEVEL"];if(u&&u<=s)return l}return n}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(n){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,n)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var n=this.audioTrackController;return n?n.audioTracks:[]}},{key:"audioTrack",get:function(){var n=this.audioTrackController;return n?n.audioTrack:-1},set:function(n){var a=this.audioTrackController;a&&(a.audioTrack=n)}},{key:"subtitleTracks",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTrack:-1},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleTrack=n)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var n=this.subtitleTrackController;return!!n&&n.subtitleDisplay},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleDisplay=n)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(n){this.config.lowLatencyMode=n}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&Ba(o.prototype,e),t&&Ba(o,t),Object.defineProperty(o,"prototype",{writable:!1}),d}();ja.defaultConfig=void 0},923:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{BaseSegment:()=>ce,ElementaryStreamTypes:()=>j,Fragment:()=>we,Part:()=>q});var j,re=B(965),R=B(945),g=B(408);function k(ye,J){ye.prototype=Object.create(J.prototype),ye.prototype.constructor=ye,L(ye,J)}function L(ye,J){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(se,K){return se.__proto__=K,se},L(ye,J)}function me(ye,J){for(var se=0;se<J.length;se++){var K=J[se];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(ye,typeof(Ee=function(ke,Ne){if(typeof ke!="object"||ke===null)return ke;var V=ke[Symbol.toPrimitive];if(V!==void 0){var E=V.call(ke,Ne);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(K.key,"string"))=="symbol"?Ee:String(Ee),K)}var Ee}function ne(ye,J,se){return J&&me(ye.prototype,J),se&&me(ye,se),Object.defineProperty(ye,"prototype",{writable:!1}),ye}(function(ye){ye.AUDIO="audio",ye.VIDEO="video",ye.AUDIOVIDEO="audiovideo"})(j||(j={}));var ce=function(){function ye(J){var se;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((se={})[j.AUDIO]=null,se[j.VIDEO]=null,se[j.AUDIOVIDEO]=null,se),this.baseurl=J}return ye.prototype.setByteRange=function(J,se){var K=J.split("@",2),Ee=[];K.length===1?Ee[0]=se?se.byteRangeEndOffset:0:Ee[0]=parseInt(K[1]),Ee[1]=parseInt(K[0])+Ee[0],this._byteRange=Ee},ne(ye,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(J){this._url=J}}]),ye}(),we=function(ye){function J(K,Ee){var ke;return(ke=ye.call(this,Ee)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new g.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=K,ke}k(J,ye);var se=J.prototype;return se.setKeyFormat=function(K){if(this.levelkeys){var Ee=this.levelkeys[K];Ee&&!this._decryptdata&&(this._decryptdata=Ee.getDecryptData(this.sn))}},se.abortRequests=function(){var K,Ee;(K=this.loader)===null||K===void 0||K.abort(),(Ee=this.keyLoader)===null||Ee===void 0||Ee.abort()},se.setElementaryStreamInfo=function(K,Ee,ke,Ne,V,E){E===void 0&&(E=!1);var U=this.elementaryStreams,D=U[K];D?(D.startPTS=Math.min(D.startPTS,Ee),D.endPTS=Math.max(D.endPTS,ke),D.startDTS=Math.min(D.startDTS,Ne),D.endDTS=Math.max(D.endDTS,V)):U[K]={startPTS:Ee,endPTS:ke,startDTS:Ne,endDTS:V,partial:E}},se.clearElementaryStreamInfo=function(){var K=this.elementaryStreams;K[j.AUDIO]=null,K[j.VIDEO]=null,K[j.AUDIOVIDEO]=null},ne(J,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var K=this.levelkeys.identity;if(K)this._decryptdata=K.getDecryptData(this.sn);else{var Ee=Object.keys(this.levelkeys);if(Ee.length===1)return this._decryptdata=this.levelkeys[Ee[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,re.isFiniteNumber)(this.programDateTime))return null;var K=(0,re.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*K}},{key:"encrypted",get:function(){var K;if((K=this._decryptdata)!==null&&K!==void 0&&K.encrypted)return!0;if(this.levelkeys){var Ee=Object.keys(this.levelkeys),ke=Ee.length;if(ke>1||ke===1&&this.levelkeys[Ee[0]].encrypted)return!0}return!1}}]),J}(ce),q=function(ye){function J(se,K,Ee,ke,Ne){var V;(V=ye.call(this,Ee)||this).fragOffset=0,V.duration=0,V.gap=!1,V.independent=!1,V.relurl=void 0,V.fragment=void 0,V.index=void 0,V.stats=new g.LoadStats,V.duration=se.decimalFloatingPoint("DURATION"),V.gap=se.bool("GAP"),V.independent=se.bool("INDEPENDENT"),V.relurl=se.enumeratedString("URI"),V.fragment=K,V.index=ke;var E=se.enumeratedString("BYTERANGE");return E&&V.setByteRange(E,Ne),Ne&&(V.fragOffset=Ne.fragOffset+Ne.duration),V}return k(J,ye),ne(J,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var se=this.elementaryStreams;return!!(se.audio||se.video||se.audiovideo)}}]),J}(ce)},408:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{LoadStats:()=>j});var j=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},965:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{MAX_SAFE_INTEGER:()=>re,isFiniteNumber:()=>j});var j=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},re=Number.MAX_SAFE_INTEGER||9007199254740991},524:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{default:()=>se,flushTextTrackMetadataCueSamples:()=>Ee,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>K});var j=B(965);let re=function(){function E(){}return E.getSilentFrame=function(U,D){if(U==="mp4a.40.2"){if(D===1)return new Uint8Array([0,200,0,128,35,128]);if(D===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(D===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(D===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(D===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(D===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(D===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(D===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(D===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},E}();var R=Math.pow(2,32)-1,g=function(){function E(){}return E.init=function(){var U;for(U in E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},E.types)E.types.hasOwnProperty(U)&&(E.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),de=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);E.HDLR_TYPES={video:D,audio:de};var Se=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),z=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=z,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var $=new Uint8Array([105,115,111,109]),Le=new Uint8Array([97,118,99,49]),Oe=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,$,Oe,$,Le),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,Se))},E.box=function(U){for(var D=8,de=arguments.length,Se=new Array(de>1?de-1:0),z=1;z<de;z++)Se[z-1]=arguments[z];for(var $=Se.length,Le=$;$--;)D+=Se[$].byteLength;var Oe=new Uint8Array(D);for(Oe[0]=D>>24&255,Oe[1]=D>>16&255,Oe[2]=D>>8&255,Oe[3]=255&D,Oe.set(U,4),$=0,D=8;$<Le;$++)Oe.set(Se[$],D),D+=Se[$].byteLength;return Oe},E.hdlr=function(U){return E.box(E.types.hdlr,E.HDLR_TYPES[U])},E.mdat=function(U){return E.box(E.types.mdat,U)},E.mdhd=function(U,D){D*=U;var de=Math.floor(D/(R+1)),Se=Math.floor(D%(R+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,255&U,de>>24,de>>16&255,de>>8&255,255&de,Se>>24,Se>>16&255,Se>>8&255,255&Se,85,196,0,0]))},E.mdia=function(U){return E.box(E.types.mdia,E.mdhd(U.timescale,U.duration),E.hdlr(U.type),E.minf(U))},E.mfhd=function(U){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,255&U]))},E.minf=function(U){return U.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(U)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(U))},E.moof=function(U,D,de){return E.box(E.types.moof,E.mfhd(U),E.traf(de,D))},E.moov=function(U){for(var D=U.length,de=[];D--;)de[D]=E.trak(U[D]);return E.box.apply(null,[E.types.moov,E.mvhd(U[0].timescale,U[0].duration)].concat(de).concat(E.mvex(U)))},E.mvex=function(U){for(var D=U.length,de=[];D--;)de[D]=E.trex(U[D]);return E.box.apply(null,[E.types.mvex].concat(de))},E.mvhd=function(U,D){D*=U;var de=Math.floor(D/(R+1)),Se=Math.floor(D%(R+1)),z=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,255&U,de>>24,de>>16&255,de>>8&255,255&de,Se>>24,Se>>16&255,Se>>8&255,255&Se,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return E.box(E.types.mvhd,z)},E.sdtp=function(U){var D,de,Se=U.samples||[],z=new Uint8Array(4+Se.length);for(D=0;D<Se.length;D++)de=Se[D].flags,z[D+4]=de.dependsOn<<4|de.isDependedOn<<2|de.hasRedundancy;return E.box(E.types.sdtp,z)},E.stbl=function(U){return E.box(E.types.stbl,E.stsd(U),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(U){var D,de,Se,z=[],$=[];for(D=0;D<U.sps.length;D++)Se=(de=U.sps[D]).byteLength,z.push(Se>>>8&255),z.push(255&Se),z=z.concat(Array.prototype.slice.call(de));for(D=0;D<U.pps.length;D++)Se=(de=U.pps[D]).byteLength,$.push(Se>>>8&255),$.push(255&Se),$=$.concat(Array.prototype.slice.call(de));var Le=E.box(E.types.avcC,new Uint8Array([1,z[3],z[4],z[5],255,224|U.sps.length].concat(z).concat([U.pps.length]).concat($))),Oe=U.width,xe=U.height,be=U.pixelRatio[0],qe=U.pixelRatio[1];return E.box(E.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Oe>>8&255,255&Oe,xe>>8&255,255&xe,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),Le,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([be>>24,be>>16&255,be>>8&255,255&be,qe>>24,qe>>16&255,qe>>8&255,255&qe])))},E.esds=function(U){var D=U.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(U.config).concat([6,1,2]))},E.mp4a=function(U){var D=U.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,255&D,0,0]),E.box(E.types.esds,E.esds(U)))},E.mp3=function(U){var D=U.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,255&D,0,0]))},E.stsd=function(U){return U.type==="audio"?U.segmentCodec==="mp3"&&U.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(U)):E.box(E.types.stsd,E.STSD,E.mp4a(U)):E.box(E.types.stsd,E.STSD,E.avc1(U))},E.tkhd=function(U){var D=U.id,de=U.duration*U.timescale,Se=U.width,z=U.height,$=Math.floor(de/(R+1)),Le=Math.floor(de%(R+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,255&D,0,0,0,0,$>>24,$>>16&255,$>>8&255,255&$,Le>>24,Le>>16&255,Le>>8&255,255&Le,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,Se>>8&255,255&Se,0,0,z>>8&255,255&z,0,0]))},E.traf=function(U,D){var de=E.sdtp(U),Se=U.id,z=Math.floor(D/(R+1)),$=Math.floor(D%(R+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,Se>>24,Se>>16&255,Se>>8&255,255&Se])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,z>>24,z>>16&255,z>>8&255,255&z,$>>24,$>>16&255,$>>8&255,255&$])),E.trun(U,de.length+16+20+8+16+8+8),de)},E.trak=function(U){return U.duration=U.duration||4294967295,E.box(E.types.trak,E.tkhd(U),E.mdia(U))},E.trex=function(U){var D=U.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,255&D,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(U,D){var de,Se,z,$,Le,Oe,xe=U.samples||[],be=xe.length,qe=12+16*be,at=new Uint8Array(qe);for(D+=8+qe,at.set([U.type==="video"?1:0,0,15,1,be>>>24&255,be>>>16&255,be>>>8&255,255&be,D>>>24&255,D>>>16&255,D>>>8&255,255&D],0),de=0;de<be;de++)z=(Se=xe[de]).duration,$=Se.size,Le=Se.flags,Oe=Se.cts,at.set([z>>>24&255,z>>>16&255,z>>>8&255,255&z,$>>>24&255,$>>>16&255,$>>>8&255,255&$,Le.isLeading<<2|Le.dependsOn,Le.isDependedOn<<6|Le.hasRedundancy<<4|Le.paddingValue<<1|Le.isNonSync,61440&Le.degradPrio,15&Le.degradPrio,Oe>>>24&255,Oe>>>16&255,Oe>>>8&255,255&Oe],12+16*de);return E.box(E.types.trun,at)},E.initSegment=function(U){E.types||E.init();var D=E.moov(U),de=new Uint8Array(E.FTYP.byteLength+D.byteLength);return de.set(E.FTYP),de.set(D,E.FTYP.byteLength),de},E}();g.types=void 0,g.HDLR_TYPES=void 0,g.STTS=void 0,g.STSC=void 0,g.STCO=void 0,g.STSZ=void 0,g.VMHD=void 0,g.SMHD=void 0,g.STSD=void 0,g.FTYP=void 0,g.DINF=void 0;let k=g;var L=B(851),me=B(973),ne=B(93),ce=B(308),we=B(673);function q(){return q=Object.assign?Object.assign.bind():function(E){for(var U=1;U<arguments.length;U++){var D=arguments[U];for(var de in D)Object.prototype.hasOwnProperty.call(D,de)&&(E[de]=D[de])}return E},q.apply(this,arguments)}var ye=null,J=null,se=function(){function E(D,de,Se,z){if(z===void 0&&(z=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=D,this.config=de,this.typeSupported=Se,this.ISGenerated=!1,ye===null){var $=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ye=$?parseInt($[1]):0}if(J===null){var Le=navigator.userAgent.match(/Safari\/(\d+)/i);J=Le?parseInt(Le[1]):0}}var U=E.prototype;return U.destroy=function(){},U.resetTimeStamp=function(D){ne.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=D},U.resetNextTimestamp=function(){ne.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},U.resetInitSegment=function(){ne.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},U.getVideoStartPts=function(D){var de=!1,Se=D.reduce(function(z,$){var Le=$.pts-z;return Le<-4294967296?(de=!0,K(z,$.pts)):Le>0?z:$.pts},D[0].pts);return de&&ne.logger.debug("PTS rollover detected"),Se},U.remux=function(D,de,Se,z,$,Le,Oe,xe){var be,qe,at,ie,pe,ae,Ue=$,H=$,ve=D.pid>-1,Ie=de.pid>-1,Fe=de.samples.length,fe=D.samples.length>0,Ce=Oe&&Fe>0||Fe>1;if((!ve||fe)&&(!Ie||Ce)||this.ISGenerated||Oe){this.ISGenerated||(at=this.generateIS(D,de,$));var Ve,Xe=this.isVideoContiguous,it=-1;if(Ce&&(it=function(wt){for(var gt=0;gt<wt.length;gt++)if(wt[gt].key)return gt;return-1}(de.samples),!Xe&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,it>0){ne.logger.warn("[mp4-remuxer]: Dropped "+it+" out of "+Fe+" video samples due to a missing keyframe");var lt=this.getVideoStartPts(de.samples);de.samples=de.samples.slice(it),de.dropped+=it,Ve=H+=(de.samples[0].pts-lt)/de.inputTimeScale}else it===-1&&(ne.logger.warn("[mp4-remuxer]: No keyframe found out of "+Fe+" video samples"),ae=!1);if(this.ISGenerated){if(fe&&Ce){var Ct=this.getVideoStartPts(de.samples),Rt=(K(D.samples[0].pts,Ct)-Ct)/de.inputTimeScale;Ue+=Math.max(0,Rt),H+=Math.max(0,-Rt)}if(fe){if(D.samplerate||(ne.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),at=this.generateIS(D,de,$)),qe=this.remuxAudio(D,Ue,this.isAudioContiguous,Le,Ie||Ce||xe===ce.PlaylistLevelType.AUDIO?H:void 0),Ce){var St=qe?qe.endPTS-qe.startPTS:0;de.inputTimeScale||(ne.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),at=this.generateIS(D,de,$)),be=this.remuxVideo(de,H,Xe,St)}}else Ce&&(be=this.remuxVideo(de,H,Xe,0));be&&(be.firstKeyFrame=it,be.independent=it!==-1,be.firstKeyFramePTS=Ve)}}return this.ISGenerated&&(Se.samples.length&&(pe=Ee(Se,$,this._initPTS,this._initDTS)),z.samples.length&&(ie=ke(z,$,this._initPTS))),{audio:qe,video:be,initSegment:at,independent:ae,text:ie,id3:pe}},U.generateIS=function(D,de,Se){var z,$,Le,Oe=D.samples,xe=de.samples,be=this.typeSupported,qe={},at=!(0,j.isFiniteNumber)(this._initPTS),ie="audio/mp4";if(at&&(z=$=1/0),D.config&&Oe.length&&(D.timescale=D.samplerate,D.segmentCodec==="mp3"&&(be.mpeg?(ie="audio/mpeg",D.codec=""):be.mp3&&(D.codec="mp3")),qe.audio={id:"audio",container:ie,codec:D.codec,initSegment:D.segmentCodec==="mp3"&&be.mpeg?new Uint8Array(0):k.initSegment([D]),metadata:{channelCount:D.channelCount}},at&&(Le=D.inputTimeScale,z=$=Oe[0].pts-Math.round(Le*Se))),de.sps&&de.pps&&xe.length&&(de.timescale=de.inputTimeScale,qe.video={id:"main",container:"video/mp4",codec:de.codec,initSegment:k.initSegment([de]),metadata:{width:de.width,height:de.height}},at)){Le=de.inputTimeScale;var pe=this.getVideoStartPts(xe),ae=Math.round(Le*Se);$=Math.min($,K(xe[0].dts,pe)-ae),z=Math.min(z,pe-ae)}if(Object.keys(qe).length)return this.ISGenerated=!0,at&&(this._initPTS=z,this._initDTS=$),{tracks:qe,initPTS:z,timescale:Le}},U.remuxVideo=function(D,de,Se,z){var $,Le,Oe=D.inputTimeScale,xe=D.samples,be=[],qe=xe.length,at=this._initPTS,ie=this.nextAvcDts,pe=8,ae=this.videoSampleDuration,Ue=Number.POSITIVE_INFINITY,H=Number.NEGATIVE_INFINITY,ve=!1;Se&&ie!==null||(ie=de*Oe-(xe[0].pts-K(xe[0].dts,xe[0].pts)));for(var Ie=0;Ie<qe;Ie++){var Fe=xe[Ie];Fe.pts=K(Fe.pts-at,ie),Fe.dts=K(Fe.dts-at,ie),Fe.dts<xe[Ie>0?Ie-1:Ie].dts&&(ve=!0)}ve&&xe.sort(function(Jt,pr){var Cr=Jt.dts-pr.dts,vr=Jt.pts-pr.pts;return Cr||vr}),$=xe[0].dts;var fe=xe[xe.length-1].dts-$,Ce=fe?Math.round(fe/(qe-1)):ae||D.inputTimeScale/30;if(Se){var Ve=$-ie,Xe=Ve>Ce,it=Ve<-1;if((Xe||it)&&(Xe?ne.logger.warn("AVC: "+(0,we.toMsFromMpegTsClock)(Ve,!0)+" ms ("+Ve+"dts) hole between fragments detected, filling it"):ne.logger.warn("AVC: "+(0,we.toMsFromMpegTsClock)(-Ve,!0)+" ms ("+Ve+"dts) overlapping between fragments detected"),!it||ie>xe[0].pts)){$=ie;var lt=xe[0].pts-Ve;xe[0].dts=$,xe[0].pts=lt,ne.logger.log("Video: First PTS/DTS adjusted: "+(0,we.toMsFromMpegTsClock)(lt,!0)+"/"+(0,we.toMsFromMpegTsClock)($,!0)+", delta: "+(0,we.toMsFromMpegTsClock)(Ve,!0)+" ms")}}$=Math.max(0,$);for(var Ct=0,Rt=0,St=0;St<qe;St++){for(var wt=xe[St],gt=wt.units,dt=gt.length,tt=0,It=0;It<dt;It++)tt+=gt[It].data.length;Rt+=tt,Ct+=dt,wt.length=tt,wt.dts=Math.max(wt.dts,$),Ue=Math.min(wt.pts,Ue),H=Math.max(wt.pts,H)}Le=xe[qe-1].dts;var Ut,Wt=Rt+4*Ct+8;try{Ut=new Uint8Array(Wt)}catch{return void this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:me.ErrorTypes.MUX_ERROR,details:me.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Wt,reason:"fail allocating video mdat "+Wt})}var Bt=new DataView(Ut.buffer);Bt.setUint32(0,Wt),Ut.set(k.types.mdat,4);for(var ar=!1,te=Number.POSITIVE_INFINITY,N=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY,C=0;C<qe;C++){for(var G=xe[C],Q=G.units,Z=0,Te=0,Re=Q.length;Te<Re;Te++){var Pe=Q[Te],Be=Pe.data,We=Pe.data.byteLength;Bt.setUint32(pe,We),pe+=4,Ut.set(Be,pe),pe+=We,Z+=4+We}var Ge=void 0;if(C<qe-1)ae=xe[C+1].dts-G.dts,Ge=xe[C+1].pts-G.pts;else{var $e=this.config,ht=C>0?G.dts-xe[C-1].dts:Ce;if(Ge=C>0?G.pts-xe[C-1].pts:Ce,$e.stretchShortVideoTrack&&this.nextAudioPts!==null){var Dt=Math.floor($e.maxBufferHole*Oe),ze=(z?Ue+z*Oe:this.nextAudioPts)-G.pts;ze>Dt?((ae=ze-ht)<0?ae=ht:ar=!0,ne.logger.log("[mp4-remuxer]: It is approximately "+ze/90+" ms to the next segment; using duration "+ae/90+" ms for the last video frame.")):ae=ht}else ae=ht}var Pt=Math.round(G.pts-G.dts);te=Math.min(te,ae),T=Math.max(T,ae),N=Math.min(N,Ge),O=Math.max(O,Ge),be.push(new Ne(G.key,ae,Z,Pt))}if(be.length){if(ye){if(ye<70){var tr=be[0].flags;tr.dependsOn=2,tr.isNonSync=0}}else if(J&&O-N<T-te&&Ce/T<.025&&be[0].cts===0){ne.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var jt=$,Ft=0,Ht=be.length;Ft<Ht;Ft++){var rt=jt+be[Ft].duration,lr=jt+be[Ft].cts;if(Ft<Ht-1){var Ar=rt+be[Ft+1].cts;be[Ft].duration=Ar-lr}else be[Ft].duration=Ft?be[Ft-1].duration:Ce;be[Ft].cts=0,jt=rt}}}ae=ar||!ae?Ce:ae,this.nextAvcDts=ie=Le+ae,this.videoSampleDuration=ae,this.isVideoContiguous=!0;var Kt={data1:k.moof(D.sequenceNumber++,$,q({},D,{samples:be})),data2:Ut,startPTS:Ue/Oe,endPTS:(H+ae)/Oe,startDTS:$/Oe,endDTS:ie/Oe,type:"video",hasAudio:!1,hasVideo:!0,nb:be.length,dropped:D.dropped};return D.samples=[],D.dropped=0,Kt},U.remuxAudio=function(D,de,Se,z,$){var Le=D.inputTimeScale,Oe=Le/(D.samplerate?D.samplerate:Le),xe=D.segmentCodec==="aac"?1024:1152,be=xe*Oe,qe=this._initPTS,at=D.segmentCodec==="mp3"&&this.typeSupported.mpeg,ie=[],pe=$!==void 0,ae=D.samples,Ue=at?0:8,H=this.nextAudioPts||-1,ve=de*Le;if(this.isAudioContiguous=Se=Se||ae.length&&H>0&&(z&&Math.abs(ve-H)<9e3||Math.abs(K(ae[0].pts-qe,ve)-H)<20*be),ae.forEach(function(Te){Te.pts=K(Te.pts-qe,ve)}),!Se||H<0){if(ae=ae.filter(function(Te){return Te.pts>=0}),!ae.length)return;H=$===0?0:z&&!pe?Math.max(0,ve):ae[0].pts}if(D.segmentCodec==="aac")for(var Ie=this.config.maxAudioFramesDrift,Fe=0,fe=H;Fe<ae.length;Fe++){var Ce=ae[Fe],Ve=Ce.pts,Xe=Ve-fe,it=Math.abs(1e3*Xe/Le);if(Xe<=-Ie*be&&pe)Fe===0&&(ne.logger.warn("Audio frame @ "+(Ve/Le).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Xe/Le)+" ms."),this.nextAudioPts=H=fe=Ve);else if(Xe>=Ie*be&&it<1e4&&pe){var lt=Math.round(Xe/be);(fe=Ve-lt*be)<0&&(lt--,fe+=be),Fe===0&&(this.nextAudioPts=H=fe),ne.logger.warn("[mp4-remuxer]: Injecting "+lt+" audio frame @ "+(fe/Le).toFixed(3)+"s due to "+Math.round(1e3*Xe/Le)+" ms gap.");for(var Ct=0;Ct<lt;Ct++){var Rt=Math.max(fe,0),St=re.getSilentFrame(D.manifestCodec||D.codec,D.channelCount);St||(ne.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),St=Ce.unit.subarray()),ae.splice(Fe,0,{unit:St,pts:Rt}),fe+=be,Fe++}}Ce.pts=fe,fe+=be}for(var wt,gt=null,dt=null,tt=0,It=ae.length;It--;)tt+=ae[It].unit.byteLength;for(var Ut=0,Wt=ae.length;Ut<Wt;Ut++){var Bt=ae[Ut],ar=Bt.unit,te=Bt.pts;if(dt!==null)ie[Ut-1].duration=Math.round((te-dt)/Oe);else{if(Se&&D.segmentCodec==="aac"&&(te=H),gt=te,!(tt>0))return;tt+=Ue;try{wt=new Uint8Array(tt)}catch{return void this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:me.ErrorTypes.MUX_ERROR,details:me.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:tt,reason:"fail allocating audio mdat "+tt})}at||(new DataView(wt.buffer).setUint32(0,tt),wt.set(k.types.mdat,4))}wt.set(ar,Ue);var N=ar.byteLength;Ue+=N,ie.push(new Ne(!0,xe,N,0)),dt=te}var T=ie.length;if(T){var O=ie[ie.length-1];this.nextAudioPts=H=dt+Oe*O.duration;var C=at?new Uint8Array(0):k.moof(D.sequenceNumber++,gt/Oe,q({},D,{samples:ie}));D.samples=[];var G=gt/Le,Q=H/Le,Z={data1:C,data2:wt,startPTS:G,endPTS:Q,startDTS:G,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,Z}},U.remuxEmptyAudio=function(D,de,Se,z){var $=D.inputTimeScale,Le=$/(D.samplerate?D.samplerate:$),Oe=this.nextAudioPts,xe=(Oe!==null?Oe:z.startDTS*$)+this._initDTS,be=z.endDTS*$+this._initDTS,qe=1024*Le,at=Math.ceil((be-xe)/qe),ie=re.getSilentFrame(D.manifestCodec||D.codec,D.channelCount);if(ne.logger.warn("[mp4-remuxer]: remux empty Audio"),ie){for(var pe=[],ae=0;ae<at;ae++){var Ue=xe+ae*qe;pe.push({unit:ie,pts:Ue,dts:Ue})}return D.samples=pe,this.remuxAudio(D,de,Se,!1)}ne.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},E}();function K(E,U){var D;if(U===null)return E;for(D=U<E?-8589934592:8589934592;Math.abs(E-U)>4294967296;)E+=D;return E}function Ee(E,U,D,de){var Se=E.samples.length;if(Se){for(var z=E.inputTimeScale,$=0;$<Se;$++){var Le=E.samples[$];Le.pts=K(Le.pts-D,U*z)/z,Le.dts=K(Le.dts-de,U*z)/z}var Oe=E.samples;return E.samples=[],{samples:Oe}}}function ke(E,U,D){var de=E.samples.length;if(de){for(var Se=E.inputTimeScale,z=0;z<de;z++){var $=E.samples[z];$.pts=K($.pts-D,U*Se)/Se}E.samples.sort(function(Oe,xe){return Oe.pts-xe.pts});var Le=E.samples;return E.samples=[],{samples:Le}}}var Ne=function(E,U,D,de){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=U,this.size=D,this.cts=de,this.flags=new V(E)},V=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},856:(oe,X,B)=>{"use strict";var j;B.r(X),B.d(X,{MetadataSchema:()=>j}),function(re){re.audioId3="org.id3",re.dateRange="com.apple.quicktime.HLS",re.emsg="https://aomedia.org/emsg/ID3"}(j||(j={}))},308:(oe,X,B)=>{"use strict";var j,re;B.r(X),B.d(X,{PlaylistContextType:()=>j,PlaylistLevelType:()=>re}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(j||(j={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}(re||(re={}))},300:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{default:()=>j});let j={hexDump:function(re){for(var R="",g=0;g<re.length;g++){var k=re[g].toString(16);k.length<2&&(k="0"+k),R+=k}return R}}},93:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{enableLogs:()=>k,logger:()=>L});var j=function(){},re={trace:j,debug:j,log:j,warn:j,info:j,error:j},R=re;function g(me){var ne=self.console[me];return ne?ne.bind(self.console,"["+me+"] >"):j}function k(me,ne){if(self.console&&me===!0||typeof me=="object"){(function(ce){for(var we=arguments.length,q=new Array(we>1?we-1:0),ye=1;ye<we;ye++)q[ye-1]=arguments[ye];q.forEach(function(J){R[J]=ce[J]?ce[J].bind(ce):g(J)})})(me,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+ne+'"')}catch{R=re}}else R=re}var L=re},63:(oe,X,B)=>{"use strict";B.r(X),B.d(X,{RemuxerTrackIdConfig:()=>ne,appendUint8Array:()=>Se,bin2str:()=>ce,computeRawDurationFromSamples:()=>U,discardEPB:()=>Oe,findBox:()=>se,getDuration:()=>E,getStartDTS:()=>V,mp4Box:()=>be,mp4pssh:()=>qe,offsetStartDTS:()=>D,parseEmsg:()=>xe,parseInitSegment:()=>Ee,parsePssh:()=>at,parseSEIMessageFromNALu:()=>Le,parseSamples:()=>z,parseSegmentIndex:()=>K,parseSinf:()=>Ne,patchEncyptionData:()=>ke,readSint32:()=>ye,readUint16:()=>we,readUint32:()=>q,segmentValidRange:()=>de,writeUint32:()=>J});var j=B(923),re=B(145),R=B(181),g=B(93),k=B(300),L=Math.pow(2,32)-1,me=[].push,ne={video:1,audio:2,id3:3,text:4};function ce(ie){return String.fromCharCode.apply(null,ie)}function we(ie,pe){var ae=ie[pe]<<8|ie[pe+1];return ae<0?65536+ae:ae}function q(ie,pe){var ae=ye(ie,pe);return ae<0?4294967296+ae:ae}function ye(ie,pe){return ie[pe]<<24|ie[pe+1]<<16|ie[pe+2]<<8|ie[pe+3]}function J(ie,pe,ae){ie[pe]=ae>>24,ie[pe+1]=ae>>16&255,ie[pe+2]=ae>>8&255,ie[pe+3]=255&ae}function se(ie,pe){var ae=[];if(!pe.length)return ae;for(var Ue=ie.byteLength,H=0;H<Ue;){var ve=q(ie,H),Ie=ve>1?H+ve:Ue;if(ce(ie.subarray(H+4,H+8))===pe[0])if(pe.length===1)ae.push(ie.subarray(H+8,Ie));else{var Fe=se(ie.subarray(H+8,Ie),pe.slice(1));Fe.length&&me.apply(ae,Fe)}H=Ie}return ae}function K(ie){var pe=[],ae=ie[0],Ue=8,H=q(ie,Ue);Ue+=4,Ue+=ae===0?8:16,Ue+=2;var ve=ie.length+0,Ie=we(ie,Ue);Ue+=2;for(var Fe=0;Fe<Ie;Fe++){var fe=Ue,Ce=q(ie,fe);fe+=4;var Ve=2147483647&Ce;if((2147483648&Ce)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Xe=q(ie,fe);fe+=4,pe.push({referenceSize:Ve,subsegmentDuration:Xe,info:{duration:Xe/H,start:ve,end:ve+Ve-1}}),ve+=Ve,Ue=fe+=4}return{earliestPresentationTime:0,timescale:H,version:ae,referencesCount:Ie,references:pe}}function Ee(ie){for(var pe=[],ae=se(ie,["moov","trak"]),Ue=0;Ue<ae.length;Ue++){var H=ae[Ue],ve=se(H,["tkhd"])[0];if(ve){var Ie=ve[0],Fe=Ie===0?12:20,fe=q(ve,Fe),Ce=se(H,["mdia","mdhd"])[0];if(Ce){var Ve=q(Ce,Fe=(Ie=Ce[0])===0?12:20),Xe=se(H,["mdia","hdlr"])[0];if(Xe){var it=ce(Xe.subarray(8,12)),lt={soun:j.ElementaryStreamTypes.AUDIO,vide:j.ElementaryStreamTypes.VIDEO}[it];if(lt){var Ct=se(H,["mdia","minf","stbl","stsd"])[0],Rt=void 0;Ct&&(Rt=ce(Ct.subarray(12,16))),pe[fe]={timescale:Ve,type:lt},pe[lt]={timescale:Ve,id:fe,codec:Rt}}}}}}return se(ie,["moov","mvex","trex"]).forEach(function(St){var wt=q(St,4),gt=pe[wt];gt&&(gt.default={duration:q(St,12),flags:q(St,20)})}),pe}function ke(ie,pe){if(!ie||!pe)return ie;var ae=pe.keyId;return ae&&pe.isCommonEncryption&&se(ie,["moov","trak"]).forEach(function(Ue){var H=se(Ue,["mdia","minf","stbl","stsd"])[0].subarray(8),ve=se(H,["enca"]),Ie=ve.length>0;Ie||(ve=se(H,["encv"])),ve.forEach(function(Fe){se(Ie?Fe.subarray(28):Fe.subarray(78),["sinf"]).forEach(function(fe){var Ce=Ne(fe);if(Ce){var Ve=Ce.subarray(8,24);Ve.some(function(Xe){return Xe!==0})||(g.logger.log("[eme] Patching keyId in 'enc"+(Ie?"a":"v")+">sinf>>tenc' box: "+k.default.hexDump(Ve)+" -> "+k.default.hexDump(ae)),Ce.set(ae,8))}})})}),ie}function Ne(ie){var pe=se(ie,["schm"])[0];if(pe){var ae=ce(pe.subarray(4,8));if(ae==="cbcs"||ae==="cenc")return se(ie,["schi","tenc"])[0]}return g.logger.error("[eme] missing 'schm' box"),null}function V(ie,pe){return se(pe,["moof","traf"]).reduce(function(ae,Ue){var H=se(Ue,["tfdt"])[0],ve=H[0],Ie=se(Ue,["tfhd"]).reduce(function(Fe,fe){var Ce=q(fe,4),Ve=ie[Ce];if(Ve){var Xe=q(H,4);ve===1&&(Xe*=Math.pow(2,32),Xe+=q(H,8));var it=Xe/(Ve.timescale||9e4);if(isFinite(it)&&(Fe===null||it<Fe))return it}return Fe},null);return Ie!==null&&isFinite(Ie)&&(ae===null||Ie<ae)?Ie:ae},null)||0}function E(ie,pe){for(var ae=0,Ue=0,H=0,ve=se(ie,["moof","traf"]),Ie=0;Ie<ve.length;Ie++){var Fe=ve[Ie],fe=se(Fe,["tfhd"])[0],Ce=pe[q(fe,4)];if(Ce){var Ve=Ce.default,Xe=q(fe,0)|(Ve==null?void 0:Ve.flags),it=Ve==null?void 0:Ve.duration;8&Xe&&(it=q(fe,2&Xe?12:8));for(var lt=Ce.timescale||9e4,Ct=se(Fe,["trun"]),Rt=0;Rt<Ct.length;Rt++)!(ae=U(Ct[Rt]))&&it&&(ae=it*q(Ct[Rt],4)),Ce.type===j.ElementaryStreamTypes.VIDEO?Ue+=ae/lt:Ce.type===j.ElementaryStreamTypes.AUDIO&&(H+=ae/lt)}}if(Ue===0&&H===0){for(var St=0,wt=se(ie,["sidx"]),gt=0;gt<wt.length;gt++){var dt=K(wt[gt]);dt!=null&&dt.references&&(St+=dt.references.reduce(function(tt,It){return tt+It.info.duration||0},0))}return St}return Ue||H}function U(ie){var pe=q(ie,0),ae=8;1&pe&&(ae+=4),4&pe&&(ae+=4);for(var Ue=0,H=q(ie,4),ve=0;ve<H;ve++)256&pe&&(Ue+=q(ie,ae),ae+=4),512&pe&&(ae+=4),1024&pe&&(ae+=4),2048&pe&&(ae+=4);return Ue}function D(ie,pe,ae){se(pe,["moof","traf"]).forEach(function(Ue){se(Ue,["tfhd"]).forEach(function(H){var ve=q(H,4),Ie=ie[ve];if(Ie){var Fe=Ie.timescale||9e4;se(Ue,["tfdt"]).forEach(function(fe){var Ce=fe[0],Ve=q(fe,4);if(Ce===0)Ve-=ae*Fe,J(fe,4,Ve=Math.max(Ve,0));else{Ve*=Math.pow(2,32),Ve+=q(fe,8),Ve-=ae*Fe,Ve=Math.max(Ve,0);var Xe=Math.floor(Ve/(L+1)),it=Math.floor(Ve%(L+1));J(fe,4,Xe),J(fe,8,it)}})}})})}function de(ie){var pe={valid:null,remainder:null},ae=se(ie,["moof"]);if(!ae)return pe;if(ae.length<2)return pe.remainder=ie,pe;var Ue=ae[ae.length-1];return pe.valid=(0,re.sliceUint8)(ie,0,Ue.byteOffset-8),pe.remainder=(0,re.sliceUint8)(ie,Ue.byteOffset-8),pe}function Se(ie,pe){var ae=new Uint8Array(ie.length+pe.length);return ae.set(ie),ae.set(pe,ie.length),ae}function z(ie,pe){var ae=[],Ue=pe.samples,H=pe.timescale,ve=pe.id,Ie=!1;return se(Ue,["moof"]).map(function(Fe){var fe=Fe.byteOffset-8;se(Fe,["traf"]).map(function(Ce){var Ve=se(Ce,["tfdt"]).map(function(Xe){var it=Xe[0],lt=q(Xe,4);return it===1&&(lt*=Math.pow(2,32),lt+=q(Xe,8)),lt/H})[0];return Ve!==void 0&&(ie=Ve),se(Ce,["tfhd"]).map(function(Xe){var it=q(Xe,4),lt=16777215&q(Xe,0),Ct=0,Rt=(16<)!=0,St=0,wt=(32<)!=0,gt=8;it===ve&&((1<)!=0&&(gt+=8),(2<)!=0&&(gt+=4),(8<)!=0&&(Ct=q(Xe,gt),gt+=4),Rt&&(St=q(Xe,gt),gt+=4),wt&&(gt+=4),pe.type==="video"&&(Ie=function(dt){if(!dt)return!1;var tt=dt.indexOf("."),It=tt<0?dt:dt.substring(0,tt);return It==="hvc1"||It==="hev1"||It==="dvh1"||It==="dvhe"}(pe.codec)),se(Ce,["trun"]).map(function(dt){var tt=dt[0],It=16777215&q(dt,0),Ut=(1&It)!=0,Wt=0,Bt=(4&It)!=0,ar=(256&It)!=0,te=0,N=(512&It)!=0,T=0,O=(1024&It)!=0,C=(2048&It)!=0,G=0,Q=q(dt,4),Z=8;Ut&&(Wt=q(dt,Z),Z+=4),Bt&&(Z+=4);for(var Te=Wt+fe,Re=0;Re<Q;Re++){if(ar?(te=q(dt,Z),Z+=4):te=Ct,N?(T=q(dt,Z),Z+=4):T=St,O&&(Z+=4),C&&(G=tt===0?q(dt,Z):ye(dt,Z),Z+=4),pe.type===j.ElementaryStreamTypes.VIDEO)for(var Pe=0;Pe<T;){var Be=q(Ue,Te);$(Ie,Ue[Te+=4])&&Le(Ue.subarray(Te,Te+Be),Ie?2:1,ie+G/H,ae),Te+=Be,Pe+=Be+4}ie+=te/H}}))})})}),ae}function $(ie,pe){if(ie){var ae=pe>>1&63;return ae===39||ae===40}return(31&pe)==6}function Le(ie,pe,ae,Ue){var H=Oe(ie),ve=0;ve+=pe;for(var Ie=0,Fe=0,fe=!1,Ce=0;ve<H.length;){Ie=0;do{if(ve>=H.length)break;Ie+=Ce=H[ve++]}while(Ce===255);Fe=0;do{if(ve>=H.length)break;Fe+=Ce=H[ve++]}while(Ce===255);var Ve=H.length-ve;if(!fe&&Ie===4&&ve<H.length){if(fe=!0,H[ve++]===181){var Xe=we(H,ve);if(ve+=2,Xe===49){var it=q(H,ve);if(ve+=4,it===1195456820){var lt=H[ve++];if(lt===3){var Ct=H[ve++],Rt=64&Ct,St=Rt?2+3*(31&Ct):0,wt=new Uint8Array(St);if(Rt){wt[0]=Ct;for(var gt=1;gt<St;gt++)wt[gt]=H[ve++]}Ue.push({type:lt,payloadType:Ie,pts:ae,bytes:wt})}}}}}else if(Ie===5&&Fe<Ve){if(fe=!0,Fe>16){for(var dt=[],tt=0;tt<16;tt++){var It=H[ve++].toString(16);dt.push(It.length==1?"0"+It:It),tt!==3&&tt!==5&&tt!==7&&tt!==9||dt.push("-")}for(var Ut=Fe-16,Wt=new Uint8Array(Ut),Bt=0;Bt<Ut;Bt++)Wt[Bt]=H[ve++];Ue.push({payloadType:Ie,pts:ae,uuid:dt.join(""),userData:(0,R.utf8ArrayToStr)(Wt),userDataBytes:Wt})}}else if(Fe<Ve)ve+=Fe;else if(Fe>Ve)break}}function Oe(ie){for(var pe=ie.byteLength,ae=[],Ue=1;Ue<pe-2;)ie[Ue]===0&&ie[Ue+1]===0&&ie[Ue+2]===3?(ae.push(Ue+2),Ue+=2):Ue++;if(ae.length===0)return ie;var H=pe-ae.length,ve=new Uint8Array(H),Ie=0;for(Ue=0;Ue<H;Ie++,Ue++)Ie===ae[0]&&(Ie++,ae.shift()),ve[Ue]=ie[Ie];return ve}function xe(ie){var pe=ie[0],ae="",Ue="",H=0,ve=0,Ie=0,Fe=0,fe=0,Ce=0;if(pe===0){for(;ce(ie.subarray(Ce,Ce+1))!=="\0";)ae+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;for(ae+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;ce(ie.subarray(Ce,Ce+1))!=="\0";)Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1,H=q(ie,12),ve=q(ie,16),Fe=q(ie,20),fe=q(ie,24),Ce=28}else if(pe===1){H=q(ie,Ce+=4);var Ve=q(ie,Ce+=4),Xe=q(ie,Ce+=4);for(Ce+=4,Ie=Math.pow(2,32)*Ve+Xe,Number.isSafeInteger(Ie)||(Ie=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),Fe=q(ie,Ce),fe=q(ie,Ce+=4),Ce+=4;ce(ie.subarray(Ce,Ce+1))!=="\0";)ae+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;for(ae+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;ce(ie.subarray(Ce,Ce+1))!=="\0";)Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1}return{schemeIdUri:ae,value:Ue,timeScale:H,presentationTime:Ie,presentationTimeDelta:ve,eventDuration:Fe,id:fe,payload:ie.subarray(Ce,ie.byteLength)}}function be(ie){for(var pe=arguments.length,ae=new Array(pe>1?pe-1:0),Ue=1;Ue<pe;Ue++)ae[Ue-1]=arguments[Ue];for(var H=ae.length,ve=8,Ie=H;Ie--;)ve+=ae[Ie].byteLength;var Fe=new Uint8Array(ve);for(Fe[0]=ve>>24&255,Fe[1]=ve>>16&255,Fe[2]=ve>>8&255,Fe[3]=255&ve,Fe.set(ie,4),Ie=0,ve=8;Ie<H;Ie++)Fe.set(ae[Ie],ve),ve+=ae[Ie].byteLength;return Fe}function qe(ie,pe,ae){if(ie.byteLength!==16)throw new RangeError("Invalid system id");var Ue,H,ve;if(pe){Ue=1,H=new Uint8Array(16*pe.length);for(var Ie=0;Ie<pe.length;Ie++){var Fe=pe[Ie];if(Fe.byteLength!==16)throw new RangeError("Invalid key");H.set(Fe,16*Ie)}}else Ue=0,H=new Uint8Array;Ue>0?(ve=new Uint8Array(4),pe.length>0&&new DataView(ve.buffer).setUint32(0,pe.length,!1)):ve=new Uint8Array;var fe=new Uint8Array(4);return ae&&ae.byteLength>0&&new DataView(fe.buffer).setUint32(0,ae.byteLength,!1),be([112,115,115,104],new Uint8Array([Ue,0,0,0]),ie,ve,H,fe,ae||new Uint8Array)}function at(ie){if(!(ie instanceof ArrayBuffer)||ie.byteLength<32)return null;var pe={version:0,systemId:"",kids:null,data:null},ae=new DataView(ie),Ue=ae.getUint32(0);if(ie.byteLength!==Ue&&Ue>44||ae.getUint32(4)!==1886614376||(pe.version=ae.getUint32(8)>>>24,pe.version>1))return null;pe.systemId=k.default.hexDump(new Uint8Array(ie,12,16));var H=ae.getUint32(28);if(pe.version===0){if(Ue-32<H)return null;pe.data=new Uint8Array(ie,32,H)}else if(pe.version===1){pe.kids=[];for(var ve=0;ve<H;ve++)pe.kids.push(new Uint8Array(ie,32+16*ve,16))}return pe}},673:(oe,X,B)=>{"use strict";function j(k,L,me,ne){me===void 0&&(me=1),ne===void 0&&(ne=!1);var ce=k*L*me;return ne?Math.round(ce):ce}function re(k,L,me,ne){return me===void 0&&(me=1),ne===void 0&&(ne=!1),j(k,L,1/me,ne)}function R(k,L){return L===void 0&&(L=!1),j(k,1e3,11111111111111112e-21,L)}function g(k,L){return L===void 0&&(L=1),j(k,9e4,1/L)}B.r(X),B.d(X,{toMpegTsClockFromTimescale:()=>g,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>j,toTimescaleFromScale:()=>re})},145:(oe,X,B)=>{"use strict";function j(re,R,g){return Uint8Array.prototype.slice?re.slice(R,g):new Uint8Array(Array.prototype.slice.call(re,R,g))}B.r(X),B.d(X,{sliceUint8:()=>j})},729:oe=>{"use strict";var X=Object.prototype.hasOwnProperty,B="~";function j(){}function re(L,me,ne){this.fn=L,this.context=me,this.once=ne||!1}function R(L,me,ne,ce,we){if(typeof ne!="function")throw new TypeError("The listener must be a function");var q=new re(ne,ce||L,we),ye=B?B+me:me;return L._events[ye]?L._events[ye].fn?L._events[ye]=[L._events[ye],q]:L._events[ye].push(q):(L._events[ye]=q,L._eventsCount++),L}function g(L,me){--L._eventsCount==0?L._events=new j:delete L._events[me]}function k(){this._events=new j,this._eventsCount=0}Object.create&&(j.prototype=Object.create(null),new j().__proto__||(B=!1)),k.prototype.eventNames=function(){var L,me,ne=[];if(this._eventsCount===0)return ne;for(me in L=this._events)X.call(L,me)&&ne.push(B?me.slice(1):me);return Object.getOwnPropertySymbols?ne.concat(Object.getOwnPropertySymbols(L)):ne},k.prototype.listeners=function(L){var me=B?B+L:L,ne=this._events[me];if(!ne)return[];if(ne.fn)return[ne.fn];for(var ce=0,we=ne.length,q=new Array(we);ce<we;ce++)q[ce]=ne[ce].fn;return q},k.prototype.listenerCount=function(L){var me=B?B+L:L,ne=this._events[me];return ne?ne.fn?1:ne.length:0},k.prototype.emit=function(L,me,ne,ce,we,q){var ye=B?B+L:L;if(!this._events[ye])return!1;var J,se,K=this._events[ye],Ee=arguments.length;if(K.fn){switch(K.once&&this.removeListener(L,K.fn,void 0,!0),Ee){case 1:return K.fn.call(K.context),!0;case 2:return K.fn.call(K.context,me),!0;case 3:return K.fn.call(K.context,me,ne),!0;case 4:return K.fn.call(K.context,me,ne,ce),!0;case 5:return K.fn.call(K.context,me,ne,ce,we),!0;case 6:return K.fn.call(K.context,me,ne,ce,we,q),!0}for(se=1,J=new Array(Ee-1);se<Ee;se++)J[se-1]=arguments[se];K.fn.apply(K.context,J)}else{var ke,Ne=K.length;for(se=0;se<Ne;se++)switch(K[se].once&&this.removeListener(L,K[se].fn,void 0,!0),Ee){case 1:K[se].fn.call(K[se].context);break;case 2:K[se].fn.call(K[se].context,me);break;case 3:K[se].fn.call(K[se].context,me,ne);break;case 4:K[se].fn.call(K[se].context,me,ne,ce);break;default:if(!J)for(ke=1,J=new Array(Ee-1);ke<Ee;ke++)J[ke-1]=arguments[ke];K[se].fn.apply(K[se].context,J)}}return!0},k.prototype.on=function(L,me,ne){return R(this,L,me,ne,!1)},k.prototype.once=function(L,me,ne){return R(this,L,me,ne,!0)},k.prototype.removeListener=function(L,me,ne,ce){var we=B?B+L:L;if(!this._events[we])return this;if(!me)return g(this,we),this;var q=this._events[we];if(q.fn)q.fn!==me||ce&&!q.once||ne&&q.context!==ne||g(this,we);else{for(var ye=0,J=[],se=q.length;ye<se;ye++)(q[ye].fn!==me||ce&&!q[ye].once||ne&&q[ye].context!==ne)&&J.push(q[ye]);J.length?this._events[we]=J.length===1?J[0]:J:g(this,we)}return this},k.prototype.removeAllListeners=function(L){var me;return L?(me=B?B+L:L,this._events[me]&&g(this,me)):(this._events=new j,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=B,k.EventEmitter=k,oe.exports=k},945:function(oe){var X,B,j,re,R;X=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,B=/^(?=([^\/?#]*))\1([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,re=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(g,k,L){if(L=L||{},g=g.trim(),!(k=k.trim())){if(!L.alwaysNormalize)return g;var me=R.parseURL(g);if(!me)throw new Error("Error trying to parse base URL.");return me.path=R.normalizePath(me.path),R.buildURLFromParts(me)}var ne=R.parseURL(k);if(!ne)throw new Error("Error trying to parse relative URL.");if(ne.scheme)return L.alwaysNormalize?(ne.path=R.normalizePath(ne.path),R.buildURLFromParts(ne)):k;var ce=R.parseURL(g);if(!ce)throw new Error("Error trying to parse base URL.");if(!ce.netLoc&&ce.path&&ce.path[0]!=="/"){var we=B.exec(ce.path);ce.netLoc=we[1],ce.path=we[2]}ce.netLoc&&!ce.path&&(ce.path="/");var q={scheme:ce.scheme,netLoc:ne.netLoc,path:null,params:ne.params,query:ne.query,fragment:ne.fragment};if(!ne.netLoc&&(q.netLoc=ce.netLoc,ne.path[0]!=="/"))if(ne.path){var ye=ce.path,J=ye.substring(0,ye.lastIndexOf("/")+1)+ne.path;q.path=R.normalizePath(J)}else q.path=ce.path,ne.params||(q.params=ce.params,ne.query||(q.query=ce.query));return q.path===null&&(q.path=L.alwaysNormalize?R.normalizePath(ne.path):ne.path),R.buildURLFromParts(q)},parseURL:function(g){var k=X.exec(g);return k?{scheme:k[1]||"",netLoc:k[2]||"",path:k[3]||"",params:k[4]||"",query:k[5]||"",fragment:k[6]||""}:null},normalizePath:function(g){for(g=g.split("").reverse().join("").replace(j,"");g.length!==(g=g.replace(re,"")).length;);return g.split("").reverse().join("")},buildURLFromParts:function(g){return g.scheme+g.netLoc+g.path+g.params+g.query+g.fragment}},oe.exports=R}},w={};function A(oe){var X=w[oe];if(X!==void 0)return X.exports;var B=w[oe]={exports:{}};return x[oe].call(B.exports,B,B.exports,A),B.exports}A.m=x,A.n=oe=>{var X=oe&&oe.__esModule?()=>oe.default:()=>oe;return A.d(X,{a:X}),X},A.d=(oe,X)=>{for(var B in X)A.o(X,B)&&!A.o(oe,B)&&Object.defineProperty(oe,B,{enumerable:!0,get:X[B]})},A.o=(oe,X)=>Object.prototype.hasOwnProperty.call(oe,X),A.r=oe=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(oe,"__esModule",{value:!0})};var le=A(76);return le.default})())});var bi=class{addEventListener(){}removeEventListener(){}dispatchEvent(w){return!0}};if(typeof DocumentFragment=="undefined"){class x extends bi{}globalThis.DocumentFragment=x}var Hi=class extends bi{},ea=class extends bi{},zs={get(x){},define(x,w,A){},upgrade(x){},whenDefined(x){return Promise.resolve(Hi)}},qi,ta=class{constructor(w,A={}){bt(this,qi,void 0);Nt(this,qi,A==null?void 0:A.detail)}get detail(){return Ye(this,qi)}initCustomEvent(){}};qi=new WeakMap;function Qs(x,w){return new Hi}var Ha={document:{createElement:Qs},DocumentFragment,customElements:zs,CustomEvent:ta,EventTarget:bi,HTMLElement:Hi,HTMLVideoElement:ea},qa=typeof window=="undefined"||typeof globalThis.customElements=="undefined",xr=qa?Ha:globalThis,ra=qa?Ha.document:globalThis.document;var bn=Ka(Va(),1),$a=Ka(Ya(),1),Js=$a.default,Sr=Js,Yi=class extends Error{constructor(x,w=Yi.MEDIA_ERR_CUSTOM,A){var le;super(x),this.name="MediaError",this.code=w,this.fatal=A!=null?A:w>=Yi.MEDIA_ERR_NETWORK&&w<=Yi.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(le=Yi.defaultMessages[this.code])!=null?le:"")}},Tr=Yi;Tr.MEDIA_ERR_ABORTED=1,Tr.MEDIA_ERR_NETWORK=2,Tr.MEDIA_ERR_DECODE=3,Tr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Tr.MEDIA_ERR_ENCRYPTED=5,Tr.MEDIA_ERR_CUSTOM=100,Tr.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var $s=x=>x==null,Za=(x,w)=>$s(w)?!1:x in w,sa={ANY:"any",MUTED:"muted"},Tn={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},oi={MSE:"mse",NATIVE:"native"},oa={HEADER:"header",QUERY:"query",NONE:"none"},da=Object.values(oa),_i={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},la={HLS:_i.M3U8},Io=Object.keys(la),Co=[...Object.values(_i),"hls","HLS"],si=(x,w,A,le,oe=x)=>{oe.addEventListener(w,A,le),x.addEventListener("teardown",()=>{oe.removeEventListener(w,A)},{once:!0})};function Zs(x,w,A){w&&A>w&&(A=w);for(let le=0;le<x.length;le++)if(x.start(le)<=A&&x.end(le)>=A)return!0;return!1}var eo=x=>{let w=x.indexOf("?");if(w<0)return[x];let A=x.slice(0,w),le=x.slice(w);return[A,le]},es=x=>{let w=x.type;if(w){let le=w.toUpperCase();return Za(le,la)?la[le]:w}let{src:A}=x;return A?to(A):""},to=x=>{let w="";try{w=new URL(x).pathname}catch{console.error("invalid url")}let A=w.lastIndexOf(".");if(A<0)return"";let le=w.slice(A+1).toUpperCase();return Za(le,_i)?_i[le]:""},ro=Object.values(sa),Wa=x=>typeof x=="boolean"||typeof x=="string"&&ro.includes(x),io=({autoplay:x},w,A)=>{let le=!1,oe=!1,X=Wa(x)?x:!!x,B=()=>{le||si(w,"playing",()=>{le=!0},{once:!0})};if(B(),si(w,"loadstart",()=>{le=!1,B(),aa(w,X)},{once:!0}),si(w,"loadstart",()=>{A||(oe=!Number.isFinite(w.duration)),aa(w,X)},{once:!0}),A&&A.once(Sr.Events.LEVEL_LOADED,(j,re)=>{var R;oe=(R=re.details.live)!=null?R:!1}),!X){let j=()=>{!oe||(A!=null&&A.liveSyncPosition?w.currentTime=A.liveSyncPosition:Number.isFinite(w.seekable.end(0))&&(w.currentTime=w.seekable.end(0)))};A&&si(w,"play",()=>{w.preload==="metadata"?A.once(Sr.Events.LEVEL_UPDATED,j):j()},{once:!0})}return j=>{le||(X=Wa(j)?j:!!j,aa(w,X))}},aa=(x,w)=>{if(!w)return;let A=x.muted,le=()=>x.muted=A;switch(w){case sa.ANY:x.play().catch(()=>{x.muted=!0,x.play().catch(le)});break;case sa.MUTED:x.muted=!0,x.play().catch(le);break;default:x.play().catch(()=>{});break}},no=({preload:x,src:w},A,le)=>{let oe=k=>{k!=null&&["","none","metadata","auto"].includes(k)?A.setAttribute("preload",k):A.removeAttribute("preload")};if(!le)return oe(x),oe;let X=!1,B=!1,j=le.config.maxBufferLength,re=le.config.maxBufferSize,R=k=>{oe(k);let L=k!=null?k:A.preload;B||L==="none"||(L==="metadata"?(le.config.maxBufferLength=1,le.config.maxBufferSize=1):(le.config.maxBufferLength=j,le.config.maxBufferSize=re),g())},g=()=>{!X&&w&&(X=!0,le.loadSource(w))};return si(A,"play",()=>{B=!0,le.config.maxBufferLength=j,le.config.maxBufferSize=re,g()},{once:!0}),R(x),R};function ao(x,w){w.on(Sr.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(oe,{tracks:X})=>{X.forEach(B=>{var j;let re=(j=B.subtitleTrack)!=null?j:B.closedCaptions,R=w.subtitleTracks.findIndex(({lang:g,name:k,type:L})=>g==(re==null?void 0:re.lang)&&k===B.label&&L.toLowerCase()===B.kind);ts(x,B.kind,B.label,re==null?void 0:re.lang,`${B.kind}${R}`)})});let A=()=>{var oe;if(!w.subtitleTracks.length)return;let X=Array.from(x.textTracks).find(j=>j.id&&j.mode==="showing"&&["subtitles","captions"].includes(j.kind)),B=`${(oe=w.subtitleTracks[w.subtitleTrack])==null?void 0:oe.type.toLowerCase()}${w.subtitleTrack}`;if(X&&(w.subtitleTrack<0||(X==null?void 0:X.id)!==B)){let j=w.subtitleTracks.findIndex(({lang:re,name:R,type:g})=>re==X.language&&R===X.label&&g.toLowerCase()===X.kind);w.subtitleTrack=j}X&&(X==null?void 0:X.id)===B&&X.cues&&Array.from(X.cues).forEach(j=>{X.addCue(j)})};x.textTracks.addEventListener("change",A),w.on(Sr.Events.CUES_PARSED,(oe,{track:X,cues:B})=>{let j=x.textTracks.getTrackById(X);if(!j)return;let re=j.mode==="disabled";re&&(j.mode="hidden"),B.forEach(R=>{var g;(g=j.cues)!=null&&g.getCueById(R.id)||j.addCue(R)}),re&&(j.mode="disabled")}),w.once(Sr.Events.DESTROYING,()=>{x.textTracks.removeEventListener("change",A),x.querySelectorAll("track[data-removeondestroy]").forEach(oe=>{oe.remove()})});let le=()=>{Array.from(x.textTracks).forEach(oe=>{var X,B;if(!["subtitles","caption"].includes(oe.kind)&&oe.label==="thumbnails"){if(!((X=oe.cues)!=null&&X.length)){let j=x.querySelector('track[label="thumbnails"]'),re=(B=j==null?void 0:j.getAttribute("src"))!=null?B:"";j==null||j.removeAttribute("src"),setTimeout(()=>{j==null||j.setAttribute("src",re)},0)}oe.mode!=="hidden"&&(oe.mode="hidden")}})};w.once(Sr.Events.MANIFEST_LOADED,le),w.once(Sr.Events.MEDIA_ATTACHED,le)}function ts(x,w,A,le,oe){let X=document.createElement("track");return X.kind=w,X.label=A,le&&(X.srclang=le),oe&&(X.id=oe),X.track.mode=["subtitles","captions"].includes(w)?"disabled":"hidden",X.setAttribute("data-removeondestroy",""),x.append(X),X.track}var Wi="cuepoints",ca=Object.freeze({label:Wi}),ha=(x,{label:w=Wi}=ca)=>{var A;return(A=Array.from(x.querySelectorAll("track")).find(le=>le.track.label===w&&le.track.kind==="metadata"))==null?void 0:A.track};async function fa(x,w,A=ca){let le=ha(x,A);if(!le){let{label:oe=Wi}=A;le=ts(x,"metadata",oe),le.mode="hidden",await new Promise(X=>setTimeout(()=>X(void 0),0))}return le.mode!=="hidden"&&(le.mode="hidden"),[...w].sort(({time:oe},{time:X})=>X-oe).forEach(({time:oe,value:X})=>{var B,j;let re=Array.prototype.findIndex.call(le==null?void 0:le.cues,me=>me.startTime>=oe),R=(B=le==null?void 0:le.cues)==null?void 0:B[re],g=R?R.startTime:Number.isFinite(x.duration)?x.duration:Number.MAX_SAFE_INTEGER,k=(j=le==null?void 0:le.cues)==null?void 0:j[re-1];k&&(k.endTime=oe);let L=new VTTCue(oe,g,JSON.stringify(X!=null?X:null));le.addCue(L)}),le}var rs=x=>({time:x.startTime,value:JSON.parse(x.text)});function is(x,w={label:Wi}){let A=ha(x,w);return A!=null&&A.cues?Array.from(A.cues,le=>rs(le)):[]}function va(x,w={label:Wi}){var A;let le=ha(x,w);if((A=le==null?void 0:le.activeCues)!=null&&A.length)return rs(le.activeCues[0])}async function so(x,w=ca){return new Promise(A=>{si(x,"loadstart",async()=>{let le=await fa(x,[],w);si(x,"cuechange",()=>{let oe=va(x);if(oe){let X=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:oe});x.dispatchEvent(X)}},{},le),A(le)})})}var Xa,za,oo=(za=(Xa=globalThis==null?void 0:globalThis.navigator)==null?void 0:Xa.userAgent)!=null?za:"",lo=oo.toLowerCase().indexOf("android")!==-1,Si=new WeakMap,ns="mux.com",Qa,Ja,as=(Ja=(Qa=Sr).isSupported)==null?void 0:Ja.call(Qa),uo=lo,ss=()=>bn.default.utils.now(),co=bn.default.utils.generateUUID,os=(x,{domain:w=ns}={})=>{if(!x)return;let[A,le=""]=eo(x);return`https://stream.${w}/${A}.m3u8${le}`},ho=x=>{if(!x)return;let[w]=x.split("?");return w||void 0},fo=x=>{if(!x||!x.startsWith("https://stream."))return;let[w]=new URL(x).pathname.slice(1).split(".m3u8");return w||void 0},vo=x=>{var w,A,le;return(w=x==null?void 0:x.metadata)!=null&&w.video_id?x.metadata.video_id:cs(x)&&(le=(A=ho(x.playbackId))!=null?A:fo(x.src))!=null?le:x.src},ls=x=>{var w;return(w=Si.get(x))==null?void 0:w.error},us=(x,w,A)=>{pa(w,A);let{metadata:le={}}=x,{view_session_id:oe=co()}=le,X=vo(x);le.view_session_id=oe,le.video_id=X,x.metadata=le,Si.set(w,{});let B=po(x,w);mo(x,w,B),yo(x,w,B),so(w);let j=io(x,w,B),re=no(x,w,B);return{engine:B,setAutoplay:j,setPreload:re}},pa=(x,w)=>{let A=w==null?void 0:w.engine;A&&(A.detachMedia(),A.destroy()),(x==null?void 0:x.mux)&&!x.mux.deleted&&(x.mux.destroy(),delete x.mux),x&&(x.removeAttribute("src"),x.load(),x.removeEventListener("error",fs),x.removeEventListener("error",ua),x.removeEventListener("durationchange",hs),Si.delete(x),x.dispatchEvent(new Event("teardown")))};function ds(x,w){var A;let le=es(x);if(le!==_i.M3U8)return!0;let oe=!le||((A=w.canPlayType(le))!=null?A:!0),{preferPlayback:X}=x,B=X===oi.MSE,j=X===oi.NATIVE;return oe&&(j||!(as&&(B||uo)))}var po=(x,w)=>{let{debug:A,streamType:le,startTime:oe=-1,metadata:X,preferCmcd:B}=x,j=es(x)===_i.M3U8,re=ds(x,w);if(j&&!re&&as){let R={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},g=go(le),k=B!==oa.NONE?{useHeaders:B===oa.HEADER,sessionId:X.view_session_id,contentId:X.video_id}:void 0;return new Sr({debug:A,startPosition:oe,cmcd:k,...R,...g})}},go=x=>[Tn.LIVE,Tn.DVR].includes(x)?{backBufferLength:8}:[Tn.LL_LIVE,Tn.LL_DVR].includes(x)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},cs=({playbackId:x,src:w,customDomain:A})=>{if(x)return!0;if(typeof w!="string")return!1;let le=window==null?void 0:window.location.href,oe=new URL(w,le).hostname.toLocaleLowerCase();return oe.includes(ns)||!!A&&oe.includes(A.toLocaleLowerCase())},mo=(x,w,A)=>{var le;let{envKey:oe}=x,X=cs(x);if(oe||X){let{playerInitTime:B,playerSoftwareName:j,playerSoftwareVersion:re,beaconCollectionDomain:R,debug:g,disableCookies:k}=x,L={...x.metadata,video_title:((le=x==null?void 0:x.metadata)==null?void 0:le.video_title)||void 0},me=ne=>typeof ne.player_error_code=="string"?!1:typeof x.errorTranslator=="function"?x.errorTranslator(ne):ne;bn.default.monitor(w,{debug:g,beaconCollectionDomain:R,hlsjs:A,Hls:A?Sr:void 0,automaticErrorTracking:!1,errorTranslator:me,disableCookies:k,data:{...oe?{env_key:oe}:{},player_software_name:j,player_software:j,player_software_version:re,player_init_time:B,...L}})}},yo=(x,w,A)=>{var le;let oe=ds(x,w),{src:X}=x;w&&oe?(typeof X=="string"?(w.setAttribute("src",X),x.startTime&&(((le=Si.get(w))!=null?le:{}).startTime=x.startTime,w.addEventListener("durationchange",hs,{once:!0}))):w.removeAttribute("src"),w.addEventListener("error",fs),w.addEventListener("error",ua)):A&&X?(A.on(Sr.Events.ERROR,(B,j)=>{let re={[Sr.ErrorTypes.NETWORK_ERROR]:Tr.MEDIA_ERR_NETWORK,[Sr.ErrorTypes.MEDIA_ERROR]:Tr.MEDIA_ERR_DECODE},R=new Tr("",re[j.type]);R.fatal=j.fatal,R.data=j,w.dispatchEvent(new CustomEvent("error",{detail:R}))}),w.addEventListener("error",ua),ao(w,A),A.attachMedia(w)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function hs(x){var w;let A=x.target,le=(w=Si.get(A))==null?void 0:w.startTime;if(!!le&&Zs(A.seekable,A.duration,le)){let oe=A.preload==="auto";oe&&(A.preload="none"),A.currentTime=le,oe&&(A.preload="auto")}}async function fs(x){if(!x.isTrusted)return;x.stopImmediatePropagation();let w=x.target;if(!(w!=null&&w.error))return;let{message:A,code:le}=w.error,oe=new Tr(A,le);if(w.src&&(le!==Tr.MEDIA_ERR_DECODE||le!==void 0))try{let{status:X}=await fetch(w.src);oe.data={response:{code:X}}}catch{}w.dispatchEvent(new CustomEvent("error",{detail:oe}))}function ua(x){var w,A;if(!(x instanceof CustomEvent)||!(x.detail instanceof Tr))return;let le=x.target,oe=x.detail;!oe||!oe.fatal||(((w=Si.get(le))!=null?w:{}).error=oe,(A=le.mux)==null||A.emit("error",{player_error_code:oe.code,player_error_message:oe.message}))}var Eo=()=>{try{return"0.13.2"}catch{}return"UNKNOWN"},To=Eo(),vs=()=>To;var ga=class extends Set{add(w){super.add(new WeakRef(w))}forEach(w){super.forEach(A=>{let le=A.deref();le&&w(le)})}},bo=x=>{var w,A,le,oe,X,ps,j,_n,R,Mr,k,Sn,me,An,ce,gs,q,ms,J,ma,K,Ee,ke,Ne,V,E,U,Xi,de,ys,z,ya,Le,Es,xe,Ea,qe,Ts,ie,Ta;return w=class extends x{constructor(){super();bt(this,U);bt(this,de);bt(this,z);bt(this,Le);bt(this,xe);bt(this,qe);bt(this,ie);Ki(this,"castEnabled",!1);bt(this,K,{paused:!1});bt(this,Ee,void 0);bt(this,ke,{});bt(this,Ne,void 0);bt(this,V,void 0);bt(this,E,void 0);w.instances.add(this),zt(this,xe,Ea).call(this)}static get castElement(){return Ye(w,A)}static get castEnabled(){return Ye(w,le)}static get castState(){var H;return(H=Ye(w,R,Mr))==null?void 0:H.getCastState()}static async exitCast(){try{await Ye(w,R,Mr).endCurrentSession(!0)}catch(ve){console.error(ve);return}}get castPlayer(){if(w.castElement===this)return Ye(this,Ee)}attributeChangedCallback(H){if(!!this.castPlayer)switch(H){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(H={}){var ve;zt(ve=w,J,ma).call(ve,H),Nt(w,A,this),Object.entries(Ye(this,ke)).forEach(([Ie,Fe])=>{Ye(this,Ee).controller.addEventListener(Ie,Fe)});try{await Ye(w,R,Mr).requestSession()}catch{Nt(w,A,void 0);return}Ye(this,K).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(Ie){console.error(Ie)}}async load(){var Ce,Ve;if(!this.castPlayer)return super.load();let H=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),ve=[...this.querySelectorAll("track")].filter(({kind:Xe,src:it})=>it&&(Xe==="subtitles"||Xe==="captions")),Ie=[],Fe=0;ve.length&&(H.tracks=ve.map(Xe=>{let it=++Fe;Ie.length===0&&Xe.track.mode==="showing"&&Ie.push(it);let lt=new chrome.cast.media.Track(it,chrome.cast.media.TrackType.TEXT);return lt.trackContentId=Xe.src,lt.trackContentType="text/vtt",lt.subtype=Xe.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,lt.name=Xe.label,lt.language=Xe.srclang,lt})),this.castStreamType==="live"?H.streamType=chrome.cast.media.StreamType.LIVE:H.streamType=chrome.cast.media.StreamType.BUFFERED,H.metadata=new chrome.cast.media.GenericMediaMetadata,H.metadata.title=this.title,H.metadata.images=[{url:this.poster}];let fe=new chrome.cast.media.LoadRequest(H);fe.currentTime=(Ce=super.currentTime)!=null?Ce:0,fe.autoplay=!Ye(this,K).paused,fe.activeTrackIds=Ie,await((Ve=Ye(w,k,Sn))==null?void 0:Ve.loadMedia(fe)),this.dispatchEvent(new Event("volumechange"))}play(){var H;if(this.castPlayer){this.castPlayer.isPaused&&((H=this.castPlayer.controller)==null||H.playOrPause());return}return super.play()}pause(){var H;if(this.castPlayer){this.castPlayer.isPaused||(H=this.castPlayer.controller)==null||H.playOrPause();return}super.pause()}get castSrc(){var H,ve,Ie;return(Ie=(ve=this.getAttribute("cast-src"))!=null?ve:(H=this.querySelector("source"))==null?void 0:H.src)!=null?Ie:this.currentSrc}set castSrc(H){this.castSrc!=H&&this.setAttribute("cast-src",`${H}`)}get castContentType(){var H;return(H=this.getAttribute("cast-content-type"))!=null?H:void 0}set castContentType(H){this.setAttribute("cast-content-type",`${H}`)}get castStreamType(){var H;return(H=this.getAttribute("cast-stream-type"))!=null?H:void 0}set castStreamType(H){this.setAttribute("cast-stream-type",`${H}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var H;return this.castPlayer?(H=this.castPlayer)==null?void 0:H.isMuted:super.muted}set muted(H){var ve;if(this.castPlayer){(H&&!this.castPlayer.isMuted||!H&&this.castPlayer.isMuted)&&((ve=this.castPlayer.controller)==null||ve.muteOrUnmute());return}super.muted=H}get volume(){var H,ve;return this.castPlayer?(ve=(H=this.castPlayer)==null?void 0:H.volumeLevel)!=null?ve:1:super.volume}set volume(H){var ve;if(this.castPlayer){this.castPlayer.volumeLevel=H,(ve=this.castPlayer.controller)==null||ve.setVolumeLevel();return}super.volume=H}get duration(){var H,ve;return this.castPlayer&&Ye(this,U,Xi)?(ve=(H=this.castPlayer)==null?void 0:H.duration)!=null?ve:NaN:super.duration}get currentTime(){var H,ve;return this.castPlayer&&Ye(this,U,Xi)?(ve=(H=this.castPlayer)==null?void 0:H.currentTime)!=null?ve:0:super.currentTime}set currentTime(H){var ve;if(this.castPlayer){this.castPlayer.currentTime=H,(ve=this.castPlayer.controller)==null||ve.seek();return}super.currentTime=H}get onentercast(){return Ye(this,Ne)}set onentercast(H){Ye(this,Ne)&&(this.removeEventListener("entercast",Ye(this,Ne)),Nt(this,Ne,null)),typeof H=="function"&&(Nt(this,Ne,H),this.addEventListener("entercast",H))}get onleavecast(){return Ye(this,V)}set onleavecast(H){Ye(this,V)&&(this.removeEventListener("leavecast",Ye(this,V)),Nt(this,V,null)),typeof H=="function"&&(Nt(this,V,H),this.addEventListener("leavecast",H))}get oncastchange(){return Ye(this,E)}set oncastchange(H){Ye(this,E)&&(this.removeEventListener("castchange",Ye(this,E)),Nt(this,E,null)),typeof H=="function"&&(Nt(this,E,H),this.addEventListener("castchange",H))}},A=new WeakMap,le=new WeakMap,oe=new WeakMap,X=new WeakSet,ps=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},j=new WeakSet,_n=function(){return typeof cast!="undefined"&&cast.framework},R=new WeakSet,Mr=function(){if(Ye(w,j,_n))return cast.framework.CastContext.getInstance()},k=new WeakSet,Sn=function(){var H;return(H=Ye(w,R,Mr))==null?void 0:H.getCurrentSession()},me=new WeakSet,An=function(){var H;return(H=Ye(w,k,Sn))==null?void 0:H.getSessionObj().media[0]},ce=new WeakSet,gs=function(H){return new Promise((ve,Ie)=>{Ye(w,me,An).editTracksInfo(H,ve,Ie)})},q=new WeakSet,ms=function(H){return new Promise((ve,Ie)=>{Ye(w,me,An).getStatus(H,ve,Ie)})},J=new WeakSet,ma=function(H){return Ye(w,R,Mr).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...H})},K=new WeakMap,Ee=new WeakMap,ke=new WeakMap,Ne=new WeakMap,V=new WeakMap,E=new WeakMap,U=new WeakSet,Xi=function(){var H;return(H=this.castPlayer)==null?void 0:H.isMediaLoaded},de=new WeakSet,ys=function(){Ye(w,A)===this&&(Object.entries(Ye(this,ke)).forEach(([H,ve])=>{Ye(this,Ee).controller.removeEventListener(H,ve)}),Nt(w,A,void 0),this.muted=Ye(this,Ee).isMuted,this.currentTime=Ye(this,Ee).savedPlayerState.currentTime,Ye(this,Ee).savedPlayerState.isPaused===!1&&this.play())},z=new WeakSet,ya=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:Ye(w,R,Mr).getCastState()}))},Le=new WeakSet,Es=async function(){var ve,Ie;let{SESSION_RESUMED:H}=cast.framework.SessionState;if(Ye(w,R,Mr).getSessionState()===H&&this.castSrc===((ve=Ye(w,me,An))==null?void 0:ve.media.contentId)){Nt(w,A,this),Object.entries(Ye(this,ke)).forEach(([Fe,fe])=>{Ye(this,Ee).controller.addEventListener(Fe,fe)});try{await zt(Ie=w,q,ms).call(Ie,new chrome.cast.media.GetStatusRequest)}catch(Fe){console.error(Fe)}Ye(this,ke)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),Ye(this,ke)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},xe=new WeakSet,Ea=function(){var H;!Ye(w,j,_n)||this.castEnabled||(this.castEnabled=!0,zt(H=w,J,ma).call(H),this.textTracks.addEventListener("change",zt(this,ie,Ta).bind(this)),zt(this,z,ya).call(this),Nt(this,Ee,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(Ye(this,Ee)),Nt(this,ke,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ve})=>{ve===!1&&zt(this,de,ys).call(this),this.dispatchEvent(new Event(ve?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!Ye(this,U,Xi)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var ve,Ie;((ve=this.castPlayer)==null?void 0:ve.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(Ie=this.castPlayer)==null?void 0:Ie.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!Ye(this,U,Xi)||(await Promise.resolve(),zt(this,qe,Ts).call(this))}}))},qe=new WeakSet,Ts=function(){zt(this,ie,Ta).call(this)},ie=new WeakSet,Ta=async function(){var Ct,Rt,St,wt,gt,dt;if(!this.castPlayer)return;let ve=((Rt=(Ct=Ye(this,Ee).mediaInfo)==null?void 0:Ct.tracks)!=null?Rt:[]).filter(({type:tt})=>tt===chrome.cast.media.TrackType.TEXT),Ie=[...this.textTracks].filter(({kind:tt})=>tt==="subtitles"||tt==="captions"),Fe=ve.map(({language:tt,name:It,trackId:Ut})=>{var Bt;let{mode:Wt}=(Bt=Ie.find(ar=>ar.language===tt&&ar.label===It))!=null?Bt:{};return Wt?{mode:Wt,trackId:Ut}:!1}).filter(Boolean),Ce=Fe.filter(({mode:tt})=>tt!=="showing").map(({trackId:tt})=>tt),Ve=Fe.find(({mode:tt})=>tt==="showing"),Xe=(gt=(wt=(St=Ye(w,k,Sn))==null?void 0:St.getSessionObj().media[0])==null?void 0:wt.activeTrackIds)!=null?gt:[],it=Xe;if(Xe.length&&(it=it.filter(tt=>!Ce.includes(tt))),Ve!=null&&Ve.trackId&&(it=[...it,Ve.trackId]),it=[...new Set(it)],!((tt,It)=>tt.length===It.length&&tt.every(Ut=>It.includes(Ut)))(Xe,it))try{let tt=new chrome.cast.media.EditTracksInfoRequest(it);await zt(dt=w,ce,gs).call(dt,tt)}catch(tt){console.error(tt)}},bt(w,X),bt(w,j),bt(w,R),bt(w,k),bt(w,me),bt(w,ce),bt(w,q),bt(w,J),Ki(w,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Ki(w,"instances",new ga),bt(w,A,void 0),bt(w,le,!1),Ki(w,"initCast",()=>{var H;Ye(w,X,ps)?Ye(w,j,_n)?Ye(H=w,oe).call(H,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ve;return Ye(ve=w,oe).call(ve,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ve;return Ye(ve=w,oe).call(ve,chrome.cast.isAvailable)})}}),bt(w,oe,H=>{if(H){Nt(w,le,!0);let{CAST_STATE_CHANGED:ve}=cast.framework.CastContextEventType;Ye(w,R,Mr).addEventListener(ve,Fe=>{w.instances.forEach(fe=>{var Ce;return zt(Ce=fe,z,ya).call(Ce,Fe)})});let{SESSION_STATE_CHANGED:Ie}=cast.framework.CastContextEventType;Ye(w,R,Mr).addEventListener(Ie,Fe=>{w.instances.forEach(fe=>{var Ce;return zt(Ce=fe,Le,Es).call(Ce,Fe)})}),w.instances.forEach(Fe=>{var fe;return zt(fe=Fe,xe,Ea).call(fe)})}}),w};if(globalThis.HTMLVideoElement&&globalThis.customElements){let x=bo(HTMLVideoElement);globalThis.customElements.get("castable-video")||(globalThis.customElements.define("castable-video",x,{extends:"video"}),globalThis.CastableVideoElement=x),x.initCast()}var bs=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","castchange","entercast","leavecast"],_s=ra.createElement("template");_s.innerHTML=`
|
|
29
|
+
`),ue=[],_e=(0,or.toMpegTsClockFromTimescale)(l,u),ge="00:00.000",De=0,He=0,Je=!0;P.oncue=function(Ae){var Ke=c[v],je=c.ccOffset,pt=(De-_e)/9e4;Ke!=null&&Ke.new&&(He!==void 0?je=c.ccOffset=Ke.start:function(xt,ir,er){var Yt=xt[ir],nr=xt[Yt.prevCC];if(!nr||!nr.new&&Yt.new)return xt.ccOffset=xt.presentationOffset=Yt.start,void(Yt.new=!1);for(;(_r=nr)!==null&&_r!==void 0&&_r.new;){var _r;xt.ccOffset+=Yt.start-nr.start,Yt.new=!1,nr=xt[(Yt=nr).prevCC]}xt.presentationOffset=er}(c,v,pt)),pt&&(je=pt-c.presentationOffset);var Mt=Ae.endTime-Ae.startTime,yt=(0,mr.normalizePts)(9e4*(Ae.startTime+je-He),9e4*m)/9e4;Ae.startTime=Math.max(yt,0),Ae.endTime=Math.max(yt+Mt,0);var kt=Ae.text.trim();Ae.text=decodeURIComponent(encodeURIComponent(kt)),Ae.id||(Ae.id=hr(Ae.startTime,Ae.endTime,kt)),Ae.endTime>0&&ue.push(Ae)},P.onparsingerror=function(Ae){F=Ae},P.onflush=function(){F?S(F):_(ue)},X.forEach(function(Ae){if(Je){if(yr(Ae,"X-TIMESTAMP-MAP=")){Je=!1,Ae.slice(16).split(",").forEach(function(Ke){yr(Ke,"LOCAL:")?ge=Ke.slice(6):yr(Ke,"MPEGTS:")&&(De=parseInt(Ke.slice(7)))});try{He=function(Ke){var je=parseInt(Ke.slice(-3)),pt=parseInt(Ke.slice(-6,-4)),Mt=parseInt(Ke.slice(-9,-7)),yt=Ke.length>9?parseInt(Ke.substring(0,Ke.indexOf(":"))):0;if(!((0,R.isFiniteNumber)(je)&&(0,R.isFiniteNumber)(pt)&&(0,R.isFiniteNumber)(Mt)&&(0,R.isFiniteNumber)(yt)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+Ke);return je+=1e3*pt,(je+=6e4*Mt)+36e5*yt}(ge)/1e3}catch(Ke){F=Ke}return}Ae===""&&(Je=!1)}P.parse(Ae+`
|
|
30
|
+
`)}),P.flush()})((n=e.initSegment)!==null&&n!==void 0&&n.data?(0,z.appendUint8Array)(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],this.timescale[e.cc],i,e.cc,e.start,function(s){a._appendCues(s,e.level),r.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(s){a._fallbackToIMSC1(e,t),L.logger.log("Failed to parse VTT cue: "+s),r.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})},o._fallbackToIMSC1=function(e,t){var i=this,n=this.tracks[e.level];n.textCodec||Aa(t,this.initPTS[e.cc],this.timescale[e.cc],function(){n.textCodec=Er,i._parseIMSC1(e,t)},function(){n.textCodec="wvtt"})},o._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(function(s){return it(n,s)})}else{var a=this.tracks[t];if(!a)return;var r=a.default?"default":"subtitles"+t;i.trigger(g.Events.CUES_PARSED,{type:"subtitles",cues:e,track:r})}},o.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===fe.PlaylistLevelType.SUBTITLE){if(!(0,R.isFiniteNumber)(this.initPTS[i.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(g.Events.FRAG_LOADED,t)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&i&&n){var a=t.frag,r=t.samples;if(a.type!==fe.PlaylistLevelType.MAIN||this.closedCaptionsForLevel(a)!=="NONE")for(var s=0;s<r.length;s++){var l=r[s].bytes;if(l){var u=this.extractCea608Data(l);i.addData(r[s].pts,u[0]),n.addData(r[s].pts,u[1])}}}},o.onBufferFlushing=function(e,t){var i=t.startOffset,n=t.endOffset,a=t.endOffsetSubtitles,r=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!r||r==="video"){var l=this.captionsTracks;Object.keys(l).forEach(function(c){return Ct(l[c],i,n)})}if(this.config.renderTextTracksNatively&&i===0&&a!==void 0){var u=this.textTracks;Object.keys(u).forEach(function(c){return Ct(u[c],i,a)})}}},o.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],n=2,a=0;a<i;a++){var r=e[n++],s=127&e[n++],l=127&e[n++];if((s!==0||l!==0)&&(4&r)!=0){var u=3&r;u!==0&&u!==1||(t[u].push(s),t[u].push(l))}}return t},d}();function Ds(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function Ls(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}let Rs=function(){function d(i){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=i,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var o,e,t=d.prototype;return t.setStreamController=function(i){this.streamController=i},t.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},t.registerListeners=function(){var i=this.hls;i.on(g.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListener=function(){var i=this.hls;i.off(g.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.onFpsDropLevelCapping=function(i,n){d.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},t.onMediaAttaching=function(i,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null},t.onManifestParsed=function(i,n){var a=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,a.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onBufferCodecs=function(i,n){this.hls.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping()},t.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var i=this.hls.levels;if(i.length){var n=this.hls;n.autoLevelCapping=this.getMaxLevel(i.length-1),n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}},t.getMaxLevel=function(i){var n=this,a=this.hls.levels;if(!a.length)return-1;var r=a.filter(function(s,l){return d.isLevelAllowed(l,n.restrictedLevels)&&l<=i});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var i=this.media,n={width:0,height:0};if(i){var a=i.getBoundingClientRect();n.width=a.width,n.height=a.height,n.width||n.height||(n.width=a.right-a.left||i.width||0,n.height=a.bottom-a.top||i.height||0)}return this.clientRect=n,n},d.isLevelAllowed=function(i,n){return n===void 0&&(n=[]),n.indexOf(i)===-1},d.getMaxLevelByMediaSize=function(i,n,a){if(!i||!i.length)return-1;for(var r,s,l=i.length-1,u=0;u<i.length;u+=1){var c=i[u];if((c.width>=n||c.height>=a)&&(r=c,!(s=i[u+1])||r.width!==s.width||r.height!==s.height)){l=u;break}}return l},o=d,(e=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var i=1;if(!this.hls.config.ignoreDevicePixelRatio)try{i=self.devicePixelRatio}catch{}return i}}])&&Ls(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}(),Is=function(){function d(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var o=d.prototype;return o.setStreamController=function(e){this.streamController=e},o.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},o.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching)},o.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},o.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},o.checkFPS=function(e,t,i){var n=performance.now();if(t){if(this.lastTime){var a=n-this.lastTime,r=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,l=1e3*r/a,u=this.hls;if(u.trigger(g.Events.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:i}),l>0&&r>u.config.fpsDroppedMonitoringThreshold*s){var c=u.currentLevel;L.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=c)&&(c-=1,u.trigger(g.Events.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:u.currentLevel}),u.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},o.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},d}();var ai=B(300);function Kn(d){var o=typeof Map=="function"?new Map:void 0;return Kn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return Hn(e,arguments,qn(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ni(i,e)},Kn(d)}function Hn(d,o,e){return Hn=Cs()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ni(r,n.prototype),r},Hn.apply(null,arguments)}function Cs(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ni(d,o){return Ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ni(d,o)}function qn(d){return qn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},qn(d)}var gn="[eme]",La=function(){function d(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=d.CDMCleanupPromise?[d.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=L.logger.debug.bind(L.logger,gn),this.log=L.logger.log.bind(L.logger,gn),this.warn=L.logger.warn.bind(L.logger,gn),this.error=L.logger.error.bind(L.logger,gn),this.hls=e,this.config=e.config,this.registerListeners()}var o=d.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},o.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,n=t.widevineLicenseUrl,a=i[e];if(a)return a.licenseUrl;if(e===K.WIDEVINE&&n)return n;throw new Error('no license server URL configured for key-system "'+e+'"')},o.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},o.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,n=function(s,l,u){return!!s&&u.indexOf(s)===l},a=i.map(function(s){return s.audioCodec}).filter(n),r=i.map(function(s){return s.videoCodec}).filter(n);return a.length+r.length===0&&r.push("avc1.42e01e"),new Promise(function(s,l){(function u(c){var v=c.shift();t.getMediaKeysPromise(v,a,r).then(function(m){return s({keySystem:v,mediaKeys:m})}).catch(function(m){c.length?u(c):l(m instanceof Rr?m:new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:m,fatal:!0},m.message))})})(e)})},o.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var n="Configured requestMediaKeySystemAccess is not a function "+i;return Se===null&&self.location.protocol==="http:"&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(n))}return i(e,t)},o.getMediaKeysPromise=function(e,t,i){var n=this,a=function(u,c,v,m){var _;switch(u){case K.FAIRPLAY:_=["cenc","sinf"];break;case K.WIDEVINE:case K.PLAYREADY:_=["cenc"];break;case K.CLEARKEY:_=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+u)}return function(S,F,P,X){return[{initDataTypes:S,persistentState:X.persistentState||"not-allowed",distinctiveIdentifier:X.distinctiveIdentifier||"not-allowed",sessionTypes:X.sessionTypes||[X.sessionType||"temporary"],audioCapabilities:F.map(function(ue){return{contentType:'audio/mp4; codecs="'+ue+'"',robustness:X.audioRobustness||"",encryptionScheme:X.audioEncryptionScheme||null}}),videoCapabilities:P.map(function(ue){return{contentType:'video/mp4; codecs="'+ue+'"',robustness:X.videoRobustness||"",encryptionScheme:X.videoEncryptionScheme||null}})}]}(_,c,v,m)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e],s=r==null?void 0:r.keySystemAccess;if(!s){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(a)),s=this.requestMediaKeySystemAccess(e,a);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(function(u){n.log('Failed to obtain access to key-system "'+e+'": '+u)}),s.then(function(u){n.log('Access for key-system "'+u.keySystem+'" obtained');var c=n.fetchServerCertificate(e);return n.log('Create media-keys for "'+e+'"'),l.mediaKeys=u.createMediaKeys().then(function(v){return n.log('Media-keys created for "'+e+'"'),c.then(function(m){return m?n.setMediaKeysServerCertificate(v,e,m):v})}),l.mediaKeys.catch(function(v){n.error('Failed to create media-keys for "'+e+'"}: '+v)}),l.mediaKeys})}return s.then(function(){return r.mediaKeys})},o.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,n=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+ai.default.hexDump(t.keyId||[]));var a=n.createSession(),r={decryptdata:t,keySystem:i,mediaKeys:n,mediaKeysSession:a,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r},o.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t);this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},o.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return ai.default.hexDump(e.keyId)},o.updateKeySession=function(e,t){var i,n=e.mediaKeysSession;return this.log('Updating key-session "'+n.sessionId+'" for keyID '+ai.default.hexDump(((i=e.decryptdata)===null||i===void 0?void 0:i.keyId)||[])+`
|
|
31
|
+
} (data length: `+(t&&t.byteLength)+")"),n.update(t)},o.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},o.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,n){var a=de(t.config),r=e.map(U).filter(function(s){return!!s&&a.indexOf(s)!==-1});return t.getKeySystemSelectionPromise(r).then(function(s){var l=s.keySystem,u=D(l);u?i(u):n(new Error('Unable to find format for key-system "'+l+'"'))}).catch(n)})},o.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,n=this.getKeyIdString(i),a="(keyId: "+n+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+a);var r=this.keyIdToKeySessionPromise[n];return r||(r=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(i).then(function(s){var l=s.keySystem,u=s.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+a),t.attemptSetMediaKeys(l,u).then(function(){t.throwIfDestroyed();var c=t.createMediaKeySessionContext({keySystem:l,mediaKeys:u,decryptdata:i});return t.generateRequestWithPreferredKeySession(c,"cenc",i.pssh,"playlist-key")})})).catch(function(s){return t.handleError(s)}),r},o.throwIfDestroyed=function(e){if(e===void 0&&(e="Invalid state"),!this.hls)throw new Error("invalid state")},o.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Rr?this.hls.trigger(g.Events.ERROR,e.data):this.hls.trigger(g.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},o.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var n=U(e.keyFormat),a=n?[n]:de(this.config);return this.attemptKeySystemAccess(a)}return i},o.getKeySystemSelectionPromise=function(e){if(e.length||(e=de(this.config)),e.length===0)throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},o._onMediaEncrypted=function(e){var t=this,i=e.initDataType,n=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),n!==null){var a,r;if(i==="sinf"&&this.config.drmSystems[K.FAIRPLAY]){var s=(0,z.bin2str)(new Uint8Array(n));try{var l=V(JSON.parse(s).sinf),u=(0,z.parseSinf)(new Uint8Array(l));if(!u)return;a=u.subarray(8,24),r=K.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var c=(0,z.parsePssh)(n);if(c===null)return;c.version===0&&c.systemId===ke.WIDEVINE&&c.data&&(a=c.data.subarray(8,24)),r=function(ue){if(ue===ke.WIDEVINE)return K.WIDEVINE}(c.systemId)}if(r&&a){for(var v=ai.default.hexDump(a),m=this.keyIdToKeySessionPromise,_=this.mediaKeySessions,S=m[v],F=function(ue){var _e=_[ue],ge=_e.decryptdata;if(ge.pssh||!ge.keyId)return"continue";var De=ai.default.hexDump(ge.keyId);return v===De||ge.uri.replace(/-/g,"").indexOf(v)!==-1?(S=m[De],delete m[De],ge.pssh=new Uint8Array(n),ge.keyId=a,S=m[v]=S.then(function(){return t.generateRequestWithPreferredKeySession(_e,i,n,"encrypted-event-key-match")}),"break"):void 0},P=0;P<_.length;P++){var X=F(P);if(X!=="continue"&&X==="break")break}S||(S=m[v]=this.getKeySystemSelectionPromise([r]).then(function(ue){var _e,ge=ue.keySystem,De=ue.mediaKeys;t.throwIfDestroyed();var He=new Le("ISO-23001-7",v,(_e=D(ge))!=null?_e:"");return He.pssh=new Uint8Array(n),He.keyId=a,t.attemptSetMediaKeys(ge,De).then(function(){t.throwIfDestroyed();var Je=t.createMediaKeySessionContext({decryptdata:He,keySystem:ge,mediaKeys:De});return t.generateRequestWithPreferredKeySession(Je,i,n,"encrypted-event-no-match")})})),S.catch(function(ue){return t.handleError(ue)})}}},o._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},o.attemptSetMediaKeys=function(e,t){var i=this,n=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var a=Promise.all(n).then(function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(a),a.then(function(){i.log('Media-keys set for "'+e+'"'),n.push(a),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(r){return n.indexOf(r)===-1})})},o.generateRequestWithPreferredKeySession=function(e,t,i,n){var a,r,s=this,l=(a=this.config.drmSystems)===null||a===void 0||(r=a[e.keySystem])===null||r===void 0?void 0:r.generateRequest;if(l)try{var u=l.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(S){var c;if(this.warn(S.message),(c=this.hls)!==null&&c!==void 0&&c.config.debug)throw S}if(i===null)return this.log('Skipping key-session request for "'+n+'" (no initData)'),Promise.resolve(e);var v=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+n+'": '+v+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var m=new(ti());e.mediaKeysSession.onmessage=function(S){var F=e.mediaKeysSession;if(F){var P=S.messageType,X=S.message;s.log('"'+P+'" message event for session "'+F.sessionId+'" message size: '+X.byteLength),P==="license-request"||P==="license-renewal"?s.renewLicense(e,X).catch(function(ue){s.handleError(ue),m.emit("error",ue)}):P==="license-release"?e.keySystem===K.FAIRPLAY&&(s.updateKeySession(e,E("acknowledged")),s.removeSession(e)):s.warn('unhandled media key message type "'+P+'"')}else m.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(S){if(e.mediaKeysSession){s.onKeyStatusChange(e);var F=e.keyStatus;m.emit("keyStatus",F),F==="expired"&&(s.warn(e.keySystem+" expired for key "+v),s.renewKeySession(e))}else m.emit("error",new Error("invalid state"))};var _=new Promise(function(S,F){m.on("error",F),m.on("keyStatus",function(P){P.startsWith("usable")?S():P==="output-restricted"?F(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):P==="internal-error"?F(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+P+'"')):P==="expired"?F(new Error("key expired while generating request")):s.warn('unhandled key status change "'+P+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var S;s.log('Request generated for key-session "'+((S=e.mediaKeysSession)===null||S===void 0?void 0:S.sessionId)+'" keyId: '+v)}).catch(function(S){throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:S,fatal:!1},"Error generating key-session request: "+S)}).then(function(){return _}).catch(function(S){throw m.removeAllListeners(),s.removeSession(e),S}).then(function(){return m.removeAllListeners(),e})},o.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,n){t.log('key status change "'+i+'" for keyStatuses keyId: '+ai.default.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))+" session keyId: "+ai.default.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},o.fetchServerCertificate=function(e){var t=this;return new Promise(function(i,n){var a=t.getServerCertificateUrl(e);if(!a)return i();t.log('Fetching serverCertificate for "'+e+'"');var r=new XMLHttpRequest;r.open("GET",a,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&(r.status===200?i(r.response):n(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r},'"'+e+'" certificate request XHR failed ('+a+"). Status: "+r.status+" ("+r.statusText+")")))},r.send()})},o.setMediaKeysServerCertificate=function(e,t,i){var n=this;return new Promise(function(a,r){e.setServerCertificate(i).then(function(s){n.log("setServerCertificate "+(s?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),a(e)}).catch(function(s){r(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})},o.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(n){return i.updateKeySession(e,new Uint8Array(n)).catch(function(a){throw new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:a,fatal:!0},a.message)})})},o.setupLicenseXHR=function(e,t,i,n){var a=this,r=this.config.licenseXhrSetup;return r?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return r.call(a.hls,e,t,i,n)}).catch(function(s){if(!i.decryptdata)throw s;return e.open("POST",t,!0),r.call(a.hls,e,t,i,n)}).then(function(s){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||n}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))},o.requestLicense=function(e,t){var i=this;return new Promise(function(n,a){var r=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+r);var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(s.readyState===4)if(s.status===200){i._requestLicenseFailureCount=0;var l=s.response;i.log("License received "+(l instanceof ArrayBuffer?l.byteLength:l));var u=i.config.licenseResponseCallback;if(u)try{l=u.call(i.hls,s,r,e)}catch(v){i.error(v)}n(l)}else if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>3||s.status>=400&&s.status<500)a(new Rr({type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:s},"License Request XHR failed ("+r+"). Status: "+s.status+" ("+s.statusText+")"));else{var c=3-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+c+" attempts left"),i.requestLicense(e,t).then(n,a)}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=s,i.setupLicenseXHR(s,r,e,t).then(function(l){var u=l.xhr,c=l.licenseChallenge;u.send(c)})})},o.onMediaAttached=function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}},o.onMediaDetached=function(){var e=this,t=this.media,i=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Le.clearKeyUriToKeyIdMap();var n=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(a){return e.removeSession(a)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(a){e.log("Could not clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))}))).then(function(){n&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(a){e.log("Could not close sessions and clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))})},o.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var n=i.reduce(function(a,r){return a.indexOf(r.keyFormat)===-1&&a.push(r.keyFormat),a},[]);this.log("Selecting key-system from session-keys "+n.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(n)}},o.removeSession=function(e){var t=this,i=e.mediaKeysSession,n=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var a=this.mediaKeySessions.indexOf(e);return a>-1&&this.mediaKeySessions.splice(a,1),i.remove().catch(function(r){t.log("Could not remove session: "+r)}).then(function(){return i.close()}).catch(function(r){t.log("Could not close session: "+r)})}},d}();La.CDMCleanupPromise=void 0;var Rr=function(d){var o,e;function t(i,n){var a;return(a=d.call(this,n)||this).data=void 0,a.data=i,i.err=i.error,a}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ni(o,e),t}(Kn(Error));let Ps=La;var fr,Vn,Ra;function Ia(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function Ca(d,o,e){return o&&Ia(d.prototype,o),e&&Ia(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function Pa(d,o){var e=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(i,n){if(i){if(typeof i=="string")return Oa(i,n);var a=Object.prototype.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Oa(i,n):void 0}}(d))||o&&d&&typeof d.length=="number"){e&&(d=e);var t=0;return function(){return t>=d.length?{done:!0}:{done:!1,value:d[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
32
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oa(d,o){(o==null||o>d.length)&&(o=d.length);for(var e=0,t=new Array(o);e<o;e++)t[e]=d[e];return t}function mn(){return mn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},mn.apply(this,arguments)}(function(d){d.MANIFEST="m",d.AUDIO="a",d.VIDEO="v",d.MUXED="av",d.INIT="i",d.CAPTION="c",d.TIMED_TEXT="tt",d.KEY="k",d.OTHER="o"})(fr||(fr={})),function(d){d.DASH="d",d.HLS="h",d.SMOOTH="s",d.OTHER="o"}(Vn||(Vn={})),function(d){d.VOD="v",d.LIVE="l"}(Ra||(Ra={}));var Os=function(){function d(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(a){try{t.apply(a,{ot:fr.MANIFEST,su:!t.initialized})}catch(r){L.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=function(a){try{var r=a.frag,s=t.hls.levels[r.level],l=t.getObjectType(r),u={d:1e3*r.duration,ot:l};l!==fr.VIDEO&&l!==fr.AUDIO&&l!=fr.MUXED||(u.br=s.bitrate/1e3,u.tb=t.getTopBandwidth(l)/1e3,u.bl=t.getBufferLength(l)),t.apply(a,u)}catch(c){L.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=e;var i=this.config=e.config,n=i.cmcd;n!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||d.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var o=d.prototype;return o.registerListeners=function(){var e=this.hls;e.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.Events.BUFFER_CREATED,this.onBufferCreated,this)},o.unregisterListeners=function(){var e=this.hls;e.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},o.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},o.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},o.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},o.onBufferCreated=function(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)===null||n===void 0?void 0:n.buffer},o.createData=function(){var e;return{v:1,sf:Vn.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},o.apply=function(e,t){t===void 0&&(t={}),mn(t,this.createData());var i=t.ot===fr.INIT||t.ot===fr.VIDEO||t.ot===fr.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var n=d.toHeaders(t);if(!Object.keys(n).length)return;e.headers||(e.headers={}),mn(e.headers,n)}else{var a=d.toQuery(t);if(!a)return;e.url=d.appendQueryToUri(e.url,a)}},o.getObjectType=function(e){var t=e.type;return t==="subtitle"?fr.TIMED_TEXT:e.sn==="initSegment"?fr.INIT:t==="audio"?fr.AUDIO:t==="main"?this.hls.audioTracks.length?fr.VIDEO:fr.MUXED:void 0},o.getTopBandwidth=function(e){var t,i=0,n=this.hls;if(e===fr.AUDIO)t=n.audioTracks;else{var a=n.maxAutoLevel,r=a>-1?a+1:n.levels.length;t=n.levels.slice(0,r)}for(var s,l=Pa(t);!(s=l()).done;){var u=s.value;u.bitrate>i&&(i=u.bitrate)}return i>0?i:NaN},o.getBufferLength=function(e){var t=this.hls.media,i=e===fr.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*Gt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},o.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},Ca(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},o.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},Ca(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],n=function(S){return!Number.isNaN(S)&&S!=null&&S!==""&&S!==!1},a=function(S){return Math.round(S)},r=function(S){return 100*a(S/100)},s={br:a,d:a,bl:r,dl:r,mtp:r,nor:function(S){return encodeURIComponent(S)},rtp:r,tb:a},l=Pa(Object.keys(e||{}).sort());!(t=l()).done;){var u=t.value,c=e[u];if(n(c)&&!(u==="v"&&c===1||u=="pr"&&c===1)){var v=s[u];v&&(c=v(c));var m,_=typeof c;m=u==="ot"||u==="sf"||u==="st"?u+"="+c:_==="boolean"?u:_==="number"?u+"="+c:u+"="+JSON.stringify(c),i.push(m)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},r=0,s=Object.keys(e);r<s.length;r++){var l=s[r];n[a[l]!=null?a[l]:1][l]=e[l]}for(var u=0;u<n.length;u++){var c=d.serialize(n[u]);c&&(t["CMCD-"+i[u]]=c)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),xa=B(408),xs=/^age:\s*[\d.]+\s*$/m;let Ma=function(){function d(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new xa.LoadStats,this.retryDelay=0}var o=d.prototype;return o.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},o.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},o.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},o.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var a=this.xhrSetup;try{if(a)try{a(i,t.url)}catch{i.open("GET",t.url,!0),a(i,t.url)}i.readyState||i.open("GET",t.url,!0);var r=this.context.headers;if(r)for(var s in r)i.setRequestHeader(s,r[s])}catch(l){return void this.callbacks.onError({code:i.status,text:l.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},o.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var n=t.readyState,a=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),n===4){t.onreadystatechange=null,t.onprogress=null;var r=t.status,s=t.responseType==="arraybuffer";if(r>=200&&r<300&&(s&&t.response||t.responseText!==null)){var l,u;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),u=s?(l=t.response).byteLength:(l=t.responseText).length,i.loaded=i.total=u,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,e,l,t),!this.callbacks)return;var v={url:t.responseURL,data:l};this.callbacks.onSuccess(v,i,e,t)}else i.retry>=a.maxRetry||r>=400&&r<499?(L.logger.error(r+" while loading "+e.url),this.callbacks.onError({code:r,text:t.statusText},e,t)):(L.logger.warn(r+" while loading "+e.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},o.loadtimeout=function(){L.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},o.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},o.getCacheAge=function(){var e=null;if(this.loader&&xs.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},d}();function Yn(d){var o=typeof Map=="function"?new Map:void 0;return Yn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return Wn(e,arguments,Xn(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ui(i,e)},Yn(d)}function Wn(d,o,e){return Wn=Ms()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Ui(r,n.prototype),r},Wn.apply(null,arguments)}function Ms(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ui(d,o){return Ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ui(d,o)}function Xn(d){return Xn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},Xn(d)}function zn(){return zn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},zn.apply(this,arguments)}var Fs=function(){function d(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Ns,this.controller=new self.AbortController,this.stats=new xa.LoadStats}var o=d.prototype;return o.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},o.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},o.load=function(e,t,i){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var r=function(c,v){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(zn({},c.headers))};return c.rangeEnd&&m.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),m}(e,this.controller.signal),s=i.onProgress,l=e.responseType==="arraybuffer",u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){n.abortInternal(),i.onTimeout(a,e,n.response)},t.timeout),self.fetch(this.request).then(function(c){if(n.response=n.loader=c,!c.ok){var v=c.status,m=c.statusText;throw new Us(m||"fetch, bad network response",v,c)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(c.headers.get("Content-Length")||"0"),s&&(0,R.isFiniteNumber)(t.highWaterMark)?n.loadProgressively(c,a,e,t.highWaterMark,s):l?c.arrayBuffer():c.text()}).then(function(c){var v=n.response;self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var m=c[u];m&&(a.loaded=a.total=m);var _={url:v.url,data:c};s&&!(0,R.isFiniteNumber)(t.highWaterMark)&&s(a,e,c,v),i.onSuccess(_,a,e,v)}).catch(function(c){if(self.clearTimeout(n.requestTimeout),!a.aborted){var v=c&&c.code||0,m=c?c.message:null;i.onError({code:v,text:m},e,c?c.details:null)}})},o.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},o.loadProgressively=function(e,t,i,n,a){n===void 0&&(n=0);var r=new hn,s=e.body.getReader();return function l(){return s.read().then(function(u){if(u.done)return r.dataLength&&a(t,i,r.flush(),e),Promise.resolve(new ArrayBuffer(0));var c=u.value,v=c.length;return t.loaded+=v,v<n||r.dataLength?(r.push(c),r.dataLength>=n&&a(t,i,r.flush(),e)):a(t,i,c,e),l()}).catch(function(){return Promise.reject()})}()},d}();function Ns(d,o){return new self.Request(d.url,o)}var Us=function(d){var o,e;function t(i,n,a){var r;return(r=d.call(this,i)||this).code=void 0,r.details=void 0,r.code=n,r.details=a,r}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Ui(o,e),t}(Yn(Error));let Fa=Fs;var Bs=/\s/;function Qn(){return Qn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Qn.apply(this,arguments)}function Na(d,o){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);o&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function Ua(d){for(var o=1;o<arguments.length;o++){var e=arguments[o]!=null?arguments[o]:{};o%2?Na(Object(e),!0).forEach(function(t){js(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Na(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function js(d,o,e){return(o=function(t){var i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return typeof i=="symbol"?i:String(i)}(o))in d?Object.defineProperty(d,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[o]=e,d}var Gs=Ua(Ua({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ma,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Cn,bufferController:Un,capLevelController:Rs,fpsController:Is,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Se,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(d,o,e,t){for(var i,n,a,r,s,l=[],u=self.VTTCue||self.TextTrackCue,c=0;c<t.rows.length;c++)if(a=!0,r=0,s="",!(i=t.rows[c]).isEmpty()){for(var v=0;v<i.chars.length;v++)Bs.test(i.chars[v].uchar)&&a?r++:(s+=i.chars[v].uchar,a=!1);i.cueStartTime=o,o===e&&(e+=1e-4),r>=16?r--:r++;var m=Xt(s.trim()),_=hr(o,e,m);d&&d.cues&&d.cues.getCueById(_)||((n=new u(o,e,m)).id=_,n.line=c+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*r/32)),l.push(n))}return d&&l.length&&(l.sort(function(S,F){return S.line==="auto"||F.line==="auto"?0:S.line>8&&F.line>8?F.line-S.line:S.line-F.line}),l.forEach(function(S){return it(d,S)})),l}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:xn,subtitleTrackController:Nn,timelineController:ws,audioStreamController:Oi,audioTrackController:Pn,emeController:Ps,cmcdController:Os});function Ba(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var ja=function(){function d(n){n===void 0&&(n={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ri.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=function(Ae,Ke){if((Ke.liveSyncDurationCount||Ke.liveMaxLatencyDurationCount)&&(Ke.liveSyncDuration||Ke.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(Ke.liveMaxLatencyDurationCount!==void 0&&(Ke.liveSyncDurationCount===void 0||Ke.liveMaxLatencyDurationCount<=Ke.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(Ke.liveMaxLatencyDuration!==void 0&&(Ke.liveSyncDuration===void 0||Ke.liveMaxLatencyDuration<=Ke.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return Qn({},Ae,Ke)}(d.DefaultConfig,n);this.userConfig=n,(0,L.enableLogs)(a.debug,"Hls instance"),this._autoLevelCapping=-1,a.progressive&&function(Ae){var Ke=Ae.loader;Ke!==Fa&&Ke!==Ma?(L.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),Ae.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(Ae.loader=Fa,Ae.progressive=!0,Ae.enableSoftwareAES=!0,L.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(a);var r=a.abrController,s=a.bufferController,l=a.capLevelController,u=a.fpsController,c=this.abrController=new r(this),v=this.bufferController=new s(this),m=this.capLevelController=new l(this),_=new u(this),S=new Ve(this),F=new tt(this),P=this.levelController=new ht(this),X=new Dt(this),ue=new pr(this.config),_e=this.streamController=new Ln(this,X,ue);m.setStreamController(_e),_.setStreamController(_e);var ge=[S,P,_e];this.networkControllers=ge;var De=[c,v,m,_,F,X];this.audioTrackController=this.createController(a.audioTrackController,ge);var He=a.audioStreamController;He&&ge.push(new He(this,X,ue)),this.subtitleTrackController=this.createController(a.subtitleTrackController,ge);var Je=a.subtitleStreamController;Je&&ge.push(new Je(this,X,ue)),this.createController(a.timelineController,De),ue.emeController=this.emeController=this.createController(a.emeController,De),this.cmcdController=this.createController(a.cmcdController,De),this.latencyController=this.createController(Ut,De),this.coreComponents=De}d.isSupported=function(){return function(){var n=fi();if(!n)return!1;var a=vi(),r=n&&typeof n.isTypeSupported=="function"&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!a||a.prototype&&typeof a.prototype.appendBuffer=="function"&&typeof a.prototype.remove=="function";return!!r&&!!s}()};var o,e,t,i=d.prototype;return i.createController=function(n,a){if(n){var r=new n(this);return a&&a.push(r),r}return null},i.on=function(n,a,r){r===void 0&&(r=this),this._emitter.on(n,a,r)},i.once=function(n,a,r){r===void 0&&(r=this),this._emitter.once(n,a,r)},i.removeAllListeners=function(n){this._emitter.removeAllListeners(n)},i.off=function(n,a,r,s){r===void 0&&(r=this),this._emitter.off(n,a,r,s)},i.listeners=function(n){return this._emitter.listeners(n)},i.emit=function(n,a,r){return this._emitter.emit(n,a,r)},i.trigger=function(n,a){if(this.config.debug)return this.emit(n,n,a);try{return this.emit(n,n,a)}catch(r){L.logger.error("An internal error happened while handling event "+n+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(g.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:n,error:r})}return!1},i.listenerCount=function(n){return this._emitter.listenerCount(n)},i.destroy=function(){L.logger.log("destroy"),this.trigger(g.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(n){return n.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(n){return n.destroy()}),this.coreComponents.length=0},i.attachMedia=function(n){L.logger.log("attachMedia"),this._media=n,this.trigger(g.Events.MEDIA_ATTACHING,{media:n})},i.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},i.loadSource=function(n){this.stopLoad();var a=this.media,r=this.url,s=this.url=re.buildAbsoluteURL(self.location.href,n,{alwaysNormalize:!0});L.logger.log("loadSource:"+s),a&&r&&r!==s&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(a)),this.trigger(g.Events.MANIFEST_LOADING,{url:n})},i.startLoad=function(n){n===void 0&&(n=-1),L.logger.log("startLoad("+n+")"),this.networkControllers.forEach(function(a){a.startLoad(n)})},i.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(n){n.stopLoad()})},i.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},i.recoverMediaError=function(){L.logger.log("recoverMediaError");var n=this._media;this.detachMedia(),n&&this.attachMedia(n)},i.removeLevel=function(n,a){a===void 0&&(a=0),this.levelController.removeLevel(n,a)},o=d,t=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return k.ErrorTypes}},{key:"ErrorDetails",get:function(){return k.ErrorDetails}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Gs},set:function(n){d.defaultConfig=n}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(n){L.logger.log("set currentLevel:"+n),this.loadLevel=n,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(n){L.logger.log("set nextLevel:"+n),this.levelController.manualLevel=n,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(n){L.logger.log("set loadLevel:"+n),this.levelController.manualLevel=n}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(n){this.levelController.nextLoadLevel=n}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(n){L.logger.log("set firstLevel:"+n),this.levelController.firstLevel=n}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(n){L.logger.log("set startLevel:"+n),n!==-1&&(n=Math.max(n,this.minAutoLevel)),this.levelController.startLevel=n}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(n){var a=!!n;a!==this.config.capLevelToPlayerSize&&(a?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=a)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(n){this._autoLevelCapping!==n&&(L.logger.log("set autoLevelCapping:"+n),this._autoLevelCapping=n)}},{key:"bandwidthEstimate",get:function(){var n=this.abrController.bwEstimator;return n?n.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(n){ar.indexOf(n)>-1&&(this._maxHdcpLevel=n)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var n=this.levels,a=this.config.minAutoBitrate;if(!n)return 0;for(var r=n.length,s=0;s<r;s++)if(n[s].maxBitrate>=a)return s;return 0}},{key:"maxAutoLevel",get:function(){var n,a=this.levels,r=this.autoLevelCapping,s=this.maxHdcpLevel;if(n=r===-1&&a&&a.length?a.length-1:r,s)for(var l=n;l--;){var u=a[l].attrs["HDCP-LEVEL"];if(u&&u<=s)return l}return n}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(n){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,n)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var n=this.audioTrackController;return n?n.audioTracks:[]}},{key:"audioTrack",get:function(){var n=this.audioTrackController;return n?n.audioTrack:-1},set:function(n){var a=this.audioTrackController;a&&(a.audioTrack=n)}},{key:"subtitleTracks",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTrack:-1},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleTrack=n)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var n=this.subtitleTrackController;return!!n&&n.subtitleDisplay},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleDisplay=n)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(n){this.config.lowLatencyMode=n}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&Ba(o.prototype,e),t&&Ba(o,t),Object.defineProperty(o,"prototype",{writable:!1}),d}();ja.defaultConfig=void 0},923:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{BaseSegment:()=>ce,ElementaryStreamTypes:()=>j,Fragment:()=>we,Part:()=>q});var j,re=B(965),R=B(945),g=B(408);function k(ye,J){ye.prototype=Object.create(J.prototype),ye.prototype.constructor=ye,L(ye,J)}function L(ye,J){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(oe,K){return oe.__proto__=K,oe},L(ye,J)}function me(ye,J){for(var oe=0;oe<J.length;oe++){var K=J[oe];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(ye,typeof(Ee=function(ke,Ne){if(typeof ke!="object"||ke===null)return ke;var V=ke[Symbol.toPrimitive];if(V!==void 0){var E=V.call(ke,Ne);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(K.key,"string"))=="symbol"?Ee:String(Ee),K)}var Ee}function ne(ye,J,oe){return J&&me(ye.prototype,J),oe&&me(ye,oe),Object.defineProperty(ye,"prototype",{writable:!1}),ye}(function(ye){ye.AUDIO="audio",ye.VIDEO="video",ye.AUDIOVIDEO="audiovideo"})(j||(j={}));var ce=function(){function ye(J){var oe;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((oe={})[j.AUDIO]=null,oe[j.VIDEO]=null,oe[j.AUDIOVIDEO]=null,oe),this.baseurl=J}return ye.prototype.setByteRange=function(J,oe){var K=J.split("@",2),Ee=[];K.length===1?Ee[0]=oe?oe.byteRangeEndOffset:0:Ee[0]=parseInt(K[1]),Ee[1]=parseInt(K[0])+Ee[0],this._byteRange=Ee},ne(ye,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(J){this._url=J}}]),ye}(),we=function(ye){function J(K,Ee){var ke;return(ke=ye.call(this,Ee)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new g.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=K,ke}k(J,ye);var oe=J.prototype;return oe.setKeyFormat=function(K){if(this.levelkeys){var Ee=this.levelkeys[K];Ee&&!this._decryptdata&&(this._decryptdata=Ee.getDecryptData(this.sn))}},oe.abortRequests=function(){var K,Ee;(K=this.loader)===null||K===void 0||K.abort(),(Ee=this.keyLoader)===null||Ee===void 0||Ee.abort()},oe.setElementaryStreamInfo=function(K,Ee,ke,Ne,V,E){E===void 0&&(E=!1);var U=this.elementaryStreams,D=U[K];D?(D.startPTS=Math.min(D.startPTS,Ee),D.endPTS=Math.max(D.endPTS,ke),D.startDTS=Math.min(D.startDTS,Ne),D.endDTS=Math.max(D.endDTS,V)):U[K]={startPTS:Ee,endPTS:ke,startDTS:Ne,endDTS:V,partial:E}},oe.clearElementaryStreamInfo=function(){var K=this.elementaryStreams;K[j.AUDIO]=null,K[j.VIDEO]=null,K[j.AUDIOVIDEO]=null},ne(J,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var K=this.levelkeys.identity;if(K)this._decryptdata=K.getDecryptData(this.sn);else{var Ee=Object.keys(this.levelkeys);if(Ee.length===1)return this._decryptdata=this.levelkeys[Ee[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,re.isFiniteNumber)(this.programDateTime))return null;var K=(0,re.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*K}},{key:"encrypted",get:function(){var K;if((K=this._decryptdata)!==null&&K!==void 0&&K.encrypted)return!0;if(this.levelkeys){var Ee=Object.keys(this.levelkeys),ke=Ee.length;if(ke>1||ke===1&&this.levelkeys[Ee[0]].encrypted)return!0}return!1}}]),J}(ce),q=function(ye){function J(oe,K,Ee,ke,Ne){var V;(V=ye.call(this,Ee)||this).fragOffset=0,V.duration=0,V.gap=!1,V.independent=!1,V.relurl=void 0,V.fragment=void 0,V.index=void 0,V.stats=new g.LoadStats,V.duration=oe.decimalFloatingPoint("DURATION"),V.gap=oe.bool("GAP"),V.independent=oe.bool("INDEPENDENT"),V.relurl=oe.enumeratedString("URI"),V.fragment=K,V.index=ke;var E=oe.enumeratedString("BYTERANGE");return E&&V.setByteRange(E,Ne),Ne&&(V.fragOffset=Ne.fragOffset+Ne.duration),V}return k(J,ye),ne(J,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var oe=this.elementaryStreams;return!!(oe.audio||oe.video||oe.audiovideo)}}]),J}(ce)},408:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{LoadStats:()=>j});var j=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},965:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{MAX_SAFE_INTEGER:()=>re,isFiniteNumber:()=>j});var j=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},re=Number.MAX_SAFE_INTEGER||9007199254740991},524:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{default:()=>oe,flushTextTrackMetadataCueSamples:()=>Ee,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>K});var j=B(965);let re=function(){function E(){}return E.getSilentFrame=function(U,D){if(U==="mp4a.40.2"){if(D===1)return new Uint8Array([0,200,0,128,35,128]);if(D===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(D===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(D===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(D===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(D===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(D===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(D===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(D===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},E}();var R=Math.pow(2,32)-1,g=function(){function E(){}return E.init=function(){var U;for(U in E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},E.types)E.types.hasOwnProperty(U)&&(E.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),de=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);E.HDLR_TYPES={video:D,audio:de};var Se=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),z=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=z,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var $=new Uint8Array([105,115,111,109]),Le=new Uint8Array([97,118,99,49]),Oe=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,$,Oe,$,Le),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,Se))},E.box=function(U){for(var D=8,de=arguments.length,Se=new Array(de>1?de-1:0),z=1;z<de;z++)Se[z-1]=arguments[z];for(var $=Se.length,Le=$;$--;)D+=Se[$].byteLength;var Oe=new Uint8Array(D);for(Oe[0]=D>>24&255,Oe[1]=D>>16&255,Oe[2]=D>>8&255,Oe[3]=255&D,Oe.set(U,4),$=0,D=8;$<Le;$++)Oe.set(Se[$],D),D+=Se[$].byteLength;return Oe},E.hdlr=function(U){return E.box(E.types.hdlr,E.HDLR_TYPES[U])},E.mdat=function(U){return E.box(E.types.mdat,U)},E.mdhd=function(U,D){D*=U;var de=Math.floor(D/(R+1)),Se=Math.floor(D%(R+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,255&U,de>>24,de>>16&255,de>>8&255,255&de,Se>>24,Se>>16&255,Se>>8&255,255&Se,85,196,0,0]))},E.mdia=function(U){return E.box(E.types.mdia,E.mdhd(U.timescale,U.duration),E.hdlr(U.type),E.minf(U))},E.mfhd=function(U){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,255&U]))},E.minf=function(U){return U.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(U)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(U))},E.moof=function(U,D,de){return E.box(E.types.moof,E.mfhd(U),E.traf(de,D))},E.moov=function(U){for(var D=U.length,de=[];D--;)de[D]=E.trak(U[D]);return E.box.apply(null,[E.types.moov,E.mvhd(U[0].timescale,U[0].duration)].concat(de).concat(E.mvex(U)))},E.mvex=function(U){for(var D=U.length,de=[];D--;)de[D]=E.trex(U[D]);return E.box.apply(null,[E.types.mvex].concat(de))},E.mvhd=function(U,D){D*=U;var de=Math.floor(D/(R+1)),Se=Math.floor(D%(R+1)),z=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,255&U,de>>24,de>>16&255,de>>8&255,255&de,Se>>24,Se>>16&255,Se>>8&255,255&Se,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return E.box(E.types.mvhd,z)},E.sdtp=function(U){var D,de,Se=U.samples||[],z=new Uint8Array(4+Se.length);for(D=0;D<Se.length;D++)de=Se[D].flags,z[D+4]=de.dependsOn<<4|de.isDependedOn<<2|de.hasRedundancy;return E.box(E.types.sdtp,z)},E.stbl=function(U){return E.box(E.types.stbl,E.stsd(U),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(U){var D,de,Se,z=[],$=[];for(D=0;D<U.sps.length;D++)Se=(de=U.sps[D]).byteLength,z.push(Se>>>8&255),z.push(255&Se),z=z.concat(Array.prototype.slice.call(de));for(D=0;D<U.pps.length;D++)Se=(de=U.pps[D]).byteLength,$.push(Se>>>8&255),$.push(255&Se),$=$.concat(Array.prototype.slice.call(de));var Le=E.box(E.types.avcC,new Uint8Array([1,z[3],z[4],z[5],255,224|U.sps.length].concat(z).concat([U.pps.length]).concat($))),Oe=U.width,xe=U.height,be=U.pixelRatio[0],qe=U.pixelRatio[1];return E.box(E.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Oe>>8&255,255&Oe,xe>>8&255,255&xe,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),Le,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([be>>24,be>>16&255,be>>8&255,255&be,qe>>24,qe>>16&255,qe>>8&255,255&qe])))},E.esds=function(U){var D=U.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(U.config).concat([6,1,2]))},E.mp4a=function(U){var D=U.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,255&D,0,0]),E.box(E.types.esds,E.esds(U)))},E.mp3=function(U){var D=U.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,255&D,0,0]))},E.stsd=function(U){return U.type==="audio"?U.segmentCodec==="mp3"&&U.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(U)):E.box(E.types.stsd,E.STSD,E.mp4a(U)):E.box(E.types.stsd,E.STSD,E.avc1(U))},E.tkhd=function(U){var D=U.id,de=U.duration*U.timescale,Se=U.width,z=U.height,$=Math.floor(de/(R+1)),Le=Math.floor(de%(R+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,255&D,0,0,0,0,$>>24,$>>16&255,$>>8&255,255&$,Le>>24,Le>>16&255,Le>>8&255,255&Le,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,Se>>8&255,255&Se,0,0,z>>8&255,255&z,0,0]))},E.traf=function(U,D){var de=E.sdtp(U),Se=U.id,z=Math.floor(D/(R+1)),$=Math.floor(D%(R+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,Se>>24,Se>>16&255,Se>>8&255,255&Se])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,z>>24,z>>16&255,z>>8&255,255&z,$>>24,$>>16&255,$>>8&255,255&$])),E.trun(U,de.length+16+20+8+16+8+8),de)},E.trak=function(U){return U.duration=U.duration||4294967295,E.box(E.types.trak,E.tkhd(U),E.mdia(U))},E.trex=function(U){var D=U.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,255&D,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(U,D){var de,Se,z,$,Le,Oe,xe=U.samples||[],be=xe.length,qe=12+16*be,at=new Uint8Array(qe);for(D+=8+qe,at.set([U.type==="video"?1:0,0,15,1,be>>>24&255,be>>>16&255,be>>>8&255,255&be,D>>>24&255,D>>>16&255,D>>>8&255,255&D],0),de=0;de<be;de++)z=(Se=xe[de]).duration,$=Se.size,Le=Se.flags,Oe=Se.cts,at.set([z>>>24&255,z>>>16&255,z>>>8&255,255&z,$>>>24&255,$>>>16&255,$>>>8&255,255&$,Le.isLeading<<2|Le.dependsOn,Le.isDependedOn<<6|Le.hasRedundancy<<4|Le.paddingValue<<1|Le.isNonSync,61440&Le.degradPrio,15&Le.degradPrio,Oe>>>24&255,Oe>>>16&255,Oe>>>8&255,255&Oe],12+16*de);return E.box(E.types.trun,at)},E.initSegment=function(U){E.types||E.init();var D=E.moov(U),de=new Uint8Array(E.FTYP.byteLength+D.byteLength);return de.set(E.FTYP),de.set(D,E.FTYP.byteLength),de},E}();g.types=void 0,g.HDLR_TYPES=void 0,g.STTS=void 0,g.STSC=void 0,g.STCO=void 0,g.STSZ=void 0,g.VMHD=void 0,g.SMHD=void 0,g.STSD=void 0,g.FTYP=void 0,g.DINF=void 0;let k=g;var L=B(851),me=B(973),ne=B(93),ce=B(308),we=B(673);function q(){return q=Object.assign?Object.assign.bind():function(E){for(var U=1;U<arguments.length;U++){var D=arguments[U];for(var de in D)Object.prototype.hasOwnProperty.call(D,de)&&(E[de]=D[de])}return E},q.apply(this,arguments)}var ye=null,J=null,oe=function(){function E(D,de,Se,z){if(z===void 0&&(z=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=D,this.config=de,this.typeSupported=Se,this.ISGenerated=!1,ye===null){var $=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ye=$?parseInt($[1]):0}if(J===null){var Le=navigator.userAgent.match(/Safari\/(\d+)/i);J=Le?parseInt(Le[1]):0}}var U=E.prototype;return U.destroy=function(){},U.resetTimeStamp=function(D){ne.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=D},U.resetNextTimestamp=function(){ne.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},U.resetInitSegment=function(){ne.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},U.getVideoStartPts=function(D){var de=!1,Se=D.reduce(function(z,$){var Le=$.pts-z;return Le<-4294967296?(de=!0,K(z,$.pts)):Le>0?z:$.pts},D[0].pts);return de&&ne.logger.debug("PTS rollover detected"),Se},U.remux=function(D,de,Se,z,$,Le,Oe,xe){var be,qe,at,ie,pe,se,Ue=$,H=$,ve=D.pid>-1,Ie=de.pid>-1,Fe=de.samples.length,fe=D.samples.length>0,Ce=Oe&&Fe>0||Fe>1;if((!ve||fe)&&(!Ie||Ce)||this.ISGenerated||Oe){this.ISGenerated||(at=this.generateIS(D,de,$));var Ve,Xe=this.isVideoContiguous,it=-1;if(Ce&&(it=function(wt){for(var gt=0;gt<wt.length;gt++)if(wt[gt].key)return gt;return-1}(de.samples),!Xe&&this.config.forceKeyFrameOnDiscontinuity))if(se=!0,it>0){ne.logger.warn("[mp4-remuxer]: Dropped "+it+" out of "+Fe+" video samples due to a missing keyframe");var lt=this.getVideoStartPts(de.samples);de.samples=de.samples.slice(it),de.dropped+=it,Ve=H+=(de.samples[0].pts-lt)/de.inputTimeScale}else it===-1&&(ne.logger.warn("[mp4-remuxer]: No keyframe found out of "+Fe+" video samples"),se=!1);if(this.ISGenerated){if(fe&&Ce){var Ct=this.getVideoStartPts(de.samples),Rt=(K(D.samples[0].pts,Ct)-Ct)/de.inputTimeScale;Ue+=Math.max(0,Rt),H+=Math.max(0,-Rt)}if(fe){if(D.samplerate||(ne.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),at=this.generateIS(D,de,$)),qe=this.remuxAudio(D,Ue,this.isAudioContiguous,Le,Ie||Ce||xe===ce.PlaylistLevelType.AUDIO?H:void 0),Ce){var St=qe?qe.endPTS-qe.startPTS:0;de.inputTimeScale||(ne.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),at=this.generateIS(D,de,$)),be=this.remuxVideo(de,H,Xe,St)}}else Ce&&(be=this.remuxVideo(de,H,Xe,0));be&&(be.firstKeyFrame=it,be.independent=it!==-1,be.firstKeyFramePTS=Ve)}}return this.ISGenerated&&(Se.samples.length&&(pe=Ee(Se,$,this._initPTS,this._initDTS)),z.samples.length&&(ie=ke(z,$,this._initPTS))),{audio:qe,video:be,initSegment:at,independent:se,text:ie,id3:pe}},U.generateIS=function(D,de,Se){var z,$,Le,Oe=D.samples,xe=de.samples,be=this.typeSupported,qe={},at=!(0,j.isFiniteNumber)(this._initPTS),ie="audio/mp4";if(at&&(z=$=1/0),D.config&&Oe.length&&(D.timescale=D.samplerate,D.segmentCodec==="mp3"&&(be.mpeg?(ie="audio/mpeg",D.codec=""):be.mp3&&(D.codec="mp3")),qe.audio={id:"audio",container:ie,codec:D.codec,initSegment:D.segmentCodec==="mp3"&&be.mpeg?new Uint8Array(0):k.initSegment([D]),metadata:{channelCount:D.channelCount}},at&&(Le=D.inputTimeScale,z=$=Oe[0].pts-Math.round(Le*Se))),de.sps&&de.pps&&xe.length&&(de.timescale=de.inputTimeScale,qe.video={id:"main",container:"video/mp4",codec:de.codec,initSegment:k.initSegment([de]),metadata:{width:de.width,height:de.height}},at)){Le=de.inputTimeScale;var pe=this.getVideoStartPts(xe),se=Math.round(Le*Se);$=Math.min($,K(xe[0].dts,pe)-se),z=Math.min(z,pe-se)}if(Object.keys(qe).length)return this.ISGenerated=!0,at&&(this._initPTS=z,this._initDTS=$),{tracks:qe,initPTS:z,timescale:Le}},U.remuxVideo=function(D,de,Se,z){var $,Le,Oe=D.inputTimeScale,xe=D.samples,be=[],qe=xe.length,at=this._initPTS,ie=this.nextAvcDts,pe=8,se=this.videoSampleDuration,Ue=Number.POSITIVE_INFINITY,H=Number.NEGATIVE_INFINITY,ve=!1;Se&&ie!==null||(ie=de*Oe-(xe[0].pts-K(xe[0].dts,xe[0].pts)));for(var Ie=0;Ie<qe;Ie++){var Fe=xe[Ie];Fe.pts=K(Fe.pts-at,ie),Fe.dts=K(Fe.dts-at,ie),Fe.dts<xe[Ie>0?Ie-1:Ie].dts&&(ve=!0)}ve&&xe.sort(function(Jt,pr){var Cr=Jt.dts-pr.dts,vr=Jt.pts-pr.pts;return Cr||vr}),$=xe[0].dts;var fe=xe[xe.length-1].dts-$,Ce=fe?Math.round(fe/(qe-1)):se||D.inputTimeScale/30;if(Se){var Ve=$-ie,Xe=Ve>Ce,it=Ve<-1;if((Xe||it)&&(Xe?ne.logger.warn("AVC: "+(0,we.toMsFromMpegTsClock)(Ve,!0)+" ms ("+Ve+"dts) hole between fragments detected, filling it"):ne.logger.warn("AVC: "+(0,we.toMsFromMpegTsClock)(-Ve,!0)+" ms ("+Ve+"dts) overlapping between fragments detected"),!it||ie>xe[0].pts)){$=ie;var lt=xe[0].pts-Ve;xe[0].dts=$,xe[0].pts=lt,ne.logger.log("Video: First PTS/DTS adjusted: "+(0,we.toMsFromMpegTsClock)(lt,!0)+"/"+(0,we.toMsFromMpegTsClock)($,!0)+", delta: "+(0,we.toMsFromMpegTsClock)(Ve,!0)+" ms")}}$=Math.max(0,$);for(var Ct=0,Rt=0,St=0;St<qe;St++){for(var wt=xe[St],gt=wt.units,dt=gt.length,tt=0,It=0;It<dt;It++)tt+=gt[It].data.length;Rt+=tt,Ct+=dt,wt.length=tt,wt.dts=Math.max(wt.dts,$),Ue=Math.min(wt.pts,Ue),H=Math.max(wt.pts,H)}Le=xe[qe-1].dts;var Ut,Wt=Rt+4*Ct+8;try{Ut=new Uint8Array(Wt)}catch{return void this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:me.ErrorTypes.MUX_ERROR,details:me.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Wt,reason:"fail allocating video mdat "+Wt})}var Bt=new DataView(Ut.buffer);Bt.setUint32(0,Wt),Ut.set(k.types.mdat,4);for(var ar=!1,te=Number.POSITIVE_INFINITY,N=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY,C=0;C<qe;C++){for(var G=xe[C],Q=G.units,Z=0,Te=0,Re=Q.length;Te<Re;Te++){var Pe=Q[Te],Be=Pe.data,We=Pe.data.byteLength;Bt.setUint32(pe,We),pe+=4,Ut.set(Be,pe),pe+=We,Z+=4+We}var Ge=void 0;if(C<qe-1)se=xe[C+1].dts-G.dts,Ge=xe[C+1].pts-G.pts;else{var $e=this.config,ht=C>0?G.dts-xe[C-1].dts:Ce;if(Ge=C>0?G.pts-xe[C-1].pts:Ce,$e.stretchShortVideoTrack&&this.nextAudioPts!==null){var Dt=Math.floor($e.maxBufferHole*Oe),ze=(z?Ue+z*Oe:this.nextAudioPts)-G.pts;ze>Dt?((se=ze-ht)<0?se=ht:ar=!0,ne.logger.log("[mp4-remuxer]: It is approximately "+ze/90+" ms to the next segment; using duration "+se/90+" ms for the last video frame.")):se=ht}else se=ht}var Pt=Math.round(G.pts-G.dts);te=Math.min(te,se),T=Math.max(T,se),N=Math.min(N,Ge),O=Math.max(O,Ge),be.push(new Ne(G.key,se,Z,Pt))}if(be.length){if(ye){if(ye<70){var tr=be[0].flags;tr.dependsOn=2,tr.isNonSync=0}}else if(J&&O-N<T-te&&Ce/T<.025&&be[0].cts===0){ne.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var jt=$,Ft=0,Ht=be.length;Ft<Ht;Ft++){var rt=jt+be[Ft].duration,lr=jt+be[Ft].cts;if(Ft<Ht-1){var Ar=rt+be[Ft+1].cts;be[Ft].duration=Ar-lr}else be[Ft].duration=Ft?be[Ft-1].duration:Ce;be[Ft].cts=0,jt=rt}}}se=ar||!se?Ce:se,this.nextAvcDts=ie=Le+se,this.videoSampleDuration=se,this.isVideoContiguous=!0;var Kt={data1:k.moof(D.sequenceNumber++,$,q({},D,{samples:be})),data2:Ut,startPTS:Ue/Oe,endPTS:(H+se)/Oe,startDTS:$/Oe,endDTS:ie/Oe,type:"video",hasAudio:!1,hasVideo:!0,nb:be.length,dropped:D.dropped};return D.samples=[],D.dropped=0,Kt},U.remuxAudio=function(D,de,Se,z,$){var Le=D.inputTimeScale,Oe=Le/(D.samplerate?D.samplerate:Le),xe=D.segmentCodec==="aac"?1024:1152,be=xe*Oe,qe=this._initPTS,at=D.segmentCodec==="mp3"&&this.typeSupported.mpeg,ie=[],pe=$!==void 0,se=D.samples,Ue=at?0:8,H=this.nextAudioPts||-1,ve=de*Le;if(this.isAudioContiguous=Se=Se||se.length&&H>0&&(z&&Math.abs(ve-H)<9e3||Math.abs(K(se[0].pts-qe,ve)-H)<20*be),se.forEach(function(Te){Te.pts=K(Te.pts-qe,ve)}),!Se||H<0){if(se=se.filter(function(Te){return Te.pts>=0}),!se.length)return;H=$===0?0:z&&!pe?Math.max(0,ve):se[0].pts}if(D.segmentCodec==="aac")for(var Ie=this.config.maxAudioFramesDrift,Fe=0,fe=H;Fe<se.length;Fe++){var Ce=se[Fe],Ve=Ce.pts,Xe=Ve-fe,it=Math.abs(1e3*Xe/Le);if(Xe<=-Ie*be&&pe)Fe===0&&(ne.logger.warn("Audio frame @ "+(Ve/Le).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Xe/Le)+" ms."),this.nextAudioPts=H=fe=Ve);else if(Xe>=Ie*be&&it<1e4&&pe){var lt=Math.round(Xe/be);(fe=Ve-lt*be)<0&&(lt--,fe+=be),Fe===0&&(this.nextAudioPts=H=fe),ne.logger.warn("[mp4-remuxer]: Injecting "+lt+" audio frame @ "+(fe/Le).toFixed(3)+"s due to "+Math.round(1e3*Xe/Le)+" ms gap.");for(var Ct=0;Ct<lt;Ct++){var Rt=Math.max(fe,0),St=re.getSilentFrame(D.manifestCodec||D.codec,D.channelCount);St||(ne.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),St=Ce.unit.subarray()),se.splice(Fe,0,{unit:St,pts:Rt}),fe+=be,Fe++}}Ce.pts=fe,fe+=be}for(var wt,gt=null,dt=null,tt=0,It=se.length;It--;)tt+=se[It].unit.byteLength;for(var Ut=0,Wt=se.length;Ut<Wt;Ut++){var Bt=se[Ut],ar=Bt.unit,te=Bt.pts;if(dt!==null)ie[Ut-1].duration=Math.round((te-dt)/Oe);else{if(Se&&D.segmentCodec==="aac"&&(te=H),gt=te,!(tt>0))return;tt+=Ue;try{wt=new Uint8Array(tt)}catch{return void this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:me.ErrorTypes.MUX_ERROR,details:me.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:tt,reason:"fail allocating audio mdat "+tt})}at||(new DataView(wt.buffer).setUint32(0,tt),wt.set(k.types.mdat,4))}wt.set(ar,Ue);var N=ar.byteLength;Ue+=N,ie.push(new Ne(!0,xe,N,0)),dt=te}var T=ie.length;if(T){var O=ie[ie.length-1];this.nextAudioPts=H=dt+Oe*O.duration;var C=at?new Uint8Array(0):k.moof(D.sequenceNumber++,gt/Oe,q({},D,{samples:ie}));D.samples=[];var G=gt/Le,Q=H/Le,Z={data1:C,data2:wt,startPTS:G,endPTS:Q,startDTS:G,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,Z}},U.remuxEmptyAudio=function(D,de,Se,z){var $=D.inputTimeScale,Le=$/(D.samplerate?D.samplerate:$),Oe=this.nextAudioPts,xe=(Oe!==null?Oe:z.startDTS*$)+this._initDTS,be=z.endDTS*$+this._initDTS,qe=1024*Le,at=Math.ceil((be-xe)/qe),ie=re.getSilentFrame(D.manifestCodec||D.codec,D.channelCount);if(ne.logger.warn("[mp4-remuxer]: remux empty Audio"),ie){for(var pe=[],se=0;se<at;se++){var Ue=xe+se*qe;pe.push({unit:ie,pts:Ue,dts:Ue})}return D.samples=pe,this.remuxAudio(D,de,Se,!1)}ne.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},E}();function K(E,U){var D;if(U===null)return E;for(D=U<E?-8589934592:8589934592;Math.abs(E-U)>4294967296;)E+=D;return E}function Ee(E,U,D,de){var Se=E.samples.length;if(Se){for(var z=E.inputTimeScale,$=0;$<Se;$++){var Le=E.samples[$];Le.pts=K(Le.pts-D,U*z)/z,Le.dts=K(Le.dts-de,U*z)/z}var Oe=E.samples;return E.samples=[],{samples:Oe}}}function ke(E,U,D){var de=E.samples.length;if(de){for(var Se=E.inputTimeScale,z=0;z<de;z++){var $=E.samples[z];$.pts=K($.pts-D,U*Se)/Se}E.samples.sort(function(Oe,xe){return Oe.pts-xe.pts});var Le=E.samples;return E.samples=[],{samples:Le}}}var Ne=function(E,U,D,de){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=U,this.size=D,this.cts=de,this.flags=new V(E)},V=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},856:(ae,W,B)=>{"use strict";var j;B.r(W),B.d(W,{MetadataSchema:()=>j}),function(re){re.audioId3="org.id3",re.dateRange="com.apple.quicktime.HLS",re.emsg="https://aomedia.org/emsg/ID3"}(j||(j={}))},308:(ae,W,B)=>{"use strict";var j,re;B.r(W),B.d(W,{PlaylistContextType:()=>j,PlaylistLevelType:()=>re}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(j||(j={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}(re||(re={}))},300:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{default:()=>j});let j={hexDump:function(re){for(var R="",g=0;g<re.length;g++){var k=re[g].toString(16);k.length<2&&(k="0"+k),R+=k}return R}}},93:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{enableLogs:()=>k,logger:()=>L});var j=function(){},re={trace:j,debug:j,log:j,warn:j,info:j,error:j},R=re;function g(me){var ne=self.console[me];return ne?ne.bind(self.console,"["+me+"] >"):j}function k(me,ne){if(self.console&&me===!0||typeof me=="object"){(function(ce){for(var we=arguments.length,q=new Array(we>1?we-1:0),ye=1;ye<we;ye++)q[ye-1]=arguments[ye];q.forEach(function(J){R[J]=ce[J]?ce[J].bind(ce):g(J)})})(me,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+ne+'"')}catch{R=re}}else R=re}var L=re},63:(ae,W,B)=>{"use strict";B.r(W),B.d(W,{RemuxerTrackIdConfig:()=>ne,appendUint8Array:()=>Se,bin2str:()=>ce,computeRawDurationFromSamples:()=>U,discardEPB:()=>Oe,findBox:()=>oe,getDuration:()=>E,getStartDTS:()=>V,mp4Box:()=>be,mp4pssh:()=>qe,offsetStartDTS:()=>D,parseEmsg:()=>xe,parseInitSegment:()=>Ee,parsePssh:()=>at,parseSEIMessageFromNALu:()=>Le,parseSamples:()=>z,parseSegmentIndex:()=>K,parseSinf:()=>Ne,patchEncyptionData:()=>ke,readSint32:()=>ye,readUint16:()=>we,readUint32:()=>q,segmentValidRange:()=>de,writeUint32:()=>J});var j=B(923),re=B(145),R=B(181),g=B(93),k=B(300),L=Math.pow(2,32)-1,me=[].push,ne={video:1,audio:2,id3:3,text:4};function ce(ie){return String.fromCharCode.apply(null,ie)}function we(ie,pe){var se=ie[pe]<<8|ie[pe+1];return se<0?65536+se:se}function q(ie,pe){var se=ye(ie,pe);return se<0?4294967296+se:se}function ye(ie,pe){return ie[pe]<<24|ie[pe+1]<<16|ie[pe+2]<<8|ie[pe+3]}function J(ie,pe,se){ie[pe]=se>>24,ie[pe+1]=se>>16&255,ie[pe+2]=se>>8&255,ie[pe+3]=255&se}function oe(ie,pe){var se=[];if(!pe.length)return se;for(var Ue=ie.byteLength,H=0;H<Ue;){var ve=q(ie,H),Ie=ve>1?H+ve:Ue;if(ce(ie.subarray(H+4,H+8))===pe[0])if(pe.length===1)se.push(ie.subarray(H+8,Ie));else{var Fe=oe(ie.subarray(H+8,Ie),pe.slice(1));Fe.length&&me.apply(se,Fe)}H=Ie}return se}function K(ie){var pe=[],se=ie[0],Ue=8,H=q(ie,Ue);Ue+=4,Ue+=se===0?8:16,Ue+=2;var ve=ie.length+0,Ie=we(ie,Ue);Ue+=2;for(var Fe=0;Fe<Ie;Fe++){var fe=Ue,Ce=q(ie,fe);fe+=4;var Ve=2147483647&Ce;if((2147483648&Ce)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Xe=q(ie,fe);fe+=4,pe.push({referenceSize:Ve,subsegmentDuration:Xe,info:{duration:Xe/H,start:ve,end:ve+Ve-1}}),ve+=Ve,Ue=fe+=4}return{earliestPresentationTime:0,timescale:H,version:se,referencesCount:Ie,references:pe}}function Ee(ie){for(var pe=[],se=oe(ie,["moov","trak"]),Ue=0;Ue<se.length;Ue++){var H=se[Ue],ve=oe(H,["tkhd"])[0];if(ve){var Ie=ve[0],Fe=Ie===0?12:20,fe=q(ve,Fe),Ce=oe(H,["mdia","mdhd"])[0];if(Ce){var Ve=q(Ce,Fe=(Ie=Ce[0])===0?12:20),Xe=oe(H,["mdia","hdlr"])[0];if(Xe){var it=ce(Xe.subarray(8,12)),lt={soun:j.ElementaryStreamTypes.AUDIO,vide:j.ElementaryStreamTypes.VIDEO}[it];if(lt){var Ct=oe(H,["mdia","minf","stbl","stsd"])[0],Rt=void 0;Ct&&(Rt=ce(Ct.subarray(12,16))),pe[fe]={timescale:Ve,type:lt},pe[lt]={timescale:Ve,id:fe,codec:Rt}}}}}}return oe(ie,["moov","mvex","trex"]).forEach(function(St){var wt=q(St,4),gt=pe[wt];gt&&(gt.default={duration:q(St,12),flags:q(St,20)})}),pe}function ke(ie,pe){if(!ie||!pe)return ie;var se=pe.keyId;return se&&pe.isCommonEncryption&&oe(ie,["moov","trak"]).forEach(function(Ue){var H=oe(Ue,["mdia","minf","stbl","stsd"])[0].subarray(8),ve=oe(H,["enca"]),Ie=ve.length>0;Ie||(ve=oe(H,["encv"])),ve.forEach(function(Fe){oe(Ie?Fe.subarray(28):Fe.subarray(78),["sinf"]).forEach(function(fe){var Ce=Ne(fe);if(Ce){var Ve=Ce.subarray(8,24);Ve.some(function(Xe){return Xe!==0})||(g.logger.log("[eme] Patching keyId in 'enc"+(Ie?"a":"v")+">sinf>>tenc' box: "+k.default.hexDump(Ve)+" -> "+k.default.hexDump(se)),Ce.set(se,8))}})})}),ie}function Ne(ie){var pe=oe(ie,["schm"])[0];if(pe){var se=ce(pe.subarray(4,8));if(se==="cbcs"||se==="cenc")return oe(ie,["schi","tenc"])[0]}return g.logger.error("[eme] missing 'schm' box"),null}function V(ie,pe){return oe(pe,["moof","traf"]).reduce(function(se,Ue){var H=oe(Ue,["tfdt"])[0],ve=H[0],Ie=oe(Ue,["tfhd"]).reduce(function(Fe,fe){var Ce=q(fe,4),Ve=ie[Ce];if(Ve){var Xe=q(H,4);ve===1&&(Xe*=Math.pow(2,32),Xe+=q(H,8));var it=Xe/(Ve.timescale||9e4);if(isFinite(it)&&(Fe===null||it<Fe))return it}return Fe},null);return Ie!==null&&isFinite(Ie)&&(se===null||Ie<se)?Ie:se},null)||0}function E(ie,pe){for(var se=0,Ue=0,H=0,ve=oe(ie,["moof","traf"]),Ie=0;Ie<ve.length;Ie++){var Fe=ve[Ie],fe=oe(Fe,["tfhd"])[0],Ce=pe[q(fe,4)];if(Ce){var Ve=Ce.default,Xe=q(fe,0)|(Ve==null?void 0:Ve.flags),it=Ve==null?void 0:Ve.duration;8&Xe&&(it=q(fe,2&Xe?12:8));for(var lt=Ce.timescale||9e4,Ct=oe(Fe,["trun"]),Rt=0;Rt<Ct.length;Rt++)!(se=U(Ct[Rt]))&&it&&(se=it*q(Ct[Rt],4)),Ce.type===j.ElementaryStreamTypes.VIDEO?Ue+=se/lt:Ce.type===j.ElementaryStreamTypes.AUDIO&&(H+=se/lt)}}if(Ue===0&&H===0){for(var St=0,wt=oe(ie,["sidx"]),gt=0;gt<wt.length;gt++){var dt=K(wt[gt]);dt!=null&&dt.references&&(St+=dt.references.reduce(function(tt,It){return tt+It.info.duration||0},0))}return St}return Ue||H}function U(ie){var pe=q(ie,0),se=8;1&pe&&(se+=4),4&pe&&(se+=4);for(var Ue=0,H=q(ie,4),ve=0;ve<H;ve++)256&pe&&(Ue+=q(ie,se),se+=4),512&pe&&(se+=4),1024&pe&&(se+=4),2048&pe&&(se+=4);return Ue}function D(ie,pe,se){oe(pe,["moof","traf"]).forEach(function(Ue){oe(Ue,["tfhd"]).forEach(function(H){var ve=q(H,4),Ie=ie[ve];if(Ie){var Fe=Ie.timescale||9e4;oe(Ue,["tfdt"]).forEach(function(fe){var Ce=fe[0],Ve=q(fe,4);if(Ce===0)Ve-=se*Fe,J(fe,4,Ve=Math.max(Ve,0));else{Ve*=Math.pow(2,32),Ve+=q(fe,8),Ve-=se*Fe,Ve=Math.max(Ve,0);var Xe=Math.floor(Ve/(L+1)),it=Math.floor(Ve%(L+1));J(fe,4,Xe),J(fe,8,it)}})}})})}function de(ie){var pe={valid:null,remainder:null},se=oe(ie,["moof"]);if(!se)return pe;if(se.length<2)return pe.remainder=ie,pe;var Ue=se[se.length-1];return pe.valid=(0,re.sliceUint8)(ie,0,Ue.byteOffset-8),pe.remainder=(0,re.sliceUint8)(ie,Ue.byteOffset-8),pe}function Se(ie,pe){var se=new Uint8Array(ie.length+pe.length);return se.set(ie),se.set(pe,ie.length),se}function z(ie,pe){var se=[],Ue=pe.samples,H=pe.timescale,ve=pe.id,Ie=!1;return oe(Ue,["moof"]).map(function(Fe){var fe=Fe.byteOffset-8;oe(Fe,["traf"]).map(function(Ce){var Ve=oe(Ce,["tfdt"]).map(function(Xe){var it=Xe[0],lt=q(Xe,4);return it===1&&(lt*=Math.pow(2,32),lt+=q(Xe,8)),lt/H})[0];return Ve!==void 0&&(ie=Ve),oe(Ce,["tfhd"]).map(function(Xe){var it=q(Xe,4),lt=16777215&q(Xe,0),Ct=0,Rt=(16<)!=0,St=0,wt=(32<)!=0,gt=8;it===ve&&((1<)!=0&&(gt+=8),(2<)!=0&&(gt+=4),(8<)!=0&&(Ct=q(Xe,gt),gt+=4),Rt&&(St=q(Xe,gt),gt+=4),wt&&(gt+=4),pe.type==="video"&&(Ie=function(dt){if(!dt)return!1;var tt=dt.indexOf("."),It=tt<0?dt:dt.substring(0,tt);return It==="hvc1"||It==="hev1"||It==="dvh1"||It==="dvhe"}(pe.codec)),oe(Ce,["trun"]).map(function(dt){var tt=dt[0],It=16777215&q(dt,0),Ut=(1&It)!=0,Wt=0,Bt=(4&It)!=0,ar=(256&It)!=0,te=0,N=(512&It)!=0,T=0,O=(1024&It)!=0,C=(2048&It)!=0,G=0,Q=q(dt,4),Z=8;Ut&&(Wt=q(dt,Z),Z+=4),Bt&&(Z+=4);for(var Te=Wt+fe,Re=0;Re<Q;Re++){if(ar?(te=q(dt,Z),Z+=4):te=Ct,N?(T=q(dt,Z),Z+=4):T=St,O&&(Z+=4),C&&(G=tt===0?q(dt,Z):ye(dt,Z),Z+=4),pe.type===j.ElementaryStreamTypes.VIDEO)for(var Pe=0;Pe<T;){var Be=q(Ue,Te);$(Ie,Ue[Te+=4])&&Le(Ue.subarray(Te,Te+Be),Ie?2:1,ie+G/H,se),Te+=Be,Pe+=Be+4}ie+=te/H}}))})})}),se}function $(ie,pe){if(ie){var se=pe>>1&63;return se===39||se===40}return(31&pe)==6}function Le(ie,pe,se,Ue){var H=Oe(ie),ve=0;ve+=pe;for(var Ie=0,Fe=0,fe=!1,Ce=0;ve<H.length;){Ie=0;do{if(ve>=H.length)break;Ie+=Ce=H[ve++]}while(Ce===255);Fe=0;do{if(ve>=H.length)break;Fe+=Ce=H[ve++]}while(Ce===255);var Ve=H.length-ve;if(!fe&&Ie===4&&ve<H.length){if(fe=!0,H[ve++]===181){var Xe=we(H,ve);if(ve+=2,Xe===49){var it=q(H,ve);if(ve+=4,it===1195456820){var lt=H[ve++];if(lt===3){var Ct=H[ve++],Rt=64&Ct,St=Rt?2+3*(31&Ct):0,wt=new Uint8Array(St);if(Rt){wt[0]=Ct;for(var gt=1;gt<St;gt++)wt[gt]=H[ve++]}Ue.push({type:lt,payloadType:Ie,pts:se,bytes:wt})}}}}}else if(Ie===5&&Fe<Ve){if(fe=!0,Fe>16){for(var dt=[],tt=0;tt<16;tt++){var It=H[ve++].toString(16);dt.push(It.length==1?"0"+It:It),tt!==3&&tt!==5&&tt!==7&&tt!==9||dt.push("-")}for(var Ut=Fe-16,Wt=new Uint8Array(Ut),Bt=0;Bt<Ut;Bt++)Wt[Bt]=H[ve++];Ue.push({payloadType:Ie,pts:se,uuid:dt.join(""),userData:(0,R.utf8ArrayToStr)(Wt),userDataBytes:Wt})}}else if(Fe<Ve)ve+=Fe;else if(Fe>Ve)break}}function Oe(ie){for(var pe=ie.byteLength,se=[],Ue=1;Ue<pe-2;)ie[Ue]===0&&ie[Ue+1]===0&&ie[Ue+2]===3?(se.push(Ue+2),Ue+=2):Ue++;if(se.length===0)return ie;var H=pe-se.length,ve=new Uint8Array(H),Ie=0;for(Ue=0;Ue<H;Ie++,Ue++)Ie===se[0]&&(Ie++,se.shift()),ve[Ue]=ie[Ie];return ve}function xe(ie){var pe=ie[0],se="",Ue="",H=0,ve=0,Ie=0,Fe=0,fe=0,Ce=0;if(pe===0){for(;ce(ie.subarray(Ce,Ce+1))!=="\0";)se+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;for(se+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;ce(ie.subarray(Ce,Ce+1))!=="\0";)Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1,H=q(ie,12),ve=q(ie,16),Fe=q(ie,20),fe=q(ie,24),Ce=28}else if(pe===1){H=q(ie,Ce+=4);var Ve=q(ie,Ce+=4),Xe=q(ie,Ce+=4);for(Ce+=4,Ie=Math.pow(2,32)*Ve+Xe,Number.isSafeInteger(Ie)||(Ie=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),Fe=q(ie,Ce),fe=q(ie,Ce+=4),Ce+=4;ce(ie.subarray(Ce,Ce+1))!=="\0";)se+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;for(se+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;ce(ie.subarray(Ce,Ce+1))!=="\0";)Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1;Ue+=ce(ie.subarray(Ce,Ce+1)),Ce+=1}return{schemeIdUri:se,value:Ue,timeScale:H,presentationTime:Ie,presentationTimeDelta:ve,eventDuration:Fe,id:fe,payload:ie.subarray(Ce,ie.byteLength)}}function be(ie){for(var pe=arguments.length,se=new Array(pe>1?pe-1:0),Ue=1;Ue<pe;Ue++)se[Ue-1]=arguments[Ue];for(var H=se.length,ve=8,Ie=H;Ie--;)ve+=se[Ie].byteLength;var Fe=new Uint8Array(ve);for(Fe[0]=ve>>24&255,Fe[1]=ve>>16&255,Fe[2]=ve>>8&255,Fe[3]=255&ve,Fe.set(ie,4),Ie=0,ve=8;Ie<H;Ie++)Fe.set(se[Ie],ve),ve+=se[Ie].byteLength;return Fe}function qe(ie,pe,se){if(ie.byteLength!==16)throw new RangeError("Invalid system id");var Ue,H,ve;if(pe){Ue=1,H=new Uint8Array(16*pe.length);for(var Ie=0;Ie<pe.length;Ie++){var Fe=pe[Ie];if(Fe.byteLength!==16)throw new RangeError("Invalid key");H.set(Fe,16*Ie)}}else Ue=0,H=new Uint8Array;Ue>0?(ve=new Uint8Array(4),pe.length>0&&new DataView(ve.buffer).setUint32(0,pe.length,!1)):ve=new Uint8Array;var fe=new Uint8Array(4);return se&&se.byteLength>0&&new DataView(fe.buffer).setUint32(0,se.byteLength,!1),be([112,115,115,104],new Uint8Array([Ue,0,0,0]),ie,ve,H,fe,se||new Uint8Array)}function at(ie){if(!(ie instanceof ArrayBuffer)||ie.byteLength<32)return null;var pe={version:0,systemId:"",kids:null,data:null},se=new DataView(ie),Ue=se.getUint32(0);if(ie.byteLength!==Ue&&Ue>44||se.getUint32(4)!==1886614376||(pe.version=se.getUint32(8)>>>24,pe.version>1))return null;pe.systemId=k.default.hexDump(new Uint8Array(ie,12,16));var H=se.getUint32(28);if(pe.version===0){if(Ue-32<H)return null;pe.data=new Uint8Array(ie,32,H)}else if(pe.version===1){pe.kids=[];for(var ve=0;ve<H;ve++)pe.kids.push(new Uint8Array(ie,32+16*ve,16))}return pe}},673:(ae,W,B)=>{"use strict";function j(k,L,me,ne){me===void 0&&(me=1),ne===void 0&&(ne=!1);var ce=k*L*me;return ne?Math.round(ce):ce}function re(k,L,me,ne){return me===void 0&&(me=1),ne===void 0&&(ne=!1),j(k,L,1/me,ne)}function R(k,L){return L===void 0&&(L=!1),j(k,1e3,11111111111111112e-21,L)}function g(k,L){return L===void 0&&(L=1),j(k,9e4,1/L)}B.r(W),B.d(W,{toMpegTsClockFromTimescale:()=>g,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>j,toTimescaleFromScale:()=>re})},145:(ae,W,B)=>{"use strict";function j(re,R,g){return Uint8Array.prototype.slice?re.slice(R,g):new Uint8Array(Array.prototype.slice.call(re,R,g))}B.r(W),B.d(W,{sliceUint8:()=>j})},729:ae=>{"use strict";var W=Object.prototype.hasOwnProperty,B="~";function j(){}function re(L,me,ne){this.fn=L,this.context=me,this.once=ne||!1}function R(L,me,ne,ce,we){if(typeof ne!="function")throw new TypeError("The listener must be a function");var q=new re(ne,ce||L,we),ye=B?B+me:me;return L._events[ye]?L._events[ye].fn?L._events[ye]=[L._events[ye],q]:L._events[ye].push(q):(L._events[ye]=q,L._eventsCount++),L}function g(L,me){--L._eventsCount==0?L._events=new j:delete L._events[me]}function k(){this._events=new j,this._eventsCount=0}Object.create&&(j.prototype=Object.create(null),new j().__proto__||(B=!1)),k.prototype.eventNames=function(){var L,me,ne=[];if(this._eventsCount===0)return ne;for(me in L=this._events)W.call(L,me)&&ne.push(B?me.slice(1):me);return Object.getOwnPropertySymbols?ne.concat(Object.getOwnPropertySymbols(L)):ne},k.prototype.listeners=function(L){var me=B?B+L:L,ne=this._events[me];if(!ne)return[];if(ne.fn)return[ne.fn];for(var ce=0,we=ne.length,q=new Array(we);ce<we;ce++)q[ce]=ne[ce].fn;return q},k.prototype.listenerCount=function(L){var me=B?B+L:L,ne=this._events[me];return ne?ne.fn?1:ne.length:0},k.prototype.emit=function(L,me,ne,ce,we,q){var ye=B?B+L:L;if(!this._events[ye])return!1;var J,oe,K=this._events[ye],Ee=arguments.length;if(K.fn){switch(K.once&&this.removeListener(L,K.fn,void 0,!0),Ee){case 1:return K.fn.call(K.context),!0;case 2:return K.fn.call(K.context,me),!0;case 3:return K.fn.call(K.context,me,ne),!0;case 4:return K.fn.call(K.context,me,ne,ce),!0;case 5:return K.fn.call(K.context,me,ne,ce,we),!0;case 6:return K.fn.call(K.context,me,ne,ce,we,q),!0}for(oe=1,J=new Array(Ee-1);oe<Ee;oe++)J[oe-1]=arguments[oe];K.fn.apply(K.context,J)}else{var ke,Ne=K.length;for(oe=0;oe<Ne;oe++)switch(K[oe].once&&this.removeListener(L,K[oe].fn,void 0,!0),Ee){case 1:K[oe].fn.call(K[oe].context);break;case 2:K[oe].fn.call(K[oe].context,me);break;case 3:K[oe].fn.call(K[oe].context,me,ne);break;case 4:K[oe].fn.call(K[oe].context,me,ne,ce);break;default:if(!J)for(ke=1,J=new Array(Ee-1);ke<Ee;ke++)J[ke-1]=arguments[ke];K[oe].fn.apply(K[oe].context,J)}}return!0},k.prototype.on=function(L,me,ne){return R(this,L,me,ne,!1)},k.prototype.once=function(L,me,ne){return R(this,L,me,ne,!0)},k.prototype.removeListener=function(L,me,ne,ce){var we=B?B+L:L;if(!this._events[we])return this;if(!me)return g(this,we),this;var q=this._events[we];if(q.fn)q.fn!==me||ce&&!q.once||ne&&q.context!==ne||g(this,we);else{for(var ye=0,J=[],oe=q.length;ye<oe;ye++)(q[ye].fn!==me||ce&&!q[ye].once||ne&&q[ye].context!==ne)&&J.push(q[ye]);J.length?this._events[we]=J.length===1?J[0]:J:g(this,we)}return this},k.prototype.removeAllListeners=function(L){var me;return L?(me=B?B+L:L,this._events[me]&&g(this,me)):(this._events=new j,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=B,k.EventEmitter=k,ae.exports=k},945:function(ae){var W,B,j,re,R;W=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,B=/^(?=([^\/?#]*))\1([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,re=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(g,k,L){if(L=L||{},g=g.trim(),!(k=k.trim())){if(!L.alwaysNormalize)return g;var me=R.parseURL(g);if(!me)throw new Error("Error trying to parse base URL.");return me.path=R.normalizePath(me.path),R.buildURLFromParts(me)}var ne=R.parseURL(k);if(!ne)throw new Error("Error trying to parse relative URL.");if(ne.scheme)return L.alwaysNormalize?(ne.path=R.normalizePath(ne.path),R.buildURLFromParts(ne)):k;var ce=R.parseURL(g);if(!ce)throw new Error("Error trying to parse base URL.");if(!ce.netLoc&&ce.path&&ce.path[0]!=="/"){var we=B.exec(ce.path);ce.netLoc=we[1],ce.path=we[2]}ce.netLoc&&!ce.path&&(ce.path="/");var q={scheme:ce.scheme,netLoc:ne.netLoc,path:null,params:ne.params,query:ne.query,fragment:ne.fragment};if(!ne.netLoc&&(q.netLoc=ce.netLoc,ne.path[0]!=="/"))if(ne.path){var ye=ce.path,J=ye.substring(0,ye.lastIndexOf("/")+1)+ne.path;q.path=R.normalizePath(J)}else q.path=ce.path,ne.params||(q.params=ce.params,ne.query||(q.query=ce.query));return q.path===null&&(q.path=L.alwaysNormalize?R.normalizePath(ne.path):ne.path),R.buildURLFromParts(q)},parseURL:function(g){var k=W.exec(g);return k?{scheme:k[1]||"",netLoc:k[2]||"",path:k[3]||"",params:k[4]||"",query:k[5]||"",fragment:k[6]||""}:null},normalizePath:function(g){for(g=g.split("").reverse().join("").replace(j,"");g.length!==(g=g.replace(re,"")).length;);return g.split("").reverse().join("")},buildURLFromParts:function(g){return g.scheme+g.netLoc+g.path+g.params+g.query+g.fragment}},ae.exports=R}},w={};function A(ae){var W=w[ae];if(W!==void 0)return W.exports;var B=w[ae]={exports:{}};return x[ae].call(B.exports,B,B.exports,A),B.exports}A.m=x,A.n=ae=>{var W=ae&&ae.__esModule?()=>ae.default:()=>ae;return A.d(W,{a:W}),W},A.d=(ae,W)=>{for(var B in W)A.o(W,B)&&!A.o(ae,B)&&Object.defineProperty(ae,B,{enumerable:!0,get:W[B]})},A.o=(ae,W)=>Object.prototype.hasOwnProperty.call(ae,W),A.r=ae=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(ae,"__esModule",{value:!0})};var le=A(76);return le.default})())});var bi=class{addEventListener(){}removeEventListener(){}dispatchEvent(w){return!0}};if(typeof DocumentFragment=="undefined"){class x extends bi{}globalThis.DocumentFragment=x}var Hi=class extends bi{},ea=class extends bi{},zs={get(x){},define(x,w,A){},upgrade(x){},whenDefined(x){return Promise.resolve(Hi)}},qi,ta=class{constructor(w,A={}){_t(this,qi,void 0);Nt(this,qi,A==null?void 0:A.detail)}get detail(){return Ye(this,qi)}initCustomEvent(){}};qi=new WeakMap;function Qs(x,w){return new Hi}var Ha={document:{createElement:Qs},DocumentFragment,customElements:zs,CustomEvent:ta,EventTarget:bi,HTMLElement:Hi,HTMLVideoElement:ea},qa=typeof window=="undefined"||typeof globalThis.customElements=="undefined",xr=qa?Ha:globalThis,ra=qa?Ha.document:globalThis.document;var bn=Ka(Va(),1),$a=Ka(Ya(),1),Js=$a.default,Sr=Js,Yi=class extends Error{constructor(x,w=Yi.MEDIA_ERR_CUSTOM,A){var le;super(x),this.name="MediaError",this.code=w,this.fatal=A!=null?A:w>=Yi.MEDIA_ERR_NETWORK&&w<=Yi.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(le=Yi.defaultMessages[this.code])!=null?le:"")}},Tr=Yi;Tr.MEDIA_ERR_ABORTED=1,Tr.MEDIA_ERR_NETWORK=2,Tr.MEDIA_ERR_DECODE=3,Tr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Tr.MEDIA_ERR_ENCRYPTED=5,Tr.MEDIA_ERR_CUSTOM=100,Tr.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var $s=x=>x==null,Za=(x,w)=>$s(w)?!1:x in w,sa={ANY:"any",MUTED:"muted"},Tn={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},oi={MSE:"mse",NATIVE:"native"},oa={HEADER:"header",QUERY:"query",NONE:"none"},da=Object.values(oa),_i={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},la={HLS:_i.M3U8},Io=Object.keys(la),Co=[...Object.values(_i),"hls","HLS"],si=(x,w,A,le,ae=x)=>{ae.addEventListener(w,A,le),x.addEventListener("teardown",()=>{ae.removeEventListener(w,A)},{once:!0})};function Zs(x,w,A){w&&A>w&&(A=w);for(let le=0;le<x.length;le++)if(x.start(le)<=A&&x.end(le)>=A)return!0;return!1}var eo=x=>{let w=x.indexOf("?");if(w<0)return[x];let A=x.slice(0,w),le=x.slice(w);return[A,le]},es=x=>{let w=x.type;if(w){let le=w.toUpperCase();return Za(le,la)?la[le]:w}let{src:A}=x;return A?to(A):""},to=x=>{let w="";try{w=new URL(x).pathname}catch{console.error("invalid url")}let A=w.lastIndexOf(".");if(A<0)return"";let le=w.slice(A+1).toUpperCase();return Za(le,_i)?_i[le]:""},ro=Object.values(sa),Wa=x=>typeof x=="boolean"||typeof x=="string"&&ro.includes(x),io=({autoplay:x},w,A)=>{let le=!1,ae=!1,W=Wa(x)?x:!!x,B=()=>{le||si(w,"playing",()=>{le=!0},{once:!0})};if(B(),si(w,"loadstart",()=>{le=!1,B(),aa(w,W)},{once:!0}),si(w,"loadstart",()=>{A||(ae=!Number.isFinite(w.duration)),aa(w,W)},{once:!0}),A&&A.once(Sr.Events.LEVEL_LOADED,(j,re)=>{var R;ae=(R=re.details.live)!=null?R:!1}),!W){let j=()=>{!ae||(A!=null&&A.liveSyncPosition?w.currentTime=A.liveSyncPosition:Number.isFinite(w.seekable.end(0))&&(w.currentTime=w.seekable.end(0)))};A&&si(w,"play",()=>{w.preload==="metadata"?A.once(Sr.Events.LEVEL_UPDATED,j):j()},{once:!0})}return j=>{le||(W=Wa(j)?j:!!j,aa(w,W))}},aa=(x,w)=>{if(!w)return;let A=x.muted,le=()=>x.muted=A;switch(w){case sa.ANY:x.play().catch(()=>{x.muted=!0,x.play().catch(le)});break;case sa.MUTED:x.muted=!0,x.play().catch(le);break;default:x.play().catch(()=>{});break}},no=({preload:x,src:w},A,le)=>{let ae=k=>{k!=null&&["","none","metadata","auto"].includes(k)?A.setAttribute("preload",k):A.removeAttribute("preload")};if(!le)return ae(x),ae;let W=!1,B=!1,j=le.config.maxBufferLength,re=le.config.maxBufferSize,R=k=>{ae(k);let L=k!=null?k:A.preload;B||L==="none"||(L==="metadata"?(le.config.maxBufferLength=1,le.config.maxBufferSize=1):(le.config.maxBufferLength=j,le.config.maxBufferSize=re),g())},g=()=>{!W&&w&&(W=!0,le.loadSource(w))};return si(A,"play",()=>{B=!0,le.config.maxBufferLength=j,le.config.maxBufferSize=re,g()},{once:!0}),R(x),R};function ao(x,w){w.on(Sr.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(ae,{tracks:W})=>{W.forEach(B=>{var j;let re=(j=B.subtitleTrack)!=null?j:B.closedCaptions,R=w.subtitleTracks.findIndex(({lang:g,name:k,type:L})=>g==(re==null?void 0:re.lang)&&k===B.label&&L.toLowerCase()===B.kind);ts(x,B.kind,B.label,re==null?void 0:re.lang,`${B.kind}${R}`)})});let A=()=>{var ae;if(!w.subtitleTracks.length)return;let W=Array.from(x.textTracks).find(j=>j.id&&j.mode==="showing"&&["subtitles","captions"].includes(j.kind)),B=`${(ae=w.subtitleTracks[w.subtitleTrack])==null?void 0:ae.type.toLowerCase()}${w.subtitleTrack}`;if(W&&(w.subtitleTrack<0||(W==null?void 0:W.id)!==B)){let j=w.subtitleTracks.findIndex(({lang:re,name:R,type:g})=>re==W.language&&R===W.label&&g.toLowerCase()===W.kind);w.subtitleTrack=j}W&&(W==null?void 0:W.id)===B&&W.cues&&Array.from(W.cues).forEach(j=>{W.addCue(j)})};x.textTracks.addEventListener("change",A),w.on(Sr.Events.CUES_PARSED,(ae,{track:W,cues:B})=>{let j=x.textTracks.getTrackById(W);if(!j)return;let re=j.mode==="disabled";re&&(j.mode="hidden"),B.forEach(R=>{var g;(g=j.cues)!=null&&g.getCueById(R.id)||j.addCue(R)}),re&&(j.mode="disabled")}),w.once(Sr.Events.DESTROYING,()=>{x.textTracks.removeEventListener("change",A),x.querySelectorAll("track[data-removeondestroy]").forEach(ae=>{ae.remove()})});let le=()=>{Array.from(x.textTracks).forEach(ae=>{var W,B;if(!["subtitles","caption"].includes(ae.kind)&&ae.label==="thumbnails"){if(!((W=ae.cues)!=null&&W.length)){let j=x.querySelector('track[label="thumbnails"]'),re=(B=j==null?void 0:j.getAttribute("src"))!=null?B:"";j==null||j.removeAttribute("src"),setTimeout(()=>{j==null||j.setAttribute("src",re)},0)}ae.mode!=="hidden"&&(ae.mode="hidden")}})};w.once(Sr.Events.MANIFEST_LOADED,le),w.once(Sr.Events.MEDIA_ATTACHED,le)}function ts(x,w,A,le,ae){let W=document.createElement("track");return W.kind=w,W.label=A,le&&(W.srclang=le),ae&&(W.id=ae),W.track.mode=["subtitles","captions"].includes(w)?"disabled":"hidden",W.setAttribute("data-removeondestroy",""),x.append(W),W.track}var Wi="cuepoints",ca=Object.freeze({label:Wi}),ha=(x,{label:w=Wi}=ca)=>{var A;return(A=Array.from(x.querySelectorAll("track")).find(le=>le.track.label===w&&le.track.kind==="metadata"))==null?void 0:A.track};async function fa(x,w,A=ca){let le=ha(x,A);if(!le){let{label:ae=Wi}=A;le=ts(x,"metadata",ae),le.mode="hidden",await new Promise(W=>setTimeout(()=>W(void 0),0))}return le.mode!=="hidden"&&(le.mode="hidden"),[...w].sort(({time:ae},{time:W})=>W-ae).forEach(({time:ae,value:W})=>{var B,j;let re=Array.prototype.findIndex.call(le==null?void 0:le.cues,me=>me.startTime>=ae),R=(B=le==null?void 0:le.cues)==null?void 0:B[re],g=R?R.startTime:Number.isFinite(x.duration)?x.duration:Number.MAX_SAFE_INTEGER,k=(j=le==null?void 0:le.cues)==null?void 0:j[re-1];k&&(k.endTime=ae);let L=new VTTCue(ae,g,JSON.stringify(W!=null?W:null));le.addCue(L)}),le}var rs=x=>({time:x.startTime,value:JSON.parse(x.text)});function is(x,w={label:Wi}){let A=ha(x,w);return A!=null&&A.cues?Array.from(A.cues,le=>rs(le)):[]}function va(x,w={label:Wi}){var A;let le=ha(x,w);if((A=le==null?void 0:le.activeCues)!=null&&A.length)return rs(le.activeCues[0])}async function so(x,w=ca){return new Promise(A=>{si(x,"loadstart",async()=>{let le=await fa(x,[],w);si(x,"cuechange",()=>{let ae=va(x);if(ae){let W=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:ae});x.dispatchEvent(W)}},{},le),A(le)})})}var Xa,za,oo=(za=(Xa=globalThis==null?void 0:globalThis.navigator)==null?void 0:Xa.userAgent)!=null?za:"",lo=oo.toLowerCase().indexOf("android")!==-1,Si=new WeakMap,ns="mux.com",Qa,Ja,as=(Ja=(Qa=Sr).isSupported)==null?void 0:Ja.call(Qa),uo=lo,ss=()=>bn.default.utils.now(),co=bn.default.utils.generateUUID,os=(x,{domain:w=ns,maxResolution:A=""}={})=>{if(!x)return;let[le,ae=""]=eo(x),W=new URL(`https://stream.${w}/${le}.m3u8${ae}`);return A&&W.searchParams.set("max_resolution",A),W.toString()},ho=x=>{if(!x)return;let[w]=x.split("?");return w||void 0},fo=x=>{if(!x||!x.startsWith("https://stream."))return;let[w]=new URL(x).pathname.slice(1).split(".m3u8");return w||void 0},vo=x=>{var w,A,le;return(w=x==null?void 0:x.metadata)!=null&&w.video_id?x.metadata.video_id:cs(x)&&(le=(A=ho(x.playbackId))!=null?A:fo(x.src))!=null?le:x.src},ls=x=>{var w;return(w=Si.get(x))==null?void 0:w.error},us=(x,w,A)=>{pa(w,A);let{metadata:le={}}=x,{view_session_id:ae=co()}=le,W=vo(x);le.view_session_id=ae,le.video_id=W,x.metadata=le,Si.set(w,{});let B=po(x,w);mo(x,w,B),yo(x,w,B),so(w);let j=io(x,w,B),re=no(x,w,B);return{engine:B,setAutoplay:j,setPreload:re}},pa=(x,w)=>{let A=w==null?void 0:w.engine;A&&(A.detachMedia(),A.destroy()),(x==null?void 0:x.mux)&&!x.mux.deleted&&(x.mux.destroy(),delete x.mux),x&&(x.removeAttribute("src"),x.load(),x.removeEventListener("error",fs),x.removeEventListener("error",ua),x.removeEventListener("durationchange",hs),Si.delete(x),x.dispatchEvent(new Event("teardown")))};function ds(x,w){var A;let le=es(x);if(le!==_i.M3U8)return!0;let ae=!le||((A=w.canPlayType(le))!=null?A:!0),{preferPlayback:W}=x,B=W===oi.MSE,j=W===oi.NATIVE;return ae&&(j||!(as&&(B||uo)))}var po=(x,w)=>{let{debug:A,streamType:le,startTime:ae=-1,metadata:W,preferCmcd:B}=x,j=es(x)===_i.M3U8,re=ds(x,w);if(j&&!re&&as){let R={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},g=go(le),k=B!==oa.NONE?{useHeaders:B===oa.HEADER,sessionId:W.view_session_id,contentId:W.video_id}:void 0;return new Sr({debug:A,startPosition:ae,cmcd:k,...R,...g})}},go=x=>[Tn.LIVE,Tn.DVR].includes(x)?{backBufferLength:8}:[Tn.LL_LIVE,Tn.LL_DVR].includes(x)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},cs=({playbackId:x,src:w,customDomain:A})=>{if(x)return!0;if(typeof w!="string")return!1;let le=window==null?void 0:window.location.href,ae=new URL(w,le).hostname.toLocaleLowerCase();return ae.includes(ns)||!!A&&ae.includes(A.toLocaleLowerCase())},mo=(x,w,A)=>{var le;let{envKey:ae}=x,W=cs(x);if(ae||W){let{playerInitTime:B,playerSoftwareName:j,playerSoftwareVersion:re,beaconCollectionDomain:R,debug:g,disableCookies:k}=x,L={...x.metadata,video_title:((le=x==null?void 0:x.metadata)==null?void 0:le.video_title)||void 0},me=ne=>typeof ne.player_error_code=="string"?!1:typeof x.errorTranslator=="function"?x.errorTranslator(ne):ne;bn.default.monitor(w,{debug:g,beaconCollectionDomain:R,hlsjs:A,Hls:A?Sr:void 0,automaticErrorTracking:!1,errorTranslator:me,disableCookies:k,data:{...ae?{env_key:ae}:{},player_software_name:j,player_software:j,player_software_version:re,player_init_time:B,...L}})}},yo=(x,w,A)=>{var le;let ae=ds(x,w),{src:W}=x;w&&ae?(typeof W=="string"?(w.setAttribute("src",W),x.startTime&&(((le=Si.get(w))!=null?le:{}).startTime=x.startTime,w.addEventListener("durationchange",hs,{once:!0}))):w.removeAttribute("src"),w.addEventListener("error",fs),w.addEventListener("error",ua),w.addEventListener("emptied",()=>{w.querySelectorAll("track[data-removeondestroy]").forEach(B=>{B.remove()})},{once:!0})):A&&W?(A.on(Sr.Events.ERROR,(B,j)=>{let re={[Sr.ErrorTypes.NETWORK_ERROR]:Tr.MEDIA_ERR_NETWORK,[Sr.ErrorTypes.MEDIA_ERROR]:Tr.MEDIA_ERR_DECODE},R=new Tr("",re[j.type]);R.fatal=j.fatal,R.data=j,w.dispatchEvent(new CustomEvent("error",{detail:R}))}),w.addEventListener("error",ua),ao(w,A),A.attachMedia(w)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function hs(x){var w;let A=x.target,le=(w=Si.get(A))==null?void 0:w.startTime;if(!!le&&Zs(A.seekable,A.duration,le)){let ae=A.preload==="auto";ae&&(A.preload="none"),A.currentTime=le,ae&&(A.preload="auto")}}async function fs(x){if(!x.isTrusted)return;x.stopImmediatePropagation();let w=x.target;if(!(w!=null&&w.error))return;let{message:A,code:le}=w.error,ae=new Tr(A,le);if(w.src&&(le!==Tr.MEDIA_ERR_DECODE||le!==void 0))try{let{status:W}=await fetch(w.src);ae.data={response:{code:W}}}catch{}w.dispatchEvent(new CustomEvent("error",{detail:ae}))}function ua(x){var w,A;if(!(x instanceof CustomEvent)||!(x.detail instanceof Tr))return;let le=x.target,ae=x.detail;!ae||!ae.fatal||(((w=Si.get(le))!=null?w:{}).error=ae,(A=le.mux)==null||A.emit("error",{player_error_code:ae.code,player_error_message:ae.message}))}var Eo=()=>{try{return"0.14.0"}catch{}return"UNKNOWN"},To=Eo(),vs=()=>To;var ga=class extends Set{add(w){super.add(new WeakRef(w))}forEach(w){super.forEach(A=>{let le=A.deref();le&&w(le)})}},bo=x=>{var w,A,le,ae,W,ps,j,_n,R,Mr,k,Sn,me,An,ce,gs,q,ms,J,ma,K,Ee,ke,Ne,V,E,U,Xi,de,ys,z,ya,Le,Es,xe,Ea,qe,Ts,ie,Ta;return w=class extends x{constructor(){super();_t(this,U);_t(this,de);_t(this,z);_t(this,Le);_t(this,xe);_t(this,qe);_t(this,ie);Ki(this,"castEnabled",!1);_t(this,K,{paused:!1});_t(this,Ee,void 0);_t(this,ke,{});_t(this,Ne,void 0);_t(this,V,void 0);_t(this,E,void 0);w.instances.add(this),zt(this,xe,Ea).call(this)}static get castElement(){return Ye(w,A)}static get castEnabled(){return Ye(w,le)}static get castState(){var H;return(H=Ye(w,R,Mr))==null?void 0:H.getCastState()}static async exitCast(){try{await Ye(w,R,Mr).endCurrentSession(!0)}catch(ve){console.error(ve);return}}get castPlayer(){if(w.castElement===this)return Ye(this,Ee)}attributeChangedCallback(H){if(!!this.castPlayer)switch(H){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(H={}){var ve;zt(ve=w,J,ma).call(ve,H),Nt(w,A,this),Object.entries(Ye(this,ke)).forEach(([Ie,Fe])=>{Ye(this,Ee).controller.addEventListener(Ie,Fe)});try{await Ye(w,R,Mr).requestSession()}catch{Nt(w,A,void 0);return}Ye(this,K).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(Ie){console.error(Ie)}}async load(){var Ce,Ve;if(!this.castPlayer)return super.load();let H=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),ve=[...this.querySelectorAll("track")].filter(({kind:Xe,src:it})=>it&&(Xe==="subtitles"||Xe==="captions")),Ie=[],Fe=0;ve.length&&(H.tracks=ve.map(Xe=>{let it=++Fe;Ie.length===0&&Xe.track.mode==="showing"&&Ie.push(it);let lt=new chrome.cast.media.Track(it,chrome.cast.media.TrackType.TEXT);return lt.trackContentId=Xe.src,lt.trackContentType="text/vtt",lt.subtype=Xe.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,lt.name=Xe.label,lt.language=Xe.srclang,lt})),this.castStreamType==="live"?H.streamType=chrome.cast.media.StreamType.LIVE:H.streamType=chrome.cast.media.StreamType.BUFFERED,H.metadata=new chrome.cast.media.GenericMediaMetadata,H.metadata.title=this.title,H.metadata.images=[{url:this.poster}];let fe=new chrome.cast.media.LoadRequest(H);fe.currentTime=(Ce=super.currentTime)!=null?Ce:0,fe.autoplay=!Ye(this,K).paused,fe.activeTrackIds=Ie,await((Ve=Ye(w,k,Sn))==null?void 0:Ve.loadMedia(fe)),this.dispatchEvent(new Event("volumechange"))}play(){var H;if(this.castPlayer){this.castPlayer.isPaused&&((H=this.castPlayer.controller)==null||H.playOrPause());return}return super.play()}pause(){var H;if(this.castPlayer){this.castPlayer.isPaused||(H=this.castPlayer.controller)==null||H.playOrPause();return}super.pause()}get castSrc(){var H,ve,Ie;return(Ie=(ve=this.getAttribute("cast-src"))!=null?ve:(H=this.querySelector("source"))==null?void 0:H.src)!=null?Ie:this.currentSrc}set castSrc(H){this.castSrc!=H&&this.setAttribute("cast-src",`${H}`)}get castContentType(){var H;return(H=this.getAttribute("cast-content-type"))!=null?H:void 0}set castContentType(H){this.setAttribute("cast-content-type",`${H}`)}get castStreamType(){var H;return(H=this.getAttribute("cast-stream-type"))!=null?H:void 0}set castStreamType(H){this.setAttribute("cast-stream-type",`${H}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var H;return this.castPlayer?(H=this.castPlayer)==null?void 0:H.isMuted:super.muted}set muted(H){var ve;if(this.castPlayer){(H&&!this.castPlayer.isMuted||!H&&this.castPlayer.isMuted)&&((ve=this.castPlayer.controller)==null||ve.muteOrUnmute());return}super.muted=H}get volume(){var H,ve;return this.castPlayer?(ve=(H=this.castPlayer)==null?void 0:H.volumeLevel)!=null?ve:1:super.volume}set volume(H){var ve;if(this.castPlayer){this.castPlayer.volumeLevel=H,(ve=this.castPlayer.controller)==null||ve.setVolumeLevel();return}super.volume=H}get duration(){var H,ve;return this.castPlayer&&Ye(this,U,Xi)?(ve=(H=this.castPlayer)==null?void 0:H.duration)!=null?ve:NaN:super.duration}get currentTime(){var H,ve;return this.castPlayer&&Ye(this,U,Xi)?(ve=(H=this.castPlayer)==null?void 0:H.currentTime)!=null?ve:0:super.currentTime}set currentTime(H){var ve;if(this.castPlayer){this.castPlayer.currentTime=H,(ve=this.castPlayer.controller)==null||ve.seek();return}super.currentTime=H}get onentercast(){return Ye(this,Ne)}set onentercast(H){Ye(this,Ne)&&(this.removeEventListener("entercast",Ye(this,Ne)),Nt(this,Ne,null)),typeof H=="function"&&(Nt(this,Ne,H),this.addEventListener("entercast",H))}get onleavecast(){return Ye(this,V)}set onleavecast(H){Ye(this,V)&&(this.removeEventListener("leavecast",Ye(this,V)),Nt(this,V,null)),typeof H=="function"&&(Nt(this,V,H),this.addEventListener("leavecast",H))}get oncastchange(){return Ye(this,E)}set oncastchange(H){Ye(this,E)&&(this.removeEventListener("castchange",Ye(this,E)),Nt(this,E,null)),typeof H=="function"&&(Nt(this,E,H),this.addEventListener("castchange",H))}},A=new WeakMap,le=new WeakMap,ae=new WeakMap,W=new WeakSet,ps=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},j=new WeakSet,_n=function(){return typeof cast!="undefined"&&cast.framework},R=new WeakSet,Mr=function(){if(Ye(w,j,_n))return cast.framework.CastContext.getInstance()},k=new WeakSet,Sn=function(){var H;return(H=Ye(w,R,Mr))==null?void 0:H.getCurrentSession()},me=new WeakSet,An=function(){var H;return(H=Ye(w,k,Sn))==null?void 0:H.getSessionObj().media[0]},ce=new WeakSet,gs=function(H){return new Promise((ve,Ie)=>{Ye(w,me,An).editTracksInfo(H,ve,Ie)})},q=new WeakSet,ms=function(H){return new Promise((ve,Ie)=>{Ye(w,me,An).getStatus(H,ve,Ie)})},J=new WeakSet,ma=function(H){return Ye(w,R,Mr).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...H})},K=new WeakMap,Ee=new WeakMap,ke=new WeakMap,Ne=new WeakMap,V=new WeakMap,E=new WeakMap,U=new WeakSet,Xi=function(){var H;return(H=this.castPlayer)==null?void 0:H.isMediaLoaded},de=new WeakSet,ys=function(){Ye(w,A)===this&&(Object.entries(Ye(this,ke)).forEach(([H,ve])=>{Ye(this,Ee).controller.removeEventListener(H,ve)}),Nt(w,A,void 0),this.muted=Ye(this,Ee).isMuted,this.currentTime=Ye(this,Ee).savedPlayerState.currentTime,Ye(this,Ee).savedPlayerState.isPaused===!1&&this.play())},z=new WeakSet,ya=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:Ye(w,R,Mr).getCastState()}))},Le=new WeakSet,Es=async function(){var ve,Ie;let{SESSION_RESUMED:H}=cast.framework.SessionState;if(Ye(w,R,Mr).getSessionState()===H&&this.castSrc===((ve=Ye(w,me,An))==null?void 0:ve.media.contentId)){Nt(w,A,this),Object.entries(Ye(this,ke)).forEach(([Fe,fe])=>{Ye(this,Ee).controller.addEventListener(Fe,fe)});try{await zt(Ie=w,q,ms).call(Ie,new chrome.cast.media.GetStatusRequest)}catch(Fe){console.error(Fe)}Ye(this,ke)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),Ye(this,ke)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},xe=new WeakSet,Ea=function(){var H;!Ye(w,j,_n)||this.castEnabled||(this.castEnabled=!0,zt(H=w,J,ma).call(H),this.textTracks.addEventListener("change",zt(this,ie,Ta).bind(this)),zt(this,z,ya).call(this),Nt(this,Ee,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(Ye(this,Ee)),Nt(this,ke,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ve})=>{ve===!1&&zt(this,de,ys).call(this),this.dispatchEvent(new Event(ve?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!Ye(this,U,Xi)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var ve,Ie;((ve=this.castPlayer)==null?void 0:ve.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(Ie=this.castPlayer)==null?void 0:Ie.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!Ye(this,U,Xi)||(await Promise.resolve(),zt(this,qe,Ts).call(this))}}))},qe=new WeakSet,Ts=function(){zt(this,ie,Ta).call(this)},ie=new WeakSet,Ta=async function(){var Ct,Rt,St,wt,gt,dt;if(!this.castPlayer)return;let ve=((Rt=(Ct=Ye(this,Ee).mediaInfo)==null?void 0:Ct.tracks)!=null?Rt:[]).filter(({type:tt})=>tt===chrome.cast.media.TrackType.TEXT),Ie=[...this.textTracks].filter(({kind:tt})=>tt==="subtitles"||tt==="captions"),Fe=ve.map(({language:tt,name:It,trackId:Ut})=>{var Bt;let{mode:Wt}=(Bt=Ie.find(ar=>ar.language===tt&&ar.label===It))!=null?Bt:{};return Wt?{mode:Wt,trackId:Ut}:!1}).filter(Boolean),Ce=Fe.filter(({mode:tt})=>tt!=="showing").map(({trackId:tt})=>tt),Ve=Fe.find(({mode:tt})=>tt==="showing"),Xe=(gt=(wt=(St=Ye(w,k,Sn))==null?void 0:St.getSessionObj().media[0])==null?void 0:wt.activeTrackIds)!=null?gt:[],it=Xe;if(Xe.length&&(it=it.filter(tt=>!Ce.includes(tt))),Ve!=null&&Ve.trackId&&(it=[...it,Ve.trackId]),it=[...new Set(it)],!((tt,It)=>tt.length===It.length&&tt.every(Ut=>It.includes(Ut)))(Xe,it))try{let tt=new chrome.cast.media.EditTracksInfoRequest(it);await zt(dt=w,ce,gs).call(dt,tt)}catch(tt){console.error(tt)}},_t(w,W),_t(w,j),_t(w,R),_t(w,k),_t(w,me),_t(w,ce),_t(w,q),_t(w,J),Ki(w,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Ki(w,"instances",new ga),_t(w,A,void 0),_t(w,le,!1),Ki(w,"initCast",()=>{var H;Ye(w,W,ps)?Ye(w,j,_n)?Ye(H=w,ae).call(H,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ve;return Ye(ve=w,ae).call(ve,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ve;return Ye(ve=w,ae).call(ve,chrome.cast.isAvailable)})}}),_t(w,ae,H=>{if(H){Nt(w,le,!0);let{CAST_STATE_CHANGED:ve}=cast.framework.CastContextEventType;Ye(w,R,Mr).addEventListener(ve,Fe=>{w.instances.forEach(fe=>{var Ce;return zt(Ce=fe,z,ya).call(Ce,Fe)})});let{SESSION_STATE_CHANGED:Ie}=cast.framework.CastContextEventType;Ye(w,R,Mr).addEventListener(Ie,Fe=>{w.instances.forEach(fe=>{var Ce;return zt(Ce=fe,Le,Es).call(Ce,Fe)})}),w.instances.forEach(Fe=>{var fe;return zt(fe=Fe,xe,Ea).call(fe)})}}),w};if(globalThis.HTMLVideoElement&&globalThis.customElements){let x=bo(HTMLVideoElement);globalThis.customElements.get("castable-video")||(globalThis.customElements.define("castable-video",x,{extends:"video"}),globalThis.CastableVideoElement=x),x.initCast()}var bs=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","castchange","entercast","leavecast"],_s=ra.createElement("template");_s.innerHTML=`
|
|
33
33
|
<style>
|
|
34
34
|
:host {
|
|
35
35
|
display: inline-block;
|
|
@@ -49,7 +49,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
49
49
|
</style>
|
|
50
50
|
<video is="castable-video" part="video" crossorigin></video>
|
|
51
51
|
<slot></slot>
|
|
52
|
-
`;var zi,Ai,kn,Qi,ba,$r=class extends xr.HTMLElement{constructor(){super();
|
|
52
|
+
`;var zi,Ai,kn,Qi,ba,$r=class extends xr.HTMLElement{constructor(){super();_t(this,Ai);_t(this,Qi);_t(this,zi,void 0);this.attachShadow({mode:"open"}),this.isConnected&&zt(this,Ai,kn).call(this)}static get observedAttributes(){let A=[],le=W=>W.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(W=>{let B=!1;try{typeof this.prototype[W]=="function"&&(B=!0)}catch{}!B&&W!==W.toUpperCase()&&A.push(W.toLowerCase(),le(W))});let ae=Object.getPrototypeOf(this).observedAttributes;return ae&&(A=A.concat(ae)),A}attributeChangedCallback(A,le,ae){zt(this,Ai,kn).call(this),zt(this,Qi,ba).call(this,A,le,ae)}connectedCallback(){zt(this,Ai,kn).call(this)}};zi=new WeakMap,Ai=new WeakSet,kn=function(){if(Ye(this,zi))return;Nt(this,zi,!0),this.shadowRoot.append(_s.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),bs.forEach(le=>{this.nativeEl.addEventListener(le,ae=>{this.dispatchEvent(new CustomEvent(ae.type,{detail:ae.detail}))})});let A=this.shadowRoot.querySelector("slot");A.addEventListener("slotchange",()=>{A.assignedElements().forEach(le=>{!["track","source"].includes(le.localName)||this.nativeEl.append(le)})}),Array.prototype.forEach.call(this.attributes,le=>{zt(this,Qi,ba).call(this,le.name,null,le.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},Qi=new WeakSet,ba=function(A,le,ae){let W=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),B=So(W,A),j=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;B&&!j?typeof this[B]=="boolean"?ae===null?this[B]=!1:this[B]=!0:this[B]=ae:ae===null?this.nativeEl.removeAttribute(A):["id","class"].indexOf(A)===-1&&this.nativeEl.setAttribute(A,ae)};var Ss=[],As=ra.createElement("video",{is:"castable-video"}),_o=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let x=Object.getPrototypeOf(As);x&&x!==xr.HTMLElement.prototype;x=Object.getPrototypeOf(x))Object.getOwnPropertyNames(x).forEach(w=>{_o.indexOf(w)===-1&&Ss.push(w)});Ss.forEach(x=>{if(x in $r.prototype)return;if(typeof As[x]=="function")$r.prototype[x]=function(){return this.nativeEl[x].apply(this.nativeEl,arguments)};else{let A={get(){return this.nativeEl[x]}};x!==x.toUpperCase()&&(A.set=function(le){this.nativeEl[x]=le}),Object.defineProperty($r.prototype,x,A)}});function So(x,w){let A=null;return x.forEach(le=>{le.toLowerCase()==w.toLowerCase()&&(A=le)}),A}xr.customElements.get("custom-video")||(xr.customElements.define("custom-video",$r),xr.CustomVideoElement=$r);var _a=$r;var mt={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_COOKIES:"disable-cookies",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TYPE:"type"},Ao=Object.values(mt),ko=vs(),wo="mux-video",Fr,ki,$i,wi,Zi,en,tn,rn,Sa,Ji=class extends _a{constructor(){super();_t(this,rn);_t(this,Fr,void 0);_t(this,ki,void 0);_t(this,$i,void 0);_t(this,wi,{});_t(this,Zi,void 0);_t(this,en,void 0);_t(this,tn,void 0);Nt(this,$i,ss())}static get observedAttributes(){var A;return[...Ao,...(A=_a.observedAttributes)!=null?A:[]]}get preferCmcd(){var A;return(A=this.getAttribute(mt.PREFER_CMCD))!=null?A:void 0}set preferCmcd(A){A!==this.preferCmcd&&(A?da.includes(A)?this.setAttribute(mt.PREFER_CMCD,A):console.warn(`Invalid value for preferCmcd. Must be one of ${da.join()}`):this.removeAttribute(mt.PREFER_CMCD))}get playerInitTime(){return Ye(this,$i)}get playerSoftwareName(){var A;return(A=Ye(this,en))!=null?A:wo}set playerSoftwareName(A){Nt(this,en,A)}get playerSoftwareVersion(){var A;return(A=Ye(this,Zi))!=null?A:ko}set playerSoftwareVersion(A){Nt(this,Zi,A)}get _hls(){var A;return(A=Ye(this,Fr))==null?void 0:A.engine}get mux(){return this.nativeEl.mux}get error(){var A;return(A=ls(this.nativeEl))!=null?A:null}get errorTranslator(){return Ye(this,tn)}set errorTranslator(A){Nt(this,tn,A)}get src(){return this.getAttribute("src")}set src(A){A!==this.src&&(A==null?this.removeAttribute("src"):this.setAttribute("src",A))}get type(){var A;return(A=this.getAttribute(mt.TYPE))!=null?A:void 0}set type(A){A!==this.type&&(A?this.setAttribute(mt.TYPE,A):this.removeAttribute(mt.TYPE))}get autoplay(){let A=this.getAttribute("autoplay");return A===null?!1:A===""?!0:A}set autoplay(A){let le=this.autoplay;A!==le&&(A?this.setAttribute("autoplay",typeof A=="string"?A:""):this.removeAttribute("autoplay"))}get preload(){let A=this.getAttribute("preload");return A===""?"auto":["none","metadata","auto"].includes(A)?A:super.preload}set preload(A){A!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(A)?this.setAttribute("preload",A):this.removeAttribute("preload"))}get debug(){return this.getAttribute(mt.DEBUG)!=null}set debug(A){A!==this.debug&&(A?this.setAttribute(mt.DEBUG,""):this.removeAttribute(mt.DEBUG))}get disableCookies(){return this.hasAttribute(mt.DISABLE_COOKIES)}set disableCookies(A){A!==this.disableCookies&&(A?this.setAttribute(mt.DISABLE_COOKIES,""):this.removeAttribute(mt.DISABLE_COOKIES))}get startTime(){let A=this.getAttribute(mt.START_TIME);if(A==null)return;let le=+A;return Number.isNaN(le)?void 0:le}set startTime(A){A!==this.startTime&&(A==null?this.removeAttribute(mt.START_TIME):this.setAttribute(mt.START_TIME,`${A}`))}get playbackId(){var A;return(A=this.getAttribute(mt.PLAYBACK_ID))!=null?A:void 0}set playbackId(A){A!==this.playbackId&&(A?this.setAttribute(mt.PLAYBACK_ID,A):this.removeAttribute(mt.PLAYBACK_ID))}get maxResolution(){var A;return(A=this.getAttribute(mt.MAX_RESOLUTION))!=null?A:void 0}set maxResolution(A){A!==this.maxResolution&&(A?this.setAttribute(mt.MAX_RESOLUTION,A):this.removeAttribute(mt.MAX_RESOLUTION))}get customDomain(){var A;return(A=this.getAttribute(mt.CUSTOM_DOMAIN))!=null?A:void 0}set customDomain(A){A!==this.customDomain&&(A?this.setAttribute(mt.CUSTOM_DOMAIN,A):this.removeAttribute(mt.CUSTOM_DOMAIN))}get envKey(){var A;return(A=this.getAttribute(mt.ENV_KEY))!=null?A:void 0}set envKey(A){A!==this.envKey&&(A?this.setAttribute(mt.ENV_KEY,A):this.removeAttribute(mt.ENV_KEY))}get beaconCollectionDomain(){var A;return(A=this.getAttribute(mt.BEACON_COLLECTION_DOMAIN))!=null?A:void 0}set beaconCollectionDomain(A){A!==this.beaconCollectionDomain&&(A?this.setAttribute(mt.BEACON_COLLECTION_DOMAIN,A):this.removeAttribute(mt.BEACON_COLLECTION_DOMAIN))}get streamType(){var A;return(A=this.getAttribute(mt.STREAM_TYPE))!=null?A:void 0}set streamType(A){A!==this.streamType&&(A?this.setAttribute(mt.STREAM_TYPE,A):this.removeAttribute(mt.STREAM_TYPE))}async addCuePoints(A){return fa(this.nativeEl,A)}get activeCuePoint(){return va(this.nativeEl)}get cuePoints(){return is(this.nativeEl)}get preferPlayback(){let A=this.getAttribute(mt.PREFER_PLAYBACK);if(A===oi.MSE||A===oi.NATIVE)return A}set preferPlayback(A){A!==this.preferPlayback&&(A===oi.MSE||A===oi.NATIVE?this.setAttribute(mt.PREFER_PLAYBACK,A):this.removeAttribute(mt.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(le=>le.startsWith("metadata-")&&![mt.METADATA_URL].includes(le)).reduce((le,ae)=>{let W=this.getAttribute(ae);return W!=null&&(le[ae.replace(/^metadata-/,"").replace(/-/g,"_")]=W),le},{}),...Ye(this,wi)}}set metadata(A){Nt(this,wi,A!=null?A:{}),this.mux&&this.mux.emit("hb",Ye(this,wi))}load(){Nt(this,Fr,us(this,this.nativeEl,Ye(this,Fr)))}unload(){pa(this.nativeEl,Ye(this,Fr)),Nt(this,Fr,void 0)}attributeChangedCallback(A,le,ae){var W,B;switch(super.attributeChangedCallback(A,le,ae),A){case mt.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=ae!=null?ae:void 0;break;case mt.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=ae!=null?ae:void 0;break;case"src":{let j=!!le,re=!!ae;!j&&re?zt(this,rn,Sa).call(this):j&&!re?this.unload():j&&re&&(this.unload(),zt(this,rn,Sa).call(this));break}case"autoplay":if(ae===le)break;(W=Ye(this,Fr))==null||W.setAutoplay(this.autoplay);break;case"preload":if(ae===le)break;(B=Ye(this,Fr))==null||B.setPreload(ae);break;case mt.PLAYBACK_ID:this.src=os(ae!=null?ae:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case mt.DEBUG:{let j=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=j);break}case mt.METADATA_URL:ae&&fetch(ae).then(j=>j.json()).then(j=>this.metadata=j).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${ae}!`));break;default:break}}disconnectedCallback(){this.unload()}};Fr=new WeakMap,ki=new WeakMap,$i=new WeakMap,wi=new WeakMap,Zi=new WeakMap,en=new WeakMap,tn=new WeakMap,rn=new WeakSet,Sa=async function(){Ye(this,ki)||(await Nt(this,ki,Promise.resolve()),Nt(this,ki,null),this.load())};xr.customElements.get("mux-video")||(xr.customElements.define("mux-video",Ji),xr.MuxVideoElement=Ji);var Xo=Ji;})();
|
|
53
53
|
/*!
|
|
54
54
|
* JavaScript Cookie v2.1.3
|
|
55
55
|
* https://github.com/js-cookie/js-cookie
|