@mux/mux-player 1.11.0 → 1.11.1

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.
@@ -1,48 +1,48 @@
1
- var Bg=Object.create;var vf=Object.defineProperty;var Hg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Vg=Object.getPrototypeOf,Kg=Object.prototype.hasOwnProperty;var gf=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports);var Wg=(n,a,l,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let v of Gg(a))!Kg.call(n,v)&&v!==l&&vf(n,v,{get:()=>a[v],enumerable:!(m=Hg(a,v))||m.enumerable});return n};var yf=(n,a,l)=>(l=n!=null?Bg(Vg(n)):{},Wg(a||!n||!n.__esModule?vf(l,"default",{value:n,enumerable:!0}):l,n));var gu=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)};var at=(n,a,l)=>(gu(n,a,"read from private field"),l?l.call(n):a.get(n)),Dt=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Oi=(n,a,l,m)=>(gu(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l);var Gt=(n,a,l)=>(gu(n,a,"access private method"),l);var Jm=gf((jl,xc)=>{(function(){var n,a;n=this,a=function(){return function(){var l={80:function(E,I,M){E.exports=M(728).default},728:function(E,I,M){"use strict";M.d(I,{default:function(){return ns}});var B=M(48),F=M.n(B),Q=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(T){var g=16*Math.random()|0;return(T==="x"?g:3&g|8).toString(16)})},re=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},te=function(T){return T&&T.nodeName!==void 0?(T.muxId||(T.muxId=T.id||re()),T.muxId):T},se=function(T){var g;T&&T.nodeName!==void 0?T=te(g=T):g=document.querySelector(T);var _=g&&g.nodeName?g.nodeName.toLowerCase():"";return[g,T,_]},pe=M(640),Ae=M.n(pe),ke=Ae().methodFactory;Ae().methodFactory=function(T,g,_){var R=ke(T,g,_);return function(){for(var C=["[mux]"],O=0;O<arguments.length;O++)C.push(arguments[O]);R.apply(void 0,C)}},Ae().setLevel(Ae().getLevel());var we=Ae();function nt(){return(F().doNotTrack||F().navigator&&F().navigator.doNotTrack)==="1"}var Ue={now:function(){var T=F().performance,g=T&&T.timing,_=g&&g.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},st=function(T){return dt(T)[0]},dt=function(T){if(typeof T!="string"||T==="")return["localhost"];var g,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(g=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,g]},oe={exists:function(){var T=F().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=F().performance,g=T&&T.timing;return g&&g.domContentLoadedEventEnd},navigationStart:function(){var T=F().performance,g=T&&T.timing;return g&&g.navigationStart}};function w(T,g,_){_=_===void 0?1:_,T[g]=T[g]||0,T[g]+=_}var le=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],$=["x-cdn","content-type"].concat(le);function Ie(T){var g={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&($.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(g[C]=R.join(": "))}}),g}function $e(T){if(T){var g=le.find(function(_){return T[_]!==void 0});return g?T[g]:void 0}}var tt=function(T){var g={};for(var _ in T){var R=T[_];R["DATA-ID"].search("io.litix.data.")!==-1&&(g[R["DATA-ID"].replace("io.litix.data.","")]=R.VALUE)}return g};function Bt(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function Je(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?Bt(Object(_),!0).forEach(function(R){H(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):Bt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function H(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var ri=function(T){if(!T)return{};var g=oe.navigationStart(),_=T.loading,R=_?_.start:T.trequest,C=_?_.first:T.tfirst,O=_?_.end:T.tload;return{bytesLoaded:T.total,requestStart:Math.round(g+R),responseStart:Math.round(g+C),responseEnd:Math.round(g+O)}},Ht=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Ie(T.getAllResponseHeaders())};function it(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function Qt(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?it(Object(_),!0).forEach(function(R){Ke(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):it(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function Ke(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var xt=function(T,g){if(!T||typeof T.getRequests!="function")return{};var _=T.getRequests({state:"executed"});if(_.length===0)return{};var R,C=_[_.length-1],O=st(C.url),x=C.url,G=C.bytesLoaded,Y=new Date(C.requestStartDate).getTime(),K=new Date(C.firstByteDate).getTime(),Z=new Date(C.requestEndDate).getTime(),Oe=isNaN(C.duration)?0:C.duration,ye=typeof g.getMetricsFor=="function"?g.getMetricsFor(C.mediaType).HttpList:g.getDashMetrics().getHttpRequests(C.mediaType);return ye.length>0&&(R=Ie(ye[ye.length-1]._responseHeaders||"")),{requestStart:Y,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:Oe,requestHostname:O,requestUrl:x,requestId:R?$e(R):void 0}},ht=function(T,g){var _=g.getQualityFor(T),R=g.getCurrentTrackFor(T).bitrateList;return R?{currentLevel:_,renditionWidth:R[_].width||null,renditionHeight:R[_].height||null,renditionBitrate:R[_].bandwidth}:{}},Tt=function(T){var g;return(g=T.match(/.*codecs\*?="(.*)"/))===null||g===void 0?void 0:g[1]};function Qi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var J=0,Ee=function(){function T(){(function(C,O){if(!(C instanceof O))throw new TypeError("Cannot call a class as a function")})(this,T)}var g,_,R;return g=T,_=[{key:"on",value:function(C,O,x){return O._eventEmitterGuid=O._eventEmitterGuid||++J,this._listeners=this._listeners||{},this._listeners[C]=this._listeners[C]||[],x&&(O=O.bind(x)),this._listeners[C].push(O),O}},{key:"off",value:function(C,O){var x=this._listeners&&this._listeners[C];x&&x.forEach(function(G,Y){G._eventEmitterGuid===O._eventEmitterGuid&&x.splice(Y,1)})}},{key:"one",value:function(C,O,x){var G=this;O._eventEmitterGuid=O._eventEmitterGuid||++J;var Y=function K(){G.off(C,K),O.apply(x||this,arguments)};Y._eventEmitterGuid=O._eventEmitterGuid,this.on(C,Y)}},{key:"emit",value:function(C,O){var x=this;if(this._listeners){O=O||{};var G=this._listeners["before*"]||[],Y=this._listeners[C]||[],K=this._listeners["after"+C]||[],Z=function(Oe,ye){(Oe=Oe.slice()).forEach(function(Se){Se.call(x,{type:C},ye)})};Z(G,O),Z(Y,O),Z(K,O)}}}],_&&Qi(g.prototype,_),R&&Qi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),rt=Ee;function bt(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var _t=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,C.on("playing",function(){O._playheadShouldBeProgressing=!0}),C.on("play",this._startPlaybackHeartbeatInterval.bind(this)),C.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),C.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),C.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),C.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("seeked",function(){C.data.player_is_paused?O._stopPlaybackHeartbeatInterval():O._startPlaybackHeartbeatInterval()}),C.on("timeupdate",function(){O._playbackHeartbeatInterval!==null&&C.emit("playbackheartbeat")}),C.on("devicesleep",function(x,G){O._playbackHeartbeatInterval!==null&&(F().clearInterval(O._playbackHeartbeatInterval),C.emit("playbackheartbeatend",{viewer_time:G.viewer_time}),O._playbackHeartbeatInterval=null)})}var g,_,R;return g=T,(_=[{key:"_startPlaybackHeartbeatInterval",value:function(){var C=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=F().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(F().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&bt(g.prototype,_),R&&bt(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ai(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Gi(T,g,_){return g&&ai(T.prototype,g),_&&ai(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var je=Gi(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_.viewErrored=!1}),g.on("error",function(R,C){try{var O=g.errorTranslator({player_error_code:C.player_error_code,player_error_message:C.player_error_message,player_error_context:C.player_error_context});O?(g.data.player_error_code=O.player_error_code||C.player_error_code,g.data.player_error_message=O.player_error_message||C.player_error_message,g.data.player_error_context=O.player_error_context||C.player_error_context,_.viewErrored=!0):(delete g.data.player_error_code,delete g.data.player_error_message,delete g.data.player_error_context)}catch(x){g.mux.log.warn("Exception in error translator callback.",x),_.viewErrored=!0}})});function di(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ui=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._watchTimeTrackerLastCheckedTime=null,C.on("playbackheartbeat",this._updateWatchTime.bind(this)),C.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updateWatchTime",value:function(C,O){var x=O.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=x),w(this.pm.data,"view_watch_time",x-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=x}},{key:"_clearWatchTimeState",value:function(C,O){this._updateWatchTime(C,O),this._watchTimeTrackerLastCheckedTime=null}}])&&di(g.prototype,_),R&&di(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Vi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Xi=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackTimeTrackerLastPlayheadPosition=-1,C.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),C.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),C.on("seeking",this._clearPlaybackTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updatePlaybackTime",value:function(){var C=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&C>this._playbackTimeTrackerLastPlayheadPosition){var O=C-this._playbackTimeTrackerLastPlayheadPosition;O<=1e3&&w(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&Vi(g.prototype,_),R&&Vi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ci(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ut=function(){function T(C){(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C;var O=this._updatePlayheadTime.bind(this);C.on("playbackheartbeat",O),C.on("playbackheartbeatend",O),C.on("timeupdate",O),C.on("destroy",function(){C.off("timeupdate",O)})}var g,_,R;return g=T,(_=[{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(C,O){var x=this,G=function(){x.pm.currentFragmentPDT&&x.pm.currentFragmentStart&&(x.pm.data.player_program_time=x.pm.currentFragmentPDT+x.pm.data.player_playhead_time-x.pm.currentFragmentStart)};if(O&&O.player_playhead_time)this.pm.data.player_playhead_time=O.player_playhead_time,G(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var Y=this.pm.getPlayheadTime();Y!==void 0&&(this.pm.data.player_playhead_time=Y,G(),this._updateMaxPlayheadPosition())}}}])&&ci(g.prototype,_),R&&ci(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Zi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function ur(T,g,_){return g&&Zi(T.prototype,g),_&&Zi(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Nr=3e5,Li=ur(function T(g){if(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")}(this,T),!g.disableRebufferTracking){var _,R=function(O,x){C(x),_=void 0},C=function(O){if(_){var x=O.viewer_time-_;w(g.data,"view_rebuffer_duration",x),_=O.viewer_time,g.data.view_rebuffer_duration>Nr&&(g.emit("viewend"),g.send("viewend"),g.mux.log.warn("Ending view after rebuffering for longer than ".concat(Nr,"ms, future events will be ignored unless a programchange or videochange occurs.")))}g.data.view_watch_time>=0&&g.data.view_rebuffer_count>0&&(g.data.view_rebuffer_frequency=g.data.view_rebuffer_count/g.data.view_watch_time,g.data.view_rebuffer_percentage=g.data.view_rebuffer_duration/g.data.view_watch_time)};g.on("playbackheartbeat",function(O,x){return C(x)}),g.on("rebufferstart",function(O,x){_||(w(g.data,"view_rebuffer_count",1),_=x.viewer_time,g.one("rebufferend",R))}),g.on("viewinit",function(){_=void 0,g.off("rebufferend",R)})}});function cr(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Hn=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.disableRebufferTracking||C.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,C.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),C.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),C.on("seeking",function(){O._cleanupRebufferTracker(null,{viewer_time:Ue.now()})}))}var g,_,R;return g=T,_=[{key:"_checkIfRebuffering",value:function(C,O){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(C,O);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var x=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&x>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=O.viewer_time}else this._cleanupRebufferTracker(C,O,!0);else this._prepareRebufferTrackerState(O.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(C){this._lastCheckedTime=C,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=C}},{key:"_cleanupRebufferTracker",value:function(C,O){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:O.viewer_time});else{if(this._lastCheckedTime===null)return;var G=this.pm.data.player_playhead_time-this._lastPlayheadTime,Y=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&G>0&&Y-G>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+Y-G}))}x?this._prepareRebufferTrackerState(O.viewer_time):this._clearRebufferTrackerState()}}],_&&cr(g.prototype,_),R&&cr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),so=Hn;function la(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Ya=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){var x=C.data,G=x.view_id;if(!x.view_program_changed){var Y=function(K,Z){var Oe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(Oe||Ue.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(Oe||Ue.now(),G)};C.one("playing",Y),C.one("adplaying",Y),C.one("viewend",function(){C.off("playing",Y),C.off("adplaying",Y)})}})}var g,_,R;return g=T,(_=[{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(C,O){O===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:C}),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))}}])&&la(g.prototype,_),R&&la(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function oo(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function lo(T,g,_){return g&&oo(T.prototype,g),_&&oo(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Id=lo(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(R){g.on(R,function(){if(_._lastPlayheadPosition>=0&&g.data.player_playhead_time>=0&&_._lastPlayerWidth>=0&&_._lastSourceWidth>0&&_._lastPlayerHeight>=0&&_._lastSourceHeight>0){var C=g.data.player_playhead_time-_._lastPlayheadPosition;if(C<0)return void(_._lastPlayheadPosition=-1);var O=Math.min(_._lastPlayerWidth/_._lastSourceWidth,_._lastPlayerHeight/_._lastSourceHeight),x=Math.max(0,O-1),G=Math.max(0,1-O);g.data.view_max_upscale_percentage=Math.max(g.data.view_max_upscale_percentage||0,x),g.data.view_max_downscale_percentage=Math.max(g.data.view_max_downscale_percentage||0,G),w(g.data,"view_total_content_playback_time",C),w(g.data,"view_total_upscaling",x*C),w(g.data,"view_total_downscaling",G*C)}_._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(R){g.on(R,function(){_._lastPlayheadPosition=g.data.player_playhead_time,_._lastPlayerWidth=g.data.player_width,_._lastPlayerHeight=g.data.player_height,_._lastSourceWidth=g.data.video_source_width,_._lastSourceHeight=g.data.video_source_height})})});function Gn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Rd(T,g,_){return g&&Gn(T.prototype,g),_&&Gn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Dd=Rd(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),this.isSeeking=!1,g.on("seeking",function(R,C){Object.assign(g.data,C),_._lastSeekingTime=Ue.now(),_.isSeeking===!1&&(_.isSeeking=!0,g.send("seeking"))}),g.on("seeked",function(){_.isSeeking=!1;var R=_._lastSeekingTime||Ue.now(),C=Ue.now()-R;w(g.data,"view_seek_count",1),w(g.data,"view_seek_duration",C);var O=g.data.view_max_seek_time||0;g.data.view_max_seek_time=Math.max(O,C)}),g.on("viewend",function(){_.isSeeking=!1})});function uo(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return co(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?co(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function co(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function ho(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Ei=function(T,g){T.push(g),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Cd=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ii=function(){function T(C){var O=this;(function(G,Y){if(!(G instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){O.isAdBreak=!1,O._currentAdRequestNumber=0,O._currentAdResponseNumber=0,O._adRequests=[],O._adResponses=[],O._adHasPlayed=!1,O._wouldBeNewAdPlay=!0,O._prerollPlayTime=void 0}),Cd.forEach(function(G){return C.on(G,O._updateAdData.bind(O))});var x=function(){O.isAdBreak=!1};C.on("adbreakstart",function(){O.isAdBreak=!0}),C.on("play",x),C.on("playing",x),C.on("viewend",x),C.on("adrequest",function(G,Y){Y=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdRequestNumber++},Y),Ei(O._adRequests,Y),w(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||w(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,Y){Y=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},Y),Ei(O._adResponses,Y);var K=O.findAdRequest(Y.ad_request_id);K&&w(C.data,"view_ad_request_time",Math.max(0,Y.viewer_time-K.viewer_time))}),C.on("adplay",function(G,Y){O._adHasPlayed=!0,O._wouldBeNewAdPlay&&(O._wouldBeNewAdPlay=!1,w(C.data,"view_ad_played_count")),O.inPrerollPosition()&&!C.data.view_preroll_played&&(C.data.view_preroll_played=!0,O._adRequests.length>0&&(C.data.view_preroll_request_time=Math.max(0,Y.viewer_time-O._adRequests[0].viewer_time)),C.data.view_start&&(C.data.view_startup_preroll_request_time=Math.max(0,Y.viewer_time-C.data.view_start)),O._prerollPlayTime=Y.viewer_time)}),C.on("adplaying",function(G,Y){O.inPrerollPosition()&&C.data.view_preroll_load_time===void 0&&O._prerollPlayTime!==void 0&&(C.data.view_preroll_load_time=Y.viewer_time-O._prerollPlayTime,C.data.view_startup_preroll_load_time=Y.viewer_time-O._prerollPlayTime)}),C.on("adended",function(){O._wouldBeNewAdPlay=!0}),C.on("aderror",function(){O._wouldBeNewAdPlay=!0})}var g,_,R;return g=T,(_=[{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(C){for(var O=0;O<this._adRequests.length;O++)if(this._adRequests[O].ad_request_id===C)return this._adRequests[O]}},{key:"_updateAdData",value:function(C,O){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&O.ad_tag_url){var x=uo(dt(O.ad_tag_url),2),G=x[0],Y=x[1];this.pm.data.view_preroll_ad_tag_domain=Y,this.pm.data.view_preroll_ad_tag_hostname=G}if(!this.pm.data.view_preroll_ad_asset_hostname&&O.ad_asset_url){var K=uo(dt(O.ad_asset_url),2),Z=K[0],Oe=K[1];this.pm.data.view_preroll_ad_asset_domain=Oe,this.pm.data.view_preroll_ad_asset_hostname=Z}}this.pm.data.ad_asset_url=O==null?void 0:O.ad_asset_url,this.pm.data.ad_tag_url=O==null?void 0:O.ad_tag_url,this.pm.data.ad_creative_id=O==null?void 0:O.ad_creative_id,this.pm.data.ad_id=O==null?void 0:O.ad_id,this.pm.data.ad_universal_id=O==null?void 0:O.ad_universal_id}}])&&ho(g.prototype,_),R&&ho(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function da(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Md(T,g,_){return g&&da(T.prototype,g),_&&da(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var fo=Md(function T(g){var _,R;(function(G,Y){if(!(G instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){g.disableRebufferTracking||_&&(w(g.data,"view_waiting_rebuffer_duration",Ue.now()-_),_=!1,F().clearInterval(R))},O=!1,x=function(){O=!1,C()};g.on("waiting",function(){O&&(g.disableRebufferTracking||(w(g.data,"view_waiting_rebuffer_count",1),_=Ue.now(),R=F().setInterval(function(){if(_){var G=Ue.now();w(g.data,"view_waiting_rebuffer_duration",G-_),_=G}},250)))}),g.on("playing",function(){C(),O=!0}),g.on("pause",x),g.on("seeking",x)});function At(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function mo(T,g,_){return g&&At(T.prototype,g),_&&At(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Fe=mo(function T(g){var _=this;(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T);var R=function(){_.lastWallClockTime=Ue.now(),g.on("before*",C)},C=function(O){var x=Ue.now(),G=_.lastWallClockTime;_.lastWallClockTime=x,x-G>3e4&&(g.emit("devicesleep",{viewer_time:G}),Object.assign(g.data,{viewer_time:G}),g.send("devicesleep"),g.emit("devicewake",{viewer_time:x}),Object.assign(g.data,{viewer_time:x}),g.send("devicewake"))};g.one("playbackheartbeat",R),g.on("playbackheartbeatend",function(){g.off("before*",C),g.one("playbackheartbeat",R)})}),Vn=M(375),Kn=M(655),ze=M.n(Kn),po="muxData",Wn=function(){var T;try{T=Vn.parse(ze().get(po)||"")}catch{T={}}return T},qn=function(T){try{ze().set(po,Vn.stringify(T),{expires:7300})}catch{}},xd=function(){var T=Wn();return T.mux_viewer_id=T.mux_viewer_id||Q(),T.msn=T.msn||Math.random(),qn(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function hr(T,g){var _=g.beaconCollectionDomain,R=g.beaconDomain;if(_)return"https://"+_;var C=R||"litix.io";return(T=T||"inferred").match(/^[a-z0-9]+$/)?"https://"+T+"."+C:"https://img.litix.io/a.gif"}var Yn=function(){var T;switch(vo()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},vo=function(){var T=F().navigator,g=T&&(T.connection||T.mozConnection||T.webkitConnection);return g&&g.type};Yn.getConnectionFromAPI=vo;var go=Yn,yo=ua({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"}),Eo=ua({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",cl:"canceled",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",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",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 ua(T){var g={};for(var _ in T)T.hasOwnProperty(_)&&(g[T[_]]=_);return g}function ca(T){var g={},_={};return Object.keys(T).forEach(function(R){var C=!1;if(T.hasOwnProperty(R)&&T[R]!==void 0){var O=R.split("_"),x=O[0],G=yo[x];G||(we.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function(Y){Y==="url"&&(C=!0),Eo[Y]?G+=Eo[Y]:Number(Y)&&Math.floor(Number(Y))===Number(Y)?G+=Y:(we.info("Data key word `"+Y+"` not expected in "+R),G+="_"+Y+"_")}),C?_[G]=T[R]:g[G]=T[R]}}),Object.assign(g,_)}var bo={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},_o=["hb","requestcompleted","requestfailed","requestcanceled"],Xt="https://img.litix.io",bi=function(T){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||Xt,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},bo,g)};bi.prototype.queueEvent=function(T,g){var _=Object.assign({},g);return(this._eventQueue.length<=this._options.maxQueueLength||T==="eventrateexceeded")&&(this._eventQueue.push(_),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},bi.prototype.flushEvents=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];T&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},bi.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),F().clearTimeout(this._sendTimeout)},bi.prototype._clearBeaconQueue=function(){var T=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,g=this._eventQueue.slice(T);T>0&&Object.assign(g[g.length-1],ca({mux_view_message:"event queue truncated"}));var _=this._createPayload(g);Ao(this._beaconUrl,_,!0,function(){})},bi.prototype._sendBeaconQueue=function(){var T=this;if(!this._postInFlight){var g=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var _=this._createPayload(g),R=Ue.now();Ao(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=g.concat(T._eventQueue),T._failureCount+=1,we.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=Ue.now()-R,T._postInFlight=!1})}},bi.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var T=Math.pow(2,this._failureCount-1);return(1+(T*=Math.random()))*this._options.baseTimeBetweenBeacons},bi.prototype._startBeaconSending=function(){var T=this;F().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=F().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},bi.prototype._createPayload=function(T){var g,_,R,C=this,O={transmission_timestamp:Math.round(Ue.now())};this._roundTripTime&&(O.rtt_ms=Math.round(this._roundTripTime));var x=function(){g=JSON.stringify({metadata:O,events:_||T}),R=g.length/1024},G=function(){return R<=C._options.maxPayloadKBSize};return x(),G()||(we.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function(Y){return _o.indexOf(Y.e)===-1}),x()),G()||(we.info("Payload size still too big ("+R+" kb). Cropping fields.."),_.forEach(function(Y){for(var K in Y){var Z=Y[K];typeof Z=="string"&&Z.length>51200&&(Y[K]=Z.substring(0,51200))}}),x()),g};var To=function(T){return T.length<=57344},Ao=function(T,g,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,g))R();else if(F().fetch)F().fetch(T,{method:"POST",body:g,headers:{"Content-Type":"text/plain"},keepalive:To(g)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(F().XMLHttpRequest){var C=new(F()).XMLHttpRequest;return C.onreadystatechange=function(){if(C.readyState===4)return R(null,C.status!==200?"error":void 0)},C.open("POST",T),C.setRequestHeader("Content-Type","text/plain"),void C.send(g)}R()}},$a=bi;function Pd(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return $n(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?$n(_,R):void 0}}(T,g)||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 $n(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function ja(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function fr(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?ja(Object(_),!0).forEach(function(R){za(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):ja(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function Fr(T){return Fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Fr(T)}function Od(T,g){if(!(T instanceof g))throw new TypeError("Cannot call a class as a function")}function jn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function za(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var ha=["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"],So=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse"],ko=["viewstart","error","ended","viewend"],Nd=function(){function T(C,O){var x,G,Y,K,Z,Oe,ye,Se,be,Re,Ge,kt,Pt,Wt,ni,Be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Od(this,T),za(this,"previousBeaconData",null),za(this,"lastEventTime",0),za(this,"rateLimited",!1),this.mux=C,this.envKey=O,this.options=Be,this.eventQueue=new $a(hr(this.envKey,this.options)),this.sampleRate=(x=this.options.sampleRate)!==null&&x!==void 0?x:1,this.disableCookies=(G=this.options.disableCookies)!==null&&G!==void 0&&G,this.respectDoNotTrack=(Y=this.options.respectDoNotTrack)!==null&&Y!==void 0&&Y,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:(K=this.options.platform)===null||K===void 0?void 0:K.name,viewer_application_version:(Z=this.options.platform)===null||Z===void 0?void 0:Z.version,viewer_application_engine:(Oe=this.options.platform)===null||Oe===void 0?void 0:Oe.layout,viewer_device_name:(ye=this.options.platform)===null||ye===void 0?void 0:ye.product,viewer_device_category:"",viewer_device_manufacturer:(Se=this.options.platform)===null||Se===void 0?void 0:Se.manufacturer,viewer_os_family:(be=this.options.platform)===null||be===void 0||(Re=be.os)===null||Re===void 0?void 0:Re.family,viewer_os_architecture:(Ge=this.options.platform)===null||Ge===void 0||(kt=Ge.os)===null||kt===void 0?void 0:kt.architecture,viewer_os_version:(Pt=this.options.platform)===null||Pt===void 0||(Wt=Pt.os)===null||Wt===void 0?void 0:Wt.version,viewer_connection_type:go(),page_url:F()===null||F()===void 0||(ni=F().location)===null||ni===void 0?void 0:ni.href},this.viewerData=this.disableCookies?{}:xd()}var g,_,R;return g=T,(_=[{key:"send",value:function(C,O){var x;if(C&&O!=null&&O.view_id){if(this.respectDoNotTrack&&nt())return we.info("Not sending `"+C+"` because Do Not Track is enabled");if(!O||Fr(O)!=="object")return we.error("A data object was expected in send() but was not provided");var G,Y,K=this.disableCookies?{}:(G=Wn(),Y=Ue.now(),G.session_start&&(G.sst=G.session_start,delete G.session_start),G.session_id&&(G.sid=G.session_id,delete G.session_id),G.session_expires&&(G.sex=G.session_expires,delete G.session_expires),(!G.sex||G.sex<Y)&&(G.sid=Q(),G.sst=Y),G.sex=Y+15e5,qn(G),{session_id:G.sid,session_start:G.sst,session_expires:G.sex}),Z=fr(fr(fr(fr(fr({},this.pageLevelData),O),K),this.viewerData),{},{event:C,env_key:this.envKey});Z.user_id&&(Z.viewer_user_id=Z.user_id,delete Z.user_id);var Oe=((x=Z.mux_sample_number)!==null&&x!==void 0?x:0)>=this.sampleRate,ye=ca(this._deduplicateBeaconData(C,Z));if(this.lastEventTime=this.mux.utils.now(),Oe)return we.info("Not sending event due to sample rate restriction",C,Z,ye);if(this.envKey||we.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",C,Z,ye),!this.rateLimited){if(we.info("Sending event",C,Z,ye),this.rateLimited=!this.eventQueue.queueEvent(C,ye),this.mux.WINDOW_UNLOADING&&C==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&C==="hb"?this.eventQueue.flushEvents(!0):ko.indexOf(C)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Z.event="eventrateexceeded",ye=ca(Z),this.eventQueue.queueEvent(Z.event,ye),we.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(C,O){var x=this,G={},Y=O.view_id;if(Y==="-1"||C==="viewstart"||C==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)G=fr({},O),Y&&(this.previousBeaconData=G),Y&&C==="viewend"&&(this.previousBeaconData=null);else{var K=C.indexOf("request")===0;Object.entries(O).forEach(function(Z){var Oe=Pd(Z,2),ye=Oe[0],Se=Oe[1];x.previousBeaconData&&(Se!==x.previousBeaconData[ye]||ha.indexOf(ye)>-1||x.objectHasChanged(K,ye,Se,x.previousBeaconData[ye])||x.eventRequiresKey(C,ye))&&(G[ye]=Se,x.previousBeaconData[ye]=Se)})}return G}},{key:"objectHasChanged",value:function(C,O,x,G){return!(!C||O.indexOf("request_")!==0||O!=="request_response_headers"&&Fr(x)==="object"&&Fr(G)==="object"&&Object.keys(x||{}).length===Object.keys(G||{}).length)}},{key:"eventRequiresKey",value:function(C,O){return C==="renditionchange"&&O.indexOf("video_source_")===0||!(O.indexOf("ad_id")!==0||!So.includes(C))}}])&&jn(g.prototype,_),R&&jn(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function zn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function wo(T,g,_){return g&&zn(T.prototype,g),_&&zn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Lo=wo(function T(g){(function(K,Z){if(!(K instanceof Z))throw new TypeError("Cannot call a class as a function")})(this,T);var _=0,R=0,C=0,O=0,x=0,G=0,Y=0;g.on("requestcompleted",function(K,Z){var Oe,ye,Se=Z.request_start,be=Z.request_response_start,Re=Z.request_response_end,Ge=Z.request_bytes_loaded;if(O++,be?(Oe=be-(Se!=null?Se:0),ye=(Re!=null?Re:0)-be):ye=(Re!=null?Re:0)-(Se!=null?Se:0),ye>0&&Ge&&Ge>0){var kt=Ge/ye*8e3;x++,R+=Ge,C+=ye,g.data.view_min_request_throughput=Math.min(g.data.view_min_request_throughput||1/0,kt),g.data.view_average_request_throughput=R/C*8e3,g.data.view_request_count=O,Oe>0&&(_+=Oe,g.data.view_max_request_latency=Math.max(g.data.view_max_request_latency||0,Oe),g.data.view_average_request_latency=_/x)}}),g.on("requestfailed",function(K,Z){O++,G++,g.data.view_request_count=O,g.data.view_request_failed_count=G}),g.on("requestcanceled",function(K,Z){O++,Y++,g.data.view_request_count=O,g.data.view_request_canceled_count=Y})});function Qn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ur(T,g,_){return g&&Qn(T.prototype,g),_&&Qn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var mr=Ur(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("before*",function(R,C){var O=C.viewer_time,x=Ue.now(),G=_._lastEventTime;if(_._lastEventTime=x,G&&x-G>36e5){var Y=Object.keys(g.data).reduce(function(K,Z){return Z.indexOf("video_")===0?Object.assign(K,function(Oe,ye,Se){return ye in Oe?Object.defineProperty(Oe,ye,{value:Se,enumerable:!0,configurable:!0,writable:!0}):Oe[ye]=Se,Oe}({},Z,g.data[Z])):K},{});g.mux.log.info("Received event after at least an hour inactivity, creating a new view"),g.emit("viewinit",Object.assign({viewer_time:O},Y)),g.playbackHeartbeat._playheadShouldBeProgressing&&R.type!=="play"&&R.type!=="adbreakstart"&&(g.emit("play",{viewer_time:O}),R.type!=="playing"&&g.emit("playing",{viewer_time:O}))}})});function hi(T){return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},hi(T)}function Ki(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return et(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?et(_,R):void 0}}(T,g)||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 et(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function _i(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ri(T,g){return Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Ri(T,g)}function Io(T){var g=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 _,R=fa(T);if(g){var C=fa(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return Xn(this,_)}}function Xn(T,g){if(g&&(hi(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return St(T)}function St(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function fa(T){return fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},fa(T)}var Ro=["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"],Br=function(T){(function(x,G){if(typeof G!="function"&&G!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(G&&G.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),Object.defineProperty(x,"prototype",{writable:!1}),G&&Ri(x,G)})(O,T);var g,_,R,C=Io(O);function O(x,G,Y){var K;(function(be,Re){if(!(be instanceof Re))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=oe.domContentLoadedEventEnd(),K.NAVIGATION_START=oe.navigationStart(),K.mux=x,K.id=G,(Y=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(be){return be}},Y)).data=Y.data||{},Y.data.property_key&&(Y.data.env_key=Y.data.property_key,delete Y.data.property_key),we.setLevel(Y.debug?"debug":"warn"),K.getPlayheadTime=Y.getPlayheadTime,K.getStateData=Y.getStateData||function(){return{}},K.getAdData=Y.getAdData||function(){},K.minimumRebufferDuration=Y.minimumRebufferDuration,K.sustainedRebufferThreshold=Y.sustainedRebufferThreshold,K.playbackHeartbeatTime=Y.playbackHeartbeatTime,K.disableRebufferTracking=Y.disableRebufferTracking,K.disableRebufferTracking&&K.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."),K.disablePlayheadRebufferTracking=Y.disablePlayheadRebufferTracking,K.errorTranslator=Y.errorTranslator,K.playbackEventDispatcher=new Nd(x,Y.data.env_key,Y),K.data={player_instance_id:Q(),mux_sample_rate:Y.sampleRate,beacon_domain:Y.beaconCollectionDomain?Y.beaconCollectionDomain:Y.beaconDomain},K.data.view_sequence_number=1,K.data.player_sequence_number=1,K.oldEmit=K.emit,K.emit=function(be,Re){Re=Object.assign({viewer_time:this.mux.utils.now()},Re),this.oldEmit(be,Re)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(St(K));K.on("viewinit",function(be,Re){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Re),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var Oe=function(be){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",be)}.bind(St(K));if(K.on("videochange",function(be,Re){Oe(Re)}),K.on("programchange",function(be,Re){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."),Oe(Object.assign(Re,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(be,Re){this.currentFragmentPDT=Re.currentFragmentPDT,this.currentFragmentStart=Re.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var ye=function(){var be=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",be&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",ye,!1);var Se=function(be){be.persisted||K.destroy()};window.addEventListener("pagehide",Se,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",ye),window.removeEventListener("pagehide",Se)})}return K.on("playerready",function(be,Re){Object.assign(this.data,Re)}),Ro.forEach(function(be){K.on(be,function(Re,Ge){be.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,Ge),this._sanitizeData()}),K.on("after"+be,function(){(be!=="error"||this.errorTracker.viewErrored)&&this.send(be)})}),K.on("viewend",function(be,Re){Object.assign(K.data,Re)}),K.one("playerready",function(be){var Re=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Re-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}),K.longResumeTracker=new mr(St(K)),K.errorTracker=new je(St(K)),new Fe(St(K)),K.seekingTracker=new Dd(St(K)),K.playheadTime=new ut(St(K)),K.playbackHeartbeat=new _t(St(K)),new Id(St(K)),K.watchTimeTracker=new ui(St(K)),new Xi(St(K)),K.adTracker=new Ii(St(K)),new so(St(K)),new Li(St(K)),new Ya(St(K)),new fo(St(K)),new Lo(St(K)),Y.hlsjs&&K.addHLSJS(Y),Y.dashjs&&K.addDashJS(Y),K.emit("viewinit",Y.data),K}return g=O,_=[{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(x){if(this.data.view_id){var G=Object.assign({},this.data);if(G.video_source_is_live===void 0&&(G.player_source_duration===1/0||G.video_source_duration===1/0?G.video_source_is_live=!0:(G.player_source_duration>0||G.video_source_duration>0)&&(G.video_source_is_live=!1)),G.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(Oe){G[Oe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var Y=Ki(dt(G.video_source_url),2),K=Y[0],Z=Y[1];G.video_source_domain=Z,G.video_source_hostname=K}delete G.ad_request_id,this.playbackEventDispatcher.send(x,G),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),x==="viewend"&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var x=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(G){var Y=parseInt(x.data[G],10);x.data[G]=isNaN(Y)?void 0:Y}),["player_source_url","video_source_url"].forEach(function(G){if(x.data[G]){var Y=x.data[G].toLowerCase();Y.indexOf("data:")!==0&&Y.indexOf("blob:")!==0||(x.data[G]="MSE style URL")}})}},{key:"_resetVideoData",value:function(x,G){var Y=this;Object.keys(this.data).forEach(function(K){K.indexOf("video_")===0&&delete Y.data[K]})}},{key:"_resetViewData",value:function(){var x=this;Object.keys(this.data).forEach(function(G){G.indexOf("view_")===0&&delete x.data[G]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(x,G){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var x=this,G=this.data.view_id=Q(),Y=function(){G===x.data.view_id&&w(x.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",Y):Y()}},{key:"_restartHeartBeat",value:function(){var x=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){x.data.player_is_paused||x.emit("hb")},1e4))}},{key:"addHLSJS",value:function(x){x.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=x.hlsjs,function(G,Y,K){var Z=arguments.length>4?arguments[4]:void 0,Oe=G.log,ye=G.utils.secondsToMs,Se=function(Ze){var de,ce=parseInt(Z.version);return ce===1&&Ze.programDateTime!==null&&(de=Ze.programDateTime),ce===0&&Ze.pdt!==null&&(de=Ze.pdt),de};if(oe.exists()){var be=function(Ze,de){return G.emit(Y,Ze,de)},Re=function(Ze,de){var ce=de.levels,he=de.audioTracks,Ne=de.url,Ve=de.stats,ft=de.networkDetails,Zt=de.sessionData,wt={},qt={};ce.forEach(function(Le,gr){wt[gr]={width:Le.width,height:Le.height,bitrate:Le.bitrate,attrs:Le.attrs}}),he.forEach(function(Le,gr){qt[gr]={name:Le.name,language:Le.lang,bitrate:Le.bitrate}});var Lt=ri(Ve),It=Lt.bytesLoaded,Di=Lt.requestStart,_a=Lt.responseStart,Rt=Lt.responseEnd;be("requestcompleted",Je(Je({},tt(Zt)),{},{request_event_type:Ze,request_bytes_loaded:It,request_start:Di,request_response_start:_a,request_response_end:Rt,request_type:"manifest",request_hostname:st(Ne),request_response_headers:Ht(ft),request_rendition_lists:{media:wt,audio:qt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,Re);var Ge=function(Ze,de){var ce=de.details,he=de.level,Ne=de.networkDetails,Ve=de.stats,ft=ri(Ve),Zt=ft.bytesLoaded,wt=ft.requestStart,qt=ft.responseStart,Lt=ft.responseEnd,It=ce.fragments[ce.fragments.length-1],Di=Se(It)+ye(It.duration);be("requestcompleted",{request_event_type:Ze,request_bytes_loaded:Zt,request_start:wt,request_response_start:qt,request_response_end:Lt,request_current_level:he,request_type:"manifest",request_hostname:st(ce.url),request_response_headers:Ht(Ne),video_holdback:ce.holdBack&&ye(ce.holdBack),video_part_holdback:ce.partHoldBack&&ye(ce.partHoldBack),video_part_target_duration:ce.partTarget&&ye(ce.partTarget),video_target_duration:ce.targetduration&&ye(ce.targetduration),video_source_is_live:ce.live,player_manifest_newest_program_time:isNaN(Di)?void 0:Di})};K.on(Z.Events.LEVEL_LOADED,Ge);var kt=function(Ze,de){var ce=de.details,he=de.networkDetails,Ne=de.stats,Ve=ri(Ne),ft=Ve.bytesLoaded,Zt=Ve.requestStart,wt=Ve.responseStart,qt=Ve.responseEnd;be("requestcompleted",{request_event_type:Ze,request_bytes_loaded:ft,request_start:Zt,request_response_start:wt,request_response_end:qt,request_type:"manifest",request_hostname:st(ce.url),request_response_headers:Ht(he)})};K.on(Z.Events.AUDIO_TRACK_LOADED,kt);var Pt=function(Ze,de){var ce=de.stats,he=de.networkDetails,Ne=de.frag;ce=ce||Ne.stats;var Ve=ri(ce),ft=Ve.bytesLoaded,Zt=Ve.requestStart,wt=Ve.responseStart,qt=Ve.responseEnd,Lt=he?Ht(he):void 0,It={request_event_type:Ze,request_bytes_loaded:ft,request_start:Zt,request_response_start:wt,request_response_end:qt,request_hostname:he?st(he.responseURL):void 0,request_id:Lt?$e(Lt):void 0,request_response_headers:Lt,request_media_duration:Ne.duration,request_url:he==null?void 0:he.responseURL};Ne.type==="main"?(It.request_type="media",It.request_current_level=Ne.level,It.request_video_width=(K.levels[Ne.level]||{}).width,It.request_video_height=(K.levels[Ne.level]||{}).height,It.request_labeled_bitrate=(K.levels[Ne.level]||{}).bitrate):It.request_type=Ne.type,be("requestcompleted",It)};K.on(Z.Events.FRAG_LOADED,Pt);var Wt=function(Ze,de){var ce=de.frag,he=ce.start,Ne={currentFragmentPDT:Se(ce),currentFragmentStart:ye(he)};be("fragmentchange",Ne)};K.on(Z.Events.FRAG_CHANGED,Wt);var ni=function(Ze,de){var ce=de.type,he=de.details,Ne=de.response,Ve=de.fatal,ft=de.frag,Zt=de.networkDetails,wt=(ft==null?void 0:ft.url)||de.url||"",qt=Zt?Ht(Zt):void 0;if(he!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&he!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&he!==Z.ErrorDetails.FRAG_LOAD_ERROR&&he!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&he!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&he!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&he!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&he!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&he!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&he!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&he!==Z.ErrorDetails.KEY_LOAD_ERROR&&he!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||be("requestfailed",{request_error:he,request_url:wt,request_hostname:st(wt),request_id:qt?$e(qt):void 0,request_type:he===Z.ErrorDetails.FRAG_LOAD_ERROR||he===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":he===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||he===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":he===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||he===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":he===Z.ErrorDetails.KEY_LOAD_ERROR||he===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ne==null?void 0:Ne.code,request_error_text:Ne==null?void 0:Ne.text}),Ve){var Lt,It="".concat(wt?"url: ".concat(wt,`
5
- `):"")+"".concat(Ne&&(Ne.code||Ne.text)?"response: ".concat(Ne.code,", ").concat(Ne.text,`
6
- `):"")+"".concat(de.reason?"failure reason: ".concat(de.reason,`
7
- `):"")+"".concat(de.level?"level: ".concat(de.level,`
8
- `):"")+"".concat(de.parent?"parent stream controller: ".concat(de.parent,`
9
- `):"")+"".concat(de.buffer?"buffer length: ".concat(de.buffer,`
10
- `):"")+"".concat(de.error?"error: ".concat(de.error,`
11
- `):"")+"".concat(de.event?"event: ".concat(de.event,`
12
- `):"")+"".concat(de.err?"error message: ".concat((Lt=de.err)===null||Lt===void 0?void 0:Lt.message,`
13
- `):"");be("error",{player_error_code:ce,player_error_message:he,player_error_context:It})}};K.on(Z.Events.ERROR,ni);var Be=function(Ze,de){var ce=de.frag,he=ce&&ce._url||"";be("requestcanceled",{request_event_type:Ze,request_url:he,request_type:"media",request_hostname:st(he)})};K.on(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Be);var yt=function(Ze,de){var ce=de.level,he=K.levels[ce];if(he&&he.attrs&&he.attrs.BANDWIDTH){var Ne,Ve=he.attrs.BANDWIDTH,ft=parseFloat(he.attrs["FRAME-RATE"]);isNaN(ft)||(Ne=ft),Ve?be("renditionchange",{video_source_fps:Ne,video_source_bitrate:Ve,video_source_width:he.width,video_source_height:he.height,video_source_rendition_name:he.name,video_source_codec:he==null?void 0:he.videoCodec}):Oe.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};K.on(Z.Events.LEVEL_SWITCHED,yt),K._stopMuxMonitor=function(){K.off(Z.Events.MANIFEST_LOADED,Re),K.off(Z.Events.LEVEL_LOADED,Ge),K.off(Z.Events.AUDIO_TRACK_LOADED,kt),K.off(Z.Events.FRAG_LOADED,Pt),K.off(Z.Events.FRAG_CHANGED,Wt),K.off(Z.Events.ERROR,ni),K.off(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Be),K.off(Z.Events.LEVEL_SWITCHED,yt),K.off(Z.Events.DESTROYING,K._stopMuxMonitor),delete K._stopMuxMonitor},K.on(Z.Events.DESTROYING,K._stopMuxMonitor)}else Oe.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,x.hlsjs,{},x.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var x;this.hlsjs&&((x=this.hlsjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(x){x.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=x.dashjs,function(G,Y,K){var Z=G.log;if(K&&K.on){var Oe=function(Be,yt){return G.emit(Y,Be,yt)},ye=function(Be){var yt=Be.type,Ze=(Be.data||{}).url;Oe("requestcompleted",{request_event_type:yt,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:st(Ze),request_url:Ze})};K.on("manifestLoaded",ye);var Se={},be=function(Be){var yt=Be.type,Ze=Be.fragmentModel,de=(Be.chunk||{}).mediaInfo||{},ce=de.type,he=de.bitrateList,Ne={};(he=he||[]).forEach(function(Rt,Le){Ne[Le]={},Ne[Le].width=Rt.width,Ne[Le].height=Rt.height,Ne[Le].bitrate=Rt.bandwidth,Ne[Le].attrs={}}),ce==="video"?Se.video=Ne:ce==="audio"?Se.audio=Ne:Se.media=Ne;var Ve=xt(Ze,K),ft=Ve.requestStart,Zt=Ve.requestResponseStart,wt=Ve.requestResponseEnd,qt=Ve.requestResponseHeaders,Lt=Ve.requestMediaDuration,It=Ve.requestHostname,Di=Ve.requestUrl,_a=Ve.requestId;Oe("requestcompleted",{request_event_type:yt,request_start:ft,request_response_start:Zt,request_response_end:wt,request_bytes_loaded:-1,request_type:ce+"_init",request_response_headers:qt,request_hostname:It,request_id:_a,request_url:Di,request_media_duration:Lt,request_rendition_lists:Se})};K.on("initFragmentLoaded",be);var Re=function(Be){var yt=Be.type,Ze=Be.fragmentModel,de=Be.chunk||{},ce=de.mediaInfo,he=de.start,Ne=(ce||{}).type,Ve=xt(Ze,K),ft=Ve.requestStart,Zt=Ve.requestResponseStart,wt=Ve.requestResponseEnd,qt=Ve.requestBytesLoaded,Lt=Ve.requestResponseHeaders,It=Ve.requestMediaDuration,Di=Ve.requestHostname,_a=Ve.requestUrl,Rt=Ve.requestId,Le=ht(Ne,K),gr=Le.currentLevel,Hr=Le.renditionWidth,Gr=Le.renditionHeight,Ta=Le.renditionBitrate;Oe("requestcompleted",{request_event_type:yt,request_start:ft,request_response_start:Zt,request_response_end:wt,request_bytes_loaded:qt,request_type:Ne,request_response_headers:Lt,request_hostname:Di,request_id:Rt,request_url:_a,request_media_start_time:he,request_media_duration:It,request_current_level:gr,request_labeled_bitrate:Ta,request_video_width:Hr,request_video_height:Gr})};K.on("mediaFragmentLoaded",Re);var Ge={video:void 0,audio:void 0,totalBitrate:void 0},kt=function(){if(Ge.video&&typeof Ge.video.bitrate=="number"){if(Ge.video.width&&Ge.video.height){var Be=Ge.video.bitrate;return Ge.audio&&typeof Ge.audio.bitrate=="number"&&(Be+=Ge.audio.bitrate),Be!==Ge.totalBitrate?(Ge.totalBitrate=Be,{video_source_bitrate:Be,video_source_height:Ge.video.height,video_source_width:Ge.video.width,video_source_codec:Tt(Ge.video.codec)}):void 0}Z.warn("have bitrate info for video but missing width/height")}},Pt=function(Be,yt,Ze){if(typeof Be.newQuality=="number"){var de=Be.mediaType;if(de==="audio"||de==="video"){var ce=K.getBitrateInfoListFor(de).find(function(Ne){return Ne.qualityIndex===Be.newQuality});if(ce&&typeof ce.bitrate=="number"){Ge[de]=Qt(Qt({},ce),{},{codec:K.getCurrentTrackFor(de).codec});var he=kt();he&&Oe("renditionchange",he)}else Z.warn("missing bitrate info for ".concat(de))}}else Z.warn("missing evt.newQuality in qualityChangeRendered event",Be)};K.on("qualityChangeRendered",Pt);var Wt=function(Be){var yt=Be.request,Ze=Be.mediaType;Oe("requestcanceled",{request_event_type:(yt=yt||{}).type+"_"+yt.action,request_url:yt.url,request_type:Ze,request_hostname:st(yt.url)})};K.on("fragmentLoadingAbandoned",Wt);var ni=function(Be){var yt,Ze,de=Be.error,ce=(de==null||(yt=de.data)===null||yt===void 0?void 0:yt.request)||{},he=(de==null||(Ze=de.data)===null||Ze===void 0?void 0:Ze.response)||{};(de==null?void 0:de.code)===27&&Oe("requestfailed",{request_error:ce.type+"_"+ce.action,request_url:ce.url,request_hostname:st(ce.url),request_type:ce.mediaType,request_error_code:he.status,request_error_text:he.statusText});var Ne="".concat(ce!=null&&ce.url?"url: ".concat(ce.url,`
14
- `):"")+"".concat(he!=null&&he.status||he!=null&&he.statusText?"response: ".concat(he==null?void 0:he.status,", ").concat(he==null?void 0:he.statusText,`
15
- `):"");Oe("error",{player_error_code:de==null?void 0:de.code,player_error_message:de==null?void 0:de.message,player_error_context:Ne})};K.on("error",ni),K._stopMuxMonitor=function(){K.off("manifestLoaded",ye),K.off("initFragmentLoaded",be),K.off("mediaFragmentLoaded",Re),K.off("qualityChangeRendered",Pt),K.off("error",ni),K.off("fragmentLoadingAbandoned",Wt),delete K._stopMuxMonitor}}else Z.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,x.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var x;this.dashjs&&((x=this.dashjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.dashjs=void 0)}}],_&&_i(g.prototype,_),R&&_i(g,R),Object.defineProperty(g,"prototype",{writable:!1}),O}(rt),Zn=Br,ma=M(153),pa=M.n(ma);function pr(T){return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},pr(T)}function Qa(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return va(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?va(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function va(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var Ji,Fd=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Ud={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};F()&&F().WeakMap&&(Ji=new WeakMap);var Jn="#EXT-X-TARGETDURATION",es="#EXT-X-PART-INF",Bd="#EXT-X-SERVER-CONTROL",Hd="#EXTINF",Do="#EXT-X-PROGRAM-DATE-TIME",ga="#EXT-X-VERSION",ts="#EXT-X-SESSION-DATA",ya=function(T){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(T),this.manifest};ya.prototype.process=function(T){var g;for(this.buffer+=T,g=this.buffer.indexOf(`
1
+ var Xg=Object.create;var Lf=Object.defineProperty;var Zg=Object.getOwnPropertyDescriptor;var Jg=Object.getOwnPropertyNames;var eE=Object.getPrototypeOf,tE=Object.prototype.hasOwnProperty;var If=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var iE=(n,r,l,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let v of Jg(r))!tE.call(n,v)&&v!==l&&Lf(n,v,{get:()=>r[v],enumerable:!(m=Zg(r,v))||m.enumerable});return n};var Rf=(n,r,l)=>(l=n!=null?Xg(eE(n)):{},iE(r||!n||!n.__esModule?Lf(l,"default",{value:n,enumerable:!0}):l,n));var Id=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)};var ot=(n,r,l)=>(Id(n,r,"read from private field"),l?l.call(n):r.get(n)),Bt=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Gi=(n,r,l,m)=>(Id(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l);var Qt=(n,r,l)=>(Id(n,r,"access private method"),l);var pp=If((su,Vc)=>{(function(){var n,r;n=this,r=function(){return function(){var l={80:function(y,I,M){y.exports=M(728).default},728:function(y,I,M){"use strict";M.d(I,{default:function(){return qo}});var B=M(48),H=M.n(B),z=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(T){var g=16*Math.random()|0;return(T==="x"?g:3&g|8).toString(16)})},J=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},ee=function(T){return T&&T.nodeName!==void 0?(T.muxId||(T.muxId=T.id||J()),T.muxId):T},le=function(T){var g;T&&T.nodeName!==void 0?T=ee(g=T):g=document.querySelector(T);var _=g&&g.nodeName?g.nodeName.toLowerCase():"";return[g,T,_]},me=M(640),_e=M.n(me),ge=_e().methodFactory;_e().methodFactory=function(T,g,_){var R=ge(T,g,_);return function(){for(var C=["[mux]"],O=0;O<arguments.length;O++)C.push(arguments[O]);R.apply(void 0,C)}},_e().setLevel(_e().getLevel());var ye=_e();function Ee(){return(H().doNotTrack||H().navigator&&H().navigator.doNotTrack)==="1"}var de={now:function(){var T=H().performance,g=T&&T.timing,_=g&&g.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},Be=function(T){return Ge(T)[0]},Ge=function(T){if(typeof T!="string"||T==="")return["localhost"];var g,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(g=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,g]},re={exists:function(){var T=H().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=H().performance,g=T&&T.timing;return g&&g.domContentLoadedEventEnd},navigationStart:function(){var T=H().performance,g=T&&T.timing;return g&&g.navigationStart}};function k(T,g,_){_=_===void 0?1:_,T[g]=T[g]||0,T[g]+=_}var se=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],W=["x-cdn","content-type"].concat(se);function Se(T){var g={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&(W.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(g[C]=R.join(": "))}}),g}function Xe(T){if(T){var g=se.find(function(_){return T[_]!==void 0});return g?T[g]:void 0}}var at=function(T){var g={};for(var _ in T){var R=T[_];R["DATA-ID"].search("io.litix.data.")!==-1&&(g[R["DATA-ID"].replace("io.litix.data.","")]=R.VALUE)}return g};function jt(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function it(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?jt(Object(_),!0).forEach(function(R){U(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):jt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function U(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var di=function(T){if(!T)return{};var g=re.navigationStart(),_=T.loading,R=_?_.start:T.trequest,C=_?_.first:T.tfirst,O=_?_.end:T.tload;return{bytesLoaded:T.total,requestStart:Math.round(g+R),responseStart:Math.round(g+C),responseEnd:Math.round(g+O)}},zt=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Se(T.getAllResponseHeaders())};function nt(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function ri(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?nt(Object(_),!0).forEach(function(R){$e(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):nt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function $e(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var Gt=function(T,g){if(!T||typeof T.getRequests!="function")return{};var _=T.getRequests({state:"executed"});if(_.length===0)return{};var R,C=_[_.length-1],O=Be(C.url),x=C.url,G=C.bytesLoaded,$=new Date(C.requestStartDate).getTime(),K=new Date(C.firstByteDate).getTime(),Z=new Date(C.requestEndDate).getTime(),Fe=isNaN(C.duration)?0:C.duration,Te=typeof g.getMetricsFor=="function"?g.getMetricsFor(C.mediaType).HttpList:g.getDashMetrics().getHttpRequests(C.mediaType);return Te.length>0&&(R=Se(Te[Te.length-1]._responseHeaders||"")),{requestStart:$,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:Fe,requestHostname:O,requestUrl:x,requestId:R?Xe(R):void 0}},gt=function(T,g){var _=g.getQualityFor(T),R=g.getCurrentTrackFor(T).bitrateList;return R?{currentLevel:_,renditionWidth:R[_].width||null,renditionHeight:R[_].height||null,renditionBitrate:R[_].bandwidth}:{}},Ct=function(T){var g;return(g=T.match(/.*codecs\*?="(.*)"/))===null||g===void 0?void 0:g[1]};function tr(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var te=0,ke=function(){function T(){(function(C,O){if(!(C instanceof O))throw new TypeError("Cannot call a class as a function")})(this,T)}var g,_,R;return g=T,_=[{key:"on",value:function(C,O,x){return O._eventEmitterGuid=O._eventEmitterGuid||++te,this._listeners=this._listeners||{},this._listeners[C]=this._listeners[C]||[],x&&(O=O.bind(x)),this._listeners[C].push(O),O}},{key:"off",value:function(C,O){var x=this._listeners&&this._listeners[C];x&&x.forEach(function(G,$){G._eventEmitterGuid===O._eventEmitterGuid&&x.splice($,1)})}},{key:"one",value:function(C,O,x){var G=this;O._eventEmitterGuid=O._eventEmitterGuid||++te;var $=function K(){G.off(C,K),O.apply(x||this,arguments)};$._eventEmitterGuid=O._eventEmitterGuid,this.on(C,$)}},{key:"emit",value:function(C,O){var x=this;if(this._listeners){O=O||{};var G=this._listeners["before*"]||[],$=this._listeners[C]||[],K=this._listeners["after"+C]||[],Z=function(Fe,Te){(Fe=Fe.slice()).forEach(function(Re){Re.call(x,{type:C},Te)})};Z(G,O),Z($,O),Z(K,O)}}}],_&&tr(g.prototype,_),R&&tr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),st=ke;function wt(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Rt=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,C.on("playing",function(){O._playheadShouldBeProgressing=!0}),C.on("play",this._startPlaybackHeartbeatInterval.bind(this)),C.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),C.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),C.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),C.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("seeked",function(){C.data.player_is_paused?O._stopPlaybackHeartbeatInterval():O._startPlaybackHeartbeatInterval()}),C.on("timeupdate",function(){O._playbackHeartbeatInterval!==null&&C.emit("playbackheartbeat")}),C.on("devicesleep",function(x,G){O._playbackHeartbeatInterval!==null&&(H().clearInterval(O._playbackHeartbeatInterval),C.emit("playbackheartbeatend",{viewer_time:G.viewer_time}),O._playbackHeartbeatInterval=null)})}var g,_,R;return g=T,(_=[{key:"_startPlaybackHeartbeatInterval",value:function(){var C=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=H().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(H().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&wt(g.prototype,_),R&&wt(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ci(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function $i(T,g,_){return g&&ci(T.prototype,g),_&&ci(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Ze=$i(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_.viewErrored=!1}),g.on("error",function(R,C){try{var O=g.errorTranslator({player_error_code:C.player_error_code,player_error_message:C.player_error_message,player_error_context:C.player_error_context});O?(g.data.player_error_code=O.player_error_code||C.player_error_code,g.data.player_error_message=O.player_error_message||C.player_error_message,g.data.player_error_context=O.player_error_context||C.player_error_context,_.viewErrored=!0):(delete g.data.player_error_code,delete g.data.player_error_message,delete g.data.player_error_context)}catch(x){g.mux.log.warn("Exception in error translator callback.",x),_.viewErrored=!0}})});function vi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var gi=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._watchTimeTrackerLastCheckedTime=null,C.on("playbackheartbeat",this._updateWatchTime.bind(this)),C.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updateWatchTime",value:function(C,O){var x=O.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=x),k(this.pm.data,"view_watch_time",x-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=x}},{key:"_clearWatchTimeState",value:function(C,O){this._updateWatchTime(C,O),this._watchTimeTrackerLastCheckedTime=null}}])&&vi(g.prototype,_),R&&vi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ji(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ir=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackTimeTrackerLastPlayheadPosition=-1,C.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),C.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),C.on("seeking",this._clearPlaybackTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updatePlaybackTime",value:function(){var C=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&C>this._playbackTimeTrackerLastPlayheadPosition){var O=C-this._playbackTimeTrackerLastPlayheadPosition;O<=1e3&&k(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&ji(g.prototype,_),R&&ji(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ei(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ct=function(){function T(C){(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C;var O=this._updatePlayheadTime.bind(this);C.on("playbackheartbeat",O),C.on("playbackheartbeatend",O),C.on("timeupdate",O),C.on("destroy",function(){C.off("timeupdate",O)})}var g,_,R;return g=T,(_=[{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(C,O){var x=this,G=function(){x.pm.currentFragmentPDT&&x.pm.currentFragmentStart&&(x.pm.data.player_program_time=x.pm.currentFragmentPDT+x.pm.data.player_playhead_time-x.pm.currentFragmentStart)};if(O&&O.player_playhead_time)this.pm.data.player_playhead_time=O.player_playhead_time,G(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var $=this.pm.getPlayheadTime();$!==void 0&&(this.pm.data.player_playhead_time=$,G(),this._updateMaxPlayheadPosition())}}}])&&Ei(g.prototype,_),R&&Ei(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function rr(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function gr(T,g,_){return g&&rr(T.prototype,g),_&&rr(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var $r=3e5,xi=gr(function T(g){if(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")}(this,T),!g.disableRebufferTracking){var _,R=function(O,x){C(x),_=void 0},C=function(O){if(_){var x=O.viewer_time-_;k(g.data,"view_rebuffer_duration",x),_=O.viewer_time,g.data.view_rebuffer_duration>$r&&(g.emit("viewend"),g.send("viewend"),g.mux.log.warn("Ending view after rebuffering for longer than ".concat($r,"ms, future events will be ignored unless a programchange or videochange occurs.")))}g.data.view_watch_time>=0&&g.data.view_rebuffer_count>0&&(g.data.view_rebuffer_frequency=g.data.view_rebuffer_count/g.data.view_watch_time,g.data.view_rebuffer_percentage=g.data.view_rebuffer_duration/g.data.view_watch_time)};g.on("playbackheartbeat",function(O,x){return C(x)}),g.on("rebufferstart",function(O,x){_||(k(g.data,"view_rebuffer_count",1),_=x.viewer_time,g.one("rebufferend",R))}),g.on("viewinit",function(){_=void 0,g.off("rebufferend",R)})}});function Er(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var es=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.disableRebufferTracking||C.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,C.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),C.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),C.on("seeking",function(){O._cleanupRebufferTracker(null,{viewer_time:de.now()})}))}var g,_,R;return g=T,_=[{key:"_checkIfRebuffering",value:function(C,O){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(C,O);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var x=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&x>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=O.viewer_time}else this._cleanupRebufferTracker(C,O,!0);else this._prepareRebufferTrackerState(O.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(C){this._lastCheckedTime=C,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=C}},{key:"_cleanupRebufferTracker",value:function(C,O){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:O.viewer_time});else{if(this._lastCheckedTime===null)return;var G=this.pm.data.player_playhead_time-this._lastPlayheadTime,$=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&G>0&&$-G>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+$-G}))}x?this._prepareRebufferTrackerState(O.viewer_time):this._clearRebufferTrackerState()}}],_&&Er(g.prototype,_),R&&Er(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),vo=es;function ga(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var an=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){var x=C.data,G=x.view_id;if(!x.view_program_changed){var $=function(K,Z){var Fe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(Fe||de.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(Fe||de.now(),G)};C.one("playing",$),C.one("adplaying",$),C.one("viewend",function(){C.off("playing",$),C.off("adplaying",$)})}})}var g,_,R;return g=T,(_=[{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(C,O){O===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:C}),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))}}])&&ga(g.prototype,_),R&&ga(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function go(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Eo(T,g,_){return g&&go(T.prototype,g),_&&go(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Bu=Eo(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(R){g.on(R,function(){if(_._lastPlayheadPosition>=0&&g.data.player_playhead_time>=0&&_._lastPlayerWidth>=0&&_._lastSourceWidth>0&&_._lastPlayerHeight>=0&&_._lastSourceHeight>0){var C=g.data.player_playhead_time-_._lastPlayheadPosition;if(C<0)return void(_._lastPlayheadPosition=-1);var O=Math.min(_._lastPlayerWidth/_._lastSourceWidth,_._lastPlayerHeight/_._lastSourceHeight),x=Math.max(0,O-1),G=Math.max(0,1-O);g.data.view_max_upscale_percentage=Math.max(g.data.view_max_upscale_percentage||0,x),g.data.view_max_downscale_percentage=Math.max(g.data.view_max_downscale_percentage||0,G),k(g.data,"view_total_content_playback_time",C),k(g.data,"view_total_upscaling",x*C),k(g.data,"view_total_downscaling",G*C)}_._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(R){g.on(R,function(){_._lastPlayheadPosition=g.data.player_playhead_time,_._lastPlayerWidth=g.data.player_width,_._lastPlayerHeight=g.data.player_height,_._lastSourceWidth=g.data.video_source_width,_._lastSourceHeight=g.data.video_source_height})})});function ts(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Hu(T,g,_){return g&&ts(T.prototype,g),_&&ts(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Gu=Hu(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),this.isSeeking=!1,g.on("seeking",function(R,C){Object.assign(g.data,C),_._lastSeekingTime=de.now(),_.isSeeking===!1&&(_.isSeeking=!0,g.send("seeking"))}),g.on("seeked",function(){_.isSeeking=!1;var R=_._lastSeekingTime||de.now(),C=de.now()-R;k(g.data,"view_seek_count",1),k(g.data,"view_seek_duration",C);var O=g.data.view_max_seek_time||0;g.data.view_max_seek_time=Math.max(O,C)}),g.on("viewend",function(){_.isSeeking=!1})});function yo(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return bo(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?bo(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function bo(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function _o(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Li=function(T,g){T.push(g),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Vu=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Pi=function(){function T(C){var O=this;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){O.isAdBreak=!1,O._currentAdRequestNumber=0,O._currentAdResponseNumber=0,O._adRequests=[],O._adResponses=[],O._adHasPlayed=!1,O._wouldBeNewAdPlay=!0,O._prerollPlayTime=void 0}),Vu.forEach(function(G){return C.on(G,O._updateAdData.bind(O))});var x=function(){O.isAdBreak=!1};C.on("adbreakstart",function(){O.isAdBreak=!0}),C.on("play",x),C.on("playing",x),C.on("viewend",x),C.on("adrequest",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdRequestNumber++},$),Li(O._adRequests,$),k(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||k(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},$),Li(O._adResponses,$);var K=O.findAdRequest($.ad_request_id);K&&k(C.data,"view_ad_request_time",Math.max(0,$.viewer_time-K.viewer_time))}),C.on("adplay",function(G,$){O._adHasPlayed=!0,O._wouldBeNewAdPlay&&(O._wouldBeNewAdPlay=!1,k(C.data,"view_ad_played_count")),O.inPrerollPosition()&&!C.data.view_preroll_played&&(C.data.view_preroll_played=!0,O._adRequests.length>0&&(C.data.view_preroll_request_time=Math.max(0,$.viewer_time-O._adRequests[0].viewer_time)),C.data.view_start&&(C.data.view_startup_preroll_request_time=Math.max(0,$.viewer_time-C.data.view_start)),O._prerollPlayTime=$.viewer_time)}),C.on("adplaying",function(G,$){O.inPrerollPosition()&&C.data.view_preroll_load_time===void 0&&O._prerollPlayTime!==void 0&&(C.data.view_preroll_load_time=$.viewer_time-O._prerollPlayTime,C.data.view_startup_preroll_load_time=$.viewer_time-O._prerollPlayTime)}),C.on("adended",function(){O._wouldBeNewAdPlay=!0}),C.on("aderror",function(){O._wouldBeNewAdPlay=!0})}var g,_,R;return g=T,(_=[{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(C){for(var O=0;O<this._adRequests.length;O++)if(this._adRequests[O].ad_request_id===C)return this._adRequests[O]}},{key:"_updateAdData",value:function(C,O){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&O.ad_tag_url){var x=yo(Ge(O.ad_tag_url),2),G=x[0],$=x[1];this.pm.data.view_preroll_ad_tag_domain=$,this.pm.data.view_preroll_ad_tag_hostname=G}if(!this.pm.data.view_preroll_ad_asset_hostname&&O.ad_asset_url){var K=yo(Ge(O.ad_asset_url),2),Z=K[0],Fe=K[1];this.pm.data.view_preroll_ad_asset_domain=Fe,this.pm.data.view_preroll_ad_asset_hostname=Z}}this.pm.data.ad_asset_url=O==null?void 0:O.ad_asset_url,this.pm.data.ad_tag_url=O==null?void 0:O.ad_tag_url,this.pm.data.ad_creative_id=O==null?void 0:O.ad_creative_id,this.pm.data.ad_id=O==null?void 0:O.ad_id,this.pm.data.ad_universal_id=O==null?void 0:O.ad_universal_id}}])&&_o(g.prototype,_),R&&_o(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ea(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ku(T,g,_){return g&&Ea(T.prototype,g),_&&Ea(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var To=Ku(function T(g){var _,R;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){g.disableRebufferTracking||_&&(k(g.data,"view_waiting_rebuffer_duration",de.now()-_),_=!1,H().clearInterval(R))},O=!1,x=function(){O=!1,C()};g.on("waiting",function(){O&&(g.disableRebufferTracking||(k(g.data,"view_waiting_rebuffer_count",1),_=de.now(),R=H().setInterval(function(){if(_){var G=de.now();k(g.data,"view_waiting_rebuffer_duration",G-_),_=G}},250)))}),g.on("playing",function(){C(),O=!0}),g.on("pause",x),g.on("seeking",x)});function Mt(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ao(T,g,_){return g&&Mt(T.prototype,g),_&&Mt(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var He=Ao(function T(g){var _=this;(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T);var R=function(){_.lastWallClockTime=de.now(),g.on("before*",C)},C=function(O){var x=de.now(),G=_.lastWallClockTime;_.lastWallClockTime=x,x-G>3e4&&(g.emit("devicesleep",{viewer_time:G}),Object.assign(g.data,{viewer_time:G}),g.send("devicesleep"),g.emit("devicewake",{viewer_time:x}),Object.assign(g.data,{viewer_time:x}),g.send("devicewake"))};g.one("playbackheartbeat",R),g.on("playbackheartbeatend",function(){g.off("before*",C),g.one("playbackheartbeat",R)})}),is=M(375),rs=M(655),Je=M.n(rs),So="muxData",as=function(){var T;try{T=is.parse(Je().get(So)||"")}catch{T={}}return T},ns=function(T){try{Je().set(So,is.stringify(T),{expires:7300})}catch{}},Wu=function(){var T=as();return T.mux_viewer_id=T.mux_viewer_id||z(),T.msn=T.msn||Math.random(),ns(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function yr(T,g){var _=g.beaconCollectionDomain,R=g.beaconDomain;if(_)return"https://"+_;var C=R||"litix.io";return(T=T||"inferred").match(/^[a-z0-9]+$/)?"https://"+T+"."+C:"https://img.litix.io/a.gif"}var ss=function(){var T;switch(ko()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},ko=function(){var T=H().navigator,g=T&&(T.connection||T.mozConnection||T.webkitConnection);return g&&g.type};ss.getConnectionFromAPI=ko;var wo=ss,Lo=ya({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"}),Io=ya({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",cl:"canceled",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",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",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 ya(T){var g={};for(var _ in T)T.hasOwnProperty(_)&&(g[T[_]]=_);return g}function ba(T){var g={},_={};return Object.keys(T).forEach(function(R){var C=!1;if(T.hasOwnProperty(R)&&T[R]!==void 0){var O=R.split("_"),x=O[0],G=Lo[x];G||(ye.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function($){$==="url"&&(C=!0),Io[$]?G+=Io[$]:Number($)&&Math.floor(Number($))===Number($)?G+=$:(ye.info("Data key word `"+$+"` not expected in "+R),G+="_"+$+"_")}),C?_[G]=T[R]:g[G]=T[R]}}),Object.assign(g,_)}var Ro={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},Do=["hb","requestcompleted","requestfailed","requestcanceled"],ai="https://img.litix.io",Ii=function(T){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||ai,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},Ro,g)};Ii.prototype.queueEvent=function(T,g){var _=Object.assign({},g);return(this._eventQueue.length<=this._options.maxQueueLength||T==="eventrateexceeded")&&(this._eventQueue.push(_),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},Ii.prototype.flushEvents=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];T&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},Ii.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),H().clearTimeout(this._sendTimeout)},Ii.prototype._clearBeaconQueue=function(){var T=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,g=this._eventQueue.slice(T);T>0&&Object.assign(g[g.length-1],ba({mux_view_message:"event queue truncated"}));var _=this._createPayload(g);Mo(this._beaconUrl,_,!0,function(){})},Ii.prototype._sendBeaconQueue=function(){var T=this;if(!this._postInFlight){var g=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var _=this._createPayload(g),R=de.now();Mo(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=g.concat(T._eventQueue),T._failureCount+=1,ye.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=de.now()-R,T._postInFlight=!1})}},Ii.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var T=Math.pow(2,this._failureCount-1);return(1+(T*=Math.random()))*this._options.baseTimeBetweenBeacons},Ii.prototype._startBeaconSending=function(){var T=this;H().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=H().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},Ii.prototype._createPayload=function(T){var g,_,R,C=this,O={transmission_timestamp:Math.round(de.now())};this._roundTripTime&&(O.rtt_ms=Math.round(this._roundTripTime));var x=function(){g=JSON.stringify({metadata:O,events:_||T}),R=g.length/1024},G=function(){return R<=C._options.maxPayloadKBSize};return x(),G()||(ye.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function($){return Do.indexOf($.e)===-1}),x()),G()||(ye.info("Payload size still too big ("+R+" kb). Cropping fields.."),_.forEach(function($){for(var K in $){var Z=$[K];typeof Z=="string"&&Z.length>51200&&($[K]=Z.substring(0,51200))}}),x()),g};var Co=function(T){return T.length<=57344},Mo=function(T,g,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,g))R();else if(H().fetch)H().fetch(T,{method:"POST",body:g,headers:{"Content-Type":"text/plain"},keepalive:Co(g)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(H().XMLHttpRequest){var C=new(H()).XMLHttpRequest;return C.onreadystatechange=function(){if(C.readyState===4)return R(null,C.status!==200?"error":void 0)},C.open("POST",T),C.setRequestHeader("Content-Type","text/plain"),void C.send(g)}R()}},nn=Ii;function qu(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return os(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?os(_,R):void 0}}(T,g)||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 os(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function sn(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function br(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?sn(Object(_),!0).forEach(function(R){on(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):sn(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function jr(T){return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},jr(T)}function Yu(T,g){if(!(T instanceof g))throw new TypeError("Cannot call a class as a function")}function ls(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function on(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var _a=["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"],xo=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse"],Po=["viewstart","error","ended","viewend"],$u=function(){function T(C,O){var x,G,$,K,Z,Fe,Te,Re,we,Ce,We,Pt,Vt,Zt,hi,Ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Yu(this,T),on(this,"previousBeaconData",null),on(this,"lastEventTime",0),on(this,"rateLimited",!1),this.mux=C,this.envKey=O,this.options=Ve,this.eventQueue=new nn(yr(this.envKey,this.options)),this.sampleRate=(x=this.options.sampleRate)!==null&&x!==void 0?x:1,this.disableCookies=(G=this.options.disableCookies)!==null&&G!==void 0&&G,this.respectDoNotTrack=($=this.options.respectDoNotTrack)!==null&&$!==void 0&&$,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:(K=this.options.platform)===null||K===void 0?void 0:K.name,viewer_application_version:(Z=this.options.platform)===null||Z===void 0?void 0:Z.version,viewer_application_engine:(Fe=this.options.platform)===null||Fe===void 0?void 0:Fe.layout,viewer_device_name:(Te=this.options.platform)===null||Te===void 0?void 0:Te.product,viewer_device_category:"",viewer_device_manufacturer:(Re=this.options.platform)===null||Re===void 0?void 0:Re.manufacturer,viewer_os_family:(we=this.options.platform)===null||we===void 0||(Ce=we.os)===null||Ce===void 0?void 0:Ce.family,viewer_os_architecture:(We=this.options.platform)===null||We===void 0||(Pt=We.os)===null||Pt===void 0?void 0:Pt.architecture,viewer_os_version:(Vt=this.options.platform)===null||Vt===void 0||(Zt=Vt.os)===null||Zt===void 0?void 0:Zt.version,viewer_connection_type:wo(),page_url:H()===null||H()===void 0||(hi=H().location)===null||hi===void 0?void 0:hi.href},this.viewerData=this.disableCookies?{}:Wu()}var g,_,R;return g=T,(_=[{key:"send",value:function(C,O){var x;if(C&&O!=null&&O.view_id){if(this.respectDoNotTrack&&Ee())return ye.info("Not sending `"+C+"` because Do Not Track is enabled");if(!O||jr(O)!=="object")return ye.error("A data object was expected in send() but was not provided");var G,$,K=this.disableCookies?{}:(G=as(),$=de.now(),G.session_start&&(G.sst=G.session_start,delete G.session_start),G.session_id&&(G.sid=G.session_id,delete G.session_id),G.session_expires&&(G.sex=G.session_expires,delete G.session_expires),(!G.sex||G.sex<$)&&(G.sid=z(),G.sst=$),G.sex=$+15e5,ns(G),{session_id:G.sid,session_start:G.sst,session_expires:G.sex}),Z=br(br(br(br(br({},this.pageLevelData),O),K),this.viewerData),{},{event:C,env_key:this.envKey});Z.user_id&&(Z.viewer_user_id=Z.user_id,delete Z.user_id);var Fe=((x=Z.mux_sample_number)!==null&&x!==void 0?x:0)>=this.sampleRate,Te=ba(this._deduplicateBeaconData(C,Z));if(this.lastEventTime=this.mux.utils.now(),Fe)return ye.info("Not sending event due to sample rate restriction",C,Z,Te);if(this.envKey||ye.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",C,Z,Te),!this.rateLimited){if(ye.info("Sending event",C,Z,Te),this.rateLimited=!this.eventQueue.queueEvent(C,Te),this.mux.WINDOW_UNLOADING&&C==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&C==="hb"?this.eventQueue.flushEvents(!0):Po.indexOf(C)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Z.event="eventrateexceeded",Te=ba(Z),this.eventQueue.queueEvent(Z.event,Te),ye.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(C,O){var x=this,G={},$=O.view_id;if($==="-1"||C==="viewstart"||C==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)G=br({},O),$&&(this.previousBeaconData=G),$&&C==="viewend"&&(this.previousBeaconData=null);else{var K=C.indexOf("request")===0;Object.entries(O).forEach(function(Z){var Fe=qu(Z,2),Te=Fe[0],Re=Fe[1];x.previousBeaconData&&(Re!==x.previousBeaconData[Te]||_a.indexOf(Te)>-1||x.objectHasChanged(K,Te,Re,x.previousBeaconData[Te])||x.eventRequiresKey(C,Te))&&(G[Te]=Re,x.previousBeaconData[Te]=Re)})}return G}},{key:"objectHasChanged",value:function(C,O,x,G){return!(!C||O.indexOf("request_")!==0||O!=="request_response_headers"&&jr(x)==="object"&&jr(G)==="object"&&Object.keys(x||{}).length===Object.keys(G||{}).length)}},{key:"eventRequiresKey",value:function(C,O){return C==="renditionchange"&&O.indexOf("video_source_")===0||!(O.indexOf("ad_id")!==0||!xo.includes(C))}}])&&ls(g.prototype,_),R&&ls(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function us(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Oo(T,g,_){return g&&us(T.prototype,g),_&&us(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var No=Oo(function T(g){(function(K,Z){if(!(K instanceof Z))throw new TypeError("Cannot call a class as a function")})(this,T);var _=0,R=0,C=0,O=0,x=0,G=0,$=0;g.on("requestcompleted",function(K,Z){var Fe,Te,Re=Z.request_start,we=Z.request_response_start,Ce=Z.request_response_end,We=Z.request_bytes_loaded;if(O++,we?(Fe=we-(Re!=null?Re:0),Te=(Ce!=null?Ce:0)-we):Te=(Ce!=null?Ce:0)-(Re!=null?Re:0),Te>0&&We&&We>0){var Pt=We/Te*8e3;x++,R+=We,C+=Te,g.data.view_min_request_throughput=Math.min(g.data.view_min_request_throughput||1/0,Pt),g.data.view_average_request_throughput=R/C*8e3,g.data.view_request_count=O,Fe>0&&(_+=Fe,g.data.view_max_request_latency=Math.max(g.data.view_max_request_latency||0,Fe),g.data.view_average_request_latency=_/x)}}),g.on("requestfailed",function(K,Z){O++,G++,g.data.view_request_count=O,g.data.view_request_failed_count=G}),g.on("requestcanceled",function(K,Z){O++,$++,g.data.view_request_count=O,g.data.view_request_canceled_count=$})});function ds(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function zr(T,g,_){return g&&ds(T.prototype,g),_&&ds(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var _r=zr(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("before*",function(R,C){var O=C.viewer_time,x=de.now(),G=_._lastEventTime;if(_._lastEventTime=x,G&&x-G>36e5){var $=Object.keys(g.data).reduce(function(K,Z){return Z.indexOf("video_")===0?Object.assign(K,function(Fe,Te,Re){return Te in Fe?Object.defineProperty(Fe,Te,{value:Re,enumerable:!0,configurable:!0,writable:!0}):Fe[Te]=Re,Fe}({},Z,g.data[Z])):K},{});g.mux.log.info("Received event after at least an hour inactivity, creating a new view"),g.emit("viewinit",Object.assign({viewer_time:O},$)),g.playbackHeartbeat._playheadShouldBeProgressing&&R.type!=="play"&&R.type!=="adbreakstart"&&(g.emit("play",{viewer_time:O}),R.type!=="playing"&&g.emit("playing",{viewer_time:O}))}})});function yi(T){return yi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},yi(T)}function zi(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return rt(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?rt(_,R):void 0}}(T,g)||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 rt(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function Ri(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Oi(T,g){return Oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Oi(T,g)}function Fo(T){var g=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 _,R=Ta(T);if(g){var C=Ta(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return cs(this,_)}}function cs(T,g){if(g&&(yi(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xt(T)}function xt(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function Ta(T){return Ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},Ta(T)}var Uo=["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"],Qr=function(T){(function(x,G){if(typeof G!="function"&&G!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(G&&G.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),Object.defineProperty(x,"prototype",{writable:!1}),G&&Oi(x,G)})(O,T);var g,_,R,C=Fo(O);function O(x,G,$){var K;(function(we,Ce){if(!(we instanceof Ce))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=re.domContentLoadedEventEnd(),K.NAVIGATION_START=re.navigationStart(),K.mux=x,K.id=G,($=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(we){return we}},$)).data=$.data||{},$.data.property_key&&($.data.env_key=$.data.property_key,delete $.data.property_key),ye.setLevel($.debug?"debug":"warn"),K.getPlayheadTime=$.getPlayheadTime,K.getStateData=$.getStateData||function(){return{}},K.getAdData=$.getAdData||function(){},K.minimumRebufferDuration=$.minimumRebufferDuration,K.sustainedRebufferThreshold=$.sustainedRebufferThreshold,K.playbackHeartbeatTime=$.playbackHeartbeatTime,K.disableRebufferTracking=$.disableRebufferTracking,K.disableRebufferTracking&&K.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."),K.disablePlayheadRebufferTracking=$.disablePlayheadRebufferTracking,K.errorTranslator=$.errorTranslator,K.playbackEventDispatcher=new $u(x,$.data.env_key,$),K.data={player_instance_id:z(),mux_sample_rate:$.sampleRate,beacon_domain:$.beaconCollectionDomain?$.beaconCollectionDomain:$.beaconDomain},K.data.view_sequence_number=1,K.data.player_sequence_number=1,K.oldEmit=K.emit,K.emit=function(we,Ce){Ce=Object.assign({viewer_time:this.mux.utils.now()},Ce),this.oldEmit(we,Ce)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(xt(K));K.on("viewinit",function(we,Ce){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Ce),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var Fe=function(we){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",we)}.bind(xt(K));if(K.on("videochange",function(we,Ce){Fe(Ce)}),K.on("programchange",function(we,Ce){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."),Fe(Object.assign(Ce,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(we,Ce){this.currentFragmentPDT=Ce.currentFragmentPDT,this.currentFragmentStart=Ce.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Te=function(){var we=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",we&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",Te,!1);var Re=function(we){we.persisted||K.destroy()};window.addEventListener("pagehide",Re,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",Te),window.removeEventListener("pagehide",Re)})}return K.on("playerready",function(we,Ce){Object.assign(this.data,Ce)}),Uo.forEach(function(we){K.on(we,function(Ce,We){we.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,We),this._sanitizeData()}),K.on("after"+we,function(){(we!=="error"||this.errorTracker.viewErrored)&&this.send(we)})}),K.on("viewend",function(we,Ce){Object.assign(K.data,Ce)}),K.one("playerready",function(we){var Ce=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Ce-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}),K.longResumeTracker=new _r(xt(K)),K.errorTracker=new Ze(xt(K)),new He(xt(K)),K.seekingTracker=new Gu(xt(K)),K.playheadTime=new ct(xt(K)),K.playbackHeartbeat=new Rt(xt(K)),new Bu(xt(K)),K.watchTimeTracker=new gi(xt(K)),new ir(xt(K)),K.adTracker=new Pi(xt(K)),new vo(xt(K)),new xi(xt(K)),new an(xt(K)),new To(xt(K)),new No(xt(K)),$.hlsjs&&K.addHLSJS($),$.dashjs&&K.addDashJS($),K.emit("viewinit",$.data),K}return g=O,_=[{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(x){if(this.data.view_id){var G=Object.assign({},this.data);if(G.video_source_is_live===void 0&&(G.player_source_duration===1/0||G.video_source_duration===1/0?G.video_source_is_live=!0:(G.player_source_duration>0||G.video_source_duration>0)&&(G.video_source_is_live=!1)),G.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(Fe){G[Fe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var $=zi(Ge(G.video_source_url),2),K=$[0],Z=$[1];G.video_source_domain=Z,G.video_source_hostname=K}delete G.ad_request_id,this.playbackEventDispatcher.send(x,G),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),x==="viewend"&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var x=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(G){var $=parseInt(x.data[G],10);x.data[G]=isNaN($)?void 0:$}),["player_source_url","video_source_url"].forEach(function(G){if(x.data[G]){var $=x.data[G].toLowerCase();$.indexOf("data:")!==0&&$.indexOf("blob:")!==0||(x.data[G]="MSE style URL")}})}},{key:"_resetVideoData",value:function(x,G){var $=this;Object.keys(this.data).forEach(function(K){K.indexOf("video_")===0&&delete $.data[K]})}},{key:"_resetViewData",value:function(){var x=this;Object.keys(this.data).forEach(function(G){G.indexOf("view_")===0&&delete x.data[G]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(x,G){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var x=this,G=this.data.view_id=z(),$=function(){G===x.data.view_id&&k(x.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",$):$()}},{key:"_restartHeartBeat",value:function(){var x=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){x.data.player_is_paused||x.emit("hb")},1e4))}},{key:"addHLSJS",value:function(x){x.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=x.hlsjs,function(G,$,K){var Z=arguments.length>4?arguments[4]:void 0,Fe=G.log,Te=G.utils.secondsToMs,Re=function(tt){var ue,he=parseInt(Z.version);return he===1&&tt.programDateTime!==null&&(ue=tt.programDateTime),he===0&&tt.pdt!==null&&(ue=tt.pdt),ue};if(re.exists()){var we=function(tt,ue){return G.emit($,tt,ue)},Ce=function(tt,ue){var he=ue.levels,fe=ue.audioTracks,Ue=ue.url,qe=ue.stats,Et=ue.networkDetails,ni=ue.sessionData,Ot={},Jt={};he.forEach(function(De,Sr){Ot[Sr]={width:De.width,height:De.height,bitrate:De.bitrate,attrs:De.attrs}}),fe.forEach(function(De,Sr){Jt[Sr]={name:De.name,language:De.lang,bitrate:De.bitrate}});var Nt=di(qe),Ft=Nt.bytesLoaded,Ni=Nt.requestStart,Da=Nt.responseStart,Ut=Nt.responseEnd;we("requestcompleted",it(it({},at(ni)),{},{request_event_type:tt,request_bytes_loaded:Ft,request_start:Ni,request_response_start:Da,request_response_end:Ut,request_type:"manifest",request_hostname:Be(Ue),request_response_headers:zt(Et),request_rendition_lists:{media:Ot,audio:Jt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,Ce);var We=function(tt,ue){var he=ue.details,fe=ue.level,Ue=ue.networkDetails,qe=ue.stats,Et=di(qe),ni=Et.bytesLoaded,Ot=Et.requestStart,Jt=Et.responseStart,Nt=Et.responseEnd,Ft=he.fragments[he.fragments.length-1],Ni=Re(Ft)+Te(Ft.duration);we("requestcompleted",{request_event_type:tt,request_bytes_loaded:ni,request_start:Ot,request_response_start:Jt,request_response_end:Nt,request_current_level:fe,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(Ue),video_holdback:he.holdBack&&Te(he.holdBack),video_part_holdback:he.partHoldBack&&Te(he.partHoldBack),video_part_target_duration:he.partTarget&&Te(he.partTarget),video_target_duration:he.targetduration&&Te(he.targetduration),video_source_is_live:he.live,player_manifest_newest_program_time:isNaN(Ni)?void 0:Ni})};K.on(Z.Events.LEVEL_LOADED,We);var Pt=function(tt,ue){var he=ue.details,fe=ue.networkDetails,Ue=ue.stats,qe=di(Ue),Et=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd;we("requestcompleted",{request_event_type:tt,request_bytes_loaded:Et,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(fe)})};K.on(Z.Events.AUDIO_TRACK_LOADED,Pt);var Vt=function(tt,ue){var he=ue.stats,fe=ue.networkDetails,Ue=ue.frag;he=he||Ue.stats;var qe=di(he),Et=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd,Nt=fe?zt(fe):void 0,Ft={request_event_type:tt,request_bytes_loaded:Et,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_hostname:fe?Be(fe.responseURL):void 0,request_id:Nt?Xe(Nt):void 0,request_response_headers:Nt,request_media_duration:Ue.duration,request_url:fe==null?void 0:fe.responseURL};Ue.type==="main"?(Ft.request_type="media",Ft.request_current_level=Ue.level,Ft.request_video_width=(K.levels[Ue.level]||{}).width,Ft.request_video_height=(K.levels[Ue.level]||{}).height,Ft.request_labeled_bitrate=(K.levels[Ue.level]||{}).bitrate):Ft.request_type=Ue.type,we("requestcompleted",Ft)};K.on(Z.Events.FRAG_LOADED,Vt);var Zt=function(tt,ue){var he=ue.frag,fe=he.start,Ue={currentFragmentPDT:Re(he),currentFragmentStart:Te(fe)};we("fragmentchange",Ue)};K.on(Z.Events.FRAG_CHANGED,Zt);var hi=function(tt,ue){var he=ue.type,fe=ue.details,Ue=ue.response,qe=ue.fatal,Et=ue.frag,ni=ue.networkDetails,Ot=(Et==null?void 0:Et.url)||ue.url||"",Jt=ni?zt(ni):void 0;if(fe!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&fe!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.FRAG_LOAD_ERROR&&fe!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&fe!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.KEY_LOAD_ERROR&&fe!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||we("requestfailed",{request_error:fe,request_url:Ot,request_hostname:Be(Ot),request_id:Jt?Xe(Jt):void 0,request_type:fe===Z.ErrorDetails.FRAG_LOAD_ERROR||fe===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":fe===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||fe===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":fe===Z.ErrorDetails.KEY_LOAD_ERROR||fe===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ue==null?void 0:Ue.code,request_error_text:Ue==null?void 0:Ue.text}),qe){var Nt,Ft="".concat(Ot?"url: ".concat(Ot,`
5
+ `):"")+"".concat(Ue&&(Ue.code||Ue.text)?"response: ".concat(Ue.code,", ").concat(Ue.text,`
6
+ `):"")+"".concat(ue.reason?"failure reason: ".concat(ue.reason,`
7
+ `):"")+"".concat(ue.level?"level: ".concat(ue.level,`
8
+ `):"")+"".concat(ue.parent?"parent stream controller: ".concat(ue.parent,`
9
+ `):"")+"".concat(ue.buffer?"buffer length: ".concat(ue.buffer,`
10
+ `):"")+"".concat(ue.error?"error: ".concat(ue.error,`
11
+ `):"")+"".concat(ue.event?"event: ".concat(ue.event,`
12
+ `):"")+"".concat(ue.err?"error message: ".concat((Nt=ue.err)===null||Nt===void 0?void 0:Nt.message,`
13
+ `):"");we("error",{player_error_code:he,player_error_message:fe,player_error_context:Ft})}};K.on(Z.Events.ERROR,hi);var Ve=function(tt,ue){var he=ue.frag,fe=he&&he._url||"";we("requestcanceled",{request_event_type:tt,request_url:fe,request_type:"media",request_hostname:Be(fe)})};K.on(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ve);var At=function(tt,ue){var he=ue.level,fe=K.levels[he];if(fe&&fe.attrs&&fe.attrs.BANDWIDTH){var Ue,qe=fe.attrs.BANDWIDTH,Et=parseFloat(fe.attrs["FRAME-RATE"]);isNaN(Et)||(Ue=Et),qe?we("renditionchange",{video_source_fps:Ue,video_source_bitrate:qe,video_source_width:fe.width,video_source_height:fe.height,video_source_rendition_name:fe.name,video_source_codec:fe==null?void 0:fe.videoCodec}):Fe.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};K.on(Z.Events.LEVEL_SWITCHED,At),K._stopMuxMonitor=function(){K.off(Z.Events.MANIFEST_LOADED,Ce),K.off(Z.Events.LEVEL_LOADED,We),K.off(Z.Events.AUDIO_TRACK_LOADED,Pt),K.off(Z.Events.FRAG_LOADED,Vt),K.off(Z.Events.FRAG_CHANGED,Zt),K.off(Z.Events.ERROR,hi),K.off(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ve),K.off(Z.Events.LEVEL_SWITCHED,At),K.off(Z.Events.DESTROYING,K._stopMuxMonitor),delete K._stopMuxMonitor},K.on(Z.Events.DESTROYING,K._stopMuxMonitor)}else Fe.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,x.hlsjs,{},x.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var x;this.hlsjs&&((x=this.hlsjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(x){x.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=x.dashjs,function(G,$,K){var Z=G.log;if(K&&K.on){var Fe=function(Ve,At){return G.emit($,Ve,At)},Te=function(Ve){var At=Ve.type,tt=(Ve.data||{}).url;Fe("requestcompleted",{request_event_type:At,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:Be(tt),request_url:tt})};K.on("manifestLoaded",Te);var Re={},we=function(Ve){var At=Ve.type,tt=Ve.fragmentModel,ue=(Ve.chunk||{}).mediaInfo||{},he=ue.type,fe=ue.bitrateList,Ue={};(fe=fe||[]).forEach(function(Ut,De){Ue[De]={},Ue[De].width=Ut.width,Ue[De].height=Ut.height,Ue[De].bitrate=Ut.bandwidth,Ue[De].attrs={}}),he==="video"?Re.video=Ue:he==="audio"?Re.audio=Ue:Re.media=Ue;var qe=Gt(tt,K),Et=qe.requestStart,ni=qe.requestResponseStart,Ot=qe.requestResponseEnd,Jt=qe.requestResponseHeaders,Nt=qe.requestMediaDuration,Ft=qe.requestHostname,Ni=qe.requestUrl,Da=qe.requestId;Fe("requestcompleted",{request_event_type:At,request_start:Et,request_response_start:ni,request_response_end:Ot,request_bytes_loaded:-1,request_type:he+"_init",request_response_headers:Jt,request_hostname:Ft,request_id:Da,request_url:Ni,request_media_duration:Nt,request_rendition_lists:Re})};K.on("initFragmentLoaded",we);var Ce=function(Ve){var At=Ve.type,tt=Ve.fragmentModel,ue=Ve.chunk||{},he=ue.mediaInfo,fe=ue.start,Ue=(he||{}).type,qe=Gt(tt,K),Et=qe.requestStart,ni=qe.requestResponseStart,Ot=qe.requestResponseEnd,Jt=qe.requestBytesLoaded,Nt=qe.requestResponseHeaders,Ft=qe.requestMediaDuration,Ni=qe.requestHostname,Da=qe.requestUrl,Ut=qe.requestId,De=gt(Ue,K),Sr=De.currentLevel,Xr=De.renditionWidth,Zr=De.renditionHeight,Ca=De.renditionBitrate;Fe("requestcompleted",{request_event_type:At,request_start:Et,request_response_start:ni,request_response_end:Ot,request_bytes_loaded:Jt,request_type:Ue,request_response_headers:Nt,request_hostname:Ni,request_id:Ut,request_url:Da,request_media_start_time:fe,request_media_duration:Ft,request_current_level:Sr,request_labeled_bitrate:Ca,request_video_width:Xr,request_video_height:Zr})};K.on("mediaFragmentLoaded",Ce);var We={video:void 0,audio:void 0,totalBitrate:void 0},Pt=function(){if(We.video&&typeof We.video.bitrate=="number"){if(We.video.width&&We.video.height){var Ve=We.video.bitrate;return We.audio&&typeof We.audio.bitrate=="number"&&(Ve+=We.audio.bitrate),Ve!==We.totalBitrate?(We.totalBitrate=Ve,{video_source_bitrate:Ve,video_source_height:We.video.height,video_source_width:We.video.width,video_source_codec:Ct(We.video.codec)}):void 0}Z.warn("have bitrate info for video but missing width/height")}},Vt=function(Ve,At,tt){if(typeof Ve.newQuality=="number"){var ue=Ve.mediaType;if(ue==="audio"||ue==="video"){var he=K.getBitrateInfoListFor(ue).find(function(Ue){return Ue.qualityIndex===Ve.newQuality});if(he&&typeof he.bitrate=="number"){We[ue]=ri(ri({},he),{},{codec:K.getCurrentTrackFor(ue).codec});var fe=Pt();fe&&Fe("renditionchange",fe)}else Z.warn("missing bitrate info for ".concat(ue))}}else Z.warn("missing evt.newQuality in qualityChangeRendered event",Ve)};K.on("qualityChangeRendered",Vt);var Zt=function(Ve){var At=Ve.request,tt=Ve.mediaType;Fe("requestcanceled",{request_event_type:(At=At||{}).type+"_"+At.action,request_url:At.url,request_type:tt,request_hostname:Be(At.url)})};K.on("fragmentLoadingAbandoned",Zt);var hi=function(Ve){var At,tt,ue=Ve.error,he=(ue==null||(At=ue.data)===null||At===void 0?void 0:At.request)||{},fe=(ue==null||(tt=ue.data)===null||tt===void 0?void 0:tt.response)||{};(ue==null?void 0:ue.code)===27&&Fe("requestfailed",{request_error:he.type+"_"+he.action,request_url:he.url,request_hostname:Be(he.url),request_type:he.mediaType,request_error_code:fe.status,request_error_text:fe.statusText});var Ue="".concat(he!=null&&he.url?"url: ".concat(he.url,`
14
+ `):"")+"".concat(fe!=null&&fe.status||fe!=null&&fe.statusText?"response: ".concat(fe==null?void 0:fe.status,", ").concat(fe==null?void 0:fe.statusText,`
15
+ `):"");Fe("error",{player_error_code:ue==null?void 0:ue.code,player_error_message:ue==null?void 0:ue.message,player_error_context:Ue})};K.on("error",hi),K._stopMuxMonitor=function(){K.off("manifestLoaded",Te),K.off("initFragmentLoaded",we),K.off("mediaFragmentLoaded",Ce),K.off("qualityChangeRendered",Vt),K.off("error",hi),K.off("fragmentLoadingAbandoned",Zt),delete K._stopMuxMonitor}}else Z.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,x.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var x;this.dashjs&&((x=this.dashjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.dashjs=void 0)}}],_&&Ri(g.prototype,_),R&&Ri(g,R),Object.defineProperty(g,"prototype",{writable:!1}),O}(st),hs=Qr,Aa=M(153),Sa=M.n(Aa);function Tr(T){return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Tr(T)}function ln(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return ka(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?ka(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ka(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var ar,ju=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],zu={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};H()&&H().WeakMap&&(ar=new WeakMap);var fs="#EXT-X-TARGETDURATION",ms="#EXT-X-PART-INF",Qu="#EXT-X-SERVER-CONTROL",Xu="#EXTINF",Bo="#EXT-X-PROGRAM-DATE-TIME",wa="#EXT-X-VERSION",ps="#EXT-X-SESSION-DATA",La=function(T){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(T),this.manifest};La.prototype.process=function(T){var g;for(this.buffer+=T,g=this.buffer.indexOf(`
17
17
  `);g>-1;g=this.buffer.indexOf(`
18
- `))this.processLine(this.buffer.substring(0,g)),this.buffer=this.buffer.substring(g+1)},ya.prototype.processLine=function(T){var g=T.indexOf(":"),_=xo(T,g),R=_[0],C=_.length===2?Ea(_[1]):void 0;if(R[0]!=="#")this.currentUri.uri=R,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(R){case Jn:if(!isFinite(C)||C<0)return;this.manifest.targetDuration=C,this.setHoldBack();break;case es:is(this.manifest,_),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Bd:is(this.manifest,_),this.setHoldBack();break;case Hd:C===0?this.currentUri.duration=.01:C>0&&(this.currentUri.duration=C);break;case Do:var O=C,x=new Date(O);this.manifest.dateTimeString||(this.manifest.dateTimeString=O,this.manifest.dateTimeObject=x),this.currentUri.dateTimeString=O,this.currentUri.dateTimeObject=x;break;case ga:is(this.manifest,_);break;case ts:var G=as(_[1]),Y=tt(G);Object.assign(this.manifest.sessionData,Y)}},ya.prototype.setHoldBack=function(){var T=this.manifest,g=T.serverControl,_=T.targetDuration,R=T.partTargetDuration;if(g){var C="holdBack",O="partHoldBack",x=_&&3*_,G=R&&2*R;_&&!g.hasOwnProperty(C)&&(g[C]=x),x&&g[C]<x&&(g[C]=x),R&&!g.hasOwnProperty(O)&&(g[O]=3*R),R&&g[O]<G&&(g[O]=G)}};var is=function(T,g){var _,R=rs(g[0].replace("#EXT-X-",""));Xa(g[1])?(_={},_=Object.assign(Mo(g[1]),_)):_=Ea(g[1]),T[R]=_},rs=function(T){return T.toLowerCase().replace(/-(\w)/g,function(g){return g[1].toUpperCase()})},Ea=function(T){if(T.toLowerCase()==="yes"||T.toLowerCase()==="no")return T.toLowerCase()==="yes";var g=T.indexOf(":")!==-1?T:parseFloat(T);return isNaN(g)?T:g},Co=function(T){var g={},_=T.split("=");return _.length>1&&(g[rs(_[0])]=Ea(_[1])),g},Mo=function(T){for(var g=T.split(","),_={},R=0;g.length>R;R++){var C=g[R],O=Co(C);_=Object.assign(O,_)}return _},Xa=function(T){return T.indexOf("=")>-1},xo=function(T,g){return g===-1?[T]:[T.substring(0,g),T.substring(g+1)]},as=function(T){var g={};if(T){var _=T.search(",");return[T.slice(0,_),T.slice(_+1)].forEach(function(R,C){for(var O=R.replace(/['"]+/g,"").split("="),x=0;x<O.length;x++)O[x]==="DATA-ID"&&(g["DATA-ID"]=O[1-x]),O[x]==="VALUE"&&(g.VALUE=O[1-x])}),{data:g}}},Po=ya,Za={safeCall:function(T,g,_,R){var C=R;if(T&&typeof T[g]=="function")try{C=T[g].apply(T,_)}catch(O){we.info("safeCall error",O)}return C},safeIncrement:w,getComputedStyle:function(T,g){var _;if(T&&g&&F()&&typeof F().getComputedStyle=="function")return Ji&&Ji.has(T)&&(_=Ji.get(T)),_||(_=F().getComputedStyle(T,null),Ji&&Ji.set(T,_)),_.getPropertyValue(g)},secondsToMs:function(T){return Math.floor(1e3*T)},assign:Object.assign,headersStringToObject:Ie,cdnHeadersToRequestId:$e,extractHostnameAndDomain:dt,extractHostname:st,manifestParser:Po,generateShortID:re,generateUUID:Q,now:Ue.now},Oo={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 ba(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return Ja(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?Ja(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ja(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var fi={},vr=function T(g){var _=arguments;typeof g=="string"?T.hasOwnProperty(g)?F().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[g].apply(null,_)},0):we.warn("`"+g+"` is an unknown task"):typeof g=="function"?F().setTimeout(function(){g(T)},0):we.warn("`"+g+"` is invalid.")},Gd={loaded:Ue.now(),NAME:"mux-embed",VERSION:"4.24.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(T,g){return function(_,R,C){var O=Qa(se(R),3),x=O[0],G=O[1],Y=O[2],K=_.log,Z=_.utils.getComputedStyle,Oe=_.utils.secondsToMs;if(!x)return K.error("No element was found with the `"+G+"` query selector.");if(Y!=="video"&&Y!=="audio")return K.error("The element of `"+G+"` was not a media element.");x.mux&&(x.mux.destroy(),delete x.mux,K.warn("Already monitoring this video element, replacing existing event listeners")),(C=Object.assign({automaticErrorTracking:!0},C)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:_.VERSION},C.data),C.getPlayheadTime=function(){return Oe(x.currentTime)},C.getStateData=function(){var Se,be,Re=this.hlsjs&&this.hlsjs.url,Ge=this.dashjs&&pr(this.dashjs.getSource==="function")&&this.dashjs.getSource(),kt={player_is_paused:x.paused,player_playhead_time:Oe(x.currentTime),player_width:parseInt(Z(x,"width")),player_height:parseInt(Z(x,"height")),player_autoplay_on:x.autoplay,player_preload_on:x.preload,player_language_code:x.lang,player_is_fullscreen:pa()&&!!(pa().fullscreenElement||pa().webkitFullscreenElement||pa().mozFullScreenElement||pa().msFullscreenElement),video_poster_url:x.poster,video_source_url:Re||Ge||x.currentSrc,video_source_duration:Oe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Se=x)===null||Se===void 0||(be=Se.getVideoPlaybackQuality)===null||be===void 0?void 0:be.call(Se).droppedVideoFrames},Pt=C.getPlayheadTime();if(x.getStartDate&&Pt>0){var Wt=x.getStartDate();if(Wt&&typeof Wt.getTime=="function"&&Wt.getTime()){var ni=Wt.getTime();if(kt.player_program_time=ni+Pt,x.seekable.length>0){var Be=ni+x.seekable.end(x.seekable.length-1);kt.player_live_edge_program_time=Be}}}return kt},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Se,be){_.emit(G,Se,be)};var ye=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Se){x.removeEventListener(Se,x.mux.listeners[Se],!1)}),delete x.mux.listeners,x.mux.destroy=ye,x.mux.swapElement=ye,x.mux.emit=ye,x.mux.addHLSJS=ye,x.mux.addDashJS=ye,x.mux.removeHLSJS=ye,x.mux.removeDashJS=ye,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Se){var be=Qa(se(Se),3),Re=be[0],Ge=be[1],kt=be[2];return Re?kt!=="video"&&kt!=="audio"?_.log.error("The element of `"+Ge+"` was not a media element."):(Re.muxId=x.muxId,delete x.muxId,Re.mux=Re.mux||{},Re.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(Re.mux.listeners).forEach(function(Pt){x.removeEventListener(Pt,Re.mux.listeners[Pt],!1),Re.addEventListener(Pt,Re.mux.listeners[Pt],!1)}),Re.mux.swapElement=x.mux.swapElement,Re.mux.destroy=x.mux.destroy,delete x.mux,void(x=Re)):_.log.error("No element was found with the `"+Ge+"` query selector.")},x.mux.addHLSJS=function(Se){_.addHLSJS(G,Se)},x.mux.addDashJS=function(Se){_.addDashJS(G,Se)},x.mux.removeHLSJS=function(){_.removeHLSJS(G)},x.mux.removeDashJS=function(){_.removeDashJS(G)},_.init(G,C),_.emit(G,"playerready"),x.paused||(_.emit(G,"play"),x.readyState>2&&_.emit(G,"playing")),x.mux.listeners={},Fd.forEach(function(Se){(Se!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Se]=function(){var be={};if(Se==="error"){if(!x.error||x.error.code===1)return;be.player_error_code=x.error.code,be.player_error_message=Ud[x.error.code]||x.error.message}_.emit(G,Se,be)},x.addEventListener(Se,x.mux.listeners[Se],!1))})}(vr,T,g)},destroyMonitor:function(T){var g=ba(se(T),1)[0];g&&g.mux&&typeof g.mux.destroy=="function"?g.mux.destroy():we.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,g){var _=te(T);fi[_]?fi[_].addHLSJS(g):we.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,g){var _=te(T);fi[_]?fi[_].addDashJS(g):we.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var g=te(T);fi[g]?fi[g].removeHLSJS():we.error("A monitor for `"+g+"` has not been initialized.")},removeDashJS:function(T){var g=te(T);fi[g]?fi[g].removeDashJS():we.error("A monitor for `"+g+"` has not been initialized.")},init:function(T,g){nt()&&g&&g.respectDoNotTrack&&we.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=te(T);fi[_]=new Zn(vr,_,g)},emit:function(T,g,_){var R=te(T);fi[R]?(fi[R].emit(g,_),g==="destroy"&&delete fi[R]):we.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:nt,log:we,utils:Za,events:Oo,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(vr,Gd),F()!==void 0&&typeof F().addEventListener=="function"&&F().addEventListener("pagehide",function(T){T.persisted||(vr.WINDOW_UNLOADING=!0)},!1);var ns=vr},655:function(E,I,M){var B,F;function Q(re){return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(te){return typeof te}:function(te){return te&&typeof Symbol=="function"&&te.constructor===Symbol&&te!==Symbol.prototype?"symbol":typeof te},Q(re);}(function(re){var te=!1;if((F=typeof(B=re)=="function"?B.call(I,M,I,E):B)===void 0||(E.exports=F),te=!0,Q(I)==="object"&&(E.exports=re(),te=!0),!te){var se=window.Cookies,pe=window.Cookies=re();pe.noConflict=function(){return window.Cookies=se,pe}}})(function(){var re=function(){for(var te=0,se={};te<arguments.length;te++){var pe=arguments[te];for(var Ae in pe)se[Ae]=pe[Ae]}return se};return function te(se){function pe(Ae,ke,we){var nt;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(we=re({path:"/"},pe.defaults,we)).expires=="number"){var Ue=new Date;Ue.setMilliseconds(Ue.getMilliseconds()+864e5*we.expires),we.expires=Ue}try{nt=JSON.stringify(ke),/^[\{\[]/.test(nt)&&(ke=nt)}catch{}return ke=se.write?se.write(ke,Ae):encodeURIComponent(String(ke)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),Ae=(Ae=(Ae=encodeURIComponent(String(Ae))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[Ae,"=",ke,we.expires?"; expires="+we.expires.toUTCString():"",we.path?"; path="+we.path:"",we.domain?"; domain="+we.domain:"",we.secure?"; secure":""].join("")}Ae||(nt={});for(var st=document.cookie?document.cookie.split("; "):[],dt=/(%[0-9A-Z]{2})+/g,oe=0;oe<st.length;oe++){var w=st[oe].split("="),le=w.slice(1).join("=");le.charAt(0)==='"'&&(le=le.slice(1,-1));try{var $=w[0].replace(dt,decodeURIComponent);if(le=se.read?se.read(le,$):se(le,$)||le.replace(dt,decodeURIComponent),this.json)try{le=JSON.parse(le)}catch{}if(Ae===$){nt=le;break}Ae||(nt[$]=le)}catch{}}return nt}}return pe.set=pe,pe.get=function(Ae){return pe.call(pe,Ae)},pe.getJSON=function(){return pe.apply({json:!0},[].slice.call(arguments))},pe.defaults={},pe.remove=function(Ae,ke){pe(Ae,"",re(ke,{expires:-1}))},pe.withConverter=te,pe}(function(){})})},153:function(E,I,M){var B,F=M.g!==void 0?M.g:typeof window!="undefined"?window:{},Q=M(558);typeof document!="undefined"?B=document:(B=F["__GLOBAL_DOCUMENT_CACHE@4"])||(B=F["__GLOBAL_DOCUMENT_CACHE@4"]=Q),E.exports=B},48:function(E,I,M){var B;B=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},E.exports=B},640:function(E,I,M){var B,F;(function(Q,re){"use strict";B=function(){var te=function(){},se="undefined",pe=typeof window!==se&&typeof window.navigator!==se&&/Trident\/|MSIE /.test(window.navigator.userAgent),Ae=["trace","debug","info","warn","error"];function ke(Ie,$e){var tt=Ie[$e];if(typeof tt.bind=="function")return tt.bind(Ie);try{return Function.prototype.bind.call(tt,Ie)}catch{return function(){return Function.prototype.apply.apply(tt,[Ie,arguments])}}}function we(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function nt(Ie){return Ie==="debug"&&(Ie="log"),typeof console!==se&&(Ie==="trace"&&pe?we:console[Ie]!==void 0?ke(console,Ie):console.log!==void 0?ke(console,"log"):te)}function Ue(Ie,$e){for(var tt=0;tt<Ae.length;tt++){var Bt=Ae[tt];this[Bt]=tt<Ie?te:this.methodFactory(Bt,Ie,$e)}this.log=this.debug}function st(Ie,$e,tt){return function(){typeof console!==se&&(Ue.call(this,$e,tt),this[Ie].apply(this,arguments))}}function dt(Ie,$e,tt){return nt(Ie)||st.apply(this,arguments)}function oe(Ie,$e,tt){var Bt,Je=this;$e=$e==null?"WARN":$e;var H="loglevel";function ri(Ke){var xt=(Ae[Ke]||"silent").toUpperCase();if(typeof window!==se&&H){try{return void(window.localStorage[H]=xt)}catch{}try{window.document.cookie=encodeURIComponent(H)+"="+xt+";"}catch{}}}function Ht(){var Ke;if(typeof window!==se&&H){try{Ke=window.localStorage[H]}catch{}if(typeof Ke===se)try{var xt=window.document.cookie,ht=xt.indexOf(encodeURIComponent(H)+"=");ht!==-1&&(Ke=/^([^;]+)/.exec(xt.slice(ht))[1])}catch{}return Je.levels[Ke]===void 0&&(Ke=void 0),Ke}}function it(){if(typeof window!==se&&H){try{return void window.localStorage.removeItem(H)}catch{}try{window.document.cookie=encodeURIComponent(H)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Ie=="string"?H+=":"+Ie:typeof Ie=="symbol"&&(H=void 0),Je.name=Ie,Je.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Je.methodFactory=tt||dt,Je.getLevel=function(){return Bt},Je.setLevel=function(Ke,xt){if(typeof Ke=="string"&&Je.levels[Ke.toUpperCase()]!==void 0&&(Ke=Je.levels[Ke.toUpperCase()]),!(typeof Ke=="number"&&Ke>=0&&Ke<=Je.levels.SILENT))throw"log.setLevel() called with invalid level: "+Ke;if(Bt=Ke,xt!==!1&&ri(Ke),Ue.call(Je,Ke,Ie),typeof console===se&&Ke<Je.levels.SILENT)return"No console available for logging"},Je.setDefaultLevel=function(Ke){$e=Ke,Ht()||Je.setLevel(Ke,!1)},Je.resetLevel=function(){Je.setLevel($e,!1),it()},Je.enableAll=function(Ke){Je.setLevel(Je.levels.TRACE,Ke)},Je.disableAll=function(Ke){Je.setLevel(Je.levels.SILENT,Ke)};var Qt=Ht();Qt==null&&(Qt=$e),Je.setLevel(Qt,!1)}var w=new oe,le={};w.getLogger=function(Ie){if(typeof Ie!="symbol"&&typeof Ie!="string"||Ie==="")throw new TypeError("You must supply a name when creating a logger.");var $e=le[Ie];return $e||($e=le[Ie]=new oe(Ie,w.getLevel(),w.methodFactory)),$e};var $=typeof window!==se?window.log:void 0;return w.noConflict=function(){return typeof window!==se&&window.log===w&&(window.log=$),w},w.getLoggers=function(){return le},w.default=w,w},(F=typeof B=="function"?B.call(I,M,I,E):B)===void 0||(E.exports=F)})()},375:function(E,I){"use strict";var M=Object.prototype.hasOwnProperty;function B(Q){try{return decodeURIComponent(Q.replace(/\+/g," "))}catch{return null}}function F(Q){try{return encodeURIComponent(Q)}catch{return null}}I.stringify=function(Q,re){re=re||"";var te,se,pe=[];for(se in typeof re!="string"&&(re="?"),Q)if(M.call(Q,se)){if((te=Q[se])||te!=null&&!isNaN(te)||(te=""),se=F(se),te=F(te),se===null||te===null)continue;pe.push(se+"="+te)}return pe.length?re+pe.join("&"):""},I.parse=function(Q){for(var re,te=/([^=?#&]+)=?([^&]*)/g,se={};re=te.exec(Q);){var pe=B(re[1]),Ae=B(re[2]);pe===null||Ae===null||pe in se||(se[pe]=Ae)}return se}},558:function(){}},m={};function v(E){var I=m[E];if(I!==void 0)return I.exports;var M=m[E]={exports:{}};return l[E].call(M.exports,M,M.exports,v),M.exports}return v.n=function(E){var I=E&&E.__esModule?function(){return E.default}:function(){return E};return v.d(I,{a:I}),I},v.d=function(E,I){for(var M in I)v.o(I,M)&&!v.o(E,M)&&Object.defineProperty(E,M,{enumerable:!0,get:I[M]})},v.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),v.o=function(E,I){return Object.prototype.hasOwnProperty.call(E,I)},v(80)}()},typeof jl=="object"&&typeof xc=="object"?xc.exports=a():typeof jl=="object"?jl.mux=a():n.mux=a()})()});var tp=gf((ep,Pc)=>{(function n(a){var l,m;l=this,m=function(){"use strict";function v(d,s){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);s&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function E(d){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?v(Object(e),!0).forEach(function(t){B(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function I(d,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,nt(t.key),t)}}function M(d,s,e){return s&&I(d.prototype,s),e&&I(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function B(d,s,e){return(s=nt(s))in d?Object.defineProperty(d,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[s]=e,d}function F(){return F=Object.assign?Object.assign.bind():function(d){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},F.apply(this,arguments)}function Q(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,te(d,s)}function re(d){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},re(d)}function te(d,s){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},te(d,s)}function se(){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 pe(d,s,e){return pe=se()?Reflect.construct.bind():function(t,i,r){var o=[null];o.push.apply(o,i);var u=new(Function.bind.apply(t,o));return r&&te(u,r.prototype),u},pe.apply(null,arguments)}function Ae(d){var s=typeof Map=="function"?new Map:void 0;return Ae=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(s!==void 0){if(s.has(e))return s.get(e);s.set(e,i)}function i(){return pe(e,arguments,re(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),te(i,e)},Ae(d)}function ke(d,s){(s==null||s>d.length)&&(s=d.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=d[e];return t}function we(d,s){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,r){if(i){if(typeof i=="string")return ke(i,r);var o=Object.prototype.toString.call(i).slice(8,-1);return o==="Object"&&i.constructor&&(o=i.constructor.name),o==="Map"||o==="Set"?Array.from(i):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ke(i,r):void 0}}(d))||s&&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.
20
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nt(d){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}(d,"string");return typeof s=="symbol"?s:String(s)}function Ue(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var st={exports:{}};(function(d,s){var e,t,i,r,o;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,c,f){if(f=f||{},u=u.trim(),!(c=c.trim())){if(!f.alwaysNormalize)return u;var h=o.parseURL(u);if(!h)throw new Error("Error trying to parse base URL.");return h.path=o.normalizePath(h.path),o.buildURLFromParts(h)}var p=o.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):c;var y=o.parseURL(u);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var b=t.exec(y.path);y.netLoc=b[1],y.path=b[2]}y.netLoc&&!y.path&&(y.path="/");var A={scheme:y.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(A.netLoc=y.netLoc,p.path[0]!=="/"))if(p.path){var k=y.path,D=k.substring(0,k.lastIndexOf("/")+1)+p.path;A.path=o.normalizePath(D)}else A.path=y.path,p.params||(A.params=y.params,p.query||(A.query=y.query));return A.path===null&&(A.path=f.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(A)},parseURL:function(u){var c=e.exec(u);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(i,"");u.length!==(u=u.replace(r,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}},d.exports=o})(st);var dt=st.exports,oe=Number.isFinite||function(d){return typeof d=="number"&&isFinite(d)},w=function(d){return d.MEDIA_ATTACHING="hlsMediaAttaching",d.MEDIA_ATTACHED="hlsMediaAttached",d.MEDIA_DETACHING="hlsMediaDetaching",d.MEDIA_DETACHED="hlsMediaDetached",d.BUFFER_RESET="hlsBufferReset",d.BUFFER_CODECS="hlsBufferCodecs",d.BUFFER_CREATED="hlsBufferCreated",d.BUFFER_APPENDING="hlsBufferAppending",d.BUFFER_APPENDED="hlsBufferAppended",d.BUFFER_EOS="hlsBufferEos",d.BUFFER_FLUSHING="hlsBufferFlushing",d.BUFFER_FLUSHED="hlsBufferFlushed",d.MANIFEST_LOADING="hlsManifestLoading",d.MANIFEST_LOADED="hlsManifestLoaded",d.MANIFEST_PARSED="hlsManifestParsed",d.LEVEL_SWITCHING="hlsLevelSwitching",d.LEVEL_SWITCHED="hlsLevelSwitched",d.LEVEL_LOADING="hlsLevelLoading",d.LEVEL_LOADED="hlsLevelLoaded",d.LEVEL_UPDATED="hlsLevelUpdated",d.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",d.LEVELS_UPDATED="hlsLevelsUpdated",d.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",d.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",d.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",d.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",d.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",d.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",d.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",d.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",d.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",d.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",d.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",d.CUES_PARSED="hlsCuesParsed",d.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",d.INIT_PTS_FOUND="hlsInitPtsFound",d.FRAG_LOADING="hlsFragLoading",d.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",d.FRAG_LOADED="hlsFragLoaded",d.FRAG_DECRYPTED="hlsFragDecrypted",d.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",d.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",d.FRAG_PARSING_METADATA="hlsFragParsingMetadata",d.FRAG_PARSED="hlsFragParsed",d.FRAG_BUFFERED="hlsFragBuffered",d.FRAG_CHANGED="hlsFragChanged",d.FPS_DROP="hlsFpsDrop",d.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",d.ERROR="hlsError",d.DESTROYING="hlsDestroying",d.KEY_LOADING="hlsKeyLoading",d.KEY_LOADED="hlsKeyLoaded",d.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",d.BACK_BUFFER_REACHED="hlsBackBufferReached",d}({}),le=function(d){return d.NETWORK_ERROR="networkError",d.MEDIA_ERROR="mediaError",d.KEY_SYSTEM_ERROR="keySystemError",d.MUX_ERROR="muxError",d.OTHER_ERROR="otherError",d}({}),$=function(d){return d.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",d.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",d.KEY_SYSTEM_NO_SESSION="keySystemNoSession",d.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",d.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",d.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",d.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",d.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",d.MANIFEST_LOAD_ERROR="manifestLoadError",d.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",d.MANIFEST_PARSING_ERROR="manifestParsingError",d.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",d.LEVEL_EMPTY_ERROR="levelEmptyError",d.LEVEL_LOAD_ERROR="levelLoadError",d.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",d.LEVEL_PARSING_ERROR="levelParsingError",d.LEVEL_SWITCH_ERROR="levelSwitchError",d.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",d.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",d.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",d.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",d.FRAG_LOAD_ERROR="fragLoadError",d.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",d.FRAG_DECRYPT_ERROR="fragDecryptError",d.FRAG_PARSING_ERROR="fragParsingError",d.FRAG_GAP="fragGap",d.REMUX_ALLOC_ERROR="remuxAllocError",d.KEY_LOAD_ERROR="keyLoadError",d.KEY_LOAD_TIMEOUT="keyLoadTimeOut",d.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",d.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",d.BUFFER_APPEND_ERROR="bufferAppendError",d.BUFFER_APPENDING_ERROR="bufferAppendingError",d.BUFFER_STALLED_ERROR="bufferStalledError",d.BUFFER_FULL_ERROR="bufferFullError",d.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",d.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",d.INTERNAL_EXCEPTION="internalException",d.INTERNAL_ABORTED="aborted",d.UNKNOWN="unknown",d}({}),Ie=function(){},$e={trace:Ie,debug:Ie,log:Ie,warn:Ie,info:Ie,error:Ie},tt=$e;function Bt(d){var s=self.console[d];return s?s.bind(self.console,"["+d+"] >"):Ie}function Je(d,s){if(self.console&&d===!0||typeof d=="object"){(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];i.forEach(function(o){tt[o]=e[o]?e[o].bind(e):Bt(o)})})(d,"debug","log","info","warn","error");try{tt.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.1')}catch{tt=$e}}else tt=$e}var H=tt,ri=/^(\d+)x(\d+)$/,Ht=/(.+?)=(".*?"|.*?)(?:,|$)/g,it=function(){function d(e){for(var t in typeof e=="string"&&(e=d.parseAttrList(e)),e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}var s=d.prototype;return s.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.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),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},s.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.decimalFloatingPoint=function(e){return parseFloat(this[e])},s.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},s.enumeratedString=function(e){return this[e]},s.bool=function(e){return this[e]==="YES"},s.decimalResolution=function(e){var t=ri.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(Ht.lastIndex=0;(t=Ht.exec(e))!==null;){var r=t[2];r.indexOf('"')===0&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1].trim()]=r}return i},d}();function Qt(d){return d==="SCTE35-OUT"||d==="SCTE35-IN"}var Ke=function(){function d(s,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){var t=e.attr;for(var i in t)if(Object.prototype.hasOwnProperty.call(s,i)&&s[i]!==t[i]){H.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=F(new it({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var r=new Date(this.attr["END-DATE"]);oe(r.getTime())&&(this._endDate=r)}}return M(d,[{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 s=this.duration;return s!==null?new Date(this._startDate.getTime()+1e3*s):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var s=this.attr.decimalFloatingPoint("DURATION");if(oe(s))return s}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),d}(),xt=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}},ht="audio",Tt="video",Qi="audiovideo",J=function(){function d(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[ht]=null,e[Tt]=null,e[Qi]=null,e),this.baseurl=s}return d.prototype.setByteRange=function(s,e){var t=s.split("@",2),i=[];t.length===1?i[0]=e?e.byteRangeEndOffset:0:i[0]=parseInt(t[1]),i[1]=parseInt(t[0])+i[0],this._byteRange=i},M(d,[{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=dt.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),d}(),Ee=function(d){function s(t,i){var r;return(r=d.call(this,i)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new xt,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.type=t,r}Q(s,d);var e=s.prototype;return e.setKeyFormat=function(t){if(this.levelkeys){var i=this.levelkeys[t];i&&!this._decryptdata&&(this._decryptdata=i.getDecryptData(this.sn))}},e.abortRequests=function(){var t,i;(t=this.loader)==null||t.abort(),(i=this.keyLoader)==null||i.abort()},e.setElementaryStreamInfo=function(t,i,r,o,u,c){c===void 0&&(c=!1);var f=this.elementaryStreams,h=f[t];h?(h.startPTS=Math.min(h.startPTS,i),h.endPTS=Math.max(h.endPTS,r),h.startDTS=Math.min(h.startDTS,o),h.endDTS=Math.max(h.endDTS,u)):f[t]={startPTS:i,endPTS:r,startDTS:o,endDTS:u,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[ht]=null,t[Tt]=null,t[Qi]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!oe(this.programDateTime))return null;var t=oe(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(J),rt=function(d){function s(e,t,i,r,o){var u;(u=d.call(this,i)||this).fragOffset=0,u.duration=0,u.gap=!1,u.independent=!1,u.relurl=void 0,u.fragment=void 0,u.index=void 0,u.stats=new xt,u.duration=e.decimalFloatingPoint("DURATION"),u.gap=e.bool("GAP"),u.independent=e.bool("INDEPENDENT"),u.relurl=e.enumeratedString("URI"),u.fragment=t,u.index=r;var c=e.enumeratedString("BYTERANGE");return c&&u.setByteRange(c,o),o&&(u.fragOffset=o.fragOffset+o.duration),u}return Q(s,d),M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),s}(J),bt=function(){function d(s){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.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=s}return d.prototype.reloaded=function(s){if(!s)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-s.lastPartSn,t=this.lastPartIndex-s.lastPartIndex;this.updated=this.endSN!==s.endSN||!!t||!!e,this.advanced=this.endSN>s.endSN||e>0||e===0&&t>0,this.updated||this.advanced?this.misses=Math.floor(.6*s.misses):this.misses=s.misses+1,this.availabilityDelay=s.availabilityDelay},M(d,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&oe(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var s=this.driftEndTime-this.driftStartTime;return s>0?1e3*(this.driftEnd-this.driftStart)/s:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var s;return(s=this.fragments)!=null&&s.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 s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),d}();function _t(d){return Uint8Array.from(atob(d),function(s){return s.charCodeAt(0)})}function ai(d){var s,e,t=d.split(":"),i=null;if(t[0]==="data"&&t.length===2){var r=t[1].split(";"),o=r[r.length-1].split(",");if(o.length===2){var u=o[0]==="base64",c=o[1];u?(r.splice(-1,1),i=_t(c)):(s=Gi(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function Gi(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(s){return s.charCodeAt(0)})}var je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},di="org.w3.clearkey",ui="com.apple.streamingkeydelivery",Vi="com.microsoft.playready",Xi="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function ci(d){switch(d){case ui:return je.FAIRPLAY;case Vi:return je.PLAYREADY;case Xi:return je.WIDEVINE;case di:return je.CLEARKEY}}var ut="edef8ba979d64acea3c827dcd51d21ed";function Zi(d){switch(d){case je.FAIRPLAY:return ui;case je.PLAYREADY:return Vi;case je.WIDEVINE:return Xi;case je.CLEARKEY:return di}}function ur(d){var s=d.drmSystems,e=d.widevineLicenseUrl,t=s?[je.FAIRPLAY,je.WIDEVINE,je.PLAYREADY,je.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[je.WIDEVINE]&&e&&t.push(je.WIDEVINE),t}var Nr=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function Li(d,s,e){return Uint8Array.prototype.slice?d.slice(s,e):new Uint8Array(Array.prototype.slice.call(d,s,e))}var cr,Hn=function(d,s){return s+10<=d.length&&d[s]===73&&d[s+1]===68&&d[s+2]===51&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},so=function(d,s){return s+10<=d.length&&d[s]===51&&d[s+1]===68&&d[s+2]===73&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},la=function(d,s){for(var e=s,t=0;Hn(d,s);)t+=10,t+=Ya(d,s+6),so(d,s+10)&&(t+=10),s+=t;if(t>0)return d.subarray(e,e+t)},Ya=function(d,s){var e=0;return e=(127&d[s])<<21,e|=(127&d[s+1])<<14,e|=(127&d[s+2])<<7,e|=127&d[s+3]},oo=function(d,s){return Hn(d,s)&&Ya(d,s+6)+10<=d.length-s},lo=function(d){return d&&d.key==="PRIV"&&d.info==="com.apple.streaming.transportStreamTimestamp"},Id=function(d){var s=String.fromCharCode(d[0],d[1],d[2],d[3]),e=Ya(d,4);return{type:s,size:e,data:d.subarray(10,10+e)}},Gn=function(d){for(var s=0,e=[];Hn(d,s);){for(var t=Ya(d,s+6),i=(s+=10)+t;s+8<i;){var r=Id(d.subarray(s)),o=Rd(r);o&&e.push(o),s+=r.size+10}so(d,s)&&(s+=10)}return e},Rd=function(d){return d.type==="PRIV"?Dd(d):d.type[0]==="W"?co(d):uo(d)},Dd=function(d){if(!(d.size<2)){var s=Ei(d.data,!0),e=new Uint8Array(d.data.subarray(s.length+1));return{key:d.type,info:s,data:e.buffer}}},uo=function(d){if(!(d.size<2)){if(d.type==="TXXX"){var s=1,e=Ei(d.data.subarray(s),!0);s+=e.length+1;var t=Ei(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ei(d.data.subarray(1));return{key:d.type,data:i}}},co=function(d){if(d.type==="WXXX"){if(d.size<2)return;var s=1,e=Ei(d.data.subarray(s),!0);s+=e.length+1;var t=Ei(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ei(d.data);return{key:d.type,data:i}},ho=function(d){if(d.data.byteLength===8){var s=new Uint8Array(d.data),e=1&s[3],t=(s[4]<<23)+(s[5]<<15)+(s[6]<<7)+s[7];return t/=45,e&&(t+=4772185884e-2),Math.round(t)}},Ei=function(d,s){s===void 0&&(s=!1);var e=Cd();if(e){var t=e.decode(d);if(s){var i=t.indexOf("\0");return i!==-1?t.substring(0,i):t}return t.replace(/\0/g,"")}for(var r,o,u,c=d.length,f="",h=0;h<c;){if((r=d[h++])===0&&s)return f;if(r!==0&&r!==3)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f+=String.fromCharCode(r);break;case 12:case 13:o=d[h++],f+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=d[h++],u=d[h++],f+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&u)<<0)}}return f};function Cd(){return cr||self.TextDecoder===void 0||(cr=new self.TextDecoder("utf-8")),cr}var Ii=function(d){for(var s="",e=0;e<d.length;e++){var t=d[e].toString(16);t.length<2&&(t="0"+t),s+=t}return s},da=Math.pow(2,32)-1,Md=[].push,fo={video:1,audio:2,id3:3,text:4};function At(d){return String.fromCharCode.apply(null,d)}function mo(d,s){var e=d[s]<<8|d[s+1];return e<0?65536+e:e}function Fe(d,s){var e=Vn(d,s);return e<0?4294967296+e:e}function Vn(d,s){return d[s]<<24|d[s+1]<<16|d[s+2]<<8|d[s+3]}function Kn(d,s,e){d[s]=e>>24,d[s+1]=e>>16&255,d[s+2]=e>>8&255,d[s+3]=255&e}function ze(d,s){var e=[];if(!s.length)return e;for(var t=d.byteLength,i=0;i<t;){var r=Fe(d,i),o=r>1?i+r:t;if(At(d.subarray(i+4,i+8))===s[0])if(s.length===1)e.push(d.subarray(i+8,o));else{var u=ze(d.subarray(i+8,o),s.slice(1));u.length&&Md.apply(e,u)}i=o}return e}function po(d){var s=[],e=d[0],t=8,i=Fe(d,t);t+=4,t+=e===0?8:16,t+=2;var r=d.length+0,o=mo(d,t);t+=2;for(var u=0;u<o;u++){var c=t,f=Fe(d,c);c+=4;var h=2147483647&f;if((2147483648&f)>>>31==1)return H.warn("SIDX has hierarchical references (not supported)"),null;var p=Fe(d,c);c+=4,s.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:r,end:r+h-1}}),r+=h,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:o,references:s}}function Wn(d){for(var s=[],e=ze(d,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],r=ze(i,["tkhd"])[0];if(r){var o=r[0],u=o===0?12:20,c=Fe(r,u),f=ze(i,["mdia","mdhd"])[0];if(f){var h=Fe(f,u=(o=f[0])===0?12:20),p=ze(i,["mdia","hdlr"])[0];if(p){var y=At(p.subarray(8,12)),b={soun:ht,vide:Tt}[y];if(b){var A=ze(i,["mdia","minf","stbl","stsd"])[0],k=void 0;A&&(k=At(A.subarray(12,16))),s[c]={timescale:h,type:b},s[b]={timescale:h,id:c,codec:k}}}}}}return ze(d,["moov","mvex","trex"]).forEach(function(D){var S=Fe(D,4),L=s[S];L&&(L.default={duration:Fe(D,12),flags:Fe(D,20)})}),s}function qn(d){var s=ze(d,["schm"])[0];if(s){var e=At(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return ze(d,["schi","tenc"])[0]}return H.error("[eme] missing 'schm' box"),null}function xd(d){var s=Fe(d,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=Fe(d,4),r=0;r<i;r++)256&s&&(t+=Fe(d,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function hr(d,s){var e=new Uint8Array(d.length+s.length);return e.set(d),e.set(s,d.length),e}function Yn(d,s){var e=[],t=s.samples,i=s.timescale,r=s.id,o=!1;return ze(t,["moof"]).map(function(u){var c=u.byteOffset-8;ze(u,["traf"]).map(function(f){var h=ze(f,["tfdt"]).map(function(p){var y=p[0],b=Fe(p,4);return y===1&&(b*=Math.pow(2,32),b+=Fe(p,8)),b/i})[0];return h!==void 0&&(d=h),ze(f,["tfhd"]).map(function(p){var y=Fe(p,4),b=16777215&Fe(p,0),A=0,k=(16&b)!=0,D=0,S=(32&b)!=0,L=8;y===r&&((1&b)!=0&&(L+=8),(2&b)!=0&&(L+=4),(8&b)!=0&&(A=Fe(p,L),L+=4),k&&(D=Fe(p,L),L+=4),S&&(L+=4),s.type==="video"&&(o=function(N){if(!N)return!1;var P=N.indexOf("."),V=P<0?N:N.substring(0,P);return V==="hvc1"||V==="hev1"||V==="dvh1"||V==="dvhe"}(s.codec)),ze(f,["trun"]).map(function(N){var P=N[0],V=16777215&Fe(N,0),q=(1&V)!=0,j=0,ee=(4&V)!=0,z=(256&V)!=0,X=0,ue=(512&V)!=0,ne=0,Te=(1024&V)!=0,Me=(2048&V)!=0,_e=0,De=Fe(N,4),xe=8;q&&(j=Fe(N,xe),xe+=4),ee&&(xe+=4);for(var Ce=j+c,He=0;He<De;He++){if(z?(X=Fe(N,xe),xe+=4):X=A,ue?(ne=Fe(N,xe),xe+=4):ne=D,Te&&(xe+=4),Me&&(_e=P===0?Fe(N,xe):Vn(N,xe),xe+=4),s.type===Tt)for(var We=0;We<ne;){var Qe=Fe(t,Ce);vo(o,t[Ce+=4])&&go(t.subarray(Ce,Ce+Qe),o?2:1,d+_e/i,e),Ce+=Qe,We+=Qe+4}d+=X/i}}))})})}),e}function vo(d,s){if(d){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function go(d,s,e,t){var i=yo(d),r=0;r+=s;for(var o=0,u=0,c=!1,f=0;r<i.length;){o=0;do{if(r>=i.length)break;o+=f=i[r++]}while(f===255);u=0;do{if(r>=i.length)break;u+=f=i[r++]}while(f===255);var h=i.length-r;if(!c&&o===4&&r<i.length){if(c=!0,i[r++]===181){var p=mo(i,r);if(r+=2,p===49){var y=Fe(i,r);if(r+=4,y===1195456820){var b=i[r++];if(b===3){var A=i[r++],k=64&A,D=k?2+3*(31&A):0,S=new Uint8Array(D);if(k){S[0]=A;for(var L=1;L<D;L++)S[L]=i[r++]}t.push({type:b,payloadType:o,pts:e,bytes:S})}}}}}else if(o===5&&u<h){if(c=!0,u>16){for(var N=[],P=0;P<16;P++){var V=i[r++].toString(16);N.push(V.length==1?"0"+V:V),P!==3&&P!==5&&P!==7&&P!==9||N.push("-")}for(var q=u-16,j=new Uint8Array(q),ee=0;ee<q;ee++)j[ee]=i[r++];t.push({payloadType:o,pts:e,uuid:N.join(""),userData:Ei(j),userDataBytes:j})}}else if(u<h)r+=u;else if(u>h)break}}function yo(d){for(var s=d.byteLength,e=[],t=1;t<s-2;)d[t]===0&&d[t+1]===0&&d[t+2]===3?(e.push(t+2),t+=2):t++;if(e.length===0)return d;var i=s-e.length,r=new Uint8Array(i),o=0;for(t=0;t<i;o++,t++)o===e[0]&&(o++,e.shift()),r[t]=d[o];return r}function Eo(d,s,e){if(d.byteLength!==16)throw new RangeError("Invalid system id");var t,i,r;if(s){t=1,i=new Uint8Array(16*s.length);for(var o=0;o<s.length;o++){var u=s[o];if(u.byteLength!==16)throw new RangeError("Invalid key");i.set(u,16*o)}}else t=0,i=new Uint8Array;t>0?(r=new Uint8Array(4),s.length>0&&new DataView(r.buffer).setUint32(0,s.length,!1)):r=new Uint8Array;var c=new Uint8Array(4);return e&&e.byteLength>0&&new DataView(c.buffer).setUint32(0,e.byteLength,!1),function(f){for(var h=arguments.length,p=new Array(h>1?h-1:0),y=1;y<h;y++)p[y-1]=arguments[y];for(var b=p.length,A=8,k=b;k--;)A+=p[k].byteLength;var D=new Uint8Array(A);for(D[0]=A>>24&255,D[1]=A>>16&255,D[2]=A>>8&255,D[3]=255&A,D.set(f,4),k=0,A=8;k<b;k++)D.set(p[k],A),A+=p[k].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),d,r,i,c,e||new Uint8Array)}var ua={},ca=function(){function d(e,t,i,r,o){r===void 0&&(r=[1]),o===void 0&&(o=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=r,this.iv=o,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){ua={}};var s=d.prototype;return s.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case ui:case Xi:case Vi:case di:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},s.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||H.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(D){for(var S=new Uint8Array(16),L=12;L<16;L++)S[L]=D>>8*(15-L)&255;return S}(e);return new d(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=ai(this.uri);if(i)switch(this.keyFormat){case Xi:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Vi:var r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Eo(r,null,i);var o=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),u=String.fromCharCode.apply(null,Array.from(o)),c=u.substring(u.indexOf("<"),u.length),f=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("KID")[0];if(f){var h=f.childNodes[0]?f.childNodes[0].nodeValue:f.getAttribute("VALUE");if(h){var p=_t(h).subarray(0,16);(function(D){var S=function(L,N,P){var V=L[N];L[N]=L[P],L[P]=V};S(D,0,3),S(D,1,2),S(D,4,5),S(D,6,7)})(p),this.keyId=p}}break;default:var y=i.subarray(0,16);if(y.length!==16){var b=new Uint8Array(16);b.set(y,16-y.length),y=b}this.keyId=y}if(!this.keyId||this.keyId.byteLength!==16){var A=ua[this.uri];if(!A){var k=Object.keys(ua).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,k),ua[this.uri]=A}this.keyId=A}return this},d}(),bo=/\{\$([a-zA-Z0-9-_]+)\}/g;function _o(d){return bo.test(d)}function Xt(d,s,e){if(d.variableList!==null||d.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],r=s[i];r&&(s[i]=bi(d,r))}}function bi(d,s){if(d.variableList!==null||d.hasVariableRefs){var e=d.variableList;return s.replace(bo,function(t){var i=t.substring(2,t.length-1),r=e==null?void 0:e[i];return r===void 0?(d.playlistParsingError||(d.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):r})}return s}function To(d,s,e){var t,i,r=d.variableList;if(r||(d.variableList=r={}),"QUERYPARAM"in s){t=s.QUERYPARAM;try{var o=new self.URL(e).searchParams;if(!o.has(t))throw new Error('"'+t+'" does not match any query parameter in URI: "'+e+'"');i=o.get(t)}catch(u){d.playlistParsingError||(d.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+u.message))}}else t=s.NAME,i=s.VALUE;t in r?d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):r[t]=i||""}function Ao(d,s,e){var t=s.IMPORT;if(e&&t in e){var i=d.variableList;i||(d.variableList=i={}),i[t]=e[t]}else d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+t+'"'))}function $a(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}var Pd={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}},$n=$a();function ja(d,s){var e;return(e=$n==null?void 0:$n.isTypeSupported((s||"video")+'/mp4;codecs="'+d+'"'))!=null&&e}var fr=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Fr=/#EXT-X-MEDIA:(.*)/g,Od=/^#EXT(?:INF|-X-TARGETDURATION):/m,jn=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),za=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|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("|")),ha=function(){function d(){}return d.findGroup=function(s,e){for(var t=0;t<s.length;t++){var i=s[t];if(i.id===e)return i}},d.convertAVC1ToAVCOTI=function(s){var e=s.split(".");if(e.length>2){var t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4)}return s},d.resolve=function(s,e){return dt.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},d.isMediaPlaylist=function(s){return Od.test(s)},d.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:_o(s)},r=[];for(fr.lastIndex=0;(t=fr.exec(s))!=null;)if(t[1]){var o,u=new it(t[1]);Xt(i,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=bi(i,t[2]),f={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(c,e)},h=u.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Nd((u.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=d.convertAVC1ToAVCOTI(f.videoCodec)),(o=f.unknownCodecs)!=null&&o.length||r.push(f),i.levels.push(f)}else if(t[3]){var p=t[3],y=t[4];switch(p){case"SESSION-DATA":var b=new it(y);Xt(i,b,["DATA-ID","LANGUAGE","VALUE","URI"]);var A=b["DATA-ID"];A&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[A]=b);break;case"SESSION-KEY":var k=So(y,e,i);k.encrypted&&k.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(k)):H.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+y+'"');break;case"DEFINE":var D=new it(y);Xt(i,D,["NAME","VALUE","QUERYPARAM"]),To(i,D,e);break;case"CONTENT-STEERING":var S=new it(y);Xt(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:d.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=ko(y)}}var L=r.length>0&&r.length<i.levels.length;return i.levels=L?r:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},d.parseMasterPlaylistMedia=function(s,e,t){var i,r={},o=t.levels,u={AUDIO:o.map(function(k){return{id:k.attrs.AUDIO,audioCodec:k.audioCodec}}),SUBTITLES:o.map(function(k){return{id:k.attrs.SUBTITLES,textCodec:k.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(Fr.lastIndex=0;(i=Fr.exec(s))!==null;){var f=new it(i[1]),h=f.TYPE;if(h){var p=u[h],y=r[h]||[];r[h]=y,Xt(t,f,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var b={attrs:f,bitrate:0,id:c++,groupId:f["GROUP-ID"]||"",instreamId:f["INSTREAM-ID"],name:f.NAME||f.LANGUAGE||"",type:h,default:f.bool("DEFAULT"),autoselect:f.bool("AUTOSELECT"),forced:f.bool("FORCED"),lang:f.LANGUAGE,url:f.URI?d.resolve(f.URI,e):""};if(p!=null&&p.length){var A=d.findGroup(p,b.groupId)||p[0];zn(b,A,"audioCodec"),zn(b,A,"textCodec")}y.push(b)}}return r},d.parseLevelPlaylist=function(s,e,t,i,r,o){var u,c,f,h=new bt(e),p=h.fragments,y=null,b=0,A=0,k=0,D=0,S=null,L=new Ee(i,e),N=-1,P=!1;for(jn.lastIndex=0,h.m3u8=s,h.hasVariableRefs=_o(s);(u=jn.exec(s))!==null;){P&&(P=!1,(L=new Ee(i,e)).start=k,L.sn=b,L.cc=D,L.level=t,y&&(L.initSegment=y,L.rawProgramDateTime=y.rawProgramDateTime,y.rawProgramDateTime=null));var V=u[1];if(V){L.duration=parseFloat(V);var q=(" "+u[2]).slice(1);L.title=q||null,L.tagList.push(q?["INF",V,q]:["INF",V])}else if(u[3]){if(oe(L.duration)){L.start=k,f&&Qn(L,f,h),L.sn=b,L.level=t,L.cc=D,L.urlId=r,p.push(L);var j=(" "+u[3]).slice(1);L.relurl=bi(h,j),wo(L,S),S=L,k+=L.duration,b++,A=0,P=!0}}else if(u[4]){var ee=(" "+u[4]).slice(1);S?L.setByteRange(ee,S):L.setByteRange(ee)}else if(u[5])L.rawProgramDateTime=(" "+u[5]).slice(1),L.tagList.push(["PROGRAM-DATE-TIME",L.rawProgramDateTime]),N===-1&&(N=p.length);else{if(!(u=u[0].match(za))){H.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<u.length&&u[c]===void 0;c++);var z=(" "+u[c]).slice(1),X=(" "+u[c+1]).slice(1),ue=u[c+2]?(" "+u[c+2]).slice(1):"";switch(z){case"PLAYLIST-TYPE":h.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":b=h.startSN=parseInt(X);break;case"SKIP":var ne=new it(X);Xt(h,ne,["RECENTLY-REMOVED-DATERANGES"]);var Te=ne.decimalInteger("SKIPPED-SEGMENTS");if(oe(Te)){h.skippedSegments=Te;for(var Me=Te;Me--;)p.unshift(null);b+=Te}var _e=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(h.recentlyRemovedDateranges=_e.split(" "));break;case"TARGETDURATION":h.targetduration=Math.max(parseInt(X),1);break;case"VERSION":h.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(X||ue)&&L.tagList.push(ue?[X,ue]:[X]);break;case"DISCONTINUITY":D++,L.tagList.push(["DIS"]);break;case"GAP":L.gap=!0,L.tagList.push([z]);break;case"BITRATE":L.tagList.push([z,X]);break;case"DATERANGE":var De=new it(X);Xt(h,De,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Xt(h,De,De.clientAttrs);var xe=new Ke(De,h.dateRanges[De.ID]);xe.isValid||h.skippedSegments?h.dateRanges[xe.id]=xe:H.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),L.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Ce=new it(X);Xt(h,Ce,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Ce?Ao(h,Ce,o):To(h,Ce,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var He=So(X,e,h);if(He.isSupported()){if(He.method==="NONE"){f=void 0;break}f||(f={}),f[He.keyFormat]&&(f=F({},f)),f[He.keyFormat]=He}else H.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":h.startTimeOffset=ko(X);break;case"MAP":var We=new it(X);if(Xt(h,We,["BYTERANGE","URI"]),L.duration){var Qe=new Ee(i,e);Lo(Qe,We,t,f),y=Qe,L.initSegment=y,y.rawProgramDateTime&&!L.rawProgramDateTime&&(L.rawProgramDateTime=y.rawProgramDateTime)}else Lo(L,We,t,f),y=L,P=!0;break;case"SERVER-CONTROL":var ot=new it(X);h.canBlockReload=ot.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=ot.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&ot.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=ot.optionalFloat("PART-HOLD-BACK",0),h.holdBack=ot.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var mi=new it(X);h.partTarget=mi.decimalFloatingPoint("PART-TARGET");break;case"PART":var Ot=h.partList;Ot||(Ot=h.partList=[]);var Wi=A>0?Ot[Ot.length-1]:void 0,xi=A++,Pi=new it(X);Xt(h,Pi,["BYTERANGE","URI"]);var Nt=new rt(Pi,L,e,xi,Wi);Ot.push(Nt),L.duration+=Nt.duration;break;case"PRELOAD-HINT":var $t=new it(X);Xt(h,$t,["URI"]),h.preloadHint=$t;break;case"RENDITION-REPORT":var tr=new it(X);Xt(h,tr,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(tr);break;default:H.warn("line parsed but not handled: "+u)}}}S&&!S.relurl?(p.pop(),k-=S.duration,h.partList&&(h.fragmentHint=S)):h.partList&&(wo(L,S),L.cc=D,h.fragmentHint=L,f&&Qn(L,f,h));var Kr=p.length,Ai=p[0],ds=p[Kr-1];if((k+=h.skippedSegments*h.targetduration)>0&&Kr&&ds){h.averagetargetduration=k/Kr;var us=ds.sn;h.endSN=us!=="initSegment"?us:0,h.live||(ds.endList=!0),Ai&&(h.startCC=Ai.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(k+=h.fragmentHint.duration),h.totalduration=k,h.endCC=D,N>0&&function(Yo,sn){for(var wa=Yo[sn],cs=sn;cs--;){var _r=Yo[cs];if(!_r)return;_r.programDateTime=wa.programDateTime-1e3*_r.duration,wa=_r}}(p,N),h},d}();function So(d,s,e){var t,i,r=new it(d);Xt(e,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var o=(t=r.METHOD)!=null?t:"",u=r.URI,c=r.hexadecimalInteger("IV"),f=r.KEYFORMATVERSIONS,h=(i=r.KEYFORMAT)!=null?i:"identity";u&&r.IV&&!c&&H.error("Invalid IV: "+r.IV);var p=u?ha.resolve(u,s):"",y=(f||"1").split("/").map(Number).filter(Number.isFinite);return new ca(o,p,h,y,c)}function ko(d){var s=new it(d).decimalFloatingPoint("TIME-OFFSET");return oe(s)?s:null}function Nd(d,s){["video","audio","text"].forEach(function(e){var t=d.filter(function(r){return function(o,u){var c=Pd[u];return!!c&&c[o.slice(0,4)]===!0}(r,e)});if(t.length){var i=t.filter(function(r){return r.lastIndexOf("avc1",0)===0||r.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(r){return t.indexOf(r)===-1})}}),s.unknownCodecs=d}function zn(d,s,e){var t=s[e];t&&(d[e]=t)}function wo(d,s){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):s!=null&&s.programDateTime&&(d.programDateTime=s.endProgramDateTime),oe(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function Lo(d,s,e,t){d.relurl=s.URI,s.BYTERANGE&&d.setByteRange(s.BYTERANGE),d.level=e,d.sn="initSegment",t&&(d.levelkeys=t),d.initSegment=null}function Qn(d,s,e){d.levelkeys=s;var t=e.encryptedFragments;t.length&&t[t.length-1].levelkeys===s||!Object.keys(s).some(function(i){return s[i].isCommonEncryption})||t.push(d)}var Ur="manifest",mr="level",hi="audioTrack",Ki="subtitleTrack",et="main",_i="audio",Ri="subtitle";function Io(d){switch(d.type){case hi:return _i;case Ki:return Ri;default:return et}}function Xn(d,s){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var St=function(){function d(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var s=d.prototype;return s.startLoad=function(e){},s.stopLoad=function(){this.destroyInternalLoaders()},s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.LEVEL_LOADING,this.onLevelLoading,this),e.on(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.LEVEL_LOADING,this.onLevelLoading,this),e.off(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader,o=new(i||r)(t);return this.loaders[e.type]=o,o},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},s.onManifestLoading=function(e,t){var i=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ur,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,r=t.level,o=t.url,u=t.deliveryDirectives;this.load({id:i,level:r,responseType:"text",type:mr,url:o,deliveryDirectives:u})},s.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,o=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:hi,url:o,deliveryDirectives:u})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,o=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:Ki,url:o,deliveryDirectives:u})},s.load=function(e){var t,i,r,o=this,u=this.hls.config,c=this.getInternalLoader(e);if(c){var f=c.context;if(f&&f.url===e.url)return void H.trace("[playlist-loader]: playlist request ongoing");H.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===Ur?u.manifestLoadPolicy.default:F({},u.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===mr&&e.level!==null?r=this.hls.levels[e.level].details:e.type===hi&&e.id!==null?r=this.hls.audioTracks[e.id].details:e.type===Ki&&e.id!==null&&(r=this.hls.subtitleTracks[e.id].details),r)){var h=r.partTarget,p=r.targetduration;if(h&&p){var y=1e3*Math.max(3*h,.8*p);i=F({},i,{maxTimeToFirstByteMs:Math.min(y,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(y,i.maxTimeToFirstByteMs)})}}var b=i.errorRetry||i.timeoutRetry||{},A={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},k={onSuccess:function(D,S,L,N){var P=o.getInternalLoader(L);o.resetInternalLoader(L.type);var V=D.data;V.indexOf("#EXTM3U")===0?(S.parsing.start=performance.now(),ha.isMediaPlaylist(V)?o.handleTrackOrLevelPlaylist(D,S,L,N||null,P):o.handleMasterPlaylist(D,S,L,N)):o.handleManifestParsingError(D,L,new Error("no EXTM3U delimiter"),N||null,S)},onError:function(D,S,L,N){o.handleNetworkError(S,L,!1,D,N)},onTimeout:function(D,S,L){o.handleNetworkError(S,L,!0,void 0,D)}};c.load(e,A,k)},s.handleMasterPlaylist=function(e,t,i,r){var o=this.hls,u=e.data,c=Xn(e,i),f=ha.parseMasterPlaylist(u,c);if(f.playlistParsingError)this.handleManifestParsingError(e,i,f.playlistParsingError,r,t);else{var h=f.contentSteering,p=f.levels,y=f.sessionData,b=f.sessionKeys,A=f.startTimeOffset,k=f.variableList;this.variableList=k;var D=ha.parseMasterPlaylistMedia(u,c,f),S=D.AUDIO,L=S===void 0?[]:S,N=D.SUBTITLES,P=D["CLOSED-CAPTIONS"];L.length&&(L.some(function(V){return!V.url})||!p[0].audioCodec||p[0].attrs.AUDIO||(H.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new it({}),bitrate:0,url:""}))),o.trigger(w.MANIFEST_LOADED,{levels:p,audioTracks:L,subtitles:N,captions:P,contentSteering:h,url:c,stats:t,networkDetails:r,sessionData:y,sessionKeys:b,startTimeOffset:A,variableList:k})}},s.handleTrackOrLevelPlaylist=function(e,t,i,r,o){var u=this.hls,c=i.id,f=i.level,h=i.type,p=Xn(e,i),y=oe(c)?c:0,b=oe(f)?f:y,A=Io(i),k=ha.parseLevelPlaylist(e.data,p,b,A,y,this.variableList);if(h===Ur){var D={attrs:new it({}),bitrate:0,details:k,name:"",url:p};u.trigger(w.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=k,this.handlePlaylistLoaded(k,e,t,i,r,o)},s.handleManifestParsingError=function(e,t,i,r,o){this.hls.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===Ur,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:o})},s.handleNetworkError=function(e,t,i,r,o){i===void 0&&(i=!1);var u="A network "+(i?"timeout":"error"+(r?" (status "+r.code+")":""))+" occurred while loading "+e.type;e.type===mr?u+=": "+e.level+" id: "+e.id:e.type!==hi&&e.type!==Ki||(u+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(u);H.warn("[playlist-loader]: "+u);var f=$.UNKNOWN,h=!1,p=this.getInternalLoader(e);switch(e.type){case Ur:f=i?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,h=!0;break;case mr:f=i?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,h=!1;break;case hi:f=i?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case Ki:f=i?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,h=!1}p&&this.resetInternalLoader(e.type);var y={type:le.NETWORK_ERROR,details:f,fatal:h,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:o};if(r){var b=(t==null?void 0:t.url)||e.url;y.response=E({url:b,data:void 0},r)}this.hls.trigger(w.ERROR,y)},s.handlePlaylistLoaded=function(e,t,i,r,o,u){var c=this.hls,f=r.type,h=r.level,p=r.id,y=r.groupId,b=r.deliveryDirectives,A=Xn(t,r),k=Io(r),D=typeof r.level=="number"&&k===et?h:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var S=e.playlistParsingError;if(S)c.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:r,level:D,parent:k,networkDetails:o,stats:i});else switch(e.live&&u&&(u.getCacheAge&&(e.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),f){case Ur:case mr:c.trigger(w.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:o,deliveryDirectives:b});break;case hi:c.trigger(w.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:y||"",stats:i,networkDetails:o,deliveryDirectives:b});break;case Ki:c.trigger(w.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:y||"",stats:i,networkDetails:o,deliveryDirectives:b})}}else{var L=new Error("No Segments found in Playlist");c.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:L,reason:L.message,response:t,context:r,level:D,parent:k,networkDetails:o,stats:i})}},d}();function fa(d,s){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=d,s.dispatchEvent(e)}function Ro(d,s){var e=d.mode;if(e==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(s.id))try{if(d.addCue(s),!d.cues.getCueById(s.id))throw new Error("addCue is failed for: "+s)}catch(i){H.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(s.startTime,s.endTime,s.text);t.id=s.id,d.addCue(t)}e==="disabled"&&(d.mode=e)}function Br(d){var s=d.mode;if(s==="disabled"&&(d.mode="hidden"),d.cues)for(var e=d.cues.length;e--;)d.removeCue(d.cues[e]);s==="disabled"&&(d.mode=s)}function Zn(d,s,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var r=function(u,c,f){var h=[],p=function(k,D){if(D<k[0].startTime)return 0;var S=k.length-1;if(D>k[S].endTime)return-1;for(var L=0,N=S;L<=N;){var P=Math.floor((N+L)/2);if(D<k[P].startTime)N=P-1;else{if(!(D>k[P].startTime&&L<S))return P;L=P+1}}return k[L].startTime-D<D-k[N].startTime?L:N}(u,c);if(p>-1)for(var y=p,b=u.length;y<b;y++){var A=u[y];if(A.startTime>=c&&A.endTime<=f)h.push(A);else if(A.startTime>f)return h}return h}(d.cues,s,e),o=0;o<r.length;o++)t&&!t(r[o])||d.removeCue(r[o]);i==="disabled"&&(d.mode=i)}var ma="org.id3",pa="com.apple.quicktime.HLS",pr="https://aomedia.org/emsg/ID3";function Qa(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var va=function(){var d=Qa();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Ji(d,s){return d.getTime()/1e3-s}var Fd=function(){function d(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},s._registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Br(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},s.onManifestLoading=function(){this.dateRangeCuesAppended={}},s.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},s.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 fa(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,r=i.enableEmsgMetadataCues,o=i.enableID3MetadataCues;if(r||o){var u=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=Qa(),f=0;f<u.length;f++){var h=u[f].type;if((h!==pr||r)&&o){var p=Gn(u[f].data);if(p){var y=u[f].pts,b=y+u[f].duration;b>va&&(b=va),b-y<=0&&(b=y+.25);for(var A=0;A<p.length;A++){var k=p[A];if(!lo(k)){this.updateId3CueEnds(y);var D=new c(y,b,"");D.value=k,h&&(D.type=h),this.id3Track.addCue(D)}}}}}}}},s.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)==null?void 0:t.cues;if(i)for(var r=i.length;r--;){var o=i[r];o.startTime<e&&o.endTime===va&&(o.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,o=t.type,u=this.id3Track,c=this.hls;if(c){var f=c.config,h=f.enableEmsgMetadataCues,p=f.enableID3MetadataCues;u&&(h||p)&&Zn(u,i,r,o==="audio"?function(y){return y.type===ma&&p}:o==="video"?function(y){return y.type===pr&&h}:function(y){return y.type===ma&&p||y.type===pr&&h})}},s.onLevelUpdated=function(e,t){var i=this,r=t.details;if(this.media&&r.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var o=this.dateRangeCuesAppended,u=this.id3Track,c=r.dateRanges,f=Object.keys(c);if(u)for(var h=Object.keys(o).filter(function(L){return!f.includes(L)}),p=function(){var L=h[y];Object.keys(o[L].cues).forEach(function(N){u.removeCue(o[L].cues[N])}),delete o[L]},y=h.length;y--;)p();var b=r.fragments[r.fragments.length-1];if(f.length!==0&&oe(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,k=Qa(),D=function(){var L=f[S],N=c[L],P=o[L],V=(P==null?void 0:P.cues)||{},q=(P==null?void 0:P.durationKnown)||!1,j=Ji(N.startDate,A),ee=va,z=N.endDate;if(z)ee=Ji(z,A),q=!0;else if(N.endOnNext&&!q){var X=f.reduce(function(Ce,He){var We=c[He];return We.class===N.class&&We.id!==He&&We.startDate>N.startDate&&Ce.push(We),Ce},[]).sort(function(Ce,He){return Ce.startDate.getTime()-He.startDate.getTime()})[0];X&&(ee=Ji(X.startDate,A),q=!0)}for(var ue,ne,Te=Object.keys(N.attr),Me=0;Me<Te.length;Me++){var _e=Te[Me];if((ne=_e)!=="ID"&&ne!=="CLASS"&&ne!=="START-DATE"&&ne!=="DURATION"&&ne!=="END-DATE"&&ne!=="END-ON-NEXT"){var De=V[_e];if(De)q&&!P.durationKnown&&(De.endTime=ee);else{var xe=N.attr[_e];De=new k(j,ee,""),Qt(_e)&&(ue=xe,xe=Uint8Array.from(ue.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),De.value={key:_e,data:xe},De.type=pa,De.id=L,i.id3Track.addCue(De),V[_e]=De}}}o[L]={cues:V,dateRange:N,durationKnown:q}},S=0;S<f.length;S++)D()}}},d}(),Ud=function(){function d(e){var t=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 t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(w.ERROR,this.onError,this)},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},s.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},s.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},s.onLevelUpdated=function(e,t){var i=t.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},s.onError=function(e,t){var i;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&H.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},s.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var i=this.computeLatency();if(i!==null){this._latency=i;var r=this.config,o=r.lowLatencyMode,u=r.maxLiveSyncPlaybackRate;if(o&&u!==1){var c=this.targetLatency;if(c!==null){var f=i-c,h=f<Math.min(this.maxLatency,c+t.targetduration);if(t.live&&h&&f>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,u)),y=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;e.playbackRate=Math.min(p,Math.max(1,y))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}}}}},s.estimateLiveEdge=function(){var e=this.levelDetails;return e===null?null:e.edge+e.age},s.computeLatency=function(){var e=this.estimateLiveEdge();return e===null?null:e-this.currentTime},M(d,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(e===null)return null;var t=e.holdBack,i=e.partHoldBack,r=e.targetduration,o=this.config,u=o.liveSyncDuration,c=o.liveSyncDurationCount,f=o.lowLatencyMode,h=this.hls.userConfig,p=f&&i||t;(h.liveSyncDuration||h.liveSyncDurationCount||p===0)&&(p=u!==void 0?u:c*r);var y=r;return p+Math.min(1*this.stallCount,y)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;var r=i.edge,o=e-t-this.edgeStalled,u=r-i.totalduration,c=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(u,o),c)}},{key:"drift",get:function(){var e=this.levelDetails;return e===null?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(e===null)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}}]),d}(),Jn=["NONE","TYPE-0","TYPE-1",null],es="",Bd="YES",Hd="v2",Do=function(){function d(s,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=s,this.part=e,this.skip=t}return d.prototype.addDirectives=function(s){var e=new self.URL(s);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}(),ga=function(){function d(s){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=[s.url],this._attrs=[s.attrs],this.bitrate=s.bitrate,s.details&&(this.details=s.details),this.id=s.id||0,this.name=s.name,this.width=s.width||0,this.height=s.height||0,this.audioCodec=s.audioCodec,this.videoCodec=s.videoCodec,this.unknownCodecs=s.unknownCodecs,this.codecSet=[s.videoCodec,s.audioCodec].filter(function(e){return e}).join(",").replace(/\.[^.,]+/g,"")}return d.prototype.addFallback=function(s){this.url.push(s.url),this._attrs.push(s.attrs)},M(d,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"attrs",get:function(){return this._attrs[this._urlId]}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(s){var e=s%this.url.length;this._urlId!==e&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=e)}},{key:"audioGroupId",get:function(){var s;return(s=this.audioGroupIds)==null?void 0:s[this.urlId]}},{key:"textGroupId",get:function(){var s;return(s=this.textGroupIds)==null?void 0:s[this.urlId]}}]),d}();function ts(d,s){var e=s.startPTS;if(oe(e)){var t,i=0;s.sn>d.sn?(i=e-d.start,t=d):(i=d.start-e,t=s),t.duration!==i&&(t.duration=i)}else s.sn>d.sn?d.cc===s.cc&&d.minEndPTS?s.start=d.start+(d.minEndPTS-d.start):s.start=d.start+d.duration:s.start=Math.max(d.start-s.duration,0)}function ya(d,s,e,t,i,r){t-e<=0&&(H.warn("Fragment should have a positive duration",s),t=e+s.duration,r=i+s.duration);var o=e,u=t,c=s.startPTS,f=s.endPTS;if(oe(c)){var h=Math.abs(c-e);oe(s.deltaPTS)?s.deltaPTS=Math.max(h,s.deltaPTS):s.deltaPTS=h,o=Math.max(e,c),e=Math.min(e,c),i=Math.min(i,s.startDTS),u=Math.min(t,f),t=Math.max(t,f),r=Math.max(r,s.endDTS)}var p=e-s.start;s.start!==0&&(s.start=e),s.duration=t-s.start,s.startPTS=e,s.maxStartPTS=o,s.startDTS=i,s.endPTS=t,s.minEndPTS=u,s.endDTS=r;var y,b=s.sn;if(!d||b<d.startSN||b>d.endSN)return 0;var A=b-d.startSN,k=d.fragments;for(k[A]=s,y=A;y>0;y--)ts(k[y],k[y-1]);for(y=A;y<k.length-1;y++)ts(k[y],k[y+1]);return d.fragmentHint&&ts(k[k.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,p}function is(d,s){for(var e=null,t=d.fragments,i=t.length-1;i>=0;i--){var r=t[i].initSegment;if(r){e=r;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var o,u,c,f,h,p=0;if(function(S,L,N){for(var P=L.skippedSegments,V=Math.max(S.startSN,L.startSN)-L.startSN,q=(S.fragmentHint?1:0)+(P?L.endSN:Math.min(S.endSN,L.endSN))-L.startSN,j=L.startSN-S.startSN,ee=L.fragmentHint?L.fragments.concat(L.fragmentHint):L.fragments,z=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=q;X++){var ue=z[j+X],ne=ee[X];P&&!ne&&X<P&&(ne=L.fragments[X]=ue),ue&&ne&&N(ue,ne)}}(d,s,function(S,L){S.relurl&&(p=S.cc-L.cc),oe(S.startPTS)&&oe(S.endPTS)&&(L.start=L.startPTS=S.startPTS,L.startDTS=S.startDTS,L.maxStartPTS=S.maxStartPTS,L.endPTS=S.endPTS,L.endDTS=S.endDTS,L.minEndPTS=S.minEndPTS,L.duration=S.endPTS-S.startPTS,L.duration&&(o=L),s.PTSKnown=s.alignedSliding=!0),L.elementaryStreams=S.elementaryStreams,L.loader=S.loader,L.stats=S.stats,L.urlId=S.urlId,S.initSegment&&(L.initSegment=S.initSegment,e=S.initSegment)}),e&&(s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments).forEach(function(S){var L;S.initSegment&&S.initSegment.relurl!==((L=e)==null?void 0:L.relurl)||(S.initSegment=e)}),s.skippedSegments)if(s.deltaUpdateFailed=s.fragments.some(function(S){return!S}),s.deltaUpdateFailed){H.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=s.skippedSegments;y--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}else s.canSkipDateRanges&&(s.dateRanges=(u=d.dateRanges,c=s.dateRanges,f=s.recentlyRemovedDateranges,h=F({},u),f&&f.forEach(function(S){delete h[S]}),Object.keys(c).forEach(function(S){var L=new Ke(c[S].attr,h[S]);L.isValid?h[S]=L:H.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),h));var b=s.fragments;if(p){H.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<b.length;A++)b[A].cc+=p}s.skippedSegments&&(s.startCC=s.fragments[0].cc),function(S,L,N){if(S&&L)for(var P=0,V=0,q=S.length;V<=q;V++){var j=S[V],ee=L[V+P];j&&ee&&j.index===ee.index&&j.fragment.sn===ee.fragment.sn?N(j,ee):P--}}(d.partList,s.partList,function(S,L){L.elementaryStreams=S.elementaryStreams,L.stats=S.stats}),o?ya(s,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):rs(d,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=d.driftStartTime,s.driftStart=d.driftStart;var k=s.advancedDateTime;if(s.advanced&&k){var D=s.edge;s.driftStart||(s.driftStartTime=k,s.driftStart=D),s.driftEndTime=k,s.driftEnd=D}else s.driftEndTime=d.driftEndTime,s.driftEnd=d.driftEnd,s.advancedDateTime=d.advancedDateTime}function rs(d,s){var e=s.startSN+s.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Ea(s,t[e].start)}function Ea(d,s){if(s){for(var e=d.fragments,t=d.skippedSegments;t<e.length;t++)e[t].start+=s;d.fragmentHint&&(d.fragmentHint.start+=s)}}function Co(d,s,e){var t;return d!=null&&d.details?Mo((t=d.details)==null?void 0:t.partList,s,e):null}function Mo(d,s,e){if(d)for(var t=d.length;t--;){var i=d[t];if(i.index===e&&i.fragment.sn===s)return i}return null}function Xa(d){switch(d.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function xo(d,s){var e=Xa(s);return d.default[(e?"timeout":"error")+"Retry"]}function as(d,s){var e=d.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*d.retryDelayMs,d.maxRetryDelayMs)}function Po(d){return E(E({},d),{errorRetry:null,timeoutRetry:null})}function Za(d,s,e,t){return!!d&&s<d.maxNumRetry&&(function(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}(t)||!!e)}var Oo=function(d,s){for(var e=0,t=d.length-1,i=null,r=null;e<=t;){var o=s(r=d[i=(e+t)/2|0]);if(o>0)e=i+1;else{if(!(o<0))return r;t=i-1}}return null};function ba(d,s,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(d?i=s[d.sn-s[0].sn+1]||null:e===0&&s[0].start===0&&(i=s[0]),i&&Ja(e,t,i)===0)return i;var r=Oo(s,Ja.bind(null,e,t));return!r||r===d&&i?i:r}function Ja(d,s,e){if(d===void 0&&(d=0),s===void 0&&(s=0),e.start<=d&&e.start+e.duration>d)return 0;var t=Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0}function fi(d,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var vr,Gd=3e5,ns=0,T=2,g=5,_=0,R=1,C=2,O=function(){function d(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=H.log.bind(H,"[info]:"),this.warn=H.warn.bind(H,"[warning]:"),this.error=H.error.bind(H,"[error]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.ERROR,this.onError,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.ERROR,this.onError,this),e.off(w.ERROR,this.onErrorOut,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this))},s.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},s.startLoad=function(e){this.playlistError=0},s.stopLoad=function(){},s.getVariantLevelIndex=function(e){return(e==null?void 0:e.type)===et?e.level:this.hls.loadLevel},s.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},s.onError=function(e,t){var i;if(!t.fatal){var r=this.hls,o=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=T);case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:var u,c,f=t.parent===et?t.level:r.loadLevel;return void(t.details===$.LEVEL_EMPTY_ERROR&&(u=t.context)!=null&&(c=u.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,f):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,f)));case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:return void(typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){var h=r.levels[r.loadLevel];if(h&&(o.type===hi&&o.groupId===h.audioGroupId||o.type===Ki&&o.groupId===h.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=T,void(t.errorAction.flags=R)}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=r.levels[r.loadLevel],y=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(y&&(t.errorAction={action:T,flags:C,hdcpLevel:y}));case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:r.loadLevel));case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:ns,flags:_})}if(t.type===le.KEY_SYSTEM_ERROR){var b=this.getVariantLevelIndex(t.frag);return t.levelRetry=!1,void(t.errorAction=this.getLevelSwitchAction(t,b))}}},s.getPlaylistRetryOrSwitchAction=function(e,t){var i,r,o=xo(this.hls.config.playlistLoadPolicy,e),u=this.playlistError++,c=(i=e.response)==null?void 0:i.code;return Za(o,u,Xa(e),c)?{action:g,flags:_,retryConfig:o,retryCount:u}:(r=e.context)!=null&&r.deliveryDirectives?{action:ns,flags:_,retryConfig:o||{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},retryCount:u}:this.getLevelSwitchAction(e,t)},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],o=t.config,u=o.fragLoadPolicy,c=o.keyLoadPolicy,f=xo(e.details.startsWith("key")?c:u,e),h=t.levels.reduce(function(A,k){return A+k.fragmentError},0);if(r){var p;e.details!==$.FRAG_GAP&&r.fragmentError++;var y=(p=e.response)==null?void 0:p.code;if(Za(f,h,Xa(e),y))return{action:g,flags:_,retryConfig:f,retryCount:h}}var b=this.getLevelSwitchAction(e,i);return f&&(b.retryConfig=f,b.retryCount=h),b},s.getLevelSwitchAction=function(e,t){var i=this.hls;t==null&&(t=i.loadLevel);var r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){for(var o,u,c=-1,f=i.levels,h=(o=e.frag)==null?void 0:o.type,p=(u=e.context)!=null?u:{},y=p.type,b=p.groupId,A=f.length;A--;){var k=(A+i.loadLevel)%f.length;if(k!==i.loadLevel&&f[k].loadError===0){var D=f[k];if(e.details===$.FRAG_GAP&&e.frag){var S=f[k].details;if(S){var L=ba(e.frag,S.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else if(y===hi&&b===D.audioGroupId||y===Ki&&b===D.textGroupId||h===_i&&r.audioGroupId===D.audioGroupId||h===Ri&&r.textGroupId===D.textGroupId)continue;c=k;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,{action:T,flags:_,nextAutoLevel:c}}return{action:T,flags:R}},s.onErrorOut=function(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ns:break;case T:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===$.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()},s.sendAlternateToPenaltyBox=function(e){var t=this.hls,i=e.errorAction;if(i){var r=i.flags,o=i.hdcpLevel,u=i.nextAutoLevel;switch(r){case _:this.switchLevel(e,u);break;case R:i.resolved||(i.resolved=this.redundantFailover(e));break;case C:o&&(t.maxHdcpLevel=Jn[Jn.indexOf(o)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,u)}},s.switchLevel=function(e,t){t!==void 0&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},s.redundantFailover=function(e){var t=this,i=this.hls,r=this.penalizedRenditions,o=e.parent===et?e.level:i.loadLevel,u=i.levels[o],c=u.url.length,f=e.frag?e.frag.urlId:u.urlId;u.urlId!==f||e.frag&&!u.details||this.penalizeRendition(u,e);for(var h=function(){var b=(f+p)%c,A=r[b];if(!A||function(k,D,S){if(performance.now()-k.lastErrorPerfMs>Gd)return!0;var L=k.details;if(D.details===$.FRAG_GAP&&L&&D.frag){var N=D.frag.start,P=ba(null,L.fragments,N);if(P&&!P.gap)return!0}if(S&&k.errors.length<S.errors.length){var V=k.errors[k.errors.length-1];if(L&&V.frag&&D.frag&&Math.abs(V.frag.start-D.frag.start)>3*L.targetduration)return!0}return!1}(A,e,r[f]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+u.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(k){k.urlId=b}),i.nextLoadLevel=o,{v:!0}},p=1;p<c;p++){var y=h();if(typeof y=="object")return y.v}return!1},s.penalizeRendition=function(e,t){var i=this.penalizedRenditions,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r},d}(),x=function(){function d(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=H.log.bind(H,t+":"),this.warn=H.warn.bind(H,t+":"),this.hls=e}var s=d.prototype;return s.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},s.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},s.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},s.stopLoad=function(){this.canLoad=!1,this.clearTimer()},s.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i){for(var r=-1,o=0;o<i.length;o++){var u=i[o],c=void 0;try{c=new self.URL(u.URI,t.url).href}catch(b){H.warn("Could not construct new URL for Rendition Report: "+b),c=u.URI||""}if(c===e){r=o;break}c===e.substring(0,c.length)&&(r=o)}if(r!==-1){var f=i[r],h=parseInt(f["LAST-MSN"])||(t==null?void 0:t.lastPartSn),p=parseInt(f["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var y=Math.min(t.age-t.partTarget,t.targetduration);p>=0&&y>t.partTarget&&(p+=1)}return new Do(h,p>=0?p:void 0,es)}}},s.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},s.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},s.shouldReloadPlaylist=function(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)},s.playlistLoaded=function(e,t,i){var r=this,o=t.details,u=t.stats,c=self.performance.now(),f=u.loading.first?Math.max(0,c-u.loading.first):0;if(o.advancedDateTime=Date.now()-f,o.live||i!=null&&i.live){if(o.reloaded(i),i&&this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),i&&o.fragments.length>0&&is(i,o),!this.canLoad||!o.live)return;var h,p=void 0,y=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var b=this.hls.config.lowLatencyMode,A=o.lastPartSn,k=o.endSN,D=o.lastPartIndex,S=A===k;D!==-1?(p=S?k+1:A,y=S?b?0:D:D+1):p=k+1;var L=o.age,N=L+o.ageHeader,P=Math.min(N-o.partTarget,1.5*o.targetduration);if(P>0){if(i&&P>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+P+" with playlist age: "+o.age),P=0;else{var V=Math.floor(P/o.targetduration);p+=V,y!==void 0&&(y+=Math.round(P%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+P+" skip sn "+V+" to part "+y)}o.tuneInGoal=P}if(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,y),b||!S)return void this.loadPlaylist(h)}else o.canBlockReload&&(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,y));var q=this.hls.mainForwardBufferInfo,j=q?q.end-q.len:0,ee=function(X,ue){ue===void 0&&(ue=1/0);var ne=1e3*X.targetduration;if(X.updated){var Te=X.fragments;if(Te.length&&4*ne>ue){var Me=1e3*Te[Te.length-1].duration;Me<ne&&(ne=Me)}}else ne/=2;return Math.round(ne)}(o,1e3*(o.edge-j));o.updated&&c>this.requestScheduled+ee&&(this.requestScheduled=u.loading.start),p!==void 0&&o.canBlockReload?this.requestScheduled=u.loading.first+ee-(1e3*o.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+ee<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=ee);var z=this.requestScheduled-c;z=Math.max(0,z),this.log("reload live playlist "+e+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(h)},z)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,r){var o=function(u,c){var f=u.canSkipUntil,h=u.canSkipDateRanges,p=u.endSN;return f&&(c!==void 0?c-p:0)<f?h?Hd:Bd:es}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,o=es),new Do(i,r,o)},s.checkRetry=function(e){var t=this,i=e.details,r=Xa(e),o=e.errorAction,u=o||{},c=u.action,f=u.retryCount,h=f===void 0?0:f,p=u.retryConfig,y=!!o&&!!p&&(c===g||!o.resolved&&c===T);if(y){var b;if(this.requestScheduled=-1,r&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist();else{var A=as(p,h);this.timer=self.setTimeout(function(){return t.loadPlaylist()},A),this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" in '+A+"ms")}e.levelRetry=!0,o.resolved=!0}return y},d}(),G=function(d){function s(t,i){var r;return(r=d.call(this,t,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=i,r._registerListeners(),r}Q(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this),t.on(w.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),d.prototype.destroy.call(this)},e.startLoad=function(){this._levels.forEach(function(t){t.loadError=0,t.fragmentError=0}),d.prototype.startLoad.call(this)},e.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},e.onManifestLoading=function(t,i){this.resetLevels()},e.onManifestLoaded=function(t,i){var r,o=[],u={};i.levels.forEach(function(c){var f,h=c.attrs;((f=c.audioCodec)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(vr||(vr=/chrome|firefox/i.test(navigator.userAgent)),vr&&(c.audioCodec=void 0));var p=h.AUDIO,y=h.CODECS,b=h["FRAME-RATE"],A=h["PATHWAY-ID"],k=h.RESOLUTION,D=h.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+k+"-"+b+"-"+y;(r=u[S])?r.addFallback(c):(r=new ga(c),u[S]=r,o.push(r)),Y(r,"audio",p),Y(r,"text",D)}),this.filterAndSortMediaOptions(o,i)},e.filterAndSortMediaOptions=function(t,i){var r=this,o=[],u=[],c=!1,f=!1,h=!1,p=t.filter(function(L){var N=L.audioCodec,P=L.videoCodec,V=L.width,q=L.height,j=L.unknownCodecs;return c||(c=!(!V||!q)),f||(f=!!P),h||(h=!!N),!(j!=null&&j.length)&&(!N||ja(N,"audio"))&&(!P||ja(P,"video"))});if((c||f)&&h&&(p=p.filter(function(L){var N=L.videoCodec,P=L.width,V=L.height;return!!N||!(!P||!V)})),p.length!==0){i.audioTracks&&K(o=i.audioTracks.filter(function(L){return!L.audioCodec||ja(L.audioCodec,"audio")})),i.subtitles&&K(u=i.subtitles);var y=p.slice(0);p.sort(function(L,N){return L.attrs["HDCP-LEVEL"]!==N.attrs["HDCP-LEVEL"]?(L.attrs["HDCP-LEVEL"]||"")>(N.attrs["HDCP-LEVEL"]||"")?1:-1:L.bitrate!==N.bitrate?L.bitrate-N.bitrate:L.attrs["FRAME-RATE"]!==N.attrs["FRAME-RATE"]?L.attrs.decimalFloatingPoint("FRAME-RATE")-N.attrs.decimalFloatingPoint("FRAME-RATE"):L.attrs.SCORE!==N.attrs.SCORE?L.attrs.decimalFloatingPoint("SCORE")-N.attrs.decimalFloatingPoint("SCORE"):c&&L.height!==N.height?L.height-N.height:0});var b=y[0];if(this.steering&&(p=this.steering.filterParsedLevels(p)).length!==y.length){for(var A=0;A<y.length;A++)if(y[A].pathwayId===p[0].pathwayId){b=y[A];break}}this._levels=p;for(var k=0;k<p.length;k++)if(p[k]===b){this._firstLevel=k,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=h&&!f,S={levels:p,audioTracks:o,subtitleTracks:u,sessionData:i.sessionData,sessionKeys:i.sessionKeys,firstLevel:this._firstLevel,stats:i.stats,audio:h,video:f,altAudio:!D&&o.some(function(L){return!!L.url})};this.hls.trigger(w.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(r.hls){var L=new Error("no level with compatible codecs found in manifest");r.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:i.url,error:L,reason:L.message})}})},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===mr&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var r=i.frag;if(r!==void 0&&r.type===et){var o=this._levels[r.level];o!==void 0&&(o.loadError=0)}},e.onLevelLoaded=function(t,i){var r,o,u=i.level,c=i.details,f=this._levels[u];if(!f)return this.warn("Invalid level index "+u),void((o=i.deliveryDirectives)!=null&&o.skip&&(c.deltaUpdateFailed=!0));u===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0),this.playlistLoaded(u,i,f.details)):(r=i.deliveryDirectives)!=null&&r.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var r=this.currentLevel;if(r){var o=this.hls.audioTracks[i.id].groupId;if(r.audioGroupIds&&r.audioGroupId!==o){for(var u=-1,c=0;c<r.audioGroupIds.length;c++)if(r.audioGroupIds[c]===o){u=c;break}u!==-1&&u!==r.urlId&&(r.urlId=u,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){var o=r.urlId,u=r.uri;if(t)try{u=t.addDirectives(u)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}var c=r.attrs["PATHWAY-ID"];this.log("Loading level index "+i+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+" with"+(c?" Pathway "+c:"")+" URI "+(o+1)+"/"+r.url.length+" "+u),this.clearTimer(),this.hls.trigger(w.LEVEL_LOADING,{url:u,level:i,id:o,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var r=this,o=function(c,f){return f!==i},u=this._levels.filter(function(c,f){return f!==t||(c.url.length>1&&i!==void 0?(c.url=c.url.filter(o),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(o)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(o)),c.urlId=0,!0):(r.steering&&r.steering.removeLevel(c),!1))});this.hls.trigger(w.LEVELS_UPDATED,{levels:u})},e.onLevelsUpdated=function(t,i){var r=i.levels;r.forEach(function(o,u){var c=o.details;c!=null&&c.fragments&&c.fragments.forEach(function(f){f.level=u})}),this._levels=r},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var i=this._levels;if(i.length!==0){if(t<0||t>=i.length){var r=new Error("invalid level idx"),o=t<0;if(this.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:t,fatal:o,error:r,reason:r.message}),o)return;t=Math.min(t,i.length-1)}var u=this.currentLevelIndex,c=this.currentLevel,f=c?c.attrs["PATHWAY-ID"]:void 0,h=i[t],p=h.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=h,u!==t||!h.details||!c||f!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+u+(f?" with Pathway "+f:""));var y=F({},h,{level:t,maxBitrate:h.maxBitrate,attrs:h.attrs,uri:h.uri,urlId:h.urlId});delete y._attrs,delete y._urlId,this.hls.trigger(w.LEVEL_SWITCHING,y);var b=h.details;if(!b||b.live){var A=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(A)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var t=this.hls.config.startLevel;return t!==void 0?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}}]),s}(x);function Y(d,s,e){e&&(s==="audio"?(d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds[d.url.length-1]=e):s==="text"&&(d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds[d.url.length-1]=e))}function K(d){var s={};d.forEach(function(e){var t=e.groupId||"";e.id=s[t]=s[t]||0,s[t]++})}var Z="NOT_LOADED",Oe="APPENDING",ye="PARTIAL",Se="OK",be=function(){function d(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var s=d.prototype;return s._registerListeners=function(){var e=this.hls;e.on(w.BUFFER_APPENDED,this.onBufferAppended,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.BUFFER_APPENDED,this.onBufferAppended,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this)},s.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},s.getAppendedFrag=function(e,t){var i=this.activePartLists[t];if(i)for(var r=i.length;r--;){var o=i[r];if(!o)break;var u=o.end;if(o.start<=e&&u!==null&&e<=u)return o}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),o=r.length;o--;){var u=i[r[o]];if((u==null?void 0:u.body.type)===t&&u.buffered){var c=u.body;if(c.start<=e&&e<=c.end)return c}}return null},s.detectEvictedFragments=function(e,t,i,r){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var u=(r==null?void 0:r.fragment.sn)||0;Object.keys(this.fragments).forEach(function(c){var f=o.fragments[c];if(f&&!(u>=f.body.sn))if(f.buffered||f.loaded){var h=f.range[e];h&&h.time.some(function(p){var y=!o.isTimeBuffered(p.startPTS,p.endPTS,t);return y&&o.removeFragment(f.body),y})}else f.body.type===i&&o.removeFragment(f.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,r=e.frag,o=e.part;if(i&&r.sn!=="initSegment"){var u=Ge(r),c=this.fragments[u];if(c){var f=!r.relurl;Object.keys(i).forEach(function(h){var p=r.elementaryStreams[h];if(p){var y=i[h],b=f||p.partial===!0;c.range[h]=t.getBufferedTimes(r,o,b,y)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c),Re(c)||this.removeParts(r.sn-1,r.type)):this.removeFragment(c.body)}}},s.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(r){return r.fragment.sn>=e}))},s.fragBuffered=function(e,t){var i=Ge(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)},s.getBufferedTimes=function(e,t,i,r){for(var o={time:[],partial:i},u=e.start,c=e.end,f=e.minEndPTS||c,h=e.maxStartPTS||u,p=0;p<r.length;p++){var y=r.start(p)-this.bufferPadding,b=r.end(p)+this.bufferPadding;if(h>=y&&f<=b){o.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});break}if(u<b&&c>y)o.partial=!0,o.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});else if(c<=y)break}return o},s.getPartialFragment=function(e){var t,i,r,o=null,u=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(h){var p=f[h];p&&Re(p)&&(i=p.body.start-c,r=p.body.end+c,e>=i&&e<=r&&(t=Math.min(e-i,r-e),u<=t&&(o=p.body,u=t)))}),o},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||Re(t))},s.getState=function(e){var t=Ge(e),i=this.fragments[t];return i?i.buffered?Re(i)?ye:Se:Oe:Z},s.isTimeBuffered=function(e,t,i){for(var r,o,u=0;u<i.length;u++){if(r=i.start(u)-this.bufferPadding,o=i.end(u)+this.bufferPadding,e>=r&&t<=o)return!0;if(t<=r)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest){var o=r?null:t,u=Ge(i);this.fragments[u]={body:i,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,r=t.frag,o=t.part,u=t.timeRanges;if(r.sn!=="initSegment"){var c=r.type;if(o){var f=this.activePartLists[c];f||(this.activePartLists[c]=f=[]),f.push(o)}this.timeRanges=u,Object.keys(u).forEach(function(h){var p=u[h];i.detectEvictedFragments(h,p,c,o)})}},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=Ge(e);return!!this.fragments[t]},s.hasParts=function(e){var t;return!((t=this.activePartLists[e])==null||!t.length)},s.removeFragmentsInRange=function(e,t,i,r,o){var u=this;r&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=u.fragments[c];if(f){var h=f.body;h.type!==i||r&&!h.gap||h.start<t&&h.end>e&&(f.buffered||o)&&u.removeFragment(h)}})},s.removeFragment=function(e){var t=Ge(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var r=e.sn;this.activePartLists[e.type]=i.filter(function(o){return o.fragment.sn!==r})}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},s.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},d}();function Re(d){var s,e;return d.buffered&&(d.body.gap||((s=d.range.video)==null?void 0:s.partial)||((e=d.range.audio)==null?void 0:e.partial))}function Ge(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}var kt=Math.pow(2,17),Pt=function(){function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var s=d.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();var o=this.config,u=o.fLoader,c=o.loader;return new Promise(function(f,h){if(i.loader&&i.loader.destroy(),e.gap)h(ni(e));else{var p=i.loader=e.loader=u?new u(o):new c(o),y=Wt(e),b=Po(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:kt};e.stats=p.stats,p.load(y,A,{onSuccess:function(k,D,S,L){i.resetLoader(e,p);var N=k.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(N.slice(0,16)),N=N.slice(16)),f({frag:e,part:null,payload:N,networkDetails:L})},onError:function(k,D,S,L){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:r,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:L}))},onAbort:function(k,D,S){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))},onProgress:function(k,D,S,L){t&&t({frag:e,part:null,payload:S,networkDetails:L})}})}})},s.loadPart=function(e,t,i){var r=this;this.abort();var o=this.config,u=o.fLoader,c=o.loader;return new Promise(function(f,h){if(r.loader&&r.loader.destroy(),e.gap||t.gap)h(ni(e,t));else{var p=r.loader=e.loader=u?new u(o):new c(o),y=Wt(e,t),b=Po(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:kt};t.stats=p.stats,p.load(y,A,{onSuccess:function(k,D,S,L){r.resetLoader(e,p),r.updateStatsFromPart(e,t);var N={frag:e,part:t,payload:k.data,networkDetails:L};i(N),f(N)},onError:function(k,D,S,L){r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:y.url,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:L}))},onAbort:function(k,D,S){e.stats.aborted=t.stats.aborted,r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,o=r.total;if(i.loaded+=r.loaded,o){var u=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/o),u),f=(u-c)*Math.round(i.loaded/c);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);var h=i.loading,p=r.loading;h.start?h.first+=p.first-p.start:(h.start=p.start,h.first=p.first),h.end=p.end},s.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d}();function Wt(d,s){s===void 0&&(s=null);var e=s||d,t={frag:d,part:s,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,r=e.byteRangeEndOffset;if(oe(i)&&oe(r)){var o,u=i,c=r;if(d.sn==="initSegment"&&((o=d.decryptdata)==null?void 0:o.method)==="AES-128"){var f=r-i;f%16&&(c=r+(16-f%16)),i!==0&&(t.resetIV=!0,u=i-16)}t.rangeStart=u,t.rangeEnd=c}return t}function ni(d,s){var e=new Error("GAP "+(d.gap?"tag":"attribute")+" found"),t={type:le.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:d,error:e,networkDetails:null};return s&&(t.part=s),(s||d).stats.aborted=!0,new Be(t)}var Be=function(d){function s(e){var t;return(t=d.call(this,e.error.message)||this).data=void 0,t.data=e,t}return Q(s,d),s}(Ae(Error)),yt=function(){function d(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var s=d.prototype;return s.abort=function(e){for(var t in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.frag.type)return;i.abort()}}},s.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},s.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},s.createKeyLoadError=function(e,t,i,r,o){return t===void 0&&(t=$.KEY_LOAD_ERROR),new Be({type:le.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:i,networkDetails:r})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,o=e.cc,u=function(){var f=t[c];if(o<=f.cc&&(r==="initSegment"||f.sn==="initSegment"||r<f.sn))return i.emeController.selectKeySystemFormat(f).then(function(h){f.setKeyFormat(h)}),"break"},c=0;c<t.length&&u()!=="break";c++);},s.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)},s.loadInternal=function(e,t){var i,r;t&&e.setKeyFormat(t);var o=e.decryptdata;if(!o){var u=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,u))}var c=o.uri;if(!c)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+c+'"')));var f,h=this.keyUriToKeyInfo[c];if((i=h)!=null&&i.decryptdata.key)return o.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((r=h)!=null&&r.keyLoadPromise)switch((f=h.mediaKeySessionContext)==null?void 0:f.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return h.keyLoadPromise.then(function(p){return o.key=p.keyInfo.decryptdata.key,{frag:e,keyInfo:h}})}switch(h=this.keyUriToKeyInfo[c]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(h,e):this.loadKeyEME(h,e);case"AES-128":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+o.method+'"')))}},s.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(function(o){return e.mediaKeySessionContext=o,i})).catch(function(o){throw e.keyLoadPromise=null,o})}return Promise.resolve(i)},s.loadKeyHTTP=function(e,t){var i=this,r=this.config,o=new r.loader(r);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise(function(u,c){var f={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},h=r.keyLoadPolicy.default,p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:function(b,A,k,D){var S=k.frag,L=k.keyInfo,N=k.url;if(!S.decryptdata||L!==i.keyUriToKeyInfo[N])return c(i.createKeyLoadError(S,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));L.decryptdata.key=S.decryptdata.key=new Uint8Array(b.data),S.keyLoader=null,L.loader=null,u({frag:S,keyInfo:L})},onError:function(b,A,k,D){i.resetLoader(A),c(i.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),k,E({url:f.url,data:void 0},b)))},onTimeout:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),k))},onAbort:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),k))}};o.load(f,p,y)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,r=e.url,o=i.loader;t.keyLoader===o&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],o&&o.destroy()},d}(),Ze=function(){function d(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var s=d.prototype;return s.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},s.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},s.onHandlerDestroyed=function(){},s.hasInterval=function(){return!!this._tickInterval},s.hasNextTick=function(){return!!this._tickTimer},s.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},s.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},s.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},s.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},s.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},s.doTick=function(){},d}(),de={length:0,start:function(){return 0},end:function(){return 0}},ce=function(){function d(){}return d.isBuffered=function(s,e){try{if(s){for(var t=d.getBuffered(s),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},d.bufferInfo=function(s,e,t){try{if(s){var i,r=d.getBuffered(s),o=[];for(i=0;i<r.length;i++)o.push({start:r.start(i),end:r.end(i)});return this.bufferedInfo(o,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},d.bufferedInfo=function(s,e,t){e=Math.max(0,e),s.sort(function(k,D){var S=k.start-D.start;return S||D.end-k.end});var i=[];if(t)for(var r=0;r<s.length;r++){var o=i.length;if(o){var u=i[o-1].end;s[r].start-u<t?s[r].end>u&&(i[o-1].end=s[r].end):i.push(s[r])}else i.push(s[r])}else i=s;for(var c,f=0,h=e,p=e,y=0;y<i.length;y++){var b=i[y].start,A=i[y].end;if(e+t>=b&&e<A)h=b,f=(p=A)-e;else if(e+t<b){c=b;break}}return{len:f,start:h||0,end:p||0,nextStart:c}},d.getBuffered=function(s){try{return s.buffered}catch(e){return H.log("failed to get media.buffered",e),de}},d}(),he=function(d,s,e,t,i,r){t===void 0&&(t=0),i===void 0&&(i=-1),r===void 0&&(r=!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=s,this.id=e,this.size=t,this.part=i,this.partial=r};function Ne(d,s){for(var e=null,t=0,i=d.length;t<i;t++){var r=d[t];if(r&&r.cc===s){e=r;break}}return e}function Ve(d,s){if(d){var e=d.start+s;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function ft(d,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)Ve(e[t],d);s.fragmentHint&&Ve(s.fragmentHint,d),s.alignedSliding=!0}function Zt(d,s,e){s&&(function(t,i,r){if(function(u,c,f){return!(!c.details||!(f.endCC>f.startCC||u&&u.cc<f.startCC))}(t,r,i)){var o=function(u,c,f){var h=u.fragments,p=c.fragments;if(p.length&&h.length){var y=Ne(h,p[0].cc);if(y&&(!y||y.startPTS))return y;H.log("No frag in previous level to align on")}else H.log("No fragments to align")}(r.details,i);o&&oe(o.start)&&(H.log("Adjusting PTS using last level due to CC increase within current level "+i.url),ft(o.start,i))}}(d,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var r=i.fragments[0].programDateTime,o=t.fragments[0].programDateTime,u=(o-r)/1e3+i.fragments[0].start;u&&oe(u)&&(H.log("Adjusting PTS using programDateTime delta "+(o-r)+"ms, sliding:"+u.toFixed(3)+" "+t.url+" "),ft(u,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||rs(s.details,e))}function wt(d,s){if(d.hasProgramDateTime&&s.hasProgramDateTime){var e=d.fragments,t=s.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],r=Ne(e,i.cc)||e[Math.round(e.length/2)-1],o=i.programDateTime,u=r.programDateTime;o!==null&&u!==null&&ft((u-o)/1e3-(r.start-i.start),d)}}}var qt=function(){function d(s,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=s,this.aesIV=e}return d.prototype.decrypt=function(s,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,s)},d}(),Lt=function(){function d(s,e){this.subtle=void 0,this.key=void 0,this.subtle=s,this.key=e}return d.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},d}(),It=function(){function d(){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 s=d.prototype;return s.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],o=i[1],u=i[2],c=i[3],f=this.invSubMix,h=f[0],p=f[1],y=f[2],b=f[3],A=new Uint32Array(256),k=0,D=0,S=0;for(S=0;S<256;S++)A[S]=S<128?S<<1:S<<1^283;for(S=0;S<256;S++){var L=D^D<<1^D<<2^D<<3^D<<4;L=L>>>8^255&L^99,e[k]=L,t[L]=k;var N=A[k],P=A[N],V=A[P],q=257*A[L]^16843008*L;r[k]=q<<24|q>>>8,o[k]=q<<16|q>>>16,u[k]=q<<8|q>>>24,c[k]=q,q=16843009*V^65537*P^257*N^16843008*k,h[L]=q<<24|q>>>8,p[L]=q<<16|q>>>16,y[L]=q<<8|q>>>24,b[L]=q,k?(k=N^A[A[A[V^N]]],D^=A[A[D]]):k=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var o=this.keySize=t.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var u,c,f,h,p=this.ksRows=4*(o+6+1),y=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,k=this.rcon,D=this.invSubMix,S=D[0],L=D[1],N=D[2],P=D[3];for(u=0;u<p;u++)u<o?f=y[u]=t[u]:(h=f,u%o==0?(h=A[(h=h<<8|h>>>24)>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h],h^=k[u/o|0]<<24):o>6&&u%o==4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h]),y[u]=f=(y[u-o]^h)>>>0);for(c=0;c<p;c++)u=p-c,h=3&c?y[u]:y[u-4],b[c]=c<4||u<=4?h:S[A[h>>>24]]^L[A[h>>>16&255]]^N[A[h>>>8&255]]^P[A[255&h]],b[c]=b[c]>>>0}},s.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s.decrypt=function(e,t,i){for(var r,o,u,c,f,h,p,y,b,A,k,D,S,L,N=this.keySize+6,P=this.invKeySchedule,V=this.invSBox,q=this.invSubMix,j=q[0],ee=q[1],z=q[2],X=q[3],ue=this.uint8ArrayToUint32Array_(i),ne=ue[0],Te=ue[1],Me=ue[2],_e=ue[3],De=new Int32Array(e),xe=new Int32Array(De.length),Ce=this.networkToHostOrderSwap;t<De.length;){for(b=Ce(De[t]),A=Ce(De[t+1]),k=Ce(De[t+2]),D=Ce(De[t+3]),f=b^P[0],h=D^P[1],p=k^P[2],y=A^P[3],S=4,L=1;L<N;L++)r=j[f>>>24]^ee[h>>16&255]^z[p>>8&255]^X[255&y]^P[S],o=j[h>>>24]^ee[p>>16&255]^z[y>>8&255]^X[255&f]^P[S+1],u=j[p>>>24]^ee[y>>16&255]^z[f>>8&255]^X[255&h]^P[S+2],c=j[y>>>24]^ee[f>>16&255]^z[h>>8&255]^X[255&p]^P[S+3],f=r,h=o,p=u,y=c,S+=4;r=V[f>>>24]<<24^V[h>>16&255]<<16^V[p>>8&255]<<8^V[255&y]^P[S],o=V[h>>>24]<<24^V[p>>16&255]<<16^V[y>>8&255]<<8^V[255&f]^P[S+1],u=V[p>>>24]<<24^V[y>>16&255]<<16^V[f>>8&255]<<8^V[255&h]^P[S+2],c=V[y>>>24]<<24^V[f>>16&255]<<16^V[h>>8&255]<<8^V[255&p]^P[S+3],xe[t]=Ce(r^ne),xe[t+1]=Ce(c^Te),xe[t+2]=Ce(u^Me),xe[t+3]=Ce(o^_e),ne=b,Te=A,Me=k,_e=D,t+=4}return xe.buffer},d}(),Di=function(){function d(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,r=i===void 0||i;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=e.enableSoftwareAES,this.removePKCS7Padding=r,r)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var s=d.prototype;return s.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},s.isSync=function(){return this.useSoftware},s.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var i,r,o,u=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(r=(i=u).byteLength,(o=r&&new DataView(i.buffer).getUint8(r-1))?Li(i,0,r-o):i):u},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(e,t,i){var r=this;return this.useSoftware?new Promise(function(o,u){r.softwareDecrypt(new Uint8Array(e),t,i);var c=r.flush();c?o(c.buffer):u(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)},s.softwareDecrypt=function(e,t,i){var r=this.currentIV,o=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(e=hr(u,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;r&&(i=r);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new It),f.expandKey(t);var h=o;return this.currentResult=f.decrypt(c.buffer,0,i),this.currentIV=Li(c,-16).buffer,h||null},s.webCryptoDecrypt=function(e,t,i){var r=this,o=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Lt(o,t)),this.fastAesKey.expandKey().then(function(u){return o?(r.logOnce("WebCrypto AES decrypt"),new qt(o,new Uint8Array(i)).decrypt(e.buffer,u)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(u){return H.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+u.name+": "+u.message),r.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},s.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=Li(e,0,i),this.remainderData=Li(e,i)),t},s.logOnce=function(e){this.logEnabled&&(H.log("[decrypter]: "+e),this.logEnabled=!1)},d}(),_a=function(d){for(var s="",e=d.length,t=0;t<e;t++)s+="["+d.start(t).toFixed(3)+"-"+d.end(t).toFixed(3)+"]";return s},Rt="STOPPED",Le="IDLE",gr="KEY_LOADING",Hr="FRAG_LOADING",Gr="FRAG_LOADING_WAITING_RETRY",Ta="WAITING_TRACK",yr="PARSING",No="PARSED",ss="ENDED",en="ERROR",os="WAITING_INIT_PTS",tn="WAITING_LEVEL",Vd=function(d){function s(t,i,r,o,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=Rt,c.playlistType=void 0,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.startTimeOffset=null,c.loadedmetadata=!1,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.playlistType=u,c.logPrefix=o,c.log=H.log.bind(H,o+":"),c.warn=H.warn.bind(H,o+":"),c.hls=t,c.fragmentLoader=new Pt(t.config),c.keyLoader=r,c.fragmentTracker=i,c.config=t.config,c.decrypter=new Di(t.config),t.on(w.MANIFEST_LOADED,c.onManifestLoaded,function(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}(c)),c}Q(s,d);var e=s.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(t){},e.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Rt},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var r=i.partList;if(r!=null&&r.length){var o=r[r.length-1];return ce.isBuffered(this.media,o.start+o.duration/2)}var u=i.fragments[i.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)},e.getLevelDetails=function(){var t;if(this.levels&&this.levelLastLoaded!==null)return(t=this.levels[this.levelLastLoaded])==null?void 0:t.details},e.onMediaAttached=function(t,i){var r=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var o=this.config;this.levels&&o.autoStartLoad&&this.state===Rt&&this.startLoad(o.startPosition)},e.onMediaDetaching=function(){var t=this.media;t!=null&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.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()},e.onMediaSeeking=function(){var t=this.config,i=this.fragCurrent,r=this.media,o=this.mediaBuffer,u=this.state,c=r?r.currentTime:0,f=ce.bufferInfo(o||r,c,t.maxBufferHole);if(this.log("media seeking to "+(oe(c)?c.toFixed(3):c)+", state: "+u),this.state===ss)this.resetLoadingState();else if(i){var h=t.maxFragLookUpTolerance,p=i.start-h,y=i.start+i.duration+h;if(!f.len||y<f.start||p>f.end){var b=c>y;(c<p||b)&&(b&&i.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0),this.lastCurrentTime=c),this.loadedmetadata||f.len||(this.nextLoadPosition=this.startPosition=c),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onManifestLoaded=function(t,i){this.startTimeOffset=i.startTimeOffset,this.initPTS=[]},e.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=Rt,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)},e.loadFragment=function(t,i,r){this._loadFragForPlayback(t,i,r)},e._loadFragForPlayback=function(t,i,r){var o=this;this._doFragLoad(t,i,r,function(u){if(o.fragContextChanged(t))return o.warn("Fragment "+t.sn+(u.part?" p: "+u.part.index:"")+" of level "+t.level+" was dropped during download."),void o.fragmentTracker.removeFragment(t);t.stats.chunkCount++,o._handleFragmentLoadProgress(u)}).then(function(u){if(u){var c=o.state;o.fragContextChanged(t)?(c===Hr||!o.fragCurrent&&c===yr)&&(o.fragmentTracker.removeFragment(t),o.state=Le):("payload"in u&&(o.log("Loaded fragment "+t.sn+" of level "+t.level),o.hls.trigger(w.FRAG_LOADED,u)),o._handleFragmentLoadComplete(u))}}).catch(function(u){o.state!==Rt&&o.state!==en&&(o.warn(u),o.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i,r=this.fragmentTracker;if(r.getState(t)===Oe){var o=t.type,u=this.getFwdBufferInfo(this.mediaBuffer,o),c=Math.max(t.duration,u?u.len:this.config.maxBufferLength);this.reduceMaxBufferLength(c)&&r.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0?r.removeAllFragments():r.hasParts(t.type)&&(r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),r.getState(t)===ye&&r.removeFragment(t))},e.flushMainBuffer=function(t,i,r){if(r===void 0&&(r=null),t-i){var o={startOffset:t,endOffset:i,type:r};this.hls.trigger(w.BUFFER_FLUSHING,o)}},e._loadInitSegment=function(t,i){var r=this;this._doFragLoad(t,i).then(function(o){if(!o||r.fragContextChanged(t)||!r.levels)throw new Error("init load aborted");return o}).then(function(o){var u=r.hls,c=o.payload,f=t.decryptdata;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var h=self.performance.now();return r.decrypter.decrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).catch(function(p){throw u.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:t}),p}).then(function(p){var y=self.performance.now();return u.trigger(w.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:h,tdecrypt:y}}),o.payload=p,o})}return o}).then(function(o){var u=r.fragCurrent,c=r.hls;if(!r.levels)throw new Error("init load aborted, missing levels");var f=t.stats;r.state=Le,i.fragmentError=0,t.data=new Uint8Array(o.payload),f.parsing.start=f.buffering.start=self.performance.now(),f.parsing.end=f.buffering.end=self.performance.now(),o.frag===u&&c.trigger(w.FRAG_BUFFERED,{stats:f,frag:u,part:null,id:t.type}),r.tick()}).catch(function(o){r.state!==Rt&&r.state!==en&&(r.warn(o),r.resetFragmentLoading(t))})},e.fragContextChanged=function(t){var i=this.fragCurrent;return!t||!i||t.level!==i.level||t.sn!==i.sn||t.urlId!==i.urlId},e.fragBufferedComplete=function(t,i){var r,o,u,c,f=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.playlistType===et?"level":"track")+" "+t.level+" (frag:["+((r=t.startPTS)!=null?r:NaN).toFixed(3)+"-"+((o=t.endPTS)!=null?o:NaN).toFixed(3)+"] > buffer:"+(f?_a(ce.getBuffered(f)):"(detached)")+")"),this.state=Le,f&&(!this.loadedmetadata&&t.type==et&&f.buffered.length&&((u=this.fragCurrent)==null?void 0:u.sn)===((c=this.fragPrevious)==null?void 0:c.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},e.seekToStartPos=function(){},e._handleFragmentLoadComplete=function(t){var i=this.transmuxer;if(i){var r=t.frag,o=t.part,u=t.partsLoaded,c=!u||u.length===0||u.some(function(h){return!h}),f=new he(r.level,r.sn,r.stats.chunkCount+1,0,o?o.index:-1,!c);i.flush(f)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,r,o){var u,c=this;r===void 0&&(r=null);var f=i==null?void 0:i.details;if(!this.levels||!f)throw new Error("frag load aborted, missing level"+(f?"":" detail")+"s");var h=null;if(!t.encrypted||(u=t.decryptdata)!=null&&u.key?!t.encrypted&&f.encryptedFragments.length&&this.keyLoader.loadClear(t,f.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+f.startSN+"-"+f.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level),this.state=gr,this.fragCurrent=t,h=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(w.KEY_LOADED,S),c.state===gr&&(c.state=Le),S}),this.hls.trigger(w.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode&&t.sn!=="initSegment"){var p=f.partList;if(p&&o){r>t.end&&f.fragmentHint&&(t=f.fragmentHint);var y=this.getNextPart(p,t,r);if(y>-1){var b,A=p[y];return this.log("Loading part sn: "+t.sn+" p: "+A.index+" cc: "+t.cc+" of playlist ["+f.startSN+"-"+f.endSN+"] parts [0-"+y+"-"+(p.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Hr,b=h?h.then(function(S){return!S||c.fragContextChanged(S.frag)?null:c.doFragPartsLoad(t,A,i,o)}).catch(function(S){return c.handleFragLoadError(S)}):this.doFragPartsLoad(t,A,i,o).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,part:A,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,r))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(f?"of ["+f.startSN+"-"+f.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),oe(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Hr;var k,D=this.config.progressive;return k=D&&h?h.then(function(S){return!S||c.fragContextChanged(S==null?void 0:S.frag)?null:c.fragmentLoader.load(t,o)}).catch(function(S){return c.handleFragLoadError(S)}):Promise.all([this.fragmentLoader.load(t,D?o:void 0),h]).then(function(S){var L=S[0];return!D&&L&&o&&o(L),L}).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):k},e.doFragPartsLoad=function(t,i,r,o){var u=this;return new Promise(function(c,f){var h,p=[],y=(h=r.details)==null?void 0:h.partList;(function b(A){u.fragmentLoader.loadPart(t,A,o).then(function(k){p[A.index]=k;var D=k.part;u.hls.trigger(w.FRAG_LOADED,k);var S=Co(r,t.sn,A.index+1)||Mo(y,t.sn,A.index+1);if(!S)return c({frag:t,part:D,partsLoaded:p});b(S)}).catch(f)})(i)})},e.handleFragLoadError=function(t){if("data"in t){var i=t.data;t.data&&i.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(i.frag,i.part):this.hls.trigger(w.ERROR,i)}else this.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},e._handleTransmuxerFlush=function(t){var i=this.getCurrentContext(t);if(i&&this.state===yr){var r=i.frag,o=i.part,u=i.level,c=self.performance.now();r.stats.parsing.end=c,o&&(o.stats.parsing.end=c),this.updateLevelTiming(r,o,u,t.partial)}else this.fragCurrent||this.state===Rt||this.state===en||(this.state=Le)},e.getCurrentContext=function(t){var i=this.levels,r=this.fragCurrent,o=t.level,u=t.sn,c=t.part;if(i==null||!i[o])return this.warn("Levels object was unset while buffering fragment "+u+" of level "+o+". The current chunk will not be buffered."),null;var f=i[o],h=c>-1?Co(f,u,c):null,p=h?h.fragment:function(y,b,A){if(y==null||!y.details)return null;var k=y.details,D=k.fragments[b-k.startSN];return D||((D=k.fragmentHint)&&D.sn===b?D:b<k.startSN&&A&&A.sn===b?A:null)}(f,u,r);return p?(r&&r!==p&&(p.stats=r.stats),{frag:p,part:h,level:f}):null},e.bufferFragmentData=function(t,i,r,o){var u;if(t&&this.state===yr){var c=t.data1,f=t.data2,h=c;if(c&&f&&(h=hr(c,f)),(u=h)!=null&&u.length){var p={type:t.type,frag:i,part:r,chunkMeta:o,parent:i.type,data:h};this.hls.trigger(w.BUFFER_APPENDING,p),t.dropped&&t.independent&&!r&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(ce.isBuffered(i,i.currentTime)){var r=i.currentTime,o=ce.bufferInfo(i,r,0),u=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*u),f=Math.max(Math.min(t.start-c,o.end-c),r+c);t.start-f>c&&this.flushMainBuffer(f,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var r=this.getLoadPosition();return oe(r)?this.getFwdBufferInfoAtPos(t,r,i):null},e.getFwdBufferInfoAtPos=function(t,i,r){var o=this.config.maxBufferHole,u=ce.bufferInfo(t,i,o);if(u.len===0&&u.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,r);if(c&&u.nextStart<c.end)return ce.bufferInfo(t,i,Math.max(u.nextStart,o))}return u},e.getMaxBufferLength=function(t){var i,r=this.config;return i=t?Math.max(8*r.maxBufferSize/t,r.maxBufferLength):r.maxBufferLength,Math.min(i,r.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,r=t||i.maxBufferLength;return i.maxMaxBufferLength>=r&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getAppendedFrag=function(t,i){var r=this.fragmentTracker.getAppendedFrag(t,et);return r&&"fragment"in r?r.fragment:r},e.getNextFragment=function(t,i){var r=i.fragments,o=r.length;if(!o)return null;var u,c=this.config,f=r[0].start;if(i.live){var h=c.initialLiveManifestSize;if(o<h)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+h+")"),null;i.PTSKnown||this.startFragRequested||this.startPosition!==-1||(u=this.getInitialLiveFragment(i,r),this.startPosition=u?this.hls.liveSyncPosition||u.start:t)}else t<=f&&(u=r[0]);if(!u){var p=c.lowLatencyMode?i.partEnd:i.fragmentEnd;u=this.getFragmentAtPosition(t,p,i)}return this.mapToInitFragWhenRequired(u)},e.isLoopLoading=function(t,i){var r=this.fragmentTracker.getState(t);return(r===Se||r===ye&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,r,o,u){var c=t.gap,f=this.getNextFragment(this.nextLoadPosition,i);if(f===null)return f;if(t=f,c&&t&&!t.gap&&r.nextStart){var h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,o);if(h!==null&&r.len+h.len>=u)return this.log('buffer full after gaps in "'+o+'" playlist starting at sn: '+t.sn),null}return t},e.mapToInitFragWhenRequired=function(t){return t==null||!t.initSegment||t!=null&&t.initSegment.data||this.bitrateTest?t:t.initSegment},e.getNextPart=function(t,i,r){for(var o=-1,u=!1,c=!0,f=0,h=t.length;f<h;f++){var p=t[f];if(c=c&&!p.independent,o>-1&&r<p.start)break;var y=p.loaded;y?o=-1:(u||p.independent||c)&&p.fragment===i&&(o=f),u=y}return o},e.loadedEndOfParts=function(t,i){var r=t[t.length-1];return r&&i>r.start&&r.loaded},e.getInitialLiveFragment=function(t,i){var r=this.fragPrevious,o=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),o=function(h,p,y){if(p===null||!Array.isArray(h)||!h.length||!oe(p)||p<(h[0].programDateTime||0)||p>=(h[h.length-1].endProgramDateTime||0))return null;y=y||0;for(var b=0;b<h.length;++b){var A=h[b];if(fi(p,y,A))return A}return null}(i,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){var u=r.sn+1;if(u>=t.startSN&&u<=t.endSN){var c=i[u-t.startSN];r.cc===c.cc&&(o=c,this.log("Live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=function(h,p){return Oo(h,function(y){return y.cc<p?1:y.cc>p?-1:0})}(i,r.cc),o&&this.log("Live playlist, switching playlist, load frag with same CC: "+o.sn))}}else{var f=this.hls.liveSyncPosition;f!==null&&(o=this.getFragmentAtPosition(f,this.bitrateTest?t.fragmentEnd:t.edge,t))}return o},e.getFragmentAtPosition=function(t,i,r){var o,u=this.config,c=this.fragPrevious,f=r.fragments,h=r.endSN,p=r.fragmentHint,y=u.maxFragLookUpTolerance,b=r.partList,A=!!(u.lowLatencyMode&&b!=null&&b.length&&p);if(A&&p&&!this.bitrateTest&&(f=f.concat(p),h=p.sn),o=t<i?ba(c,f,t,t>i-y?0:y):f[f.length-1]){var k=o.sn-r.startSN,D=this.fragmentTracker.getState(o);if((D===Se||D===ye&&o.gap)&&(c=o),c&&o.sn===c.sn&&(!A||b[0].fragment.sn>o.sn)&&c&&o.level===c.level){var S=f[k+1];o=o.sn<h&&this.fragmentTracker.getState(S)!==Se?S:null}}return o},e.synchronizeToLiveEdge=function(t){var i=this.config,r=this.media;if(r){var o=this.hls.liveSyncPosition,u=r.currentTime,c=t.fragments[0].start,f=t.edge,h=u>=c-i.maxFragLookUpTolerance&&u<=f;if(o!==null&&r.duration>o&&(u<o||!h)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!h&&r.readyState<4||u<f-p)&&(this.loadedmetadata||(this.nextLoadPosition=o),r.readyState&&(this.warn("Playback: "+u.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+o.toFixed(3)),r.currentTime=o))}}},e.alignPlaylists=function(t,i){var r=this.levels,o=this.levelLastLoaded,u=this.fragPrevious,c=o!==null?r[o]:null,f=t.fragments.length;if(!f)return this.warn("No fragments in live playlist"),0;var h=t.fragments[0].start,p=!i,y=t.alignedSliding&&oe(h);if(p||!y&&!h){Zt(u,c,t);var b=t.fragments[0].start;return this.log("Live playlist sliding: "+b.toFixed(2)+" start-sn: "+(i?i.startSN:"na")+"->"+t.startSN+" prev-sn: "+(u?u.sn:"na")+" fragments: "+f),b}return h},e.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},e.setStartPosition=function(t,i){var r=this.startPosition;if(r<i&&(r=-1),r===-1||this.lastCurrentTime===-1){var o=this.startTimeOffset!==null,u=o?this.startTimeOffset:t.startTimeOffset;u!==null&&oe(u)?(r=i+u,u<0&&(r+=t.totalduration),r=Math.min(Math.max(i,r),i+t.totalduration),this.log("Start time offset "+u+" found in "+(o?"multivariant":"media")+" playlist, adjust startPosition to "+r),this.startPosition=r):t.live?r=this.hls.liveSyncPosition||i:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},e.getLoadPosition=function(){var t=this.media,i=0;return this.loadedmetadata&&t?i=t.currentTime:this.nextLoadPosition&&(i=this.nextLoadPosition),i},e.handleFragLoadAborted=function(t,i){this.transmuxer&&t.sn!=="initSegment"&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(i?" part "+i.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},e.resetFragmentLoading=function(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Gr)||(this.state=Le)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var r=this.getCurrentContext(i.chunkMeta);r&&(i.frag=r.frag)}var o=i.frag;if(o&&o.type===t&&this.levels)if(this.fragContextChanged(o)){var u;this.warn("Frag load error must match current frag to retry "+o.url+" > "+((u=this.fragCurrent)==null?void 0:u.url))}else{var c=i.details===$.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(o,!0);var f=i.errorAction,h=f||{},p=h.action,y=h.retryCount,b=y===void 0?0:y,A=h.retryConfig;if(f&&p===g&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var k=as(A,b);this.warn("Fragment "+o.sn+" of "+t+" "+o.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+k+"ms"),f.resolved=!0,this.retryDate=self.performance.now()+k,this.state=Gr}else A&&f?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(f.resolved=!0):H.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=en;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===yr||this.state===No){var i=t.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),o=r&&r.len>.5;o&&this.reduceMaxBufferLength(r.len);var u=!o;return u&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+i+" buffer"),t.frag&&(this.fragmentTracker.removeFragment(t.frag),this.nextLoadPosition=t.frag.start),this.resetLoadingState(),u}return!1},e.resetFragmentErrors=function(t){t===_i&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Rt&&(this.state=Le)},e.afterBufferFlushed=function(t,i,r){if(t){var o=ce.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,o,r),this.state===ss&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Le},e.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var i=this.levels?this.levels[t].details:null;i!=null&&i.live?(this.startPosition=-1,this.setStartPosition(i,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},e.resetWhenMissingContext=function(t){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(t.level),this.resetLoadingState()},e.removeUnbufferedFrags=function(t){t===void 0&&(t=0),this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)},e.updateLevelTiming=function(t,i,r,o){var u,c=this,f=r.details;if(f){if(Object.keys(t.elementaryStreams).reduce(function(p,y){var b=t.elementaryStreams[y];if(b){var A=b.endPTS-b.startPTS;if(A<=0)return c.warn("Could not parse fragment "+t.sn+" "+y+" duration reliably ("+A+")"),p||!1;var k=o?0:ya(f,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(w.LEVEL_PTS_UPDATED,{details:f,level:r,drift:k,type:y,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))r.fragmentError=0;else if(((u=this.transmuxer)==null?void 0:u.error)===null){var h=new Error("Found no media in fragment "+t.sn+" of level "+r.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(h.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+r.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=No,this.hls.trigger(w.FRAG_PARSED,{frag:t,part:i})}else this.warn("level.details undefined")},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},e.recoverWorkerError=function(t){t.event==="demuxerWorker"&&(this.resetTransmuxer(),this.resetLoadingState())},M(s,[{key:"state",get:function(){return this._state},set:function(t){var i=this._state;i!==t&&(this._state=t,this.log(i+"->"+t))}}]),s}(Ze);function Eh(){return self.SourceBuffer||self.WebKitSourceBuffer}function er(d,s){return d===void 0&&(d=""),s===void 0&&(s=9e4),{type:d,id:-1,pid:-1,inputTimeScale:s,sequenceNumber:-1,samples:[],dropped:0}}var bh=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},s.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},s.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},s.canParse=function(e,t){return!1},s.appendFrame=function(e,t,i){},s.demux=function(e,t){this.cachedData&&(e=hr(this.cachedData,e),this.cachedData=null);var i,r=la(e,0),o=r?r.length:0,u=this._audioTrack,c=this._id3Track,f=r?function(b){for(var A=Gn(b),k=0;k<A.length;k++){var D=A[k];if(lo(D))return ho(D)}}(r):void 0,h=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(f))&&(this.basePTS=kv(f,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ma,duration:Number.POSITIVE_INFINITY});o<h;){if(this.canParse(e,o)){var p=this.appendFrame(u,e,o);p?(this.frameIndex++,this.lastPTS=p.sample.pts,i=o+=p.length):o=h}else oo(e,o)?(r=la(e,o),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ma,duration:Number.POSITIVE_INFINITY}),i=o+=r.length):o++;if(o===h&&i!==h){var y=Li(e,i);this.cachedData?this.cachedData=hr(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,videoTrack:er(),id3Track:c,textTrack:er()}},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},s.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:er(),id3Track:this._id3Track,textTrack:er()}},s.destroy=function(){},d}(),kv=function(d,s,e){return oe(d)?90*d:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function _h(d,s){return d[s]===255&&(246&d[s+1])==240}function Th(d,s){return 1&d[s+1]?7:9}function Kd(d,s){return(3&d[s+3])<<11|d[s+4]<<3|(224&d[s+5])>>>5}function Fo(d,s){return s+1<d.length&&_h(d,s)}function wv(d,s){if(Fo(d,s)){var e=Th(d,s);if(s+e>=d.length)return!1;var t=Kd(d,s);if(t<=e)return!1;var i=s+t;return i===d.length||Fo(d,i)}return!1}function Ah(d,s,e,t,i){if(!d.samplerate){var r=function(o,u,c,f){var h,p,y,b,A=navigator.userAgent.toLowerCase(),k=f,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=1+((192&u[c+2])>>>6);var S=(60&u[c+2])>>>2;if(!(S>D.length-1))return y=(1&u[c+2])<<2,y|=(192&u[c+3])>>>6,H.log("manifest codec:"+f+", ADTS type:"+h+", samplingIndex:"+S),/firefox/i.test(A)?S>=6?(h=5,b=new Array(4),p=S-3):(h=2,b=new Array(2),p=S):A.indexOf("android")!==-1?(h=2,b=new Array(2),p=S):(h=5,b=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&S>=6?p=S-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(S>=6&&y===1||/vivaldi/i.test(A))||!f&&y===1)&&(h=2,b=new Array(2)),p=S)),b[0]=h<<3,b[0]|=(14&S)>>1,b[1]|=(1&S)<<7,b[1]|=y<<3,h===5&&(b[1]|=(14&p)>>1,b[2]=(1&p)<<7,b[2]|=8,b[3]=0),{config:b,samplerate:D[S],channelCount:y,codec:"mp4a.40."+h,manifestCodec:k};o.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!r)return;d.config=r.config,d.samplerate=r.samplerate,d.channelCount=r.channelCount,d.codec=r.codec,d.manifestCodec=r.manifestCodec,H.log("parsed codec:"+d.codec+", rate:"+r.samplerate+", channels:"+r.channelCount)}}function Sh(d){return 9216e4/d}function kh(d,s,e,t,i){var r,o=t+i*Sh(d.samplerate),u=function(A,k){var D=Th(A,k);if(k+D<=A.length){var S=Kd(A,k)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(u){var c=u.frameLength,f=u.headerLength,h=f+c,p=Math.max(0,e+h-s.length);p?(r=new Uint8Array(h-f)).set(s.subarray(e+f,s.length),0):r=s.subarray(e+f,e+h);var y={unit:r,pts:o};return p||d.samples.push(y),{sample:y,length:h,missing:p}}var b=s.length-e;return(r=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:r,pts:o},length:b,missing:-1}}var Lv=function(d){function s(t,i){var r;return(r=d.call(this)||this).observer=void 0,r.config=void 0,r.observer=t,r.config=i,r}Q(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,o){d.prototype.resetInitSegment.call(this,t,i,r,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(la(t,0)||[]).length,r=t.length;i<r;i++)if(wv(t,i))return H.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,o){return function(u,c){return c+5<u.length}(r,o)&&_h(r,o)&&Kd(r,o)<=r.length-o}(t,i)},e.appendFrame=function(t,i,r){Ah(t,this.observer,i,r,t.manifestCodec);var o=kh(t,i,r,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o},s}(bh),Iv=/\/emsg[-/]ID3/i,Rv=function(){function d(e,t){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=t}var s=d.prototype;return s.resetTimeStamp=function(){},s.resetInitSegment=function(e,t,i,r){var o=this.videoTrack=er("video",1),u=this.audioTrack=er("audio",1),c=this.txtTrack=er("text",1);if(this.id3Track=er("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var f=Wn(e);if(f.video){var h=f.video,p=h.id,y=h.timescale,b=h.codec;o.id=p,o.timescale=c.timescale=y,o.codec=b}if(f.audio){var A=f.audio,k=A.id,D=A.timescale,S=A.codec;u.id=k,u.timescale=D,u.codec=S}c.id=fo.text,o.sampleDuration=0,o.duration=u.duration=r}},s.resetContiguity=function(){this.remainderData=null},d.probe=function(e){return ze(e=e.length>16384?e.subarray(0,16384):e,["moof"]).length>0},s.demux=function(e,t){this.timeOffset=t;var i=e,r=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=hr(this.remainderData,e));var u=function(f){var h={valid:null,remainder:null},p=ze(f,["moof"]);if(!p)return h;if(p.length<2)return h.remainder=f,h;var y=p[p.length-1];return h.valid=Li(f,0,y.byteOffset-8),h.remainder=Li(f,y.byteOffset-8),h}(i);this.remainderData=u.remainder,r.samples=u.valid||new Uint8Array}else r.samples=i;var c=this.extractID3Track(r,t);return o.samples=Yn(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}},s.flush=function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var r=this.extractID3Track(t,this.timeOffset);return i.samples=Yn(e,t),{videoTrack:t,audioTrack:er(),id3Track:r,textTrack:er()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var r=ze(e.samples,["emsg"]);r&&r.forEach(function(o){var u=function(p){var y=p[0],b="",A="",k=0,D=0,S=0,L=0,N=0,P=0;if(y===0){for(;At(p.subarray(P,P+1))!=="\0";)b+=At(p.subarray(P,P+1)),P+=1;for(b+=At(p.subarray(P,P+1)),P+=1;At(p.subarray(P,P+1))!=="\0";)A+=At(p.subarray(P,P+1)),P+=1;A+=At(p.subarray(P,P+1)),P+=1,k=Fe(p,12),D=Fe(p,16),L=Fe(p,20),N=Fe(p,24),P=28}else if(y===1){k=Fe(p,P+=4);var V=Fe(p,P+=4),q=Fe(p,P+=4);for(P+=4,S=Math.pow(2,32)*V+q,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,H.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),L=Fe(p,P),N=Fe(p,P+=4),P+=4;At(p.subarray(P,P+1))!=="\0";)b+=At(p.subarray(P,P+1)),P+=1;for(b+=At(p.subarray(P,P+1)),P+=1;At(p.subarray(P,P+1))!=="\0";)A+=At(p.subarray(P,P+1)),P+=1;A+=At(p.subarray(P,P+1)),P+=1}return{schemeIdUri:b,value:A,timeScale:k,presentationTime:S,presentationTimeDelta:D,eventDuration:L,id:N,payload:p.subarray(P,p.byteLength)}}(o);if(Iv.test(u.schemeIdUri)){var c=oe(u.presentationTime)?u.presentationTime/u.timeScale:t+u.presentationTimeDelta/u.timeScale,f=u.eventDuration===4294967295?Number.POSITIVE_INFINITY:u.eventDuration/u.timeScale;f<=.001&&(f=Number.POSITIVE_INFINITY);var h=u.payload;i.samples.push({data:h,len:h.byteLength,dts:c,pts:c,type:pr,duration:f})}})}return i},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},s.destroy=function(){},d}(),Uo=null,Dv=[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],Cv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Mv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],xv=[0,1,1,4];function wh(d,s,e,t,i){if(!(e+24>s.length)){var r=Lh(s,e);if(r&&e+r.frameLength<=s.length){var o=t+i*(9e4*r.samplesPerFrame/r.sampleRate),u={unit:s.subarray(e,e+r.frameLength),pts:o,dts:o};return d.config=[],d.channelCount=r.channelCount,d.samplerate=r.sampleRate,d.samples.push(u),{sample:u,length:r.frameLength,missing:0}}}}function Lh(d,s){var e=d[s+1]>>3&3,t=d[s+1]>>1&3,i=d[s+2]>>4&15,r=d[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&r!==3){var o=d[s+2]>>1&1,u=d[s+3]>>6,c=1e3*Dv[14*(e===3?3-t:t===3?3:4)+i-1],f=Cv[3*(e===3?0:e===2?1:2)+r],h=u===3?1:2,p=Mv[e][t],y=xv[t],b=8*p*y,A=Math.floor(p*c/f+o)*y;if(Uo===null){var k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Uo=k?parseInt(k[1]):0}return!!Uo&&Uo<=87&&t===2&&c>=224e3&&u===0&&(d[s+3]=128|d[s+3]),{sampleRate:f,channelCount:h,frameLength:A,samplesPerFrame:b}}}function Wd(d,s){return d[s]===255&&(224&d[s+1])==224&&(6&d[s+1])!=0}function Ih(d,s){return s+1<d.length&&Wd(d,s)}function Pv(d,s){if(s+1<d.length&&Wd(d,s)){var e=Lh(d,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===d.length||Ih(d,i)}return!1}var Rh=function(){function d(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var s=d.prototype;return s.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");r.set(e.subarray(i,i+o)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*o,this.bytesAvailable-=o},s.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},s.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&H.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i},s.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},s.skipUEG=function(){this.skipBits(1+this.skipLZ())},s.skipEG=function(){this.skipBits(1+this.skipLZ())},s.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},s.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},s.readBoolean=function(){return this.readBits(1)===1},s.readUByte=function(){return this.readBits(8)},s.readUShort=function(){return this.readBits(16)},s.readUInt=function(){return this.readBits(32)},s.skipScalingList=function(e){for(var t=8,i=8,r=0;r<e;r++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,r=0,o=0,u=0,c=0,f=this.readUByte.bind(this),h=this.readBits.bind(this),p=this.readUEG.bind(this),y=this.readBoolean.bind(this),b=this.skipBits.bind(this),A=this.skipEG.bind(this),k=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);f();var S=f();if(h(5),b(3),f(),k(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var L=p();if(L===3&&b(1),k(),k(),b(1),y())for(t=L!==3?8:12,i=0;i<t;i++)y()&&D(i<6?16:64)}k();var N=p();if(N===0)p();else if(N===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();k(),b(1);var P=p(),V=p(),q=h(1);q===0&&b(1),b(1),y()&&(r=p(),o=p(),u=p(),c=p());var j=[1,1];if(y()&&y())switch(f()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:j=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(P+1)-2*r-2*o),height:(2-q)*(V+1)*16-(q?2:4)*(u+c),pixelRatio:j}},s.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},d}(),Ov=function(){function d(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Di(t,{removePKCS7Padding:!1})}var s=d.prototype;return s.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},s.decryptAacSample=function(e,t,i){var r=this,o=e[t].unit;if(!(o.length<=16)){var u=o.subarray(16,o.length-o.length%16),c=u.buffer.slice(u.byteOffset,u.byteOffset+u.length);this.decryptBuffer(c).then(function(f){var h=new Uint8Array(f);o.set(h,16),r.decrypter.isSync()||r.decryptAacSamples(e,t+1,i)})}},s.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},s.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,o=32;o<e.length-16;o+=160,r+=16)i.set(e.subarray(o,o+16),r);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,o=32;o<e.length-16;o+=160,r+=16)e.set(i.subarray(r,r+16),o);return e},s.decryptAvcSample=function(e,t,i,r,o){var u=this,c=yo(o.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(h){o.data=u.getAvcDecryptedUnit(c,h),u.decrypter.isSync()||u.decryptAvcSamples(e,t,i+1,r)})},s.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var o=e[t].units;!(i>=o.length);i++){var u=o[i];if(!(u.data.length<=48||u.type!==1&&u.type!==5||(this.decryptAvcSample(e,t,i,r,u),this.decrypter.isSync())))return}}},d}(),Ti=188,Nv=function(){function d(e,t,i){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=e,this.config=t,this.typeSupported=i}d.probe=function(e){var t=d.syncOffset(e);return t>0&&H.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},d.syncOffset=function(e){for(var t=e.length,i=Math.min(940,e.length-Ti)+1,r=0;r<i;){for(var o=!1,u=r;u<t&&e[u]===71;u+=Ti)if(o||qd(e,u)!==0||(o=!0),o&&u+Ti>i)return r;r++}return-1},d.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:fo[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}};var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video"),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3"),this._txtTrack=d.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r},s.resetTimeStamp=function(){},s.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},s.demux=function(e,t,i,r){var o;i===void 0&&(i=!1),r===void 0&&(r=!1),i||(this.sampleAes=null);var u=this._avcTrack,c=this._audioTrack,f=this._id3Track,h=this._txtTrack,p=u.pid,y=u.pesData,b=c.pid,A=f.pid,k=c.pesData,D=f.pesData,S=null,L=this.pmtParsed,N=this._pmtId,P=e.length;if(this.remainderData&&(P=(e=hr(this.remainderData,e)).length,this.remainderData=null),P<Ti&&!r)return this.remainderData=e,{audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};var V=Math.max(0,d.syncOffset(e));(P-=(P-V)%Ti)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,P,e.buffer.byteLength-P));for(var q=0,j=V;j<P;j+=Ti)if(e[j]===71){var ee=!!(64&e[j+1]),z=qd(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+Ti)continue}else X=j+4;switch(z){case p:ee&&(y&&(o=rn(y))&&this.parseAVCPES(u,h,o,!1),y={data:[],size:0}),y&&(y.data.push(e.subarray(X,j+Ti)),y.size+=j+Ti-X);break;case b:if(ee){if(k&&(o=rn(k)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,o);break;case"mp3":this.parseMPEGPES(c,o)}k={data:[],size:0}}k&&(k.data.push(e.subarray(X,j+Ti)),k.size+=j+Ti-X);break;case A:ee&&(D&&(o=rn(D))&&this.parseID3PES(f,o),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+Ti)),D.size+=j+Ti-X);break;case 0:ee&&(X+=e[X]+1),N=this._pmtId=Fv(e,X);break;case N:ee&&(X+=e[X]+1);var ue=Uv(e,X,this.typeSupported,i);(p=ue.avc)>0&&(u.pid=p),(b=ue.audio)>0&&(c.pid=b,c.segmentCodec=ue.segmentCodec),(A=ue.id3)>0&&(f.pid=A),S===null||L||(H.warn("MPEG-TS PMT found at "+j+" after unknown PID '"+S+"'. Backtracking to sync byte @"+V+" to parse all TS packets."),S=null,j=V-188),L=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=z}}else q++;if(q>0){var ne=new Error("Found "+q+" TS packet/s that do not start with 0x47");this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:ne,reason:ne.message})}u.pesData=y,c.pesData=k,f.pesData=D;var Te={audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};return r&&this.extractRemainingSamples(Te),Te},s.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},s.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.videoTrack,o=e.id3Track,u=e.textTrack,c=r.pesData,f=i.pesData,h=o.pesData;if(c&&(t=rn(c))?(this.parseAVCPES(r,u,t,!0),r.pesData=null):r.pesData=c,f&&(t=rn(f))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t)}i.pesData=null}else f!=null&&f.size&&H.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=f;h&&(t=rn(h))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=h},s.demuxSampleAes=function(e,t,i){var r=this.demux(e,i,!0,!this.config.progressive),o=this.sampleAes=new Ov(this.observer,this.config,t);return this.decrypt(r,o)},s.decrypt=function(e,t){return new Promise(function(i){var r=e.audioTrack,o=e.videoTrack;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,function(){o.samples?t.decryptAvcSamples(o.samples,0,0,function(){i(e)}):i(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,function(){i(e)})})},s.destroy=function(){this._duration=0},s.parseAVCPES=function(e,t,i,r){var o,u=this,c=this.parseAVCNALu(e,i.data),f=this.avcSample,h=!1;i.data=null,f&&c.length&&!e.audFound&&(Yd(f,e),f=this.avcSample=Bo(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:o=!0,f||(f=u.avcSample=Bo(!0,i.pts,i.dts,"")),f.frame=!0;var y=p.data;if(h&&y.length>4){var b=new Rh(y).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(f.key=!0)}break;case 5:o=!0,f||(f=u.avcSample=Bo(!0,i.pts,i.dts,"")),f.key=!0,f.frame=!0;break;case 6:o=!0,go(p.data,1,i.pts,t.samples);break;case 7:if(o=!0,h=!0,!e.sps){var A=p.data,k=new Rh(A).readSPS();e.width=k.width,e.height=k.height,e.pixelRatio=k.pixelRatio,e.sps=[A],e.duration=u._duration;for(var D=A.subarray(1,4),S="avc1.",L=0;L<3;L++){var N=D[L].toString(16);N.length<2&&(N="0"+N),S+=N}e.codec=S}break;case 8:o=!0,e.pps||(e.pps=[p.data]);break;case 9:o=!1,e.audFound=!0,f&&Yd(f,e),f=u.avcSample=Bo(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,f&&(f.debug+="unknown NAL "+p.type+" ")}f&&o&&f.units.push(p)}),r&&f&&(Yd(f,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,r=this.avcSample;if(r&&r.units.length!==0||(r=e[e.length-1]),(t=r)!=null&&t.units){var o=r.units;i=o[o.length-1]}return i},s.parseAVCNALu=function(e,t){var i,r,o=t.byteLength,u=e.naluState||0,c=u,f=[],h=0,p=-1,y=0;for(u===-1&&(p=0,y=31&t[0],u=0,h=1);h<o;)if(i=t[h++],u)if(u!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,h-u-1),type:y};f.push(b)}else{var A=this.getLastNalUnit(e.samples);if(A&&(c&&h<=4-c&&A.state&&(A.data=A.data.subarray(0,A.data.byteLength-c)),(r=h-u-1)>0)){var k=new Uint8Array(A.data.byteLength+r);k.set(A.data,0),k.set(t.subarray(0,r),A.data.byteLength),A.data=k,A.state=0}}h<o?(p=h,y=31&t[h],u=0):u=-1}else u=0;else u=3;else u=i?0:2;else u=i?0:1;if(p>=0&&u>=0){var D={data:t.subarray(p,o),type:y,state:u};f.push(D)}if(f.length===0){var S=this.getLastNalUnit(e.samples);if(S){var L=new Uint8Array(S.data.byteLength+t.byteLength);L.set(S.data,0),L.set(t,S.data.byteLength),S.data=L}}return e.naluState=u,f},s.parseAACPES=function(e,t){var i,r,o,u=0,c=this.aacOverFlow,f=t.data;if(c){this.aacOverFlow=null;var h=c.missing,p=c.sample.unit.byteLength;if(h===-1){var y=new Uint8Array(p+f.byteLength);y.set(c.sample.unit,0),y.set(f,p),f=y}else{var b=p-h;c.sample.unit.set(f.subarray(0,h),b),e.samples.push(c.sample),u=c.missing}}for(i=u,r=f.length;i<r-1&&!Fo(f,i);i++);if(i!==u){var A,k=i<r-1;A=k?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(H.warn("parsing error: "+A),this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:k,error:D,reason:A}),!k)return}if(Ah(e,this.observer,f,i,this.audioCodec),t.pts!==void 0)o=t.pts;else{if(!c)return void H.warn("[tsdemuxer]: AAC PES unknown PTS");var S=Sh(e.samplerate);o=c.sample.pts+S}for(var L,N=0;i<r;){if(i+=(L=kh(e,f,i,o,N)).length,L.missing){this.aacOverFlow=L;break}for(N++;i<r-1&&!Fo(f,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,r=i.length,o=0,u=0,c=t.pts;if(c!==void 0)for(;u<r;)if(Ih(i,u)){var f=wh(e,i,u,c,o);if(!f)break;u+=f.length,o++}else u++;else H.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=F({},t,{type:this._avcTrack?pr:ma,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else H.warn("[tsdemuxer]: ID3 PES unknown PTS")},d}();function Bo(d,s,e,t){return{key:d,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function qd(d,s){return((31&d[s+1])<<8)+d[s+2]}function Fv(d,s){return(31&d[s+10])<<8|d[s+11]}function Uv(d,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},r=s+3+((15&d[s+1])<<8|d[s+2])-4;for(s+=12+((15&d[s+10])<<8|d[s+11]);s<r;){var o=qd(d,s);switch(d[s]){case 207:if(!t){H.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=o);break;case 21:i.id3===-1&&(i.id3=o);break;case 219:if(!t){H.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=o);break;case 3:case 4:e.mpeg!==!0&&e.mp3!==!0?H.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=o,i.segmentCodec="mp3");break;case 36:H.warn("Unsupported HEVC stream type found")}s+=5+((15&d[s+3])<<8|d[s+4])}return i}function rn(d){var s,e,t,i,r,o=0,u=d.data;if(!d||d.size===0)return null;for(;u[0].length<19&&u.length>1;){var c=new Uint8Array(u[0].length+u[1].length);c.set(u[0]),c.set(u[1],u[0].length),u[0]=c,u.splice(1,1)}if(((s=u[0])[0]<<16)+(s[1]<<8)+s[2]===1){if((e=(s[4]<<8)+s[5])&&e>d.size-6)return null;var f=s[7];192&f&&(i=536870912*(14&s[9])+4194304*(255&s[10])+16384*(254&s[11])+128*(255&s[12])+(254&s[13])/2,64&f?i-(r=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(H.warn(Math.round((i-r)/9e4)+"s delta between PTS and DTS, align them"),i=r):r=i);var h=(t=s[8])+9;if(d.size<=h)return null;d.size-=h;for(var p=new Uint8Array(d.size),y=0,b=u.length;y<b;y++){var A=(s=u[y]).byteLength;if(h){if(h>A){h-=A;continue}s=s.subarray(h),A-=h,h=0}p.set(s,o),o+=A}return e&&(e-=t+3),{data:p,pts:i,dts:r,len:e}}return null}function Yd(d,s){if(d.units.length&&d.frame){if(d.pts===void 0){var e=s.samples,t=e.length;if(!t)return void s.dropped++;var i=e[t-1];d.pts=i.pts,d.dts=i.dts}s.samples.push(d)}d.debug.length&&H.log(d.pts+"/"+d.dts+":"+d.debug)}var Bv=function(d){function s(){return d.apply(this,arguments)||this}Q(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,o){d.prototype.resetInitSegment.call(this,t,i,r,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(la(t,0)||[]).length,r=t.length;i<r;i++)if(Pv(t,i))return H.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,o){return Wd(r,o)&&4<=r.length-o}(t,i)},e.appendFrame=function(t,i,r){if(this.basePTS!==null)return wh(t,i,r,this.basePTS,this.frameIndex)},s}(bh),Dh=function(){function d(){}return d.getSilentFrame=function(s,e){if(s==="mp4a.40.2"){if(e===1)return new Uint8Array([0,200,0,128,35,128]);if(e===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(e===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(e===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(e===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(e===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(e===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(e===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(e===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])}},d}(),Vr=Math.pow(2,32)-1,Yt=function(){function d(){}return d.init=function(){var s;for(s in d.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:[]},d.types)d.types.hasOwnProperty(s)&&(d.types[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]);var e=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]),t=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]);d.HDLR_TYPES={video:e,audio:t};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);d.STTS=d.STSC=d.STCO=r,d.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),d.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),d.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),d.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);d.FTYP=d.box(d.types.ftyp,o,c,o,u),d.DINF=d.box(d.types.dinf,d.box(d.types.dref,i))},d.box=function(s){for(var e=8,t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var o=i.length,u=o;o--;)e+=i[o].byteLength;var c=new Uint8Array(e);for(c[0]=e>>24&255,c[1]=e>>16&255,c[2]=e>>8&255,c[3]=255&e,c.set(s,4),o=0,e=8;o<u;o++)c.set(i[o],e),e+=i[o].byteLength;return c},d.hdlr=function(s){return d.box(d.types.hdlr,d.HDLR_TYPES[s])},d.mdat=function(s){return d.box(d.types.mdat,s)},d.mdhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1));return d.box(d.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},d.mdia=function(s){return d.box(d.types.mdia,d.mdhd(s.timescale,s.duration),d.hdlr(s.type),d.minf(s))},d.mfhd=function(s){return d.box(d.types.mfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s]))},d.minf=function(s){return s.type==="audio"?d.box(d.types.minf,d.box(d.types.smhd,d.SMHD),d.DINF,d.stbl(s)):d.box(d.types.minf,d.box(d.types.vmhd,d.VMHD),d.DINF,d.stbl(s))},d.moof=function(s,e,t){return d.box(d.types.moof,d.mfhd(s),d.traf(t,e))},d.moov=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trak(s[e]);return d.box.apply(null,[d.types.moov,d.mvhd(s[0].timescale,s[0].duration)].concat(t).concat(d.mvex(s)))},d.mvex=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trex(s[e]);return d.box.apply(null,[d.types.mvex].concat(t))},d.mvhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,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 d.box(d.types.mvhd,r)},d.sdtp=function(s){var e,t,i=s.samples||[],r=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,r[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return d.box(d.types.sdtp,r)},d.stbl=function(s){return d.box(d.types.stbl,d.stsd(s),d.box(d.types.stts,d.STTS),d.box(d.types.stsc,d.STSC),d.box(d.types.stsz,d.STSZ),d.box(d.types.stco,d.STCO))},d.avc1=function(s){var e,t,i,r=[],o=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(e=0;e<s.pps.length;e++)i=(t=s.pps[e]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(t));var u=d.box(d.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|s.sps.length].concat(r).concat([s.pps.length]).concat(o))),c=s.width,f=s.height,h=s.pixelRatio[0],p=s.pixelRatio[1];return d.box(d.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,c>>8&255,255&c,f>>8&255,255&f,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]),u,d.box(d.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),d.box(d.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,p>>24,p>>16&255,p>>8&255,255&p])))},d.esds=function(s){var e=s.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(s.config).concat([6,1,2]))},d.mp4a=function(s){var e=s.samplerate;return d.box(d.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),d.box(d.types.esds,d.esds(s)))},d.mp3=function(s){var e=s.samplerate;return d.box(d.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},d.stsd=function(s){return s.type==="audio"?s.segmentCodec==="mp3"&&s.codec==="mp3"?d.box(d.types.stsd,d.STSD,d.mp3(s)):d.box(d.types.stsd,d.STSD,d.mp4a(s)):d.box(d.types.stsd,d.STSD,d.avc1(s))},d.tkhd=function(s){var e=s.id,t=s.duration*s.timescale,i=s.width,r=s.height,o=Math.floor(t/(Vr+1)),u=Math.floor(t%(Vr+1));return d.box(d.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,u>>24,u>>16&255,u>>8&255,255&u,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,i>>8&255,255&i,0,0,r>>8&255,255&r,0,0]))},d.traf=function(s,e){var t=d.sdtp(s),i=s.id,r=Math.floor(e/(Vr+1)),o=Math.floor(e%(Vr+1));return d.box(d.types.traf,d.box(d.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),d.box(d.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),d.trun(s,t.length+16+20+8+16+8+8),t)},d.trak=function(s){return s.duration=s.duration||4294967295,d.box(d.types.trak,d.tkhd(s),d.mdia(s))},d.trex=function(s){var e=s.id;return d.box(d.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},d.trun=function(s,e){var t,i,r,o,u,c,f=s.samples||[],h=f.length,p=12+16*h,y=new Uint8Array(p);for(e+=8+p,y.set([s.type==="video"?1:0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,255&h,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),t=0;t<h;t++)r=(i=f[t]).duration,o=i.size,u=i.flags,c=i.cts,y.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*t);return d.box(d.types.trun,y)},d.initSegment=function(s){d.types||d.init();var e=d.moov(s),t=new Uint8Array(d.FTYP.byteLength+e.byteLength);return t.set(d.FTYP),t.set(e,d.FTYP.byteLength),t},d}();function $d(d,s,e,t){e===void 0&&(e=1),t===void 0&&(t=!1);var i=d*s*e;return t?Math.round(i):i}function ls(d,s){return s===void 0&&(s=!1),$d(d,1e3,1/9e4,s)}Yt.types=void 0,Yt.HDLR_TYPES=void 0,Yt.STTS=void 0,Yt.STSC=void 0,Yt.STCO=void 0,Yt.STSZ=void 0,Yt.VMHD=void 0,Yt.SMHD=void 0,Yt.STSD=void 0,Yt.FTYP=void 0,Yt.DINF=void 0;var Ho=null,jd=null,zd=function(){function d(e,t,i,r){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Ho===null){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ho=o?parseInt(o[1]):0}if(jd===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);jd=u?parseInt(u[1]):0}}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){H.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){H.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){H.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(r,o){var u=o.pts-r;return u<-4294967296?(t=!0,Ci(r,o.pts)):u>0?r:o.pts},e[0].pts);return t&&H.debug("PTS rollover detected"),i},s.remux=function(e,t,i,r,o,u,c,f){var h,p,y,b,A,k,D=o,S=o,L=e.pid>-1,N=t.pid>-1,P=t.samples.length,V=e.samples.length>0,q=c&&P>0||P>1;if((!L||V)&&(!N||q)||this.ISGenerated||c){this.ISGenerated||(y=this.generateIS(e,t,o,u));var j,ee=this.isVideoContiguous,z=-1;if(q&&(z=function(Me){for(var _e=0;_e<Me.length;_e++)if(Me[_e].key)return _e;return-1}(t.samples),!ee&&this.config.forceKeyFrameOnDiscontinuity))if(k=!0,z>0){H.warn("[mp4-remuxer]: Dropped "+z+" out of "+P+" video samples due to a missing keyframe");var X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(z),t.dropped+=z,j=S+=(t.samples[0].pts-X)/t.inputTimeScale}else z===-1&&(H.warn("[mp4-remuxer]: No keyframe found out of "+P+" video samples"),k=!1);if(this.ISGenerated){if(V&&q){var ue=this.getVideoStartPts(t.samples),ne=(Ci(e.samples[0].pts,ue)-ue)/t.inputTimeScale;D+=Math.max(0,ne),S+=Math.max(0,-ne)}if(V){if(e.samplerate||(H.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),y=this.generateIS(e,t,o,u)),p=this.remuxAudio(e,D,this.isAudioContiguous,u,N||q||f===_i?S:void 0),q){var Te=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(H.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),y=this.generateIS(e,t,o,u)),h=this.remuxVideo(t,S,ee,Te)}}else q&&(h=this.remuxVideo(t,S,ee,0));h&&(h.firstKeyFrame=z,h.independent=z!==-1,h.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Ch(i,o,this._initPTS,this._initDTS)),r.samples.length&&(b=Mh(r,o,this._initPTS))),{audio:p,video:h,initSegment:y,independent:k,text:b,id3:A}},s.generateIS=function(e,t,i,r){var o,u,c,f=e.samples,h=t.samples,p=this.typeSupported,y={},b=this._initPTS,A=!b||r,k="audio/mp4";if(A&&(o=u=1/0),e.config&&f.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(k="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),y.audio={id:"audio",container:k,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):Yt.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:o=u=f[0].pts-Math.round(c*i))),t.sps&&t.pps&&h.length&&(t.timescale=t.inputTimeScale,y.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Yt.initSegment([t]),metadata:{width:t.width,height:t.height}},A))if(c=t.inputTimeScale,b&&c===b.timescale)A=!1;else{var D=this.getVideoStartPts(h),S=Math.round(c*i);u=Math.min(u,Ci(h[0].dts,D)-S),o=Math.min(o,D-S)}if(Object.keys(y).length)return this.ISGenerated=!0,A?(this._initPTS={baseTime:o,timescale:c},this._initDTS={baseTime:u,timescale:c}):o=c=void 0,{tracks:y,initPTS:o,timescale:c}},s.remuxVideo=function(e,t,i,r){var o,u,c=e.inputTimeScale,f=e.samples,h=[],p=f.length,y=this._initPTS,b=this.nextAvcDts,A=8,k=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,L=!1;i&&b!==null||(b=t*c-(f[0].pts-Ci(f[0].dts,f[0].pts)));for(var N=y.baseTime*c/y.timescale,P=0;P<p;P++){var V=f[P];V.pts=Ci(V.pts-N,b),V.dts=Ci(V.dts-N,b),V.dts<f[P>0?P-1:P].dts&&(L=!0)}L&&f.sort(function($o,pf){var Fg=$o.dts-pf.dts,Ug=$o.pts-pf.pts;return Fg||Ug}),o=f[0].dts;var q=(u=f[f.length-1].dts)-o,j=q?Math.round(q/(p-1)):k||e.inputTimeScale/30;if(i){var ee=o-b,z=ee>j,X=ee<-1;if((z||X)&&(z?H.warn("AVC: "+ls(ee,!0)+" ms ("+ee+"dts) hole between fragments detected, filling it"):H.warn("AVC: "+ls(-ee,!0)+" ms ("+ee+"dts) overlapping between fragments detected"),!X||b>f[0].pts)){o=b;var ue=f[0].pts-ee;f[0].dts=o,f[0].pts=ue,H.log("Video: First PTS/DTS adjusted: "+ls(ue,!0)+"/"+ls(o,!0)+", delta: "+ls(ee,!0)+" ms")}}o=Math.max(0,o);for(var ne=0,Te=0,Me=0;Me<p;Me++){for(var _e=f[Me],De=_e.units,xe=De.length,Ce=0,He=0;He<xe;He++)Ce+=De[He].data.length;Te+=Ce,ne+=xe,_e.length=Ce,_e.dts=Math.max(_e.dts,o),D=Math.min(_e.pts,D),S=Math.max(_e.pts,S)}u=f[p-1].dts;var We,Qe=Te+4*ne+8;try{We=new Uint8Array(Qe)}catch($o){return void this.observer.emit(w.ERROR,w.ERROR,{type:le.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:$o,bytes:Qe,reason:"fail allocating video mdat "+Qe})}var ot=new DataView(We.buffer);ot.setUint32(0,Qe),We.set(Yt.types.mdat,4);for(var mi=!1,Ot=Number.POSITIVE_INFINITY,Wi=Number.POSITIVE_INFINITY,xi=Number.NEGATIVE_INFINITY,Pi=Number.NEGATIVE_INFINITY,Nt=0;Nt<p;Nt++){for(var $t=f[Nt],tr=$t.units,Kr=0,Ai=0,ds=tr.length;Ai<ds;Ai++){var us=tr[Ai],Yo=us.data,sn=us.data.byteLength;ot.setUint32(A,sn),A+=4,We.set(Yo,A),A+=sn,Kr+=4+sn}var wa=void 0;if(Nt<p-1)k=f[Nt+1].dts-$t.dts,wa=f[Nt+1].pts-$t.pts;else{var cs=this.config,_r=Nt>0?$t.dts-f[Nt-1].dts:j;if(wa=Nt>0?$t.pts-f[Nt-1].pts:j,cs.stretchShortVideoTrack&&this.nextAudioPts!==null){var Mg=Math.floor(cs.maxBufferHole*c),pu=(r?D+r*c:this.nextAudioPts)-$t.pts;pu>Mg?((k=pu-_r)<0?k=_r:mi=!0,H.log("[mp4-remuxer]: It is approximately "+pu/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=_r}else k=_r}var xg=Math.round($t.pts-$t.dts);Ot=Math.min(Ot,k),xi=Math.max(xi,k),Wi=Math.min(Wi,wa),Pi=Math.max(Pi,wa),h.push(new xh($t.key,k,Kr,xg))}if(h.length){if(Ho){if(Ho<70){var hf=h[0].flags;hf.dependsOn=2,hf.isNonSync=0}}else if(jd&&Pi-Wi<xi-Ot&&j/xi<.025&&h[0].cts===0){H.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var vu=o,qi=0,ff=h.length;qi<ff;qi++){var mf=vu+h[qi].duration,Pg=vu+h[qi].cts;if(qi<ff-1){var Og=mf+h[qi+1].cts;h[qi].duration=Og-Pg}else h[qi].duration=qi?h[qi-1].duration:j;h[qi].cts=0,vu=mf}}}k=mi||!k?j:k,this.nextAvcDts=b=u+k,this.videoSampleDuration=k,this.isVideoContiguous=!0;var Ng={data1:Yt.moof(e.sequenceNumber++,o,F({},e,{samples:h})),data2:We,startPTS:D/c,endPTS:(S+k)/c,startDTS:o/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ng},s.remuxAudio=function(e,t,i,r,o){var u=e.inputTimeScale,c=u/(e.samplerate?e.samplerate:u),f=e.segmentCodec==="aac"?1024:1152,h=f*c,p=this._initPTS,y=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=o!==void 0,k=e.samples,D=y?0:8,S=this.nextAudioPts||-1,L=t*u,N=p.baseTime*u/p.timescale;if(this.isAudioContiguous=i=i||k.length&&S>0&&(r&&Math.abs(L-S)<9e3||Math.abs(Ci(k[0].pts-N,L)-S)<20*h),k.forEach(function(Ai){Ai.pts=Ci(Ai.pts-N,L)}),!i||S<0){if(k=k.filter(function(Ai){return Ai.pts>=0}),!k.length)return;S=o===0?0:r&&!A?Math.max(0,L):k[0].pts}if(e.segmentCodec==="aac")for(var P=this.config.maxAudioFramesDrift,V=0,q=S;V<k.length;V++){var j=k[V],ee=j.pts,z=ee-q,X=Math.abs(1e3*z/u);if(z<=-P*h&&A)V===0&&(H.warn("Audio frame @ "+(ee/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*z/u)+" ms."),this.nextAudioPts=S=q=ee);else if(z>=P*h&&X<1e4&&A){var ue=Math.round(z/h);(q=ee-ue*h)<0&&(ue--,q+=h),V===0&&(this.nextAudioPts=S=q),H.warn("[mp4-remuxer]: Injecting "+ue+" audio frame @ "+(q/u).toFixed(3)+"s due to "+Math.round(1e3*z/u)+" ms gap.");for(var ne=0;ne<ue;ne++){var Te=Math.max(q,0),Me=Dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Me||(H.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Me=j.unit.subarray()),k.splice(V,0,{unit:Me,pts:Te}),q+=h,V++}}j.pts=q,q+=h}for(var _e,De=null,xe=null,Ce=0,He=k.length;He--;)Ce+=k[He].unit.byteLength;for(var We=0,Qe=k.length;We<Qe;We++){var ot=k[We],mi=ot.unit,Ot=ot.pts;if(xe!==null)b[We-1].duration=Math.round((Ot-xe)/c);else{if(i&&e.segmentCodec==="aac"&&(Ot=S),De=Ot,!(Ce>0))return;Ce+=D;try{_e=new Uint8Array(Ce)}catch(Ai){return void this.observer.emit(w.ERROR,w.ERROR,{type:le.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:Ai,bytes:Ce,reason:"fail allocating audio mdat "+Ce})}y||(new DataView(_e.buffer).setUint32(0,Ce),_e.set(Yt.types.mdat,4))}_e.set(mi,D);var Wi=mi.byteLength;D+=Wi,b.push(new xh(!0,f,Wi,0)),xe=Ot}var xi=b.length;if(xi){var Pi=b[b.length-1];this.nextAudioPts=S=xe+c*Pi.duration;var Nt=y?new Uint8Array(0):Yt.moof(e.sequenceNumber++,De/c,F({},e,{samples:b}));e.samples=[];var $t=De/u,tr=S/u,Kr={data1:Nt,data2:_e,startPTS:$t,endPTS:tr,startDTS:$t,endDTS:tr,type:"audio",hasAudio:!0,hasVideo:!1,nb:xi};return this.isAudioContiguous=!0,Kr}},s.remuxEmptyAudio=function(e,t,i,r){var o=e.inputTimeScale,u=o/(e.samplerate?e.samplerate:o),c=this.nextAudioPts,f=this._initDTS,h=9e4*f.baseTime/f.timescale,p=(c!==null?c:r.startDTS*o)+h,y=r.endDTS*o+h,b=1024*u,A=Math.ceil((y-p)/b),k=Dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(H.warn("[mp4-remuxer]: remux empty Audio"),k){for(var D=[],S=0;S<A;S++){var L=p+S*b;D.push({unit:k,pts:L,dts:L})}return e.samples=D,this.remuxAudio(e,t,i,!1)}H.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},d}();function Ci(d,s){var e;if(s===null)return d;for(e=s<d?-8589934592:8589934592;Math.abs(d-s)>4294967296;)d+=e;return d}function Ch(d,s,e,t){var i=d.samples.length;if(i){for(var r=d.inputTimeScale,o=0;o<i;o++){var u=d.samples[o];u.pts=Ci(u.pts-9e4*e.baseTime/e.timescale,s*r)/r,u.dts=Ci(u.dts-9e4*t.baseTime/t.timescale,s*r)/r}var c=d.samples;return d.samples=[],{samples:c}}}function Mh(d,s,e){var t=d.samples.length;if(t){for(var i=d.inputTimeScale,r=0;r<t;r++){var o=d.samples[r];o.pts=Ci(o.pts-9e4*e.baseTime/e.timescale,s*i)/i}d.samples.sort(function(c,f){return c.pts-f.pts});var u=d.samples;return d.samples=[],{samples:u}}}var Er,xh=function(d,s,e,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=e,this.cts=t,this.flags=new Hv(d)},Hv=function(d){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=d?2:1,this.isNonSync=d?0:1},Gv=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},s.resetNextTimestamp=function(){this.lastEndTime=null},s.resetInitSegment=function(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(o,u){if(!o||!u)return o;var c=u.keyId;return c&&u.isCommonEncryption&&ze(o,["moov","trak"]).forEach(function(f){var h=ze(f,["mdia","minf","stbl","stsd"])[0].subarray(8),p=ze(h,["enca"]),y=p.length>0;y||(p=ze(h,["encv"])),p.forEach(function(b){ze(y?b.subarray(28):b.subarray(78),["sinf"]).forEach(function(A){var k=qn(A);if(k){var D=k.subarray(8,24);D.some(function(S){return S!==0})||(H.log("[eme] Patching keyId in 'enc"+(y?"a":"v")+">sinf>>tenc' box: "+Ii(D)+" -> "+Ii(c)),k.set(c,8))}})})}),o}(e,r)),this.emitInitSegment=!0},s.generateInitSegment=function(e){var t=this.audioCodec,i=this.videoCodec;if(e==null||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Wn(e);t||(t=Ph(r.audio,ht)),i||(i=Ph(r.video,Tt));var o={};r.audio&&r.video?o.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?o.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:H.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},s.remux=function(e,t,i,r,o,u){var c,f,h=this.initPTS,p=this.lastEndTime,y={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(p)||(p=this.lastEndTime=o||0);var b=t.samples;if(b==null||!b.length)return y;var A={initPTS:void 0,timescale:1},k=this.initData;if((c=k)!=null&&c.length||(this.generateInitSegment(b),k=this.initData),(f=k)==null||!f.length)return H.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),y;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(z,X){return ze(X,["moof","traf"]).reduce(function(ue,ne){var Te=ze(ne,["tfdt"])[0],Me=Te[0],_e=ze(ne,["tfhd"]).reduce(function(De,xe){var Ce=Fe(xe,4),He=z[Ce];if(He){var We=Fe(Te,4);if(Me===1){if(We===da)return H.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),De;We*=da+1,We+=Fe(Te,8)}var Qe=We/(He.timescale||9e4);if(isFinite(Qe)&&(De===null||Qe<De))return Qe}return De},null);return _e!==null&&isFinite(_e)&&(ue===null||_e<ue)?_e:ue},null)}(k,b),S=D===null?o:D;(function(z,X,ue){if(z===null)return!0;var ne=X-z.baseTime/z.timescale;return ne<0&&Math.abs(ne-ue)>1}(h,S,o)||A.timescale!==h.timescale&&u)&&(A.initPTS=S-o,this.initPTS=h={baseTime:A.initPTS,timescale:1});var L=function(z,X){for(var ue=0,ne=0,Te=0,Me=ze(z,["moof","traf"]),_e=0;_e<Me.length;_e++){var De=Me[_e],xe=ze(De,["tfhd"])[0],Ce=X[Fe(xe,4)];if(Ce){var He=Ce.default,We=Fe(xe,0)|(He==null?void 0:He.flags),Qe=He==null?void 0:He.duration;8&We&&(Qe=Fe(xe,2&We?12:8));for(var ot=Ce.timescale||9e4,mi=ze(De,["trun"]),Ot=0;Ot<mi.length;Ot++)!(ue=xd(mi[Ot]))&&Qe&&(ue=Qe*Fe(mi[Ot],4)),Ce.type===Tt?ne+=ue/ot:Ce.type===ht&&(Te+=ue/ot)}}if(ne===0&&Te===0){for(var Wi=0,xi=ze(z,["sidx"]),Pi=0;Pi<xi.length;Pi++){var Nt=po(xi[Pi]);Nt!=null&&Nt.references&&(Wi+=Nt.references.reduce(function($t,tr){return $t+tr.info.duration||0},0))}return Wi}return ne||Te}(b,k),N=e?S-h.baseTime/h.timescale:p,P=N+L;(function(z,X,ue){ze(X,["moof","traf"]).forEach(function(ne){ze(ne,["tfhd"]).forEach(function(Te){var Me=Fe(Te,4),_e=z[Me];if(_e){var De=_e.timescale||9e4;ze(ne,["tfdt"]).forEach(function(xe){var Ce=xe[0],He=Fe(xe,4);if(Ce===0)He-=ue*De,Kn(xe,4,He=Math.max(He,0));else{He*=Math.pow(2,32),He+=Fe(xe,8),He-=ue*De,He=Math.max(He,0);var We=Math.floor(He/(da+1)),Qe=Math.floor(He%(da+1));Kn(xe,4,We),Kn(xe,8,Qe)}})}})})})(k,b,h.baseTime/h.timescale),L>0?this.lastEndTime=P:(H.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!k.audio,q=!!k.video,j="";V&&(j+="audio"),q&&(j+="video");var ee={data1:b,startPTS:N,startDTS:N,endPTS:P,endDTS:P,type:j,hasAudio:V,hasVideo:q,nb:1,dropped:0};return y.audio=ee.type==="audio"?ee:void 0,y.video=ee.type!=="audio"?ee:void 0,y.initSegment=A,y.id3=Ch(i,o,h,h),r.samples.length&&(y.text=Mh(r,o,h)),y},d}();function Ph(d,s){var e=d==null?void 0:d.codec;return e&&e.length>4?e:e==="hvc1"||e==="hev1"?"hvc1.1.6.L120.90":e==="av01"?"av01.0.04M.08":e==="avc1"||s===Tt?"avc1.42e01e":"mp4a.40.5"}try{Er=self.performance.now.bind(self.performance)}catch{H.debug("Unable to use Performance API on this environment"),Er=typeof self!="undefined"&&self.Date.now}var Qd=[{demux:Rv,remux:Gv},{demux:Nv,remux:zd},{demux:Lv,remux:zd},{demux:Bv,remux:zd}],Xd=function(){function d(e,t,i,r,o){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=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=o}var s=d.prototype;return s.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},s.push=function(e,t,i,r){var o=this,u=i.transmuxing;u.executeStart=Er();var c=new Uint8Array(e),f=this.currentTransmuxState,h=this.transmuxConfig;r&&(this.currentTransmuxState=r);var p=r||f,y=p.contiguous,b=p.discontinuity,A=p.trackSwitch,k=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,L=h.audioCodec,N=h.videoCodec,P=h.defaultInitPts,V=h.duration,q=h.initSegmentData,j=function(Me,_e){var De=null;return Me.byteLength>0&&_e!=null&&_e.key!=null&&_e.iv!==null&&_e.method!=null&&(De=_e),De}(c,t);if(j&&j.method==="AES-128"){var ee=this.getDecrypter();if(!ee.isSync())return this.decryptionPromise=ee.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(Me){var _e=o.push(Me,null,i);return o.decryptionPromise=null,_e}),this.decryptionPromise;var z=ee.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(z=ee.flush()),!z)return u.executeEnd=Er(),Zd(i);c=new Uint8Array(z)}var X=this.needsProbing(b,A);if(X){var ue=this.configureTransmuxer(c);if(ue)return H.warn("[transmuxer] "+ue.message),this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:ue,reason:ue.message}),u.executeEnd=Er(),Zd(i)}(b||A||S||X)&&this.resetInitSegment(q,L,N,V,t),(b||S||X)&&this.resetInitialTimestamp(P),y||this.resetContiguity();var ne=this.transmux(c,j,D,k,i),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,u.executeEnd=Er(),ne},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=Er();var r=this.decrypter,o=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then(function(){return t.flush(e)});var c=[],f=o.timeOffset;if(r){var h=r.flush();h&&c.push(this.push(h,null,e))}var p=this.demuxer,y=this.remuxer;if(!p||!y)return i.executeEnd=Er(),[Zd(e)];var b=p.flush(f);return Aa(b)?b.then(function(A){return t.flushRemux(c,A,e),c}):(this.flushRemux(c,b,e),c)},s.flushRemux=function(e,t,i){var r=t.audioTrack,o=t.videoTrack,u=t.id3Track,c=t.textTrack,f=this.currentTransmuxState,h=f.accurateTimeOffset,p=f.timeOffset;H.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var y=this.remuxer.remux(r,o,u,c,p,h,!0,this.id);e.push({remuxResult:y,chunkMeta:i}),i.transmuxing.executeEnd=Er()},s.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},s.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},s.resetInitSegment=function(e,t,i,r,o){var u=this.demuxer,c=this.remuxer;u&&c&&(u.resetInitSegment(e,t,i,r),c.resetInitSegment(e,t,i,o))},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(e,t,i,r,o){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,r,o):this.transmuxUnencrypted(e,i,r,o)},s.transmuxUnencrypted=function(e,t,i,r){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),u=o.audioTrack,c=o.videoTrack,f=o.id3Track,h=o.textTrack;return{remuxResult:this.remuxer.remux(u,c,f,h,t,i,!1,this.id),chunkMeta:r}},s.transmuxSampleAes=function(e,t,i,r,o){var u=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(c){return{remuxResult:u.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,i,r,!1,u.id),chunkMeta:o}})},s.configureTransmuxer=function(e){for(var t,i=this.config,r=this.observer,o=this.typeSupported,u=this.vendor,c=0,f=Qd.length;c<f;c++)if(Qd[c].demux.probe(e)){t=Qd[c];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var h=this.demuxer,p=this.remuxer,y=t.remux,b=t.demux;p&&p instanceof y||(this.remuxer=new y(r,i,o,u)),h&&h instanceof b||(this.demuxer=new b(r,i,o),this.probe=b.probe)},s.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},s.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new Di(this.config)),e},d}(),Zd=function(d){return{remuxResult:{},chunkMeta:d}};function Aa(d){return"then"in d&&d.then instanceof Function}var Vv=function(d,s,e,t,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=s,this.initSegmentData=e,this.duration=t,this.defaultInitPts=i||null},Kv=function(d,s,e,t,i,r){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=d,this.contiguous=s,this.accurateTimeOffset=e,this.trackSwitch=t,this.timeOffset=i,this.initSegmentChange=r},Oh={exports:{}};(function(d){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,f,h){this.fn=c,this.context=f,this.once=h||!1}function r(c,f,h,p,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var b=new i(h,p||c,y),A=e?e+f:f;return c._events[A]?c._events[A].fn?c._events[A]=[c._events[A],b]:c._events[A].push(b):(c._events[A]=b,c._eventsCount++),c}function o(c,f){--c._eventsCount==0?c._events=new t:delete c._events[f]}function u(){this._events=new t,this._eventsCount=0}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(e=!1)),u.prototype.eventNames=function(){var c,f,h=[];if(this._eventsCount===0)return h;for(f in c=this._events)s.call(c,f)&&h.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},u.prototype.listeners=function(c){var f=e?e+c:c,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,y=h.length,b=new Array(y);p<y;p++)b[p]=h[p].fn;return b},u.prototype.listenerCount=function(c){var f=e?e+c:c,h=this._events[f];return h?h.fn?1:h.length:0},u.prototype.emit=function(c,f,h,p,y,b){var A=e?e+c:c;if(!this._events[A])return!1;var k,D,S=this._events[A],L=arguments.length;if(S.fn){switch(S.once&&this.removeListener(c,S.fn,void 0,!0),L){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,h),!0;case 4:return S.fn.call(S.context,f,h,p),!0;case 5:return S.fn.call(S.context,f,h,p,y),!0;case 6:return S.fn.call(S.context,f,h,p,y,b),!0}for(D=1,k=new Array(L-1);D<L;D++)k[D-1]=arguments[D];S.fn.apply(S.context,k)}else{var N,P=S.length;for(D=0;D<P;D++)switch(S[D].once&&this.removeListener(c,S[D].fn,void 0,!0),L){case 1:S[D].fn.call(S[D].context);break;case 2:S[D].fn.call(S[D].context,f);break;case 3:S[D].fn.call(S[D].context,f,h);break;case 4:S[D].fn.call(S[D].context,f,h,p);break;default:if(!k)for(N=1,k=new Array(L-1);N<L;N++)k[N-1]=arguments[N];S[D].fn.apply(S[D].context,k)}}return!0},u.prototype.on=function(c,f,h){return r(this,c,f,h,!1)},u.prototype.once=function(c,f,h){return r(this,c,f,h,!0)},u.prototype.removeListener=function(c,f,h,p){var y=e?e+c:c;if(!this._events[y])return this;if(!f)return o(this,y),this;var b=this._events[y];if(b.fn)b.fn!==f||p&&!b.once||h&&b.context!==h||o(this,y);else{for(var A=0,k=[],D=b.length;A<D;A++)(b[A].fn!==f||p&&!b[A].once||h&&b[A].context!==h)&&k.push(b[A]);k.length?this._events[y]=k.length===1?k[0]:k:o(this,y)}return this},u.prototype.removeAllListeners=function(c){var f;return c?(f=e?e+c:c,this._events[f]&&o(this,f)):(this._events=new t,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=e,u.EventEmitter=u,d.exports=u})(Oh);var Go=Ue(Oh.exports);function Jd(d,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,r=i.audio,o=i.video;return r&&Nh(t,r),o&&Nh(t,o),d.postMessage({event:"transmuxComplete",data:s},t),!0}function Nh(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function Fh(d,s,e){s.reduce(function(t,i){return Jd(d,i)||t},!1)||d.postMessage({event:"transmuxComplete",data:s[0]}),d.postMessage({event:"flush",data:e})}a!==void 0&&a&&function(d){var s=new Go,e=function(i,r){d.postMessage({event:i,data:r})};s.on(w.FRAG_DECRYPTED,e),s.on(w.ERROR,e);var t=function(){var i=function(o){var u=function(c){e("workerLog",{logType:o,message:c})};H[o]=u};for(var r in H)i(r)};d.addEventListener("message",function(i){var r=i.data;switch(r.cmd){case"init":var o=JSON.parse(r.config);d.transmuxer=new Xd(s,r.typeSupported,o,r.vendor,r.id),Je(o.debug,r.id),t(),e("init",null);break;case"configure":d.transmuxer.configure(r.config);break;case"demux":var u=d.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Aa(u)?(d.transmuxer.async=!0,u.then(function(h){Jd(d,h)}).catch(function(h){e(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker push error"})})):(d.transmuxer.async=!1,Jd(d,u));break;case"flush":var c=r.chunkMeta,f=d.transmuxer.flush(c);Aa(f)||d.transmuxer.async?(Aa(f)||(f=Promise.resolve(f)),f.then(function(h){Fh(d,h,c)}).catch(function(h){e(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker flush error"})})):Fh(d,f,c)}})}(self);var eu=$a()||{isTypeSupported:function(){return!1}},Uh=function(){function d(e,t,i,r){var o=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var u=e.config;this.hls=e,this.id=t,this.useWorker=!!u.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;var c=function(D,S){(S=S||{}).frag=o.frag,S.id=o.id,D===w.ERROR&&(o.error=S.error),o.hls.trigger(D,S)};this.observer=new Go,this.observer.on(w.FRAG_DECRYPTED,c),this.observer.on(w.ERROR,c);var f,h,p,y,b={mp4:eu.isTypeSupported("video/mp4"),mpeg:eu.isTypeSupported("audio/mpeg"),mp3:eu.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(u.workerPath,0))this.transmuxer=new Xd(this.observer,b,u,A,t);else try{u.workerPath?(H.log("loading Web Worker "+u.workerPath+' for "'+t+'"'),this.workerContext=(p=u.workerPath,y=new self.URL(p,self.location.href).href,{worker:new self.Worker(y),scriptURL:y})):(H.log('injecting Web Worker for "'+t+'"'),this.workerContext=(f=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+n.toString()+")(true);"],{type:"text/javascript"}),h=self.URL.createObjectURL(f),{worker:new self.Worker(h),objectURL:h})),this.onwmsg=function(D){return o.onWorkerMessage(D)};var k=this.workerContext.worker;k.addEventListener("message",this.onwmsg),k.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");u.enableWorker=!1,H.warn('Error in "'+t+'" Web Worker, fallback to inline'),o.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},k.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(u)})}catch(D){H.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new Xd(this.observer,b,u,A,t)}}var s=d.prototype;return s.resetWorker=function(){if(this.workerContext){var e=this.workerContext,t=e.worker,i=e.objectURL;i&&self.URL.revokeObjectURL(i),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}},s.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},s.push=function(e,t,i,r,o,u,c,f,h,p){var y,b,A=this;h.transmuxing.start=self.performance.now();var k=this.transmuxer,D=u?u.start:o.start,S=o.decryptdata,L=this.frag,N=!(L&&o.cc===L.cc),P=!(L&&h.level===L.level),V=L?h.sn-L.sn:-1,q=this.part?h.part-this.part.index:-1,j=V===0&&h.id>1&&h.id===(L==null?void 0:L.stats.chunkCount),ee=!P&&(V===1||V===0&&(q===1||j&&q<=0)),z=self.performance.now();(P||V||o.stats.parsing.start===0)&&(o.stats.parsing.start=z),!u||!q&&ee||(u.stats.parsing.start=z);var X=!(L&&((y=o.initSegment)==null?void 0:y.url)===((b=L.initSegment)==null?void 0:b.url)),ue=new Kv(N,ee,f,P,D,X);if(!ee||N||X){H.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
18
+ `))this.processLine(this.buffer.substring(0,g)),this.buffer=this.buffer.substring(g+1)},La.prototype.processLine=function(T){var g=T.indexOf(":"),_=Vo(T,g),R=_[0],C=_.length===2?Ia(_[1]):void 0;if(R[0]!=="#")this.currentUri.uri=R,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(R){case fs:if(!isFinite(C)||C<0)return;this.manifest.targetDuration=C,this.setHoldBack();break;case ms:vs(this.manifest,_),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Qu:vs(this.manifest,_),this.setHoldBack();break;case Xu:C===0?this.currentUri.duration=.01:C>0&&(this.currentUri.duration=C);break;case Bo:var O=C,x=new Date(O);this.manifest.dateTimeString||(this.manifest.dateTimeString=O,this.manifest.dateTimeObject=x),this.currentUri.dateTimeString=O,this.currentUri.dateTimeObject=x;break;case wa:vs(this.manifest,_);break;case ps:var G=Es(_[1]),$=at(G);Object.assign(this.manifest.sessionData,$)}},La.prototype.setHoldBack=function(){var T=this.manifest,g=T.serverControl,_=T.targetDuration,R=T.partTargetDuration;if(g){var C="holdBack",O="partHoldBack",x=_&&3*_,G=R&&2*R;_&&!g.hasOwnProperty(C)&&(g[C]=x),x&&g[C]<x&&(g[C]=x),R&&!g.hasOwnProperty(O)&&(g[O]=3*R),R&&g[O]<G&&(g[O]=G)}};var vs=function(T,g){var _,R=gs(g[0].replace("#EXT-X-",""));un(g[1])?(_={},_=Object.assign(Go(g[1]),_)):_=Ia(g[1]),T[R]=_},gs=function(T){return T.toLowerCase().replace(/-(\w)/g,function(g){return g[1].toUpperCase()})},Ia=function(T){if(T.toLowerCase()==="yes"||T.toLowerCase()==="no")return T.toLowerCase()==="yes";var g=T.indexOf(":")!==-1?T:parseFloat(T);return isNaN(g)?T:g},Ho=function(T){var g={},_=T.split("=");return _.length>1&&(g[gs(_[0])]=Ia(_[1])),g},Go=function(T){for(var g=T.split(","),_={},R=0;g.length>R;R++){var C=g[R],O=Ho(C);_=Object.assign(O,_)}return _},un=function(T){return T.indexOf("=")>-1},Vo=function(T,g){return g===-1?[T]:[T.substring(0,g),T.substring(g+1)]},Es=function(T){var g={};if(T){var _=T.search(",");return[T.slice(0,_),T.slice(_+1)].forEach(function(R,C){for(var O=R.replace(/['"]+/g,"").split("="),x=0;x<O.length;x++)O[x]==="DATA-ID"&&(g["DATA-ID"]=O[1-x]),O[x]==="VALUE"&&(g.VALUE=O[1-x])}),{data:g}}},Ko=La,dn={safeCall:function(T,g,_,R){var C=R;if(T&&typeof T[g]=="function")try{C=T[g].apply(T,_)}catch(O){ye.info("safeCall error",O)}return C},safeIncrement:k,getComputedStyle:function(T,g){var _;if(T&&g&&H()&&typeof H().getComputedStyle=="function")return ar&&ar.has(T)&&(_=ar.get(T)),_||(_=H().getComputedStyle(T,null),ar&&ar.set(T,_)),_.getPropertyValue(g)},secondsToMs:function(T){return Math.floor(1e3*T)},assign:Object.assign,headersStringToObject:Se,cdnHeadersToRequestId:Xe,extractHostnameAndDomain:Ge,extractHostname:Be,manifestParser:Ko,generateShortID:J,generateUUID:z,now:de.now},Wo={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 Ra(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return cn(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?cn(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function cn(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var bi={},Ar=function T(g){var _=arguments;typeof g=="string"?T.hasOwnProperty(g)?H().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[g].apply(null,_)},0):ye.warn("`"+g+"` is an unknown task"):typeof g=="function"?H().setTimeout(function(){g(T)},0):ye.warn("`"+g+"` is invalid.")},Zu={loaded:de.now(),NAME:"mux-embed",VERSION:"4.24.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(T,g){return function(_,R,C){var O=ln(le(R),3),x=O[0],G=O[1],$=O[2],K=_.log,Z=_.utils.getComputedStyle,Fe=_.utils.secondsToMs;if(!x)return K.error("No element was found with the `"+G+"` query selector.");if($!=="video"&&$!=="audio")return K.error("The element of `"+G+"` was not a media element.");x.mux&&(x.mux.destroy(),delete x.mux,K.warn("Already monitoring this video element, replacing existing event listeners")),(C=Object.assign({automaticErrorTracking:!0},C)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:_.VERSION},C.data),C.getPlayheadTime=function(){return Fe(x.currentTime)},C.getStateData=function(){var Re,we,Ce=this.hlsjs&&this.hlsjs.url,We=this.dashjs&&Tr(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Pt={player_is_paused:x.paused,player_playhead_time:Fe(x.currentTime),player_width:parseInt(Z(x,"width")),player_height:parseInt(Z(x,"height")),player_autoplay_on:x.autoplay,player_preload_on:x.preload,player_language_code:x.lang,player_is_fullscreen:Sa()&&!!(Sa().fullscreenElement||Sa().webkitFullscreenElement||Sa().mozFullScreenElement||Sa().msFullscreenElement),video_poster_url:x.poster,video_source_url:Ce||We||x.currentSrc,video_source_duration:Fe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Re=x)===null||Re===void 0||(we=Re.getVideoPlaybackQuality)===null||we===void 0?void 0:we.call(Re).droppedVideoFrames},Vt=C.getPlayheadTime();if(x.getStartDate&&Vt>0){var Zt=x.getStartDate();if(Zt&&typeof Zt.getTime=="function"&&Zt.getTime()){var hi=Zt.getTime();if(Pt.player_program_time=hi+Vt,x.seekable.length>0){var Ve=hi+x.seekable.end(x.seekable.length-1);Pt.player_live_edge_program_time=Ve}}}return Pt},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Re,we){_.emit(G,Re,we)};var Te=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Re){x.removeEventListener(Re,x.mux.listeners[Re],!1)}),delete x.mux.listeners,x.mux.destroy=Te,x.mux.swapElement=Te,x.mux.emit=Te,x.mux.addHLSJS=Te,x.mux.addDashJS=Te,x.mux.removeHLSJS=Te,x.mux.removeDashJS=Te,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Re){var we=ln(le(Re),3),Ce=we[0],We=we[1],Pt=we[2];return Ce?Pt!=="video"&&Pt!=="audio"?_.log.error("The element of `"+We+"` was not a media element."):(Ce.muxId=x.muxId,delete x.muxId,Ce.mux=Ce.mux||{},Ce.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(Ce.mux.listeners).forEach(function(Vt){x.removeEventListener(Vt,Ce.mux.listeners[Vt],!1),Ce.addEventListener(Vt,Ce.mux.listeners[Vt],!1)}),Ce.mux.swapElement=x.mux.swapElement,Ce.mux.destroy=x.mux.destroy,delete x.mux,void(x=Ce)):_.log.error("No element was found with the `"+We+"` query selector.")},x.mux.addHLSJS=function(Re){_.addHLSJS(G,Re)},x.mux.addDashJS=function(Re){_.addDashJS(G,Re)},x.mux.removeHLSJS=function(){_.removeHLSJS(G)},x.mux.removeDashJS=function(){_.removeDashJS(G)},_.init(G,C),_.emit(G,"playerready"),x.paused||(_.emit(G,"play"),x.readyState>2&&_.emit(G,"playing")),x.mux.listeners={},ju.forEach(function(Re){(Re!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Re]=function(){var we={};if(Re==="error"){if(!x.error||x.error.code===1)return;we.player_error_code=x.error.code,we.player_error_message=zu[x.error.code]||x.error.message}_.emit(G,Re,we)},x.addEventListener(Re,x.mux.listeners[Re],!1))})}(Ar,T,g)},destroyMonitor:function(T){var g=Ra(le(T),1)[0];g&&g.mux&&typeof g.mux.destroy=="function"?g.mux.destroy():ye.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,g){var _=ee(T);bi[_]?bi[_].addHLSJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,g){var _=ee(T);bi[_]?bi[_].addDashJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var g=ee(T);bi[g]?bi[g].removeHLSJS():ye.error("A monitor for `"+g+"` has not been initialized.")},removeDashJS:function(T){var g=ee(T);bi[g]?bi[g].removeDashJS():ye.error("A monitor for `"+g+"` has not been initialized.")},init:function(T,g){Ee()&&g&&g.respectDoNotTrack&&ye.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=ee(T);bi[_]=new hs(Ar,_,g)},emit:function(T,g,_){var R=ee(T);bi[R]?(bi[R].emit(g,_),g==="destroy"&&delete bi[R]):ye.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:Ee,log:ye,utils:dn,events:Wo,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Ar,Zu),H()!==void 0&&typeof H().addEventListener=="function"&&H().addEventListener("pagehide",function(T){T.persisted||(Ar.WINDOW_UNLOADING=!0)},!1);var qo=Ar},655:function(y,I,M){var B,H;function z(J){return z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},z(J);}(function(J){var ee=!1;if((H=typeof(B=J)=="function"?B.call(I,M,I,y):B)===void 0||(y.exports=H),ee=!0,z(I)==="object"&&(y.exports=J(),ee=!0),!ee){var le=window.Cookies,me=window.Cookies=J();me.noConflict=function(){return window.Cookies=le,me}}})(function(){var J=function(){for(var ee=0,le={};ee<arguments.length;ee++){var me=arguments[ee];for(var _e in me)le[_e]=me[_e]}return le};return function ee(le){function me(_e,ge,ye){var Ee;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(ye=J({path:"/"},me.defaults,ye)).expires=="number"){var de=new Date;de.setMilliseconds(de.getMilliseconds()+864e5*ye.expires),ye.expires=de}try{Ee=JSON.stringify(ge),/^[\{\[]/.test(Ee)&&(ge=Ee)}catch{}return ge=le.write?le.write(ge,_e):encodeURIComponent(String(ge)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),_e=(_e=(_e=encodeURIComponent(String(_e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[_e,"=",ge,ye.expires?"; expires="+ye.expires.toUTCString():"",ye.path?"; path="+ye.path:"",ye.domain?"; domain="+ye.domain:"",ye.secure?"; secure":""].join("")}_e||(Ee={});for(var Be=document.cookie?document.cookie.split("; "):[],Ge=/(%[0-9A-Z]{2})+/g,re=0;re<Be.length;re++){var k=Be[re].split("="),se=k.slice(1).join("=");se.charAt(0)==='"'&&(se=se.slice(1,-1));try{var W=k[0].replace(Ge,decodeURIComponent);if(se=le.read?le.read(se,W):le(se,W)||se.replace(Ge,decodeURIComponent),this.json)try{se=JSON.parse(se)}catch{}if(_e===W){Ee=se;break}_e||(Ee[W]=se)}catch{}}return Ee}}return me.set=me,me.get=function(_e){return me.call(me,_e)},me.getJSON=function(){return me.apply({json:!0},[].slice.call(arguments))},me.defaults={},me.remove=function(_e,ge){me(_e,"",J(ge,{expires:-1}))},me.withConverter=ee,me}(function(){})})},153:function(y,I,M){var B,H=M.g!==void 0?M.g:typeof window!="undefined"?window:{},z=M(558);typeof document!="undefined"?B=document:(B=H["__GLOBAL_DOCUMENT_CACHE@4"])||(B=H["__GLOBAL_DOCUMENT_CACHE@4"]=z),y.exports=B},48:function(y,I,M){var B;B=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},y.exports=B},640:function(y,I,M){var B,H;(function(z,J){"use strict";B=function(){var ee=function(){},le="undefined",me=typeof window!==le&&typeof window.navigator!==le&&/Trident\/|MSIE /.test(window.navigator.userAgent),_e=["trace","debug","info","warn","error"];function ge(Se,Xe){var at=Se[Xe];if(typeof at.bind=="function")return at.bind(Se);try{return Function.prototype.bind.call(at,Se)}catch{return function(){return Function.prototype.apply.apply(at,[Se,arguments])}}}function ye(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function Ee(Se){return Se==="debug"&&(Se="log"),typeof console!==le&&(Se==="trace"&&me?ye:console[Se]!==void 0?ge(console,Se):console.log!==void 0?ge(console,"log"):ee)}function de(Se,Xe){for(var at=0;at<_e.length;at++){var jt=_e[at];this[jt]=at<Se?ee:this.methodFactory(jt,Se,Xe)}this.log=this.debug}function Be(Se,Xe,at){return function(){typeof console!==le&&(de.call(this,Xe,at),this[Se].apply(this,arguments))}}function Ge(Se,Xe,at){return Ee(Se)||Be.apply(this,arguments)}function re(Se,Xe,at){var jt,it=this;Xe=Xe==null?"WARN":Xe;var U="loglevel";function di($e){var Gt=(_e[$e]||"silent").toUpperCase();if(typeof window!==le&&U){try{return void(window.localStorage[U]=Gt)}catch{}try{window.document.cookie=encodeURIComponent(U)+"="+Gt+";"}catch{}}}function zt(){var $e;if(typeof window!==le&&U){try{$e=window.localStorage[U]}catch{}if(typeof $e===le)try{var Gt=window.document.cookie,gt=Gt.indexOf(encodeURIComponent(U)+"=");gt!==-1&&($e=/^([^;]+)/.exec(Gt.slice(gt))[1])}catch{}return it.levels[$e]===void 0&&($e=void 0),$e}}function nt(){if(typeof window!==le&&U){try{return void window.localStorage.removeItem(U)}catch{}try{window.document.cookie=encodeURIComponent(U)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Se=="string"?U+=":"+Se:typeof Se=="symbol"&&(U=void 0),it.name=Se,it.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},it.methodFactory=at||Ge,it.getLevel=function(){return jt},it.setLevel=function($e,Gt){if(typeof $e=="string"&&it.levels[$e.toUpperCase()]!==void 0&&($e=it.levels[$e.toUpperCase()]),!(typeof $e=="number"&&$e>=0&&$e<=it.levels.SILENT))throw"log.setLevel() called with invalid level: "+$e;if(jt=$e,Gt!==!1&&di($e),de.call(it,$e,Se),typeof console===le&&$e<it.levels.SILENT)return"No console available for logging"},it.setDefaultLevel=function($e){Xe=$e,zt()||it.setLevel($e,!1)},it.resetLevel=function(){it.setLevel(Xe,!1),nt()},it.enableAll=function($e){it.setLevel(it.levels.TRACE,$e)},it.disableAll=function($e){it.setLevel(it.levels.SILENT,$e)};var ri=zt();ri==null&&(ri=Xe),it.setLevel(ri,!1)}var k=new re,se={};k.getLogger=function(Se){if(typeof Se!="symbol"&&typeof Se!="string"||Se==="")throw new TypeError("You must supply a name when creating a logger.");var Xe=se[Se];return Xe||(Xe=se[Se]=new re(Se,k.getLevel(),k.methodFactory)),Xe};var W=typeof window!==le?window.log:void 0;return k.noConflict=function(){return typeof window!==le&&window.log===k&&(window.log=W),k},k.getLoggers=function(){return se},k.default=k,k},(H=typeof B=="function"?B.call(I,M,I,y):B)===void 0||(y.exports=H)})()},375:function(y,I){"use strict";var M=Object.prototype.hasOwnProperty;function B(z){try{return decodeURIComponent(z.replace(/\+/g," "))}catch{return null}}function H(z){try{return encodeURIComponent(z)}catch{return null}}I.stringify=function(z,J){J=J||"";var ee,le,me=[];for(le in typeof J!="string"&&(J="?"),z)if(M.call(z,le)){if((ee=z[le])||ee!=null&&!isNaN(ee)||(ee=""),le=H(le),ee=H(ee),le===null||ee===null)continue;me.push(le+"="+ee)}return me.length?J+me.join("&"):""},I.parse=function(z){for(var J,ee=/([^=?#&]+)=?([^&]*)/g,le={};J=ee.exec(z);){var me=B(J[1]),_e=B(J[2]);me===null||_e===null||me in le||(le[me]=_e)}return le}},558:function(){}},m={};function v(y){var I=m[y];if(I!==void 0)return I.exports;var M=m[y]={exports:{}};return l[y].call(M.exports,M,M.exports,v),M.exports}return v.n=function(y){var I=y&&y.__esModule?function(){return y.default}:function(){return y};return v.d(I,{a:I}),I},v.d=function(y,I){for(var M in I)v.o(I,M)&&!v.o(y,M)&&Object.defineProperty(y,M,{enumerable:!0,get:I[M]})},v.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),v.o=function(y,I){return Object.prototype.hasOwnProperty.call(y,I)},v(80)}()},typeof su=="object"&&typeof Vc=="object"?Vc.exports=r():typeof su=="object"?su.mux=r():n.mux=r()})()});var gp=If((vp,Kc)=>{(function n(r){var l,m;l=this,m=function(){"use strict";function v(u,s){var e=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);s&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),e.push.apply(e,t)}return e}function y(u){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?v(Object(e),!0).forEach(function(t){B(u,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(e,t))})}return u}function I(u,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(u,Ee(t.key),t)}}function M(u,s,e){return s&&I(u.prototype,s),e&&I(u,e),Object.defineProperty(u,"prototype",{writable:!1}),u}function B(u,s,e){return(s=Ee(s))in u?Object.defineProperty(u,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):u[s]=e,u}function H(){return H=Object.assign?Object.assign.bind():function(u){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(u[t]=e[t])}return u},H.apply(this,arguments)}function z(u,s){u.prototype=Object.create(s.prototype),u.prototype.constructor=u,ee(u,s)}function J(u){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},J(u)}function ee(u,s){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ee(u,s)}function le(){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 me(u,s,e){return me=le()?Reflect.construct.bind():function(t,i,a){var o=[null];o.push.apply(o,i);var d=new(Function.bind.apply(t,o));return a&&ee(d,a.prototype),d},me.apply(null,arguments)}function _e(u){var s=typeof Map=="function"?new Map:void 0;return _e=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(s!==void 0){if(s.has(e))return s.get(e);s.set(e,i)}function i(){return me(e,arguments,J(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ee(i,e)},_e(u)}function ge(u,s){(s==null||s>u.length)&&(s=u.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=u[e];return t}function ye(u,s){var e=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(e)return(e=e.call(u)).next.bind(e);if(Array.isArray(u)||(e=function(i,a){if(i){if(typeof i=="string")return ge(i,a);var o=Object.prototype.toString.call(i).slice(8,-1);return o==="Object"&&i.constructor&&(o=i.constructor.name),o==="Map"||o==="Set"?Array.from(i):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ge(i,a):void 0}}(u))||s&&u&&typeof u.length=="number"){e&&(u=e);var t=0;return function(){return t>=u.length?{done:!0}:{done:!1,value:u[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
20
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ee(u){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var a=i.call(e,t||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}(u,"string");return typeof s=="symbol"?s:String(s)}function de(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Be={exports:{}};(function(u,s){var e,t,i,a,o;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(d,c,f){if(f=f||{},d=d.trim(),!(c=c.trim())){if(!f.alwaysNormalize)return d;var h=o.parseURL(d);if(!h)throw new Error("Error trying to parse base URL.");return h.path=o.normalizePath(h.path),o.buildURLFromParts(h)}var p=o.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):c;var E=o.parseURL(d);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=t.exec(E.path);E.netLoc=b[1],E.path=b[2]}E.netLoc&&!E.path&&(E.path="/");var A={scheme:E.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(A.netLoc=E.netLoc,p.path[0]!=="/"))if(p.path){var w=E.path,D=w.substring(0,w.lastIndexOf("/")+1)+p.path;A.path=o.normalizePath(D)}else A.path=E.path,p.params||(A.params=E.params,p.query||(A.query=E.query));return A.path===null&&(A.path=f.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(A)},parseURL:function(d){var c=e.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(i,"");d.length!==(d=d.replace(a,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}},u.exports=o})(Be);var Ge=Be.exports,re=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},k=function(u){return u.MEDIA_ATTACHING="hlsMediaAttaching",u.MEDIA_ATTACHED="hlsMediaAttached",u.MEDIA_DETACHING="hlsMediaDetaching",u.MEDIA_DETACHED="hlsMediaDetached",u.BUFFER_RESET="hlsBufferReset",u.BUFFER_CODECS="hlsBufferCodecs",u.BUFFER_CREATED="hlsBufferCreated",u.BUFFER_APPENDING="hlsBufferAppending",u.BUFFER_APPENDED="hlsBufferAppended",u.BUFFER_EOS="hlsBufferEos",u.BUFFER_FLUSHING="hlsBufferFlushing",u.BUFFER_FLUSHED="hlsBufferFlushed",u.MANIFEST_LOADING="hlsManifestLoading",u.MANIFEST_LOADED="hlsManifestLoaded",u.MANIFEST_PARSED="hlsManifestParsed",u.LEVEL_SWITCHING="hlsLevelSwitching",u.LEVEL_SWITCHED="hlsLevelSwitched",u.LEVEL_LOADING="hlsLevelLoading",u.LEVEL_LOADED="hlsLevelLoaded",u.LEVEL_UPDATED="hlsLevelUpdated",u.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",u.LEVELS_UPDATED="hlsLevelsUpdated",u.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",u.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",u.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",u.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",u.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",u.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",u.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",u.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",u.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",u.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",u.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",u.CUES_PARSED="hlsCuesParsed",u.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",u.INIT_PTS_FOUND="hlsInitPtsFound",u.FRAG_LOADING="hlsFragLoading",u.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",u.FRAG_LOADED="hlsFragLoaded",u.FRAG_DECRYPTED="hlsFragDecrypted",u.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",u.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",u.FRAG_PARSING_METADATA="hlsFragParsingMetadata",u.FRAG_PARSED="hlsFragParsed",u.FRAG_BUFFERED="hlsFragBuffered",u.FRAG_CHANGED="hlsFragChanged",u.FPS_DROP="hlsFpsDrop",u.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",u.ERROR="hlsError",u.DESTROYING="hlsDestroying",u.KEY_LOADING="hlsKeyLoading",u.KEY_LOADED="hlsKeyLoaded",u.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",u.BACK_BUFFER_REACHED="hlsBackBufferReached",u}({}),se=function(u){return u.NETWORK_ERROR="networkError",u.MEDIA_ERROR="mediaError",u.KEY_SYSTEM_ERROR="keySystemError",u.MUX_ERROR="muxError",u.OTHER_ERROR="otherError",u}({}),W=function(u){return u.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",u.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",u.KEY_SYSTEM_NO_SESSION="keySystemNoSession",u.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",u.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",u.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",u.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",u.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",u.MANIFEST_LOAD_ERROR="manifestLoadError",u.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",u.MANIFEST_PARSING_ERROR="manifestParsingError",u.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",u.LEVEL_EMPTY_ERROR="levelEmptyError",u.LEVEL_LOAD_ERROR="levelLoadError",u.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",u.LEVEL_PARSING_ERROR="levelParsingError",u.LEVEL_SWITCH_ERROR="levelSwitchError",u.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",u.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",u.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",u.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",u.FRAG_LOAD_ERROR="fragLoadError",u.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",u.FRAG_DECRYPT_ERROR="fragDecryptError",u.FRAG_PARSING_ERROR="fragParsingError",u.FRAG_GAP="fragGap",u.REMUX_ALLOC_ERROR="remuxAllocError",u.KEY_LOAD_ERROR="keyLoadError",u.KEY_LOAD_TIMEOUT="keyLoadTimeOut",u.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",u.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",u.BUFFER_APPEND_ERROR="bufferAppendError",u.BUFFER_APPENDING_ERROR="bufferAppendingError",u.BUFFER_STALLED_ERROR="bufferStalledError",u.BUFFER_FULL_ERROR="bufferFullError",u.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",u.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",u.INTERNAL_EXCEPTION="internalException",u.INTERNAL_ABORTED="aborted",u.UNKNOWN="unknown",u}({}),Se=function(){},Xe={trace:Se,debug:Se,log:Se,warn:Se,info:Se,error:Se},at=Xe;function jt(u){var s=self.console[u];return s?s.bind(self.console,"["+u+"] >"):Se}function it(u,s){if(self.console&&u===!0||typeof u=="object"){(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];i.forEach(function(o){at[o]=e[o]?e[o].bind(e):jt(o)})})(u,"debug","log","info","warn","error");try{at.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.3')}catch{at=Xe}}else at=Xe}var U=at,di=/^(\d+)x(\d+)$/,zt=/(.+?)=(".*?"|.*?)(?:,|$)/g,nt=function(){function u(e){for(var t in typeof e=="string"&&(e=u.parseAttrList(e)),e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}var s=u.prototype;return s.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.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),a=0;a<t.length/2;a++)i[a]=parseInt(t.slice(2*a,2*a+2),16);return i}return null},s.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.decimalFloatingPoint=function(e){return parseFloat(this[e])},s.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},s.enumeratedString=function(e){return this[e]},s.bool=function(e){return this[e]==="YES"},s.decimalResolution=function(e){var t=di.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},u.parseAttrList=function(e){var t,i={};for(zt.lastIndex=0;(t=zt.exec(e))!==null;){var a=t[2];a.indexOf('"')===0&&a.lastIndexOf('"')===a.length-1&&(a=a.slice(1,-1)),i[t[1].trim()]=a}return i},u}();function ri(u){return u==="SCTE35-OUT"||u==="SCTE35-IN"}var $e=function(){function u(s,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){var t=e.attr;for(var i in t)if(Object.prototype.hasOwnProperty.call(s,i)&&s[i]!==t[i]){U.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=H(new nt({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var a=new Date(this.attr["END-DATE"]);re(a.getTime())&&(this._endDate=a)}}return M(u,[{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 s=this.duration;return s!==null?new Date(this._startDate.getTime()+1e3*s):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var s=this.attr.decimalFloatingPoint("DURATION");if(re(s))return s}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&re(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),u}(),Gt=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}},gt="audio",Ct="video",tr="audiovideo",te=function(){function u(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[gt]=null,e[Ct]=null,e[tr]=null,e),this.baseurl=s}return u.prototype.setByteRange=function(s,e){var t=s.split("@",2),i=[];t.length===1?i[0]=e?e.byteRangeEndOffset:0:i[0]=parseInt(t[1]),i[1]=parseInt(t[0])+i[0],this._byteRange=i},M(u,[{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=Ge.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),u}(),ke=function(u){function s(t,i){var a;return(a=u.call(this,i)||this)._decryptdata=null,a.rawProgramDateTime=null,a.programDateTime=null,a.tagList=[],a.duration=0,a.sn=0,a.levelkeys=void 0,a.type=void 0,a.loader=null,a.keyLoader=null,a.level=-1,a.cc=0,a.startPTS=void 0,a.endPTS=void 0,a.startDTS=void 0,a.endDTS=void 0,a.start=0,a.deltaPTS=void 0,a.maxStartPTS=void 0,a.minEndPTS=void 0,a.stats=new Gt,a.urlId=0,a.data=void 0,a.bitrateTest=!1,a.title=null,a.initSegment=null,a.endList=void 0,a.gap=void 0,a.type=t,a}z(s,u);var e=s.prototype;return e.setKeyFormat=function(t){if(this.levelkeys){var i=this.levelkeys[t];i&&!this._decryptdata&&(this._decryptdata=i.getDecryptData(this.sn))}},e.abortRequests=function(){var t,i;(t=this.loader)==null||t.abort(),(i=this.keyLoader)==null||i.abort()},e.setElementaryStreamInfo=function(t,i,a,o,d,c){c===void 0&&(c=!1);var f=this.elementaryStreams,h=f[t];h?(h.startPTS=Math.min(h.startPTS,i),h.endPTS=Math.max(h.endPTS,a),h.startDTS=Math.min(h.startDTS,o),h.endDTS=Math.max(h.endDTS,d)):f[t]={startPTS:i,endPTS:a,startDTS:o,endDTS:d,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[gt]=null,t[Ct]=null,t[tr]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!re(this.programDateTime))return null;var t=re(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var i=Object.keys(this.levelkeys),a=i.length;if(a>1||a===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(te),st=function(u){function s(e,t,i,a,o){var d;(d=u.call(this,i)||this).fragOffset=0,d.duration=0,d.gap=!1,d.independent=!1,d.relurl=void 0,d.fragment=void 0,d.index=void 0,d.stats=new Gt,d.duration=e.decimalFloatingPoint("DURATION"),d.gap=e.bool("GAP"),d.independent=e.bool("INDEPENDENT"),d.relurl=e.enumeratedString("URI"),d.fragment=t,d.index=a;var c=e.enumeratedString("BYTERANGE");return c&&d.setByteRange(c,o),o&&(d.fragOffset=o.fragOffset+o.duration),d}return z(s,u),M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),s}(te),wt=function(){function u(s){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.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=s}return u.prototype.reloaded=function(s){if(!s)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-s.lastPartSn,t=this.lastPartIndex-s.lastPartIndex;this.updated=this.endSN!==s.endSN||!!t||!!e,this.advanced=this.endSN>s.endSN||e>0||e===0&&t>0,this.updated||this.advanced?this.misses=Math.floor(.6*s.misses):this.misses=s.misses+1,this.availabilityDelay=s.availabilityDelay},M(u,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&re(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var s=this.driftEndTime-this.driftStartTime;return s>0?1e3*(this.driftEnd-this.driftStart)/s:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var s;return(s=this.fragments)!=null&&s.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 s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),u}();function Rt(u){return Uint8Array.from(atob(u),function(s){return s.charCodeAt(0)})}function ci(u){var s,e,t=u.split(":"),i=null;if(t[0]==="data"&&t.length===2){var a=t[1].split(";"),o=a[a.length-1].split(",");if(o.length===2){var d=o[0]==="base64",c=o[1];d?(a.splice(-1,1),i=Rt(c)):(s=$i(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function $i(u){return Uint8Array.from(unescape(encodeURIComponent(u)),function(s){return s.charCodeAt(0)})}var Ze={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},vi="org.w3.clearkey",gi="com.apple.streamingkeydelivery",ji="com.microsoft.playready",ir="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Ei(u){switch(u){case gi:return Ze.FAIRPLAY;case ji:return Ze.PLAYREADY;case ir:return Ze.WIDEVINE;case vi:return Ze.CLEARKEY}}var ct="edef8ba979d64acea3c827dcd51d21ed";function rr(u){switch(u){case Ze.FAIRPLAY:return gi;case Ze.PLAYREADY:return ji;case Ze.WIDEVINE:return ir;case Ze.CLEARKEY:return vi}}function gr(u){var s=u.drmSystems,e=u.widevineLicenseUrl,t=s?[Ze.FAIRPLAY,Ze.WIDEVINE,Ze.PLAYREADY,Ze.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[Ze.WIDEVINE]&&e&&t.push(Ze.WIDEVINE),t}var $r=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function xi(u,s,e){return Uint8Array.prototype.slice?u.slice(s,e):new Uint8Array(Array.prototype.slice.call(u,s,e))}var Er,es=function(u,s){return s+10<=u.length&&u[s]===73&&u[s+1]===68&&u[s+2]===51&&u[s+3]<255&&u[s+4]<255&&u[s+6]<128&&u[s+7]<128&&u[s+8]<128&&u[s+9]<128},vo=function(u,s){return s+10<=u.length&&u[s]===51&&u[s+1]===68&&u[s+2]===73&&u[s+3]<255&&u[s+4]<255&&u[s+6]<128&&u[s+7]<128&&u[s+8]<128&&u[s+9]<128},ga=function(u,s){for(var e=s,t=0;es(u,s);)t+=10,t+=an(u,s+6),vo(u,s+10)&&(t+=10),s+=t;if(t>0)return u.subarray(e,e+t)},an=function(u,s){var e=0;return e=(127&u[s])<<21,e|=(127&u[s+1])<<14,e|=(127&u[s+2])<<7,e|=127&u[s+3]},go=function(u,s){return es(u,s)&&an(u,s+6)+10<=u.length-s},Eo=function(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"},Bu=function(u){var s=String.fromCharCode(u[0],u[1],u[2],u[3]),e=an(u,4);return{type:s,size:e,data:u.subarray(10,10+e)}},ts=function(u){for(var s=0,e=[];es(u,s);){for(var t=an(u,s+6),i=(s+=10)+t;s+8<i;){var a=Bu(u.subarray(s)),o=Hu(a);o&&e.push(o),s+=a.size+10}vo(u,s)&&(s+=10)}return e},Hu=function(u){return u.type==="PRIV"?Gu(u):u.type[0]==="W"?bo(u):yo(u)},Gu=function(u){if(!(u.size<2)){var s=Li(u.data,!0),e=new Uint8Array(u.data.subarray(s.length+1));return{key:u.type,info:s,data:e.buffer}}},yo=function(u){if(!(u.size<2)){if(u.type==="TXXX"){var s=1,e=Li(u.data.subarray(s),!0);s+=e.length+1;var t=Li(u.data.subarray(s));return{key:u.type,info:e,data:t}}var i=Li(u.data.subarray(1));return{key:u.type,data:i}}},bo=function(u){if(u.type==="WXXX"){if(u.size<2)return;var s=1,e=Li(u.data.subarray(s),!0);s+=e.length+1;var t=Li(u.data.subarray(s));return{key:u.type,info:e,data:t}}var i=Li(u.data);return{key:u.type,data:i}},_o=function(u){if(u.data.byteLength===8){var s=new Uint8Array(u.data),e=1&s[3],t=(s[4]<<23)+(s[5]<<15)+(s[6]<<7)+s[7];return t/=45,e&&(t+=4772185884e-2),Math.round(t)}},Li=function(u,s){s===void 0&&(s=!1);var e=Vu();if(e){var t=e.decode(u);if(s){var i=t.indexOf("\0");return i!==-1?t.substring(0,i):t}return t.replace(/\0/g,"")}for(var a,o,d,c=u.length,f="",h=0;h<c;){if((a=u[h++])===0&&s)return f;if(a!==0&&a!==3)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f+=String.fromCharCode(a);break;case 12:case 13:o=u[h++],f+=String.fromCharCode((31&a)<<6|63&o);break;case 14:o=u[h++],d=u[h++],f+=String.fromCharCode((15&a)<<12|(63&o)<<6|(63&d)<<0)}}return f};function Vu(){return Er||self.TextDecoder===void 0||(Er=new self.TextDecoder("utf-8")),Er}var Pi=function(u){for(var s="",e=0;e<u.length;e++){var t=u[e].toString(16);t.length<2&&(t="0"+t),s+=t}return s},Ea=Math.pow(2,32)-1,Ku=[].push,To={video:1,audio:2,id3:3,text:4};function Mt(u){return String.fromCharCode.apply(null,u)}function Ao(u,s){var e=u[s]<<8|u[s+1];return e<0?65536+e:e}function He(u,s){var e=is(u,s);return e<0?4294967296+e:e}function is(u,s){return u[s]<<24|u[s+1]<<16|u[s+2]<<8|u[s+3]}function rs(u,s,e){u[s]=e>>24,u[s+1]=e>>16&255,u[s+2]=e>>8&255,u[s+3]=255&e}function Je(u,s){var e=[];if(!s.length)return e;for(var t=u.byteLength,i=0;i<t;){var a=He(u,i),o=a>1?i+a:t;if(Mt(u.subarray(i+4,i+8))===s[0])if(s.length===1)e.push(u.subarray(i+8,o));else{var d=Je(u.subarray(i+8,o),s.slice(1));d.length&&Ku.apply(e,d)}i=o}return e}function So(u){var s=[],e=u[0],t=8,i=He(u,t);t+=4,t+=e===0?8:16,t+=2;var a=u.length+0,o=Ao(u,t);t+=2;for(var d=0;d<o;d++){var c=t,f=He(u,c);c+=4;var h=2147483647&f;if((2147483648&f)>>>31==1)return U.warn("SIDX has hierarchical references (not supported)"),null;var p=He(u,c);c+=4,s.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:a,end:a+h-1}}),a+=h,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:o,references:s}}function as(u){for(var s=[],e=Je(u,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],a=Je(i,["tkhd"])[0];if(a){var o=a[0],d=o===0?12:20,c=He(a,d),f=Je(i,["mdia","mdhd"])[0];if(f){var h=He(f,d=(o=f[0])===0?12:20),p=Je(i,["mdia","hdlr"])[0];if(p){var E=Mt(p.subarray(8,12)),b={soun:gt,vide:Ct}[E];if(b){var A=Je(i,["mdia","minf","stbl","stsd"])[0],w=void 0;A&&(w=Mt(A.subarray(12,16))),s[c]={timescale:h,type:b},s[b]={timescale:h,id:c,codec:w}}}}}}return Je(u,["moov","mvex","trex"]).forEach(function(D){var S=He(D,4),L=s[S];L&&(L.default={duration:He(D,12),flags:He(D,20)})}),s}function ns(u){var s=Je(u,["schm"])[0];if(s){var e=Mt(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return Je(u,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function Wu(u){var s=He(u,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=He(u,4),a=0;a<i;a++)256&s&&(t+=He(u,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function yr(u,s){var e=new Uint8Array(u.length+s.length);return e.set(u),e.set(s,u.length),e}function ss(u,s){var e=[],t=s.samples,i=s.timescale,a=s.id,o=!1;return Je(t,["moof"]).map(function(d){var c=d.byteOffset-8;Je(d,["traf"]).map(function(f){var h=Je(f,["tfdt"]).map(function(p){var E=p[0],b=He(p,4);return E===1&&(b*=Math.pow(2,32),b+=He(p,8)),b/i})[0];return h!==void 0&&(u=h),Je(f,["tfhd"]).map(function(p){var E=He(p,4),b=16777215&He(p,0),A=0,w=(16&b)!=0,D=0,S=(32&b)!=0,L=8;E===a&&((1&b)!=0&&(L+=8),(2&b)!=0&&(L+=4),(8&b)!=0&&(A=He(p,L),L+=4),w&&(D=He(p,L),L+=4),S&&(L+=4),s.type==="video"&&(o=function(N){if(!N)return!1;var P=N.indexOf("."),V=P<0?N:N.substring(0,P);return V==="hvc1"||V==="hev1"||V==="dvh1"||V==="dvhe"}(s.codec)),Je(f,["trun"]).map(function(N){var P=N[0],V=16777215&He(N,0),Y=(1&V)!=0,j=0,ie=(4&V)!=0,Q=(256&V)!=0,X=0,ce=(512&V)!=0,oe=0,Ae=(1024&V)!=0,xe=(2048&V)!=0,Le=0,Me=He(N,4),Oe=8;Y&&(j=He(N,Oe),Oe+=4),ie&&(Oe+=4);for(var Pe=j+c,Ke=0;Ke<Me;Ke++){if(Q?(X=He(N,Oe),Oe+=4):X=A,ce?(oe=He(N,Oe),Oe+=4):oe=D,Ae&&(Oe+=4),xe&&(Le=P===0?He(N,Oe):is(N,Oe),Oe+=4),s.type===Ct)for(var je=0;je<oe;){var et=He(t,Pe);ko(o,t[Pe+=4])&&wo(t.subarray(Pe,Pe+et),o?2:1,u+Le/i,e),Pe+=et,je+=et+4}u+=X/i}}))})})}),e}function ko(u,s){if(u){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function wo(u,s,e,t){var i=Lo(u),a=0;a+=s;for(var o=0,d=0,c=!1,f=0;a<i.length;){o=0;do{if(a>=i.length)break;o+=f=i[a++]}while(f===255);d=0;do{if(a>=i.length)break;d+=f=i[a++]}while(f===255);var h=i.length-a;if(!c&&o===4&&a<i.length){if(c=!0,i[a++]===181){var p=Ao(i,a);if(a+=2,p===49){var E=He(i,a);if(a+=4,E===1195456820){var b=i[a++];if(b===3){var A=i[a++],w=64&A,D=w?2+3*(31&A):0,S=new Uint8Array(D);if(w){S[0]=A;for(var L=1;L<D;L++)S[L]=i[a++]}t.push({type:b,payloadType:o,pts:e,bytes:S})}}}}}else if(o===5&&d<h){if(c=!0,d>16){for(var N=[],P=0;P<16;P++){var V=i[a++].toString(16);N.push(V.length==1?"0"+V:V),P!==3&&P!==5&&P!==7&&P!==9||N.push("-")}for(var Y=d-16,j=new Uint8Array(Y),ie=0;ie<Y;ie++)j[ie]=i[a++];t.push({payloadType:o,pts:e,uuid:N.join(""),userData:Li(j),userDataBytes:j})}}else if(d<h)a+=d;else if(d>h)break}}function Lo(u){for(var s=u.byteLength,e=[],t=1;t<s-2;)u[t]===0&&u[t+1]===0&&u[t+2]===3?(e.push(t+2),t+=2):t++;if(e.length===0)return u;var i=s-e.length,a=new Uint8Array(i),o=0;for(t=0;t<i;o++,t++)o===e[0]&&(o++,e.shift()),a[t]=u[o];return a}function Io(u,s,e){if(u.byteLength!==16)throw new RangeError("Invalid system id");var t,i,a;if(s){t=1,i=new Uint8Array(16*s.length);for(var o=0;o<s.length;o++){var d=s[o];if(d.byteLength!==16)throw new RangeError("Invalid key");i.set(d,16*o)}}else t=0,i=new Uint8Array;t>0?(a=new Uint8Array(4),s.length>0&&new DataView(a.buffer).setUint32(0,s.length,!1)):a=new Uint8Array;var c=new Uint8Array(4);return e&&e.byteLength>0&&new DataView(c.buffer).setUint32(0,e.byteLength,!1),function(f){for(var h=arguments.length,p=new Array(h>1?h-1:0),E=1;E<h;E++)p[E-1]=arguments[E];for(var b=p.length,A=8,w=b;w--;)A+=p[w].byteLength;var D=new Uint8Array(A);for(D[0]=A>>24&255,D[1]=A>>16&255,D[2]=A>>8&255,D[3]=255&A,D.set(f,4),w=0,A=8;w<b;w++)D.set(p[w],A),A+=p[w].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),u,a,i,c,e||new Uint8Array)}var ya={},ba=function(){function u(e,t,i,a,o){a===void 0&&(a=[1]),o===void 0&&(o=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=a,this.iv=o,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}u.clearKeyUriToKeyIdMap=function(){ya={}};var s=u.prototype;return s.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case gi:case ir:case ji:case vi:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},s.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||U.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(D){for(var S=new Uint8Array(16),L=12;L<16;L++)S[L]=D>>8*(15-L)&255;return S}(e);return new u(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=ci(this.uri);if(i)switch(this.keyFormat){case ir:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ji:var a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Io(a,null,i);var o=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),d=String.fromCharCode.apply(null,Array.from(o)),c=d.substring(d.indexOf("<"),d.length),f=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("KID")[0];if(f){var h=f.childNodes[0]?f.childNodes[0].nodeValue:f.getAttribute("VALUE");if(h){var p=Rt(h).subarray(0,16);(function(D){var S=function(L,N,P){var V=L[N];L[N]=L[P],L[P]=V};S(D,0,3),S(D,1,2),S(D,4,5),S(D,6,7)})(p),this.keyId=p}}break;default:var E=i.subarray(0,16);if(E.length!==16){var b=new Uint8Array(16);b.set(E,16-E.length),E=b}this.keyId=E}if(!this.keyId||this.keyId.byteLength!==16){var A=ya[this.uri];if(!A){var w=Object.keys(ya).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,w),ya[this.uri]=A}this.keyId=A}return this},u}(),Ro=/\{\$([a-zA-Z0-9-_]+)\}/g;function Do(u){return Ro.test(u)}function ai(u,s,e){if(u.variableList!==null||u.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],a=s[i];a&&(s[i]=Ii(u,a))}}function Ii(u,s){if(u.variableList!==null||u.hasVariableRefs){var e=u.variableList;return s.replace(Ro,function(t){var i=t.substring(2,t.length-1),a=e==null?void 0:e[i];return a===void 0?(u.playlistParsingError||(u.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):a})}return s}function Co(u,s,e){var t,i,a=u.variableList;if(a||(u.variableList=a={}),"QUERYPARAM"in s){t=s.QUERYPARAM;try{var o=new self.URL(e).searchParams;if(!o.has(t))throw new Error('"'+t+'" does not match any query parameter in URI: "'+e+'"');i=o.get(t)}catch(d){u.playlistParsingError||(u.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+d.message))}}else t=s.NAME,i=s.VALUE;t in a?u.playlistParsingError||(u.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):a[t]=i||""}function Mo(u,s,e){var t=s.IMPORT;if(e&&t in e){var i=u.variableList;i||(u.variableList=i={}),i[t]=e[t]}else u.playlistParsingError||(u.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+t+'"'))}function nn(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}var qu={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}},os=nn();function sn(u,s){var e;return(e=os==null?void 0:os.isTypeSupported((s||"video")+'/mp4;codecs="'+u+'"'))!=null&&e}var br=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,jr=/#EXT-X-MEDIA:(.*)/g,Yu=/^#EXT(?:INF|-X-TARGETDURATION):/m,ls=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),on=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|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("|")),_a=function(){function u(){}return u.findGroup=function(s,e){for(var t=0;t<s.length;t++){var i=s[t];if(i.id===e)return i}},u.convertAVC1ToAVCOTI=function(s){var e=s.split(".");if(e.length>2){var t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4)}return s},u.resolve=function(s,e){return Ge.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},u.isMediaPlaylist=function(s){return Yu.test(s)},u.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Do(s)},a=[];for(br.lastIndex=0;(t=br.exec(s))!=null;)if(t[1]){var o,d=new nt(t[1]);ai(i,d,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=Ii(i,t[2]),f={attrs:d,bitrate:d.decimalInteger("AVERAGE-BANDWIDTH")||d.decimalInteger("BANDWIDTH"),name:d.NAME,url:u.resolve(c,e)},h=d.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),$u((d.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=u.convertAVC1ToAVCOTI(f.videoCodec)),(o=f.unknownCodecs)!=null&&o.length||a.push(f),i.levels.push(f)}else if(t[3]){var p=t[3],E=t[4];switch(p){case"SESSION-DATA":var b=new nt(E);ai(i,b,["DATA-ID","LANGUAGE","VALUE","URI"]);var A=b["DATA-ID"];A&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[A]=b);break;case"SESSION-KEY":var w=xo(E,e,i);w.encrypted&&w.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(w)):U.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+E+'"');break;case"DEFINE":var D=new nt(E);ai(i,D,["NAME","VALUE","QUERYPARAM"]),Co(i,D,e);break;case"CONTENT-STEERING":var S=new nt(E);ai(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:u.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=Po(E)}}var L=a.length>0&&a.length<i.levels.length;return i.levels=L?a:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},u.parseMasterPlaylistMedia=function(s,e,t){var i,a={},o=t.levels,d={AUDIO:o.map(function(w){return{id:w.attrs.AUDIO,audioCodec:w.audioCodec}}),SUBTITLES:o.map(function(w){return{id:w.attrs.SUBTITLES,textCodec:w.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(jr.lastIndex=0;(i=jr.exec(s))!==null;){var f=new nt(i[1]),h=f.TYPE;if(h){var p=d[h],E=a[h]||[];a[h]=E,ai(t,f,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var b={attrs:f,bitrate:0,id:c++,groupId:f["GROUP-ID"]||"",instreamId:f["INSTREAM-ID"],name:f.NAME||f.LANGUAGE||"",type:h,default:f.bool("DEFAULT"),autoselect:f.bool("AUTOSELECT"),forced:f.bool("FORCED"),lang:f.LANGUAGE,url:f.URI?u.resolve(f.URI,e):""};if(p!=null&&p.length){var A=u.findGroup(p,b.groupId)||p[0];us(b,A,"audioCodec"),us(b,A,"textCodec")}E.push(b)}}return a},u.parseLevelPlaylist=function(s,e,t,i,a,o){var d,c,f,h=new wt(e),p=h.fragments,E=null,b=0,A=0,w=0,D=0,S=null,L=new ke(i,e),N=-1,P=!1;for(ls.lastIndex=0,h.m3u8=s,h.hasVariableRefs=Do(s);(d=ls.exec(s))!==null;){P&&(P=!1,(L=new ke(i,e)).start=w,L.sn=b,L.cc=D,L.level=t,E&&(L.initSegment=E,L.rawProgramDateTime=E.rawProgramDateTime,E.rawProgramDateTime=null));var V=d[1];if(V){L.duration=parseFloat(V);var Y=(" "+d[2]).slice(1);L.title=Y||null,L.tagList.push(Y?["INF",V,Y]:["INF",V])}else if(d[3]){if(re(L.duration)){L.start=w,f&&ds(L,f,h),L.sn=b,L.level=t,L.cc=D,L.urlId=a,p.push(L);var j=(" "+d[3]).slice(1);L.relurl=Ii(h,j),Oo(L,S),S=L,w+=L.duration,b++,A=0,P=!0}}else if(d[4]){var ie=(" "+d[4]).slice(1);S?L.setByteRange(ie,S):L.setByteRange(ie)}else if(d[5])L.rawProgramDateTime=(" "+d[5]).slice(1),L.tagList.push(["PROGRAM-DATE-TIME",L.rawProgramDateTime]),N===-1&&(N=p.length);else{if(!(d=d[0].match(on))){U.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<d.length&&d[c]===void 0;c++);var Q=(" "+d[c]).slice(1),X=(" "+d[c+1]).slice(1),ce=d[c+2]?(" "+d[c+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":h.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":b=h.startSN=parseInt(X);break;case"SKIP":var oe=new nt(X);ai(h,oe,["RECENTLY-REMOVED-DATERANGES"]);var Ae=oe.decimalInteger("SKIPPED-SEGMENTS");if(re(Ae)){h.skippedSegments=Ae;for(var xe=Ae;xe--;)p.unshift(null);b+=Ae}var Le=oe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(h.recentlyRemovedDateranges=Le.split(" "));break;case"TARGETDURATION":h.targetduration=Math.max(parseInt(X),1);break;case"VERSION":h.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(X||ce)&&L.tagList.push(ce?[X,ce]:[X]);break;case"DISCONTINUITY":D++,L.tagList.push(["DIS"]);break;case"GAP":L.gap=!0,L.tagList.push([Q]);break;case"BITRATE":L.tagList.push([Q,X]);break;case"DATERANGE":var Me=new nt(X);ai(h,Me,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ai(h,Me,Me.clientAttrs);var Oe=new $e(Me,h.dateRanges[Me.ID]);Oe.isValid||h.skippedSegments?h.dateRanges[Oe.id]=Oe:U.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),L.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Pe=new nt(X);ai(h,Pe,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Pe?Mo(h,Pe,o):Co(h,Pe,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var Ke=xo(X,e,h);if(Ke.isSupported()){if(Ke.method==="NONE"){f=void 0;break}f||(f={}),f[Ke.keyFormat]&&(f=H({},f)),f[Ke.keyFormat]=Ke}else U.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":h.startTimeOffset=Po(X);break;case"MAP":var je=new nt(X);if(ai(h,je,["BYTERANGE","URI"]),L.duration){var et=new ke(i,e);No(et,je,t,f),E=et,L.initSegment=E,E.rawProgramDateTime&&!L.rawProgramDateTime&&(L.rawProgramDateTime=E.rawProgramDateTime)}else No(L,je,t,f),E=L,P=!0;break;case"SERVER-CONTROL":var lt=new nt(X);h.canBlockReload=lt.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=lt.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&lt.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=lt.optionalFloat("PART-HOLD-BACK",0),h.holdBack=lt.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var _i=new nt(X);h.partTarget=_i.decimalFloatingPoint("PART-TARGET");break;case"PART":var Kt=h.partList;Kt||(Kt=h.partList=[]);var Qi=A>0?Kt[Kt.length-1]:void 0,Bi=A++,Hi=new nt(X);ai(h,Hi,["BYTERANGE","URI"]);var Wt=new st(Hi,L,e,Bi,Qi);Kt.push(Wt),L.duration+=Wt.duration;break;case"PRELOAD-HINT":var ti=new nt(X);ai(h,ti,["URI"]),h.preloadHint=ti;break;case"RENDITION-REPORT":var sr=new nt(X);ai(h,sr,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(sr);break;default:U.warn("line parsed but not handled: "+d)}}}S&&!S.relurl?(p.pop(),w-=S.duration,h.partList&&(h.fragmentHint=S)):h.partList&&(Oo(L,S),L.cc=D,h.fragmentHint=L,f&&ds(L,f,h));var ea=p.length,Ci=p[0],Ts=p[ea-1];if((w+=h.skippedSegments*h.targetduration)>0&&ea&&Ts){h.averagetargetduration=w/ea;var As=Ts.sn;h.endSN=As!=="initSegment"?As:0,h.live||(Ts.endList=!0),Ci&&(h.startCC=Ci.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(w+=h.fragmentHint.duration),h.totalduration=w,h.endCC=D,N>0&&function(il,gn){for(var Oa=il[gn],Ss=gn;Ss--;){var Ir=il[Ss];if(!Ir)return;Ir.programDateTime=Oa.programDateTime-1e3*Ir.duration,Oa=Ir}}(p,N),h},u}();function xo(u,s,e){var t,i,a=new nt(u);ai(e,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var o=(t=a.METHOD)!=null?t:"",d=a.URI,c=a.hexadecimalInteger("IV"),f=a.KEYFORMATVERSIONS,h=(i=a.KEYFORMAT)!=null?i:"identity";d&&a.IV&&!c&&U.error("Invalid IV: "+a.IV);var p=d?_a.resolve(d,s):"",E=(f||"1").split("/").map(Number).filter(Number.isFinite);return new ba(o,p,h,E,c)}function Po(u){var s=new nt(u).decimalFloatingPoint("TIME-OFFSET");return re(s)?s:null}function $u(u,s){["video","audio","text"].forEach(function(e){var t=u.filter(function(a){return function(o,d){var c=qu[d];return!!c&&c[o.slice(0,4)]===!0}(a,e)});if(t.length){var i=t.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],u=u.filter(function(a){return t.indexOf(a)===-1})}}),s.unknownCodecs=u}function us(u,s,e){var t=s[e];t&&(u[e]=t)}function Oo(u,s){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):s!=null&&s.programDateTime&&(u.programDateTime=s.endProgramDateTime),re(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}function No(u,s,e,t){u.relurl=s.URI,s.BYTERANGE&&u.setByteRange(s.BYTERANGE),u.level=e,u.sn="initSegment",t&&(u.levelkeys=t),u.initSegment=null}function ds(u,s,e){u.levelkeys=s;var t=e.encryptedFragments;t.length&&t[t.length-1].levelkeys===s||!Object.keys(s).some(function(i){return s[i].isCommonEncryption})||t.push(u)}var zr="manifest",_r="level",yi="audioTrack",zi="subtitleTrack",rt="main",Ri="audio",Oi="subtitle";function Fo(u){switch(u.type){case yi:return Ri;case zi:return Oi;default:return rt}}function cs(u,s){var e=u.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var xt=function(){function u(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var s=u.prototype;return s.startLoad=function(e){},s.stopLoad=function(){this.destroyInternalLoaders()},s.registerListeners=function(){var e=this.hls;e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.LEVEL_LOADING,this.onLevelLoading,this),e.on(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.LEVEL_LOADING,this.onLevelLoading,this),e.off(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,a=t.loader,o=new(i||a)(t);return this.loaders[e.type]=o,o},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},s.onManifestLoading=function(e,t){var i=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:zr,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,a=t.level,o=t.url,d=t.deliveryDirectives;this.load({id:i,level:a,responseType:"text",type:_r,url:o,deliveryDirectives:d})},s.onAudioTrackLoading=function(e,t){var i=t.id,a=t.groupId,o=t.url,d=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:yi,url:o,deliveryDirectives:d})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,a=t.groupId,o=t.url,d=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:zi,url:o,deliveryDirectives:d})},s.load=function(e){var t,i,a,o=this,d=this.hls.config,c=this.getInternalLoader(e);if(c){var f=c.context;if(f&&f.url===e.url)return void U.trace("[playlist-loader]: playlist request ongoing");U.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===zr?d.manifestLoadPolicy.default:H({},d.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===_r&&e.level!==null?a=this.hls.levels[e.level].details:e.type===yi&&e.id!==null?a=this.hls.audioTracks[e.id].details:e.type===zi&&e.id!==null&&(a=this.hls.subtitleTracks[e.id].details),a)){var h=a.partTarget,p=a.targetduration;if(h&&p){var E=1e3*Math.max(3*h,.8*p);i=H({},i,{maxTimeToFirstByteMs:Math.min(E,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(E,i.maxTimeToFirstByteMs)})}}var b=i.errorRetry||i.timeoutRetry||{},A={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},w={onSuccess:function(D,S,L,N){var P=o.getInternalLoader(L);o.resetInternalLoader(L.type);var V=D.data;V.indexOf("#EXTM3U")===0?(S.parsing.start=performance.now(),_a.isMediaPlaylist(V)?o.handleTrackOrLevelPlaylist(D,S,L,N||null,P):o.handleMasterPlaylist(D,S,L,N)):o.handleManifestParsingError(D,L,new Error("no EXTM3U delimiter"),N||null,S)},onError:function(D,S,L,N){o.handleNetworkError(S,L,!1,D,N)},onTimeout:function(D,S,L){o.handleNetworkError(S,L,!0,void 0,D)}};c.load(e,A,w)},s.handleMasterPlaylist=function(e,t,i,a){var o=this.hls,d=e.data,c=cs(e,i),f=_a.parseMasterPlaylist(d,c);if(f.playlistParsingError)this.handleManifestParsingError(e,i,f.playlistParsingError,a,t);else{var h=f.contentSteering,p=f.levels,E=f.sessionData,b=f.sessionKeys,A=f.startTimeOffset,w=f.variableList;this.variableList=w;var D=_a.parseMasterPlaylistMedia(d,c,f),S=D.AUDIO,L=S===void 0?[]:S,N=D.SUBTITLES,P=D["CLOSED-CAPTIONS"];L.length&&(L.some(function(V){return!V.url})||!p[0].audioCodec||p[0].attrs.AUDIO||(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new nt({}),bitrate:0,url:""}))),o.trigger(k.MANIFEST_LOADED,{levels:p,audioTracks:L,subtitles:N,captions:P,contentSteering:h,url:c,stats:t,networkDetails:a,sessionData:E,sessionKeys:b,startTimeOffset:A,variableList:w})}},s.handleTrackOrLevelPlaylist=function(e,t,i,a,o){var d=this.hls,c=i.id,f=i.level,h=i.type,p=cs(e,i),E=re(c)?c:0,b=re(f)?f:E,A=Fo(i),w=_a.parseLevelPlaylist(e.data,p,b,A,E,this.variableList);if(h===zr){var D={attrs:new nt({}),bitrate:0,details:w,name:"",url:p};d.trigger(k.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=w,this.handlePlaylistLoaded(w,e,t,i,a,o)},s.handleManifestParsingError=function(e,t,i,a,o){this.hls.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.MANIFEST_PARSING_ERROR,fatal:t.type===zr,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:a,stats:o})},s.handleNetworkError=function(e,t,i,a,o){i===void 0&&(i=!1);var d="A network "+(i?"timeout":"error"+(a?" (status "+a.code+")":""))+" occurred while loading "+e.type;e.type===_r?d+=": "+e.level+" id: "+e.id:e.type!==yi&&e.type!==zi||(d+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(d);U.warn("[playlist-loader]: "+d);var f=W.UNKNOWN,h=!1,p=this.getInternalLoader(e);switch(e.type){case zr:f=i?W.MANIFEST_LOAD_TIMEOUT:W.MANIFEST_LOAD_ERROR,h=!0;break;case _r:f=i?W.LEVEL_LOAD_TIMEOUT:W.LEVEL_LOAD_ERROR,h=!1;break;case yi:f=i?W.AUDIO_TRACK_LOAD_TIMEOUT:W.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case zi:f=i?W.SUBTITLE_TRACK_LOAD_TIMEOUT:W.SUBTITLE_LOAD_ERROR,h=!1}p&&this.resetInternalLoader(e.type);var E={type:se.NETWORK_ERROR,details:f,fatal:h,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:o};if(a){var b=(t==null?void 0:t.url)||e.url;E.response=y({url:b,data:void 0},a)}this.hls.trigger(k.ERROR,E)},s.handlePlaylistLoaded=function(e,t,i,a,o,d){var c=this.hls,f=a.type,h=a.level,p=a.id,E=a.groupId,b=a.deliveryDirectives,A=cs(t,a),w=Fo(a),D=typeof a.level=="number"&&w===rt?h:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var S=e.playlistParsingError;if(S)c.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:a,level:D,parent:w,networkDetails:o,stats:i});else switch(e.live&&d&&(d.getCacheAge&&(e.ageHeader=d.getCacheAge()||0),d.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),f){case zr:case _r:c.trigger(k.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:o,deliveryDirectives:b});break;case yi:c.trigger(k.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:o,deliveryDirectives:b});break;case zi:c.trigger(k.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:o,deliveryDirectives:b})}}else{var L=new Error("No Segments found in Playlist");c.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:L,reason:L.message,response:t,context:a,level:D,parent:w,networkDetails:o,stats:i})}},u}();function Ta(u,s){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=u,s.dispatchEvent(e)}function Uo(u,s){var e=u.mode;if(e==="disabled"&&(u.mode="hidden"),u.cues&&!u.cues.getCueById(s.id))try{if(u.addCue(s),!u.cues.getCueById(s.id))throw new Error("addCue is failed for: "+s)}catch(i){U.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(s.startTime,s.endTime,s.text);t.id=s.id,u.addCue(t)}e==="disabled"&&(u.mode=e)}function Qr(u){var s=u.mode;if(s==="disabled"&&(u.mode="hidden"),u.cues)for(var e=u.cues.length;e--;)u.removeCue(u.cues[e]);s==="disabled"&&(u.mode=s)}function hs(u,s,e,t){var i=u.mode;if(i==="disabled"&&(u.mode="hidden"),u.cues&&u.cues.length>0)for(var a=function(d,c,f){var h=[],p=function(w,D){if(D<w[0].startTime)return 0;var S=w.length-1;if(D>w[S].endTime)return-1;for(var L=0,N=S;L<=N;){var P=Math.floor((N+L)/2);if(D<w[P].startTime)N=P-1;else{if(!(D>w[P].startTime&&L<S))return P;L=P+1}}return w[L].startTime-D<D-w[N].startTime?L:N}(d,c);if(p>-1)for(var E=p,b=d.length;E<b;E++){var A=d[E];if(A.startTime>=c&&A.endTime<=f)h.push(A);else if(A.startTime>f)return h}return h}(u.cues,s,e),o=0;o<a.length;o++)t&&!t(a[o])||u.removeCue(a[o]);i==="disabled"&&(u.mode=i)}var Aa="org.id3",Sa="com.apple.quicktime.HLS",Tr="https://aomedia.org/emsg/ID3";function ln(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var ka=function(){var u=ln();try{new u(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function ar(u,s){return u.getTime()/1e3-s}var ju=function(){function u(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var s=u.prototype;return s.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},s._registerListeners=function(){var e=this.hls;e.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Qr(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},s.onManifestLoading=function(){this.dateRangeCuesAppended={}},s.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},s.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 Ta(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,a=i.enableEmsgMetadataCues,o=i.enableID3MetadataCues;if(a||o){var d=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=ln(),f=0;f<d.length;f++){var h=d[f].type;if((h!==Tr||a)&&o){var p=ts(d[f].data);if(p){var E=d[f].pts,b=E+d[f].duration;b>ka&&(b=ka),b-E<=0&&(b=E+.25);for(var A=0;A<p.length;A++){var w=p[A];if(!Eo(w)){this.updateId3CueEnds(E);var D=new c(E,b,"");D.value=w,h&&(D.type=h),this.id3Track.addCue(D)}}}}}}}},s.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)==null?void 0:t.cues;if(i)for(var a=i.length;a--;){var o=i[a];o.startTime<e&&o.endTime===ka&&(o.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,o=t.type,d=this.id3Track,c=this.hls;if(c){var f=c.config,h=f.enableEmsgMetadataCues,p=f.enableID3MetadataCues;d&&(h||p)&&hs(d,i,a,o==="audio"?function(E){return E.type===Aa&&p}:o==="video"?function(E){return E.type===Tr&&h}:function(E){return E.type===Aa&&p||E.type===Tr&&h})}},s.onLevelUpdated=function(e,t){var i=this,a=t.details;if(this.media&&a.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var o=this.dateRangeCuesAppended,d=this.id3Track,c=a.dateRanges,f=Object.keys(c);if(d)for(var h=Object.keys(o).filter(function(L){return!f.includes(L)}),p=function(){var L=h[E];Object.keys(o[L].cues).forEach(function(N){d.removeCue(o[L].cues[N])}),delete o[L]},E=h.length;E--;)p();var b=a.fragments[a.fragments.length-1];if(f.length!==0&&re(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,w=ln(),D=function(){var L=f[S],N=c[L],P=o[L],V=(P==null?void 0:P.cues)||{},Y=(P==null?void 0:P.durationKnown)||!1,j=ar(N.startDate,A),ie=ka,Q=N.endDate;if(Q)ie=ar(Q,A),Y=!0;else if(N.endOnNext&&!Y){var X=f.reduce(function(Pe,Ke){var je=c[Ke];return je.class===N.class&&je.id!==Ke&&je.startDate>N.startDate&&Pe.push(je),Pe},[]).sort(function(Pe,Ke){return Pe.startDate.getTime()-Ke.startDate.getTime()})[0];X&&(ie=ar(X.startDate,A),Y=!0)}for(var ce,oe,Ae=Object.keys(N.attr),xe=0;xe<Ae.length;xe++){var Le=Ae[xe];if((oe=Le)!=="ID"&&oe!=="CLASS"&&oe!=="START-DATE"&&oe!=="DURATION"&&oe!=="END-DATE"&&oe!=="END-ON-NEXT"){var Me=V[Le];if(Me)Y&&!P.durationKnown&&(Me.endTime=ie);else{var Oe=N.attr[Le];Me=new w(j,ie,""),ri(Le)&&(ce=Oe,Oe=Uint8Array.from(ce.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Me.value={key:Le,data:Oe},Me.type=Sa,Me.id=L,i.id3Track.addCue(Me),V[Le]=Me}}}o[L]={cues:V,dateRange:N,durationKnown:Y}},S=0;S<f.length;S++)D()}}},u}(),zu=function(){function u(e){var t=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 t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var s=u.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(k.ERROR,this.onError,this)},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},s.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},s.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},s.onLevelUpdated=function(e,t){var i=t.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},s.onError=function(e,t){var i;t.details===W.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&U.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},s.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var i=this.computeLatency();if(i!==null){this._latency=i;var a=this.config,o=a.lowLatencyMode,d=a.maxLiveSyncPlaybackRate;if(o&&d!==1){var c=this.targetLatency;if(c!==null){var f=i-c,h=f<Math.min(this.maxLatency,c+t.targetduration);if(t.live&&h&&f>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,d)),E=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;e.playbackRate=Math.min(p,Math.max(1,E))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}}}}},s.estimateLiveEdge=function(){var e=this.levelDetails;return e===null?null:e.edge+e.age},s.computeLatency=function(){var e=this.estimateLiveEdge();return e===null?null:e-this.currentTime},M(u,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(e===null)return null;var t=e.holdBack,i=e.partHoldBack,a=e.targetduration,o=this.config,d=o.liveSyncDuration,c=o.liveSyncDurationCount,f=o.lowLatencyMode,h=this.hls.userConfig,p=f&&i||t;(h.liveSyncDuration||h.liveSyncDurationCount||p===0)&&(p=d!==void 0?d:c*a);var E=a;return p+Math.min(1*this.stallCount,E)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;var a=i.edge,o=e-t-this.edgeStalled,d=a-i.totalduration,c=a-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(d,o),c)}},{key:"drift",get:function(){var e=this.levelDetails;return e===null?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(e===null)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}}]),u}(),fs=["NONE","TYPE-0","TYPE-1",null],ms="",Qu="YES",Xu="v2",Bo=function(){function u(s,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=s,this.part=e,this.skip=t}return u.prototype.addDirectives=function(s){var e=new self.URL(s);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},u}(),wa=function(){function u(s){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=[s.url],this._attrs=[s.attrs],this.bitrate=s.bitrate,s.details&&(this.details=s.details),this.id=s.id||0,this.name=s.name,this.width=s.width||0,this.height=s.height||0,this.audioCodec=s.audioCodec,this.videoCodec=s.videoCodec,this.unknownCodecs=s.unknownCodecs,this.codecSet=[s.videoCodec,s.audioCodec].filter(function(e){return e}).join(",").replace(/\.[^.,]+/g,"")}return u.prototype.addFallback=function(s){this.url.push(s.url),this._attrs.push(s.attrs)},M(u,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"attrs",get:function(){return this._attrs[this._urlId]}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(s){var e=s%this.url.length;this._urlId!==e&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=e)}},{key:"audioGroupId",get:function(){var s;return(s=this.audioGroupIds)==null?void 0:s[this.urlId]}},{key:"textGroupId",get:function(){var s;return(s=this.textGroupIds)==null?void 0:s[this.urlId]}}]),u}();function ps(u,s){var e=s.startPTS;if(re(e)){var t,i=0;s.sn>u.sn?(i=e-u.start,t=u):(i=u.start-e,t=s),t.duration!==i&&(t.duration=i)}else s.sn>u.sn?u.cc===s.cc&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration:s.start=Math.max(u.start-s.duration,0)}function La(u,s,e,t,i,a){t-e<=0&&(U.warn("Fragment should have a positive duration",s),t=e+s.duration,a=i+s.duration);var o=e,d=t,c=s.startPTS,f=s.endPTS;if(re(c)){var h=Math.abs(c-e);re(s.deltaPTS)?s.deltaPTS=Math.max(h,s.deltaPTS):s.deltaPTS=h,o=Math.max(e,c),e=Math.min(e,c),i=Math.min(i,s.startDTS),d=Math.min(t,f),t=Math.max(t,f),a=Math.max(a,s.endDTS)}var p=e-s.start;s.start!==0&&(s.start=e),s.duration=t-s.start,s.startPTS=e,s.maxStartPTS=o,s.startDTS=i,s.endPTS=t,s.minEndPTS=d,s.endDTS=a;var E,b=s.sn;if(!u||b<u.startSN||b>u.endSN)return 0;var A=b-u.startSN,w=u.fragments;for(w[A]=s,E=A;E>0;E--)ps(w[E],w[E-1]);for(E=A;E<w.length-1;E++)ps(w[E],w[E+1]);return u.fragmentHint&&ps(w[w.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,p}function vs(u,s){for(var e=null,t=u.fragments,i=t.length-1;i>=0;i--){var a=t[i].initSegment;if(a){e=a;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var o,d,c,f,h,p=0;if(function(S,L,N){for(var P=L.skippedSegments,V=Math.max(S.startSN,L.startSN)-L.startSN,Y=(S.fragmentHint?1:0)+(P?L.endSN:Math.min(S.endSN,L.endSN))-L.startSN,j=L.startSN-S.startSN,ie=L.fragmentHint?L.fragments.concat(L.fragmentHint):L.fragments,Q=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=Y;X++){var ce=Q[j+X],oe=ie[X];P&&!oe&&X<P&&(oe=L.fragments[X]=ce),ce&&oe&&N(ce,oe)}}(u,s,function(S,L){S.relurl&&(p=S.cc-L.cc),re(S.startPTS)&&re(S.endPTS)&&(L.start=L.startPTS=S.startPTS,L.startDTS=S.startDTS,L.maxStartPTS=S.maxStartPTS,L.endPTS=S.endPTS,L.endDTS=S.endDTS,L.minEndPTS=S.minEndPTS,L.duration=S.endPTS-S.startPTS,L.duration&&(o=L),s.PTSKnown=s.alignedSliding=!0),L.elementaryStreams=S.elementaryStreams,L.loader=S.loader,L.stats=S.stats,L.urlId=S.urlId,S.initSegment&&(L.initSegment=S.initSegment,e=S.initSegment)}),e&&(s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments).forEach(function(S){var L;S.initSegment&&S.initSegment.relurl!==((L=e)==null?void 0:L.relurl)||(S.initSegment=e)}),s.skippedSegments)if(s.deltaUpdateFailed=s.fragments.some(function(S){return!S}),s.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var E=s.skippedSegments;E--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}else s.canSkipDateRanges&&(s.dateRanges=(d=u.dateRanges,c=s.dateRanges,f=s.recentlyRemovedDateranges,h=H({},d),f&&f.forEach(function(S){delete h[S]}),Object.keys(c).forEach(function(S){var L=new $e(c[S].attr,h[S]);L.isValid?h[S]=L:U.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),h));var b=s.fragments;if(p){U.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<b.length;A++)b[A].cc+=p}s.skippedSegments&&(s.startCC=s.fragments[0].cc),function(S,L,N){if(S&&L)for(var P=0,V=0,Y=S.length;V<=Y;V++){var j=S[V],ie=L[V+P];j&&ie&&j.index===ie.index&&j.fragment.sn===ie.fragment.sn?N(j,ie):P--}}(u.partList,s.partList,function(S,L){L.elementaryStreams=S.elementaryStreams,L.stats=S.stats}),o?La(s,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):gs(u,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var w=s.advancedDateTime;if(s.advanced&&w){var D=s.edge;s.driftStart||(s.driftStartTime=w,s.driftStart=D),s.driftEndTime=w,s.driftEnd=D}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function gs(u,s){var e=s.startSN+s.skippedSegments-u.startSN,t=u.fragments;e<0||e>=t.length||Ia(s,t[e].start)}function Ia(u,s){if(s){for(var e=u.fragments,t=u.skippedSegments;t<e.length;t++)e[t].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function Ho(u,s,e){var t;return u!=null&&u.details?Go((t=u.details)==null?void 0:t.partList,s,e):null}function Go(u,s,e){if(u)for(var t=u.length;t--;){var i=u[t];if(i.index===e&&i.fragment.sn===s)return i}return null}function un(u){switch(u.details){case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_TIMEOUT:case W.LEVEL_LOAD_TIMEOUT:case W.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Vo(u,s){var e=un(s);return u.default[(e?"timeout":"error")+"Retry"]}function Es(u,s){var e=u.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*u.retryDelayMs,u.maxRetryDelayMs)}function Ko(u){return y(y({},u),{errorRetry:null,timeoutRetry:null})}function dn(u,s,e,t){return!!u&&s<u.maxNumRetry&&(function(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}(t)||!!e)}var Wo=function(u,s){for(var e=0,t=u.length-1,i=null,a=null;e<=t;){var o=s(a=u[i=(e+t)/2|0]);if(o>0)e=i+1;else{if(!(o<0))return a;t=i-1}}return null};function Ra(u,s,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(u?i=s[u.sn-s[0].sn+1]||null:e===0&&s[0].start===0&&(i=s[0]),i&&cn(e,t,i)===0)return i;var a=Wo(s,cn.bind(null,e,t));return!a||a===u&&i?i:a}function cn(u,s,e){if(u===void 0&&(u=0),s===void 0&&(s=0),e.start<=u&&e.start+e.duration>u)return 0;var t=Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=u?1:e.start-t>u&&e.start?-1:0}function bi(u,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>u}var Ar,Zu=3e5,qo=0,T=2,g=5,_=0,R=1,C=2,O=function(){function u(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.ERROR,this.onError,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.ERROR,this.onError,this),e.off(k.ERROR,this.onErrorOut,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this))},s.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},s.startLoad=function(e){this.playlistError=0},s.stopLoad=function(){},s.getVariantLevelIndex=function(e){return(e==null?void 0:e.type)===rt?e.level:this.hls.loadLevel},s.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},s.onError=function(e,t){var i;if(!t.fatal){var a=this.hls,o=t.context;switch(t.details){case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=T);case W.LEVEL_EMPTY_ERROR:case W.LEVEL_PARSING_ERROR:var d,c,f=t.parent===rt?t.level:a.loadLevel;return void(t.details===W.LEVEL_EMPTY_ERROR&&(d=t.context)!=null&&(c=d.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,f):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,f)));case W.LEVEL_LOAD_ERROR:case W.LEVEL_LOAD_TIMEOUT:return void(typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.SUBTITLE_LOAD_ERROR:case W.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){var h=a.levels[a.loadLevel];if(h&&(o.type===yi&&o.groupId===h.audioGroupId||o.type===zi&&o.groupId===h.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.loadLevel),t.errorAction.action=T,void(t.errorAction.flags=R)}return;case W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=a.levels[a.loadLevel],E=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(E&&(t.errorAction={action:T,flags:C,hdcpLevel:E}));case W.BUFFER_ADD_CODEC_ERROR:case W.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:a.loadLevel));case W.INTERNAL_EXCEPTION:case W.BUFFER_APPENDING_ERROR:case W.BUFFER_APPEND_ERROR:case W.BUFFER_FULL_ERROR:case W.LEVEL_SWITCH_ERROR:case W.BUFFER_STALLED_ERROR:case W.BUFFER_SEEK_OVER_HOLE:case W.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:qo,flags:_})}if(t.type===se.KEY_SYSTEM_ERROR){var b=this.getVariantLevelIndex(t.frag);return t.levelRetry=!1,void(t.errorAction=this.getLevelSwitchAction(t,b))}}},s.getPlaylistRetryOrSwitchAction=function(e,t){var i,a=Vo(this.hls.config.playlistLoadPolicy,e),o=this.playlistError++,d=(i=e.response)==null?void 0:i.code;if(dn(a,o,un(e),d))return{action:g,flags:_,retryConfig:a,retryCount:o};var c=this.getLevelSwitchAction(e,t);return a&&(c.retryConfig=a,c.retryCount=o),c},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),a=t.levels[i],o=t.config,d=o.fragLoadPolicy,c=o.keyLoadPolicy,f=Vo(e.details.startsWith("key")?c:d,e),h=t.levels.reduce(function(A,w){return A+w.fragmentError},0);if(a){var p;e.details!==W.FRAG_GAP&&a.fragmentError++;var E=(p=e.response)==null?void 0:p.code;if(dn(f,h,un(e),E))return{action:g,flags:_,retryConfig:f,retryCount:h}}var b=this.getLevelSwitchAction(e,i);return f&&(b.retryConfig=f,b.retryCount=h),b},s.getLevelSwitchAction=function(e,t){var i=this.hls;t==null&&(t=i.loadLevel);var a=this.hls.levels[t];if(a&&(a.loadError++,i.autoLevelEnabled)){for(var o,d,c=-1,f=i.levels,h=(o=e.frag)==null?void 0:o.type,p=(d=e.context)!=null?d:{},E=p.type,b=p.groupId,A=f.length;A--;){var w=(A+i.loadLevel)%f.length;if(w!==i.loadLevel&&f[w].loadError===0){var D=f[w];if(e.details===W.FRAG_GAP&&e.frag){var S=f[w].details;if(S){var L=Ra(e.frag,S.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else if(E===yi&&b===D.audioGroupId||E===zi&&b===D.textGroupId||h===Ri&&a.audioGroupId===D.audioGroupId||h===Oi&&a.textGroupId===D.textGroupId)continue;c=w;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,{action:T,flags:_,nextAutoLevel:c}}return{action:T,flags:R}},s.onErrorOut=function(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case qo:break;case T:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===W.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()},s.sendAlternateToPenaltyBox=function(e){var t=this.hls,i=e.errorAction;if(i){var a=i.flags,o=i.hdcpLevel,d=i.nextAutoLevel;switch(a){case _:this.switchLevel(e,d);break;case R:i.resolved||(i.resolved=this.redundantFailover(e));break;case C:o&&(t.maxHdcpLevel=fs[fs.indexOf(o)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,d)}},s.switchLevel=function(e,t){t!==void 0&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},s.redundantFailover=function(e){var t=this,i=this.hls,a=this.penalizedRenditions,o=e.parent===rt?e.level:i.loadLevel,d=i.levels[o],c=d.url.length,f=e.frag?e.frag.urlId:d.urlId;d.urlId!==f||e.frag&&!d.details||this.penalizeRendition(d,e);for(var h=function(){var b=(f+p)%c,A=a[b];if(!A||function(w,D,S){if(performance.now()-w.lastErrorPerfMs>Zu)return!0;var L=w.details;if(D.details===W.FRAG_GAP&&L&&D.frag){var N=D.frag.start,P=Ra(null,L.fragments,N);if(P&&!P.gap)return!0}if(S&&w.errors.length<S.errors.length){var V=w.errors[w.errors.length-1];if(L&&V.frag&&D.frag&&Math.abs(V.frag.start-D.frag.start)>3*L.targetduration)return!0}return!1}(A,e,a[f]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+d.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(w){w.urlId=b}),i.nextLoadLevel=o,{v:!0}},p=1;p<c;p++){var E=h();if(typeof E=="object")return E.v}return!1},s.penalizeRendition=function(e,t){var i=this.penalizedRenditions,a=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};a.lastErrorPerfMs=performance.now(),a.errors.push(t),a.details=e.details,i[e.urlId]=a},u}(),x=function(){function u(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=U.log.bind(U,t+":"),this.warn=U.warn.bind(U,t+":"),this.hls=e}var s=u.prototype;return s.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},s.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},s.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},s.stopLoad=function(){this.canLoad=!1,this.clearTimer()},s.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i){for(var a=-1,o=0;o<i.length;o++){var d=i[o],c=void 0;try{c=new self.URL(d.URI,t.url).href}catch(b){U.warn("Could not construct new URL for Rendition Report: "+b),c=d.URI||""}if(c===e){a=o;break}c===e.substring(0,c.length)&&(a=o)}if(a!==-1){var f=i[a],h=parseInt(f["LAST-MSN"])||(t==null?void 0:t.lastPartSn),p=parseInt(f["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var E=Math.min(t.age-t.partTarget,t.targetduration);p>=0&&E>t.partTarget&&(p+=1)}return new Bo(h,p>=0?p:void 0,ms)}}},s.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},s.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},s.shouldReloadPlaylist=function(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)},s.playlistLoaded=function(e,t,i){var a=this,o=t.details,d=t.stats,c=self.performance.now(),f=d.loading.first?Math.max(0,c-d.loading.first):0;if(o.advancedDateTime=Date.now()-f,o.live||i!=null&&i.live){if(o.reloaded(i),i&&this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),i&&o.fragments.length>0&&vs(i,o),!this.canLoad||!o.live)return;var h,p=void 0,E=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var b=this.hls.config.lowLatencyMode,A=o.lastPartSn,w=o.endSN,D=o.lastPartIndex,S=A===w;D!==-1?(p=S?w+1:A,E=S?b?0:D:D+1):p=w+1;var L=o.age,N=L+o.ageHeader,P=Math.min(N-o.partTarget,1.5*o.targetduration);if(P>0){if(i&&P>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+P+" with playlist age: "+o.age),P=0;else{var V=Math.floor(P/o.targetduration);p+=V,E!==void 0&&(E+=Math.round(P%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+P+" skip sn "+V+" to part "+E)}o.tuneInGoal=P}if(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,E),b||!S)return void this.loadPlaylist(h)}else o.canBlockReload&&(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,E));var Y=this.hls.mainForwardBufferInfo,j=Y?Y.end-Y.len:0,ie=function(X,ce){ce===void 0&&(ce=1/0);var oe=1e3*X.targetduration;if(X.updated){var Ae=X.fragments;if(Ae.length&&4*oe>ce){var xe=1e3*Ae[Ae.length-1].duration;xe<oe&&(oe=xe)}}else oe/=2;return Math.round(oe)}(o,1e3*(o.edge-j));o.updated&&c>this.requestScheduled+ie&&(this.requestScheduled=d.loading.start),p!==void 0&&o.canBlockReload?this.requestScheduled=d.loading.first+ie-(1e3*o.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+ie<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=ie);var Q=this.requestScheduled-c;Q=Math.max(0,Q),this.log("reload live playlist "+e+" in "+Math.round(Q)+" ms"),this.timer=self.setTimeout(function(){return a.loadPlaylist(h)},Q)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,a){var o=function(d,c){var f=d.canSkipUntil,h=d.canSkipDateRanges,p=d.endSN;return f&&(c!==void 0?c-p:0)<f?h?Xu:Qu:ms}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,a=t.part,o=ms),new Bo(i,a,o)},s.checkRetry=function(e){var t=this,i=e.details,a=un(e),o=e.errorAction,d=o||{},c=d.action,f=d.retryCount,h=f===void 0?0:f,p=d.retryConfig,E=!!o&&!!p&&(c===g||!o.resolved&&c===T);if(E){var b;if(this.requestScheduled=-1,a&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist();else{var A=Es(p,h);this.timer=self.setTimeout(function(){return t.loadPlaylist()},A),this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" in '+A+"ms")}e.levelRetry=!0,o.resolved=!0}return E},u}(),G=function(u){function s(t,i){var a;return(a=u.call(this,t,"[level-controller]")||this)._levels=[],a._firstLevel=-1,a._startLevel=void 0,a.currentLevel=null,a.currentLevelIndex=-1,a.manualLevelIndex=-1,a.steering=void 0,a.onParsedComplete=void 0,a.steering=i,a._registerListeners(),a}z(s,u);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.FRAG_LOADED,this.onFragLoaded,this),t.on(k.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.FRAG_LOADED,this.onFragLoaded,this),t.off(k.ERROR,this.onError,this)},e.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),u.prototype.destroy.call(this)},e.startLoad=function(){this._levels.forEach(function(t){t.loadError=0,t.fragmentError=0}),u.prototype.startLoad.call(this)},e.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},e.onManifestLoading=function(t,i){this.resetLevels()},e.onManifestLoaded=function(t,i){var a,o=[],d={};i.levels.forEach(function(c){var f,h=c.attrs;((f=c.audioCodec)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(Ar||(Ar=/chrome|firefox/i.test(navigator.userAgent)),Ar&&(c.audioCodec=void 0));var p=h.AUDIO,E=h.CODECS,b=h["FRAME-RATE"],A=h["PATHWAY-ID"],w=h.RESOLUTION,D=h.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+w+"-"+b+"-"+E;(a=d[S])?a.addFallback(c):(a=new wa(c),d[S]=a,o.push(a)),$(a,"audio",p),$(a,"text",D)}),this.filterAndSortMediaOptions(o,i)},e.filterAndSortMediaOptions=function(t,i){var a=this,o=[],d=[],c=!1,f=!1,h=!1,p=t.filter(function(L){var N=L.audioCodec,P=L.videoCodec,V=L.width,Y=L.height,j=L.unknownCodecs;return c||(c=!(!V||!Y)),f||(f=!!P),h||(h=!!N),!(j!=null&&j.length)&&(!N||sn(N,"audio"))&&(!P||sn(P,"video"))});if((c||f)&&h&&(p=p.filter(function(L){var N=L.videoCodec,P=L.width,V=L.height;return!!N||!(!P||!V)})),p.length!==0){i.audioTracks&&K(o=i.audioTracks.filter(function(L){return!L.audioCodec||sn(L.audioCodec,"audio")})),i.subtitles&&K(d=i.subtitles);var E=p.slice(0);p.sort(function(L,N){return L.attrs["HDCP-LEVEL"]!==N.attrs["HDCP-LEVEL"]?(L.attrs["HDCP-LEVEL"]||"")>(N.attrs["HDCP-LEVEL"]||"")?1:-1:L.bitrate!==N.bitrate?L.bitrate-N.bitrate:L.attrs["FRAME-RATE"]!==N.attrs["FRAME-RATE"]?L.attrs.decimalFloatingPoint("FRAME-RATE")-N.attrs.decimalFloatingPoint("FRAME-RATE"):L.attrs.SCORE!==N.attrs.SCORE?L.attrs.decimalFloatingPoint("SCORE")-N.attrs.decimalFloatingPoint("SCORE"):c&&L.height!==N.height?L.height-N.height:0});var b=E[0];if(this.steering&&(p=this.steering.filterParsedLevels(p)).length!==E.length){for(var A=0;A<E.length;A++)if(E[A].pathwayId===p[0].pathwayId){b=E[A];break}}this._levels=p;for(var w=0;w<p.length;w++)if(p[w]===b){this._firstLevel=w,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=h&&!f,S={levels:p,audioTracks:o,subtitleTracks:d,sessionData:i.sessionData,sessionKeys:i.sessionKeys,firstLevel:this._firstLevel,stats:i.stats,audio:h,video:f,altAudio:!D&&o.some(function(L){return!!L.url})};this.hls.trigger(k.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(a.hls){var L=new Error("no level with compatible codecs found in manifest");a.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:i.url,error:L,reason:L.message})}})},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===_r&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var a=i.frag;if(a!==void 0&&a.type===rt){var o=this._levels[a.level];o!==void 0&&(o.loadError=0)}},e.onLevelLoaded=function(t,i){var a,o,d=i.level,c=i.details,f=this._levels[d];if(!f)return this.warn("Invalid level index "+d),void((o=i.deliveryDirectives)!=null&&o.skip&&(c.deltaUpdateFailed=!0));d===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0),this.playlistLoaded(d,i,f.details)):(a=i.deliveryDirectives)!=null&&a.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var a=this.currentLevel;if(a){var o=this.hls.audioTracks[i.id].groupId;if(a.audioGroupIds&&a.audioGroupId!==o){for(var d=-1,c=0;c<a.audioGroupIds.length;c++)if(a.audioGroupIds[c]===o){d=c;break}d!==-1&&d!==a.urlId&&(a.urlId=d,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){u.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){var o=a.urlId,d=a.uri;if(t)try{d=t.addDirectives(d)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}var c=a.attrs["PATHWAY-ID"];this.log("Loading level index "+i+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+" with"+(c?" Pathway "+c:"")+" URI "+(o+1)+"/"+a.url.length+" "+d),this.clearTimer(),this.hls.trigger(k.LEVEL_LOADING,{url:d,level:i,id:o,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var a=this,o=function(c,f){return f!==i},d=this._levels.filter(function(c,f){return f!==t||(c.url.length>1&&i!==void 0?(c.url=c.url.filter(o),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(o)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(o)),c.urlId=0,!0):(a.steering&&a.steering.removeLevel(c),!1))});this.hls.trigger(k.LEVELS_UPDATED,{levels:d})},e.onLevelsUpdated=function(t,i){var a=i.levels;a.forEach(function(o,d){var c=o.details;c!=null&&c.fragments&&c.fragments.forEach(function(f){f.level=d})}),this._levels=a},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var i=this._levels;if(i.length!==0){if(t<0||t>=i.length){var a=new Error("invalid level idx"),o=t<0;if(this.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.LEVEL_SWITCH_ERROR,level:t,fatal:o,error:a,reason:a.message}),o)return;t=Math.min(t,i.length-1)}var d=this.currentLevelIndex,c=this.currentLevel,f=c?c.attrs["PATHWAY-ID"]:void 0,h=i[t],p=h.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=h,d!==t||!h.details||!c||f!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+d+(f?" with Pathway "+f:""));var E=H({},h,{level:t,maxBitrate:h.maxBitrate,attrs:h.attrs,uri:h.uri,urlId:h.urlId});delete E._attrs,delete E._urlId,this.hls.trigger(k.LEVEL_SWITCHING,E);var b=h.details;if(!b||b.live){var A=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(A)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var t=this.hls.config.startLevel;return t!==void 0?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}}]),s}(x);function $(u,s,e){e&&(s==="audio"?(u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds[u.url.length-1]=e):s==="text"&&(u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds[u.url.length-1]=e))}function K(u){var s={};u.forEach(function(e){var t=e.groupId||"";e.id=s[t]=s[t]||0,s[t]++})}var Z="NOT_LOADED",Fe="APPENDING",Te="PARTIAL",Re="OK",we=function(){function u(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var s=u.prototype;return s._registerListeners=function(){var e=this.hls;e.on(k.BUFFER_APPENDED,this.onBufferAppended,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.BUFFER_APPENDED,this.onBufferAppended,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this)},s.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},s.getAppendedFrag=function(e,t){var i=this.activePartLists[t];if(i)for(var a=i.length;a--;){var o=i[a];if(!o)break;var d=o.end;if(o.start<=e&&d!==null&&e<=d)return o}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,a=Object.keys(i),o=a.length;o--;){var d=i[a[o]];if((d==null?void 0:d.body.type)===t&&d.buffered){var c=d.body;if(c.start<=e&&e<=c.end)return c}}return null},s.detectEvictedFragments=function(e,t,i,a){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var d=(a==null?void 0:a.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(c){var f=o.fragments[c];if(f&&!(d>=f.body.sn))if(f.buffered||f.loaded){var h=f.range[e];h&&h.time.some(function(p){var E=!o.isTimeBuffered(p.startPTS,p.endPTS,t);return E&&o.removeFragment(f.body),E})}else f.body.type===i&&o.removeFragment(f.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,a=e.frag,o=e.part;if(i&&a.sn!=="initSegment"){var d=We(a),c=this.fragments[d];if(c){var f=!a.relurl;Object.keys(i).forEach(function(h){var p=a.elementaryStreams[h];if(p){var E=i[h],b=f||p.partial===!0;c.range[h]=t.getBufferedTimes(a,o,b,E)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c),Ce(c)||this.removeParts(a.sn-1,a.type)):this.removeFragment(c.body)}}},s.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(a){return a.fragment.sn>=e}))},s.fragBuffered=function(e,t){var i=We(e),a=this.fragments[i];!a&&t&&(a=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,a.buffered=!0)},s.getBufferedTimes=function(e,t,i,a){for(var o={time:[],partial:i},d=e.start,c=e.end,f=e.minEndPTS||c,h=e.maxStartPTS||d,p=0;p<a.length;p++){var E=a.start(p)-this.bufferPadding,b=a.end(p)+this.bufferPadding;if(h>=E&&f<=b){o.time.push({startPTS:Math.max(d,a.start(p)),endPTS:Math.min(c,a.end(p))});break}if(d<b&&c>E)o.partial=!0,o.time.push({startPTS:Math.max(d,a.start(p)),endPTS:Math.min(c,a.end(p))});else if(c<=E)break}return o},s.getPartialFragment=function(e){var t,i,a,o=null,d=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(h){var p=f[h];p&&Ce(p)&&(i=p.body.start-c,a=p.body.end+c,e>=i&&e<=a&&(t=Math.min(e-i,a-e),d<=t&&(o=p.body,d=t)))}),o},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||Ce(t))},s.getState=function(e){var t=We(e),i=this.fragments[t];return i?i.buffered?Ce(i)?Te:Re:Fe:Z},s.isTimeBuffered=function(e,t,i){for(var a,o,d=0;d<i.length;d++){if(a=i.start(d)-this.bufferPadding,o=i.end(d)+this.bufferPadding,e>=a&&t<=o)return!0;if(t<=a)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest){var o=a?null:t,d=We(i);this.fragments[d]={body:i,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,a=t.frag,o=t.part,d=t.timeRanges;if(a.sn!=="initSegment"){var c=a.type;if(o){var f=this.activePartLists[c];f||(this.activePartLists[c]=f=[]),f.push(o)}this.timeRanges=d,Object.keys(d).forEach(function(h){var p=d[h];i.detectEvictedFragments(h,p,c,o)})}},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=We(e);return!!this.fragments[t]},s.hasParts=function(e){var t;return!((t=this.activePartLists[e])==null||!t.length)},s.removeFragmentsInRange=function(e,t,i,a,o){var d=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=d.fragments[c];if(f){var h=f.body;h.type!==i||a&&!h.gap||h.start<t&&h.end>e&&(f.buffered||o)&&d.removeFragment(h)}})},s.removeFragment=function(e){var t=We(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var a=e.sn;this.activePartLists[e.type]=i.filter(function(o){return o.fragment.sn!==a})}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},s.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},u}();function Ce(u){var s,e,t;return u.buffered&&(u.body.gap||((s=u.range.video)==null?void 0:s.partial)||((e=u.range.audio)==null?void 0:e.partial)||((t=u.range.audiovideo)==null?void 0:t.partial))}function We(u){return u.type+"_"+u.level+"_"+u.urlId+"_"+u.sn}var Pt=Math.pow(2,17),Vt=function(){function u(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var s=u.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(e,t){var i=this,a=e.url;if(!a)return Promise.reject(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(a?"part list":"url")),networkDetails:null}));this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,h){if(i.loader&&i.loader.destroy(),e.gap)h(hi(e));else{var p=i.loader=e.loader=d?new d(o):new c(o),E=Zt(e),b=Ko(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Pt};e.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){i.resetLoader(e,p);var N=w.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(N.slice(0,16)),N=N.slice(16)),f({frag:e,part:null,payload:N,networkDetails:L})},onError:function(w,D,S,L){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:a,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))},onProgress:function(w,D,S,L){t&&t({frag:e,part:null,payload:S,networkDetails:L})}})}})},s.loadPart=function(e,t,i){var a=this;this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,h){if(a.loader&&a.loader.destroy(),e.gap||t.gap)h(hi(e,t));else{var p=a.loader=e.loader=d?new d(o):new c(o),E=Zt(e,t),b=Ko(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pt};t.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){a.resetLoader(e,p),a.updateStatsFromPart(e,t);var N={frag:e,part:t,payload:w.data,networkDetails:L};i(N),f(N)},onError:function(w,D,S,L){a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:E.url,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){e.stats.aborted=t.stats.aborted,a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,a=t.stats,o=a.total;if(i.loaded+=a.loaded,o){var d=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/o),d),f=(d-c)*Math.round(i.loaded/c);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);var h=i.loading,p=a.loading;h.start?h.first+=p.first-p.start:(h.start=p.start,h.first=p.first),h.end=p.end},s.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},u}();function Zt(u,s){s===void 0&&(s=null);var e=s||u,t={frag:u,part:s,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,a=e.byteRangeEndOffset;if(re(i)&&re(a)){var o,d=i,c=a;if(u.sn==="initSegment"&&((o=u.decryptdata)==null?void 0:o.method)==="AES-128"){var f=a-i;f%16&&(c=a+(16-f%16)),i!==0&&(t.resetIV=!0,d=i-16)}t.rangeStart=d,t.rangeEnd=c}return t}function hi(u,s){var e=new Error("GAP "+(u.gap?"tag":"attribute")+" found"),t={type:se.MEDIA_ERROR,details:W.FRAG_GAP,fatal:!1,frag:u,error:e,networkDetails:null};return s&&(t.part=s),(s||u).stats.aborted=!0,new Ve(t)}var Ve=function(u){function s(e){var t;return(t=u.call(this,e.error.message)||this).data=void 0,t.data=e,t}return z(s,u),s}(_e(Error)),At=function(){function u(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var s=u.prototype;return s.abort=function(e){for(var t in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.frag.type)return;i.abort()}}},s.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},s.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},s.createKeyLoadError=function(e,t,i,a,o){return t===void 0&&(t=W.KEY_LOAD_ERROR),new Ve({type:se.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:i,networkDetails:a})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var a=e.sn,o=e.cc,d=function(){var f=t[c];if(o<=f.cc&&(a==="initSegment"||f.sn==="initSegment"||a<f.sn))return i.emeController.selectKeySystemFormat(f).then(function(h){f.setKeyFormat(h)}),"break"},c=0;c<t.length&&d()!=="break";c++);},s.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)},s.loadInternal=function(e,t){var i,a;t&&e.setKeyFormat(t);var o=e.decryptdata;if(!o){var d=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,d))}var c=o.uri;if(!c)return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+c+'"')));var f,h=this.keyUriToKeyInfo[c];if((i=h)!=null&&i.decryptdata.key)return o.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((a=h)!=null&&a.keyLoadPromise)switch((f=h.mediaKeySessionContext)==null?void 0:f.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return h.keyLoadPromise.then(function(p){return o.key=p.keyInfo.decryptdata.key,{frag:e,keyInfo:h}})}switch(h=this.keyUriToKeyInfo[c]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(h,e):this.loadKeyEME(h,e);case"AES-128":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+o.method+'"')))}},s.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var a=this.emeController.loadKey(i);if(a)return(e.keyLoadPromise=a.then(function(o){return e.mediaKeySessionContext=o,i})).catch(function(o){throw e.keyLoadPromise=null,o})}return Promise.resolve(i)},s.loadKeyHTTP=function(e,t){var i=this,a=this.config,o=new a.loader(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise(function(d,c){var f={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},h=a.keyLoadPolicy.default,p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},E={onSuccess:function(b,A,w,D){var S=w.frag,L=w.keyInfo,N=w.url;if(!S.decryptdata||L!==i.keyUriToKeyInfo[N])return c(i.createKeyLoadError(S,W.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));L.decryptdata.key=S.decryptdata.key=new Uint8Array(b.data),S.keyLoader=null,L.loader=null,d({frag:S,keyInfo:L})},onError:function(b,A,w,D){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),w,y({url:f.url,data:void 0},b)))},onTimeout:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),w))},onAbort:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.INTERNAL_ABORTED,new Error("key loading aborted"),w))}};o.load(f,p,E)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,a=e.url,o=i.loader;t.keyLoader===o&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[a],o&&o.destroy()},u}(),tt=function(){function u(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var s=u.prototype;return s.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},s.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},s.onHandlerDestroyed=function(){},s.hasInterval=function(){return!!this._tickInterval},s.hasNextTick=function(){return!!this._tickTimer},s.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},s.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},s.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},s.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},s.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},s.doTick=function(){},u}(),ue={length:0,start:function(){return 0},end:function(){return 0}},he=function(){function u(){}return u.isBuffered=function(s,e){try{if(s){for(var t=u.getBuffered(s),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},u.bufferInfo=function(s,e,t){try{if(s){var i,a=u.getBuffered(s),o=[];for(i=0;i<a.length;i++)o.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(o,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},u.bufferedInfo=function(s,e,t){e=Math.max(0,e),s.sort(function(w,D){var S=w.start-D.start;return S||D.end-w.end});var i=[];if(t)for(var a=0;a<s.length;a++){var o=i.length;if(o){var d=i[o-1].end;s[a].start-d<t?s[a].end>d&&(i[o-1].end=s[a].end):i.push(s[a])}else i.push(s[a])}else i=s;for(var c,f=0,h=e,p=e,E=0;E<i.length;E++){var b=i[E].start,A=i[E].end;if(e+t>=b&&e<A)h=b,f=(p=A)-e;else if(e+t<b){c=b;break}}return{len:f,start:h||0,end:p||0,nextStart:c}},u.getBuffered=function(s){try{return s.buffered}catch(e){return U.log("failed to get media.buffered",e),ue}},u}(),fe=function(u,s,e,t,i,a){t===void 0&&(t=0),i===void 0&&(i=-1),a===void 0&&(a=!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=u,this.sn=s,this.id=e,this.size=t,this.part=i,this.partial=a};function Ue(u,s){for(var e=null,t=0,i=u.length;t<i;t++){var a=u[t];if(a&&a.cc===s){e=a;break}}return e}function qe(u,s){if(u){var e=u.start+s;u.start=u.startPTS=e,u.endPTS=e+u.duration}}function Et(u,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)qe(e[t],u);s.fragmentHint&&qe(s.fragmentHint,u),s.alignedSliding=!0}function ni(u,s,e){s&&(function(t,i,a){if(function(d,c,f){return!(!c.details||!(f.endCC>f.startCC||d&&d.cc<f.startCC))}(t,a,i)){var o=function(d,c,f){var h=d.fragments,p=c.fragments;if(p.length&&h.length){var E=Ue(h,p[0].cc);if(E&&(!E||E.startPTS))return E;U.log("No frag in previous level to align on")}else U.log("No fragments to align")}(a.details,i);o&&re(o.start)&&(U.log("Adjusting PTS using last level due to CC increase within current level "+i.url),Et(o.start,i))}}(u,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var a=i.fragments[0].programDateTime,o=t.fragments[0].programDateTime,d=(o-a)/1e3+i.fragments[0].start;d&&re(d)&&(U.log("Adjusting PTS using programDateTime delta "+(o-a)+"ms, sliding:"+d.toFixed(3)+" "+t.url+" "),Et(d,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||gs(s.details,e))}function Ot(u,s){if(u.hasProgramDateTime&&s.hasProgramDateTime){var e=u.fragments,t=s.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],a=Ue(e,i.cc)||e[Math.round(e.length/2)-1],o=i.programDateTime,d=a.programDateTime;o!==null&&d!==null&&Et((d-o)/1e3-(a.start-i.start),u)}}}var Jt=function(){function u(s,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=s,this.aesIV=e}return u.prototype.decrypt=function(s,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,s)},u}(),Nt=function(){function u(s,e){this.subtle=void 0,this.key=void 0,this.subtle=s,this.key=e}return u.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},u}(),Ft=function(){function u(){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 s=u.prototype;return s.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),a=0;a<4;a++)i[a]=t.getUint32(4*a);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,a=i[0],o=i[1],d=i[2],c=i[3],f=this.invSubMix,h=f[0],p=f[1],E=f[2],b=f[3],A=new Uint32Array(256),w=0,D=0,S=0;for(S=0;S<256;S++)A[S]=S<128?S<<1:S<<1^283;for(S=0;S<256;S++){var L=D^D<<1^D<<2^D<<3^D<<4;L=L>>>8^255&L^99,e[w]=L,t[L]=w;var N=A[w],P=A[N],V=A[P],Y=257*A[L]^16843008*L;a[w]=Y<<24|Y>>>8,o[w]=Y<<16|Y>>>16,d[w]=Y<<8|Y>>>24,c[w]=Y,Y=16843009*V^65537*P^257*N^16843008*w,h[L]=Y<<24|Y>>>8,p[L]=Y<<16|Y>>>16,E[L]=Y<<8|Y>>>24,b[L]=Y,w?(w=N^A[A[A[V^N]]],D^=A[A[D]]):w=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,a=0;a<t.length&&i;)i=t[a]===this.key[a],a++;if(!i){this.key=t;var o=this.keySize=t.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var d,c,f,h,p=this.ksRows=4*(o+6+1),E=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,w=this.rcon,D=this.invSubMix,S=D[0],L=D[1],N=D[2],P=D[3];for(d=0;d<p;d++)d<o?f=E[d]=t[d]:(h=f,d%o==0?(h=A[(h=h<<8|h>>>24)>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h],h^=w[d/o|0]<<24):o>6&&d%o==4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h]),E[d]=f=(E[d-o]^h)>>>0);for(c=0;c<p;c++)d=p-c,h=3&c?E[d]:E[d-4],b[c]=c<4||d<=4?h:S[A[h>>>24]]^L[A[h>>>16&255]]^N[A[h>>>8&255]]^P[A[255&h]],b[c]=b[c]>>>0}},s.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s.decrypt=function(e,t,i){for(var a,o,d,c,f,h,p,E,b,A,w,D,S,L,N=this.keySize+6,P=this.invKeySchedule,V=this.invSBox,Y=this.invSubMix,j=Y[0],ie=Y[1],Q=Y[2],X=Y[3],ce=this.uint8ArrayToUint32Array_(i),oe=ce[0],Ae=ce[1],xe=ce[2],Le=ce[3],Me=new Int32Array(e),Oe=new Int32Array(Me.length),Pe=this.networkToHostOrderSwap;t<Me.length;){for(b=Pe(Me[t]),A=Pe(Me[t+1]),w=Pe(Me[t+2]),D=Pe(Me[t+3]),f=b^P[0],h=D^P[1],p=w^P[2],E=A^P[3],S=4,L=1;L<N;L++)a=j[f>>>24]^ie[h>>16&255]^Q[p>>8&255]^X[255&E]^P[S],o=j[h>>>24]^ie[p>>16&255]^Q[E>>8&255]^X[255&f]^P[S+1],d=j[p>>>24]^ie[E>>16&255]^Q[f>>8&255]^X[255&h]^P[S+2],c=j[E>>>24]^ie[f>>16&255]^Q[h>>8&255]^X[255&p]^P[S+3],f=a,h=o,p=d,E=c,S+=4;a=V[f>>>24]<<24^V[h>>16&255]<<16^V[p>>8&255]<<8^V[255&E]^P[S],o=V[h>>>24]<<24^V[p>>16&255]<<16^V[E>>8&255]<<8^V[255&f]^P[S+1],d=V[p>>>24]<<24^V[E>>16&255]<<16^V[f>>8&255]<<8^V[255&h]^P[S+2],c=V[E>>>24]<<24^V[f>>16&255]<<16^V[h>>8&255]<<8^V[255&p]^P[S+3],Oe[t]=Pe(a^oe),Oe[t+1]=Pe(c^Ae),Oe[t+2]=Pe(d^xe),Oe[t+3]=Pe(o^Le),oe=b,Ae=A,xe=w,Le=D,t+=4}return Oe.buffer},u}(),Ni=function(){function u(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,a=i===void 0||i;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=e.enableSoftwareAES,this.removePKCS7Padding=a,a)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var s=u.prototype;return s.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},s.isSync=function(){return this.useSoftware},s.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var i,a,o,d=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(a=(i=d).byteLength,(o=a&&new DataView(i.buffer).getUint8(a-1))?xi(i,0,a-o):i):d},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(e,t,i){var a=this;return this.useSoftware?new Promise(function(o,d){a.softwareDecrypt(new Uint8Array(e),t,i);var c=a.flush();c?o(c.buffer):d(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)},s.softwareDecrypt=function(e,t,i){var a=this.currentIV,o=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(e=yr(d,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;a&&(i=a);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new Ft),f.expandKey(t);var h=o;return this.currentResult=f.decrypt(c.buffer,0,i),this.currentIV=xi(c,-16).buffer,h||null},s.webCryptoDecrypt=function(e,t,i){var a=this,o=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Nt(o,t)),this.fastAesKey.expandKey().then(function(d){return o?(a.logOnce("WebCrypto AES decrypt"),new Jt(o,new Uint8Array(i)).decrypt(e.buffer,d)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(d){return U.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+d.name+": "+d.message),a.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var a=this.flush();if(a)return a.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},s.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=xi(e,0,i),this.remainderData=xi(e,i)),t},s.logOnce=function(e){this.logEnabled&&(U.log("[decrypter]: "+e),this.logEnabled=!1)},u}(),Da=function(u){for(var s="",e=u.length,t=0;t<e;t++)s+="["+u.start(t).toFixed(3)+"-"+u.end(t).toFixed(3)+"]";return s},Ut="STOPPED",De="IDLE",Sr="KEY_LOADING",Xr="FRAG_LOADING",Zr="FRAG_LOADING_WAITING_RETRY",Ca="WAITING_TRACK",kr="PARSING",Yo="PARSED",ys="ENDED",hn="ERROR",bs="WAITING_INIT_PTS",fn="WAITING_LEVEL",Ju=function(u){function s(t,i,a,o,d){var c;return(c=u.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=Ut,c.playlistType=void 0,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.startTimeOffset=null,c.loadedmetadata=!1,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.playlistType=d,c.logPrefix=o,c.log=U.log.bind(U,o+":"),c.warn=U.warn.bind(U,o+":"),c.hls=t,c.fragmentLoader=new Vt(t.config),c.keyLoader=a,c.fragmentTracker=i,c.config=t.config,c.decrypter=new Ni(t.config),t.on(k.MANIFEST_LOADED,c.onManifestLoaded,function(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}(c)),c}z(s,u);var e=s.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(t){},e.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Ut},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var a=i.partList;if(a!=null&&a.length){var o=a[a.length-1];return he.isBuffered(this.media,o.start+o.duration/2)}var d=i.fragments[i.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)},e.getLevelDetails=function(){var t;if(this.levels&&this.levelLastLoaded!==null)return(t=this.levels[this.levelLastLoaded])==null?void 0:t.details},e.onMediaAttached=function(t,i){var a=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),a.addEventListener("seeking",this.onvseeking),a.addEventListener("ended",this.onvended);var o=this.config;this.levels&&o.autoStartLoad&&this.state===Ut&&this.startLoad(o.startPosition)},e.onMediaDetaching=function(){var t=this.media;t!=null&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.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()},e.onMediaSeeking=function(){var t=this.config,i=this.fragCurrent,a=this.media,o=this.mediaBuffer,d=this.state,c=a?a.currentTime:0,f=he.bufferInfo(o||a,c,t.maxBufferHole);if(this.log("media seeking to "+(re(c)?c.toFixed(3):c)+", state: "+d),this.state===ys)this.resetLoadingState();else if(i){var h=t.maxFragLookUpTolerance,p=i.start-h,E=i.start+i.duration+h;if(!f.len||E<f.start||p>f.end){var b=c>E;(c<p||b)&&(b&&i.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0),this.lastCurrentTime=c),this.loadedmetadata||f.len||(this.nextLoadPosition=this.startPosition=c),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onManifestLoaded=function(t,i){this.startTimeOffset=i.startTimeOffset,this.initPTS=[]},e.onHandlerDestroying=function(){this.stopLoad(),u.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=Ut,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,u.prototype.onHandlerDestroyed.call(this)},e.loadFragment=function(t,i,a){this._loadFragForPlayback(t,i,a)},e._loadFragForPlayback=function(t,i,a){var o=this;this._doFragLoad(t,i,a,function(d){if(o.fragContextChanged(t))return o.warn("Fragment "+t.sn+(d.part?" p: "+d.part.index:"")+" of level "+t.level+" was dropped during download."),void o.fragmentTracker.removeFragment(t);t.stats.chunkCount++,o._handleFragmentLoadProgress(d)}).then(function(d){if(d){var c=o.state;o.fragContextChanged(t)?(c===Xr||!o.fragCurrent&&c===kr)&&(o.fragmentTracker.removeFragment(t),o.state=De):("payload"in d&&(o.log("Loaded fragment "+t.sn+" of level "+t.level),o.hls.trigger(k.FRAG_LOADED,d)),o._handleFragmentLoadComplete(d))}}).catch(function(d){o.state!==Ut&&o.state!==hn&&(o.warn(d),o.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i,a=this.fragmentTracker;if(a.getState(t)===Fe){var o=t.type,d=this.getFwdBufferInfo(this.mediaBuffer,o),c=Math.max(t.duration,d?d.len:this.config.maxBufferLength);this.reduceMaxBufferLength(c)&&a.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0?a.removeAllFragments():a.hasParts(t.type)&&(a.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),a.getState(t)===Te&&a.removeFragment(t))},e.flushMainBuffer=function(t,i,a){if(a===void 0&&(a=null),t-i){var o={startOffset:t,endOffset:i,type:a};this.hls.trigger(k.BUFFER_FLUSHING,o)}},e._loadInitSegment=function(t,i){var a=this;this._doFragLoad(t,i).then(function(o){if(!o||a.fragContextChanged(t)||!a.levels)throw new Error("init load aborted");return o}).then(function(o){var d=a.hls,c=o.payload,f=t.decryptdata;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var h=self.performance.now();return a.decrypter.decrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).catch(function(p){throw d.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:t}),p}).then(function(p){var E=self.performance.now();return d.trigger(k.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:h,tdecrypt:E}}),o.payload=p,o})}return o}).then(function(o){var d=a.fragCurrent,c=a.hls;if(!a.levels)throw new Error("init load aborted, missing levels");var f=t.stats;a.state=De,i.fragmentError=0,t.data=new Uint8Array(o.payload),f.parsing.start=f.buffering.start=self.performance.now(),f.parsing.end=f.buffering.end=self.performance.now(),o.frag===d&&c.trigger(k.FRAG_BUFFERED,{stats:f,frag:d,part:null,id:t.type}),a.tick()}).catch(function(o){a.state!==Ut&&a.state!==hn&&(a.warn(o),a.resetFragmentLoading(t))})},e.fragContextChanged=function(t){var i=this.fragCurrent;return!t||!i||t.level!==i.level||t.sn!==i.sn||t.urlId!==i.urlId},e.fragBufferedComplete=function(t,i){var a,o,d,c,f=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.playlistType===rt?"level":"track")+" "+t.level+" (frag:["+((a=t.startPTS)!=null?a:NaN).toFixed(3)+"-"+((o=t.endPTS)!=null?o:NaN).toFixed(3)+"] > buffer:"+(f?Da(he.getBuffered(f)):"(detached)")+")"),this.state=De,f&&(!this.loadedmetadata&&t.type==rt&&f.buffered.length&&((d=this.fragCurrent)==null?void 0:d.sn)===((c=this.fragPrevious)==null?void 0:c.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},e.seekToStartPos=function(){},e._handleFragmentLoadComplete=function(t){var i=this.transmuxer;if(i){var a=t.frag,o=t.part,d=t.partsLoaded,c=!d||d.length===0||d.some(function(h){return!h}),f=new fe(a.level,a.sn,a.stats.chunkCount+1,0,o?o.index:-1,!c);i.flush(f)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,a,o){var d,c=this;a===void 0&&(a=null);var f=i==null?void 0:i.details;if(!this.levels||!f)throw new Error("frag load aborted, missing level"+(f?"":" detail")+"s");var h=null;if(!t.encrypted||(d=t.decryptdata)!=null&&d.key?!t.encrypted&&f.encryptedFragments.length&&this.keyLoader.loadClear(t,f.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+f.startSN+"-"+f.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level),this.state=Sr,this.fragCurrent=t,h=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(k.KEY_LOADED,S),c.state===Sr&&(c.state=De),S}),this.hls.trigger(k.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(t.start,a||0),this.config.lowLatencyMode&&t.sn!=="initSegment"){var p=f.partList;if(p&&o){a>t.end&&f.fragmentHint&&(t=f.fragmentHint);var E=this.getNextPart(p,t,a);if(E>-1){var b,A=p[E];return this.log("Loading part sn: "+t.sn+" p: "+A.index+" cc: "+t.cc+" of playlist ["+f.startSN+"-"+f.endSN+"] parts [0-"+E+"-"+(p.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(a.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Xr,b=h?h.then(function(S){return!S||c.fragContextChanged(S.frag)?null:c.doFragPartsLoad(t,A,i,o)}).catch(function(S){return c.handleFragLoadError(S)}):this.doFragPartsLoad(t,A,i,o).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(k.FRAG_LOADING,{frag:t,part:A,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,a))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(f?"of ["+f.startSN+"-"+f.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(a.toFixed(3))),re(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Xr;var w,D=this.config.progressive;return w=D&&h?h.then(function(S){return!S||c.fragContextChanged(S==null?void 0:S.frag)?null:c.fragmentLoader.load(t,o)}).catch(function(S){return c.handleFragLoadError(S)}):Promise.all([this.fragmentLoader.load(t,D?o:void 0),h]).then(function(S){var L=S[0];return!D&&L&&o&&o(L),L}).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(k.FRAG_LOADING,{frag:t,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):w},e.doFragPartsLoad=function(t,i,a,o){var d=this;return new Promise(function(c,f){var h,p=[],E=(h=a.details)==null?void 0:h.partList;(function b(A){d.fragmentLoader.loadPart(t,A,o).then(function(w){p[A.index]=w;var D=w.part;d.hls.trigger(k.FRAG_LOADED,w);var S=Ho(a,t.sn,A.index+1)||Go(E,t.sn,A.index+1);if(!S)return c({frag:t,part:D,partsLoaded:p});b(S)}).catch(f)})(i)})},e.handleFragLoadError=function(t){if("data"in t){var i=t.data;t.data&&i.details===W.INTERNAL_ABORTED?this.handleFragLoadAborted(i.frag,i.part):this.hls.trigger(k.ERROR,i)}else this.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},e._handleTransmuxerFlush=function(t){var i=this.getCurrentContext(t);if(i&&this.state===kr){var a=i.frag,o=i.part,d=i.level,c=self.performance.now();a.stats.parsing.end=c,o&&(o.stats.parsing.end=c),this.updateLevelTiming(a,o,d,t.partial)}else this.fragCurrent||this.state===Ut||this.state===hn||(this.state=De)},e.getCurrentContext=function(t){var i=this.levels,a=this.fragCurrent,o=t.level,d=t.sn,c=t.part;if(i==null||!i[o])return this.warn("Levels object was unset while buffering fragment "+d+" of level "+o+". The current chunk will not be buffered."),null;var f=i[o],h=c>-1?Ho(f,d,c):null,p=h?h.fragment:function(E,b,A){if(E==null||!E.details)return null;var w=E.details,D=w.fragments[b-w.startSN];return D||((D=w.fragmentHint)&&D.sn===b?D:b<w.startSN&&A&&A.sn===b?A:null)}(f,d,a);return p?(a&&a!==p&&(p.stats=a.stats),{frag:p,part:h,level:f}):null},e.bufferFragmentData=function(t,i,a,o){var d;if(t&&this.state===kr){var c=t.data1,f=t.data2,h=c;if(c&&f&&(h=yr(c,f)),(d=h)!=null&&d.length){var p={type:t.type,frag:i,part:a,chunkMeta:o,parent:i.type,data:h};this.hls.trigger(k.BUFFER_APPENDING,p),t.dropped&&t.independent&&!a&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(he.isBuffered(i,i.currentTime)){var a=i.currentTime,o=he.bufferInfo(i,a,0),d=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*d),f=Math.max(Math.min(t.start-c,o.end-c),a+c);t.start-f>c&&this.flushMainBuffer(f,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var a=this.getLoadPosition();return re(a)?this.getFwdBufferInfoAtPos(t,a,i):null},e.getFwdBufferInfoAtPos=function(t,i,a){var o=this.config.maxBufferHole,d=he.bufferInfo(t,i,o);if(d.len===0&&d.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,a);if(c&&d.nextStart<c.end)return he.bufferInfo(t,i,Math.max(d.nextStart,o))}return d},e.getMaxBufferLength=function(t){var i,a=this.config;return i=t?Math.max(8*a.maxBufferSize/t,a.maxBufferLength):a.maxBufferLength,Math.min(i,a.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,a=t||i.maxBufferLength;return i.maxMaxBufferLength>=a&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getAppendedFrag=function(t,i){var a=this.fragmentTracker.getAppendedFrag(t,rt);return a&&"fragment"in a?a.fragment:a},e.getNextFragment=function(t,i){var a=i.fragments,o=a.length;if(!o)return null;var d,c=this.config,f=a[0].start;if(i.live){var h=c.initialLiveManifestSize;if(o<h)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+h+")"),null;i.PTSKnown||this.startFragRequested||this.startPosition!==-1||(d=this.getInitialLiveFragment(i,a),this.startPosition=d?this.hls.liveSyncPosition||d.start:t)}else t<=f&&(d=a[0]);if(!d){var p=c.lowLatencyMode?i.partEnd:i.fragmentEnd;d=this.getFragmentAtPosition(t,p,i)}return this.mapToInitFragWhenRequired(d)},e.isLoopLoading=function(t,i){var a=this.fragmentTracker.getState(t);return(a===Re||a===Te&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,a,o,d){var c=t.gap,f=this.getNextFragment(this.nextLoadPosition,i);if(f===null)return f;if(t=f,c&&t&&!t.gap&&a.nextStart){var h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,o);if(h!==null&&a.len+h.len>=d)return this.log('buffer full after gaps in "'+o+'" playlist starting at sn: '+t.sn),null}return t},e.mapToInitFragWhenRequired=function(t){return t==null||!t.initSegment||t!=null&&t.initSegment.data||this.bitrateTest?t:t.initSegment},e.getNextPart=function(t,i,a){for(var o=-1,d=!1,c=!0,f=0,h=t.length;f<h;f++){var p=t[f];if(c=c&&!p.independent,o>-1&&a<p.start)break;var E=p.loaded;E?o=-1:(d||p.independent||c)&&p.fragment===i&&(o=f),d=E}return o},e.loadedEndOfParts=function(t,i){var a=t[t.length-1];return a&&i>a.start&&a.loaded},e.getInitialLiveFragment=function(t,i){var a=this.fragPrevious,o=null;if(a){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),o=function(h,p,E){if(p===null||!Array.isArray(h)||!h.length||!re(p)||p<(h[0].programDateTime||0)||p>=(h[h.length-1].endProgramDateTime||0))return null;E=E||0;for(var b=0;b<h.length;++b){var A=h[b];if(bi(p,E,A))return A}return null}(i,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){var d=a.sn+1;if(d>=t.startSN&&d<=t.endSN){var c=i[d-t.startSN];a.cc===c.cc&&(o=c,this.log("Live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=function(h,p){return Wo(h,function(E){return E.cc<p?1:E.cc>p?-1:0})}(i,a.cc),o&&this.log("Live playlist, switching playlist, load frag with same CC: "+o.sn))}}else{var f=this.hls.liveSyncPosition;f!==null&&(o=this.getFragmentAtPosition(f,this.bitrateTest?t.fragmentEnd:t.edge,t))}return o},e.getFragmentAtPosition=function(t,i,a){var o,d=this.config,c=this.fragPrevious,f=a.fragments,h=a.endSN,p=a.fragmentHint,E=d.maxFragLookUpTolerance,b=a.partList,A=!!(d.lowLatencyMode&&b!=null&&b.length&&p);if(A&&p&&!this.bitrateTest&&(f=f.concat(p),h=p.sn),o=t<i?Ra(c,f,t,t>i-E?0:E):f[f.length-1]){var w=o.sn-a.startSN,D=this.fragmentTracker.getState(o);if((D===Re||D===Te&&o.gap)&&(c=o),c&&o.sn===c.sn&&(!A||b[0].fragment.sn>o.sn)&&c&&o.level===c.level){var S=f[w+1];o=o.sn<h&&this.fragmentTracker.getState(S)!==Re?S:null}}return o},e.synchronizeToLiveEdge=function(t){var i=this.config,a=this.media;if(a){var o=this.hls.liveSyncPosition,d=a.currentTime,c=t.fragments[0].start,f=t.edge,h=d>=c-i.maxFragLookUpTolerance&&d<=f;if(o!==null&&a.duration>o&&(d<o||!h)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!h&&a.readyState<4||d<f-p)&&(this.loadedmetadata||(this.nextLoadPosition=o),a.readyState&&(this.warn("Playback: "+d.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+o.toFixed(3)),a.currentTime=o))}}},e.alignPlaylists=function(t,i){var a=this.levels,o=this.levelLastLoaded,d=this.fragPrevious,c=o!==null?a[o]:null,f=t.fragments.length;if(!f)return this.warn("No fragments in live playlist"),0;var h=t.fragments[0].start,p=!i,E=t.alignedSliding&&re(h);if(p||!E&&!h){ni(d,c,t);var b=t.fragments[0].start;return this.log("Live playlist sliding: "+b.toFixed(2)+" start-sn: "+(i?i.startSN:"na")+"->"+t.startSN+" prev-sn: "+(d?d.sn:"na")+" fragments: "+f),b}return h},e.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},e.setStartPosition=function(t,i){var a=this.startPosition;if(a<i&&(a=-1),a===-1||this.lastCurrentTime===-1){var o=this.startTimeOffset!==null,d=o?this.startTimeOffset:t.startTimeOffset;d!==null&&re(d)?(a=i+d,d<0&&(a+=t.totalduration),a=Math.min(Math.max(i,a),i+t.totalduration),this.log("Start time offset "+d+" found in "+(o?"multivariant":"media")+" playlist, adjust startPosition to "+a),this.startPosition=a):t.live?a=this.hls.liveSyncPosition||i:this.startPosition=a=0,this.lastCurrentTime=a}this.nextLoadPosition=a},e.getLoadPosition=function(){var t=this.media,i=0;return this.loadedmetadata&&t?i=t.currentTime:this.nextLoadPosition&&(i=this.nextLoadPosition),i},e.handleFragLoadAborted=function(t,i){this.transmuxer&&t.sn!=="initSegment"&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(i?" part "+i.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},e.resetFragmentLoading=function(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Zr)||(this.state=De)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var a=this.getCurrentContext(i.chunkMeta);a&&(i.frag=a.frag)}var o=i.frag;if(o&&o.type===t&&this.levels)if(this.fragContextChanged(o)){var d;this.warn("Frag load error must match current frag to retry "+o.url+" > "+((d=this.fragCurrent)==null?void 0:d.url))}else{var c=i.details===W.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(o,!0);var f=i.errorAction,h=f||{},p=h.action,E=h.retryCount,b=E===void 0?0:E,A=h.retryConfig;if(f&&p===g&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var w=Es(A,b);this.warn("Fragment "+o.sn+" of "+t+" "+o.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+w+"ms"),f.resolved=!0,this.retryDate=self.performance.now()+w,this.state=Zr}else A&&f?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(f.resolved=!0):U.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=hn;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===kr||this.state===Yo){var i=t.parent,a=this.getFwdBufferInfo(this.mediaBuffer,i),o=a&&a.len>.5;o&&this.reduceMaxBufferLength(a.len);var d=!o;return d&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+i+" buffer"),t.frag&&(this.fragmentTracker.removeFragment(t.frag),this.nextLoadPosition=t.frag.start),this.resetLoadingState(),d}return!1},e.resetFragmentErrors=function(t){t===Ri&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Ut&&(this.state=De)},e.afterBufferFlushed=function(t,i,a){if(t){var o=he.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,o,a),this.state===ys&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=De},e.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var i=this.levels?this.levels[t].details:null;i!=null&&i.live?(this.startPosition=-1,this.setStartPosition(i,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},e.resetWhenMissingContext=function(t){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(t.level),this.resetLoadingState()},e.removeUnbufferedFrags=function(t){t===void 0&&(t=0),this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)},e.updateLevelTiming=function(t,i,a,o){var d,c=this,f=a.details;if(f){if(Object.keys(t.elementaryStreams).reduce(function(p,E){var b=t.elementaryStreams[E];if(b){var A=b.endPTS-b.startPTS;if(A<=0)return c.warn("Could not parse fragment "+t.sn+" "+E+" duration reliably ("+A+")"),p||!1;var w=o?0:La(f,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(k.LEVEL_PTS_UPDATED,{details:f,level:a,drift:w,type:E,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))a.fragmentError=0;else if(((d=this.transmuxer)==null?void 0:d.error)===null){var h=new Error("Found no media in fragment "+t.sn+" of level "+a.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(h.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Yo,this.hls.trigger(k.FRAG_PARSED,{frag:t,part:i})}else this.warn("level.details undefined")},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},e.recoverWorkerError=function(t){t.event==="demuxerWorker"&&(this.resetTransmuxer(),this.resetLoadingState())},M(s,[{key:"state",get:function(){return this._state},set:function(t){var i=this._state;i!==t&&(this._state=t,this.log(i+"->"+t))}}]),s}(tt);function Dh(){return self.SourceBuffer||self.WebKitSourceBuffer}function nr(u,s){return u===void 0&&(u=""),s===void 0&&(s=9e4),{type:u,id:-1,pid:-1,inputTimeScale:s,sequenceNumber:-1,samples:[],dropped:0}}var Ch=function(){function u(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var s=u.prototype;return s.resetInitSegment=function(e,t,i,a){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},s.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},s.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},s.canParse=function(e,t){return!1},s.appendFrame=function(e,t,i){},s.demux=function(e,t){this.cachedData&&(e=yr(this.cachedData,e),this.cachedData=null);var i,a=ga(e,0),o=a?a.length:0,d=this._audioTrack,c=this._id3Track,f=a?function(b){for(var A=ts(b),w=0;w<A.length;w++){var D=A[w];if(Eo(D))return _o(D)}}(a):void 0,h=e.length;for((this.basePTS===null||this.frameIndex===0&&re(f))&&(this.basePTS=Fv(f,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),a&&a.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY});o<h;){if(this.canParse(e,o)){var p=this.appendFrame(d,e,o);p?(this.frameIndex++,this.lastPTS=p.sample.pts,i=o+=p.length):o=h}else go(e,o)?(a=ga(e,o),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY}),i=o+=a.length):o++;if(o===h&&i!==h){var E=xi(e,i);this.cachedData?this.cachedData=yr(this.cachedData,E):this.cachedData=E}}return{audioTrack:d,videoTrack:nr(),id3Track:c,textTrack:nr()}},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},s.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:nr(),id3Track:this._id3Track,textTrack:nr()}},s.destroy=function(){},u}(),Fv=function(u,s,e){return re(u)?90*u:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function Mh(u,s){return u[s]===255&&(246&u[s+1])==240}function xh(u,s){return 1&u[s+1]?7:9}function ed(u,s){return(3&u[s+3])<<11|u[s+4]<<3|(224&u[s+5])>>>5}function $o(u,s){return s+1<u.length&&Mh(u,s)}function Uv(u,s){if($o(u,s)){var e=xh(u,s);if(s+e>=u.length)return!1;var t=ed(u,s);if(t<=e)return!1;var i=s+t;return i===u.length||$o(u,i)}return!1}function Ph(u,s,e,t,i){if(!u.samplerate){var a=function(o,d,c,f){var h,p,E,b,A=navigator.userAgent.toLowerCase(),w=f,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=1+((192&d[c+2])>>>6);var S=(60&d[c+2])>>>2;if(!(S>D.length-1))return E=(1&d[c+2])<<2,E|=(192&d[c+3])>>>6,U.log("manifest codec:"+f+", ADTS type:"+h+", samplingIndex:"+S),/firefox/i.test(A)?S>=6?(h=5,b=new Array(4),p=S-3):(h=2,b=new Array(2),p=S):A.indexOf("android")!==-1?(h=2,b=new Array(2),p=S):(h=5,b=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&S>=6?p=S-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(S>=6&&E===1||/vivaldi/i.test(A))||!f&&E===1)&&(h=2,b=new Array(2)),p=S)),b[0]=h<<3,b[0]|=(14&S)>>1,b[1]|=(1&S)<<7,b[1]|=E<<3,h===5&&(b[1]|=(14&p)>>1,b[2]=(1&p)<<7,b[2]|=8,b[3]=0),{config:b,samplerate:D[S],channelCount:E,codec:"mp4a.40."+h,manifestCodec:w};o.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!a)return;u.config=a.config,u.samplerate=a.samplerate,u.channelCount=a.channelCount,u.codec=a.codec,u.manifestCodec=a.manifestCodec,U.log("parsed codec:"+u.codec+", rate:"+a.samplerate+", channels:"+a.channelCount)}}function Oh(u){return 9216e4/u}function Nh(u,s,e,t,i){var a,o=t+i*Oh(u.samplerate),d=function(A,w){var D=xh(A,w);if(w+D<=A.length){var S=ed(A,w)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(d){var c=d.frameLength,f=d.headerLength,h=f+c,p=Math.max(0,e+h-s.length);p?(a=new Uint8Array(h-f)).set(s.subarray(e+f,s.length),0):a=s.subarray(e+f,e+h);var E={unit:a,pts:o};return p||u.samples.push(E),{sample:E,length:h,missing:p}}var b=s.length-e;return(a=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:a,pts:o},length:b,missing:-1}}var Bv=function(u){function s(t,i){var a;return(a=u.call(this)||this).observer=void 0,a.config=void 0,a.observer=t,a.config=i,a}z(s,u);var e=s.prototype;return e.resetInitSegment=function(t,i,a,o){u.prototype.resetInitSegment.call(this,t,i,a,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(Uv(t,i))return U.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,o){return function(d,c){return c+5<d.length}(a,o)&&Mh(a,o)&&ed(a,o)<=a.length-o}(t,i)},e.appendFrame=function(t,i,a){Ph(t,this.observer,i,a,t.manifestCodec);var o=Nh(t,i,a,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o},s}(Ch),Hv=/\/emsg[-/]ID3/i,Gv=function(){function u(e,t){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=t}var s=u.prototype;return s.resetTimeStamp=function(){},s.resetInitSegment=function(e,t,i,a){var o=this.videoTrack=nr("video",1),d=this.audioTrack=nr("audio",1),c=this.txtTrack=nr("text",1);if(this.id3Track=nr("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var f=as(e);if(f.video){var h=f.video,p=h.id,E=h.timescale,b=h.codec;o.id=p,o.timescale=c.timescale=E,o.codec=b}if(f.audio){var A=f.audio,w=A.id,D=A.timescale,S=A.codec;d.id=w,d.timescale=D,d.codec=S}c.id=To.text,o.sampleDuration=0,o.duration=d.duration=a}},s.resetContiguity=function(){this.remainderData=null},u.probe=function(e){return Je(e=e.length>16384?e.subarray(0,16384):e,["moof"]).length>0},s.demux=function(e,t){this.timeOffset=t;var i=e,a=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=yr(this.remainderData,e));var d=function(f){var h={valid:null,remainder:null},p=Je(f,["moof"]);if(!p)return h;if(p.length<2)return h.remainder=f,h;var E=p[p.length-1];return h.valid=xi(f,0,E.byteOffset-8),h.remainder=xi(f,E.byteOffset-8),h}(i);this.remainderData=d.remainder,a.samples=d.valid||new Uint8Array}else a.samples=i;var c=this.extractID3Track(a,t);return o.samples=ss(t,a),{videoTrack:a,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}},s.flush=function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var a=this.extractID3Track(t,this.timeOffset);return i.samples=ss(e,t),{videoTrack:t,audioTrack:nr(),id3Track:a,textTrack:nr()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var a=Je(e.samples,["emsg"]);a&&a.forEach(function(o){var d=function(p){var E=p[0],b="",A="",w=0,D=0,S=0,L=0,N=0,P=0;if(E===0){for(;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1,w=He(p,12),D=He(p,16),L=He(p,20),N=He(p,24),P=28}else if(E===1){w=He(p,P+=4);var V=He(p,P+=4),Y=He(p,P+=4);for(P+=4,S=Math.pow(2,32)*V+Y,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),L=He(p,P),N=He(p,P+=4),P+=4;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1}return{schemeIdUri:b,value:A,timeScale:w,presentationTime:S,presentationTimeDelta:D,eventDuration:L,id:N,payload:p.subarray(P,p.byteLength)}}(o);if(Hv.test(d.schemeIdUri)){var c=re(d.presentationTime)?d.presentationTime/d.timeScale:t+d.presentationTimeDelta/d.timeScale,f=d.eventDuration===4294967295?Number.POSITIVE_INFINITY:d.eventDuration/d.timeScale;f<=.001&&(f=Number.POSITIVE_INFINITY);var h=d.payload;i.samples.push({data:h,len:h.byteLength,dts:c,pts:c,type:Tr,duration:f})}})}return i},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},s.destroy=function(){},u}(),jo=null,Vv=[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],Kv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Wv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],qv=[0,1,1,4];function Fh(u,s,e,t,i){if(!(e+24>s.length)){var a=Uh(s,e);if(a&&e+a.frameLength<=s.length){var o=t+i*(9e4*a.samplesPerFrame/a.sampleRate),d={unit:s.subarray(e,e+a.frameLength),pts:o,dts:o};return u.config=[],u.channelCount=a.channelCount,u.samplerate=a.sampleRate,u.samples.push(d),{sample:d,length:a.frameLength,missing:0}}}}function Uh(u,s){var e=u[s+1]>>3&3,t=u[s+1]>>1&3,i=u[s+2]>>4&15,a=u[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&a!==3){var o=u[s+2]>>1&1,d=u[s+3]>>6,c=1e3*Vv[14*(e===3?3-t:t===3?3:4)+i-1],f=Kv[3*(e===3?0:e===2?1:2)+a],h=d===3?1:2,p=Wv[e][t],E=qv[t],b=8*p*E,A=Math.floor(p*c/f+o)*E;if(jo===null){var w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);jo=w?parseInt(w[1]):0}return!!jo&&jo<=87&&t===2&&c>=224e3&&d===0&&(u[s+3]=128|u[s+3]),{sampleRate:f,channelCount:h,frameLength:A,samplesPerFrame:b}}}function td(u,s){return u[s]===255&&(224&u[s+1])==224&&(6&u[s+1])!=0}function Bh(u,s){return s+1<u.length&&td(u,s)}function Yv(u,s){if(s+1<u.length&&td(u,s)){var e=Uh(u,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===u.length||Bh(u,i)}return!1}var Hh=function(){function u(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var s=u.prototype;return s.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,a=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");a.set(e.subarray(i,i+o)),this.word=new DataView(a.buffer).getUint32(0),this.bitsAvailable=8*o,this.bytesAvailable-=o},s.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},s.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&U.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i},s.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},s.skipUEG=function(){this.skipBits(1+this.skipLZ())},s.skipEG=function(){this.skipBits(1+this.skipLZ())},s.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},s.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},s.readBoolean=function(){return this.readBits(1)===1},s.readUByte=function(){return this.readBits(8)},s.readUShort=function(){return this.readBits(16)},s.readUInt=function(){return this.readBits(32)},s.skipScalingList=function(e){for(var t=8,i=8,a=0;a<e;a++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,a=0,o=0,d=0,c=0,f=this.readUByte.bind(this),h=this.readBits.bind(this),p=this.readUEG.bind(this),E=this.readBoolean.bind(this),b=this.skipBits.bind(this),A=this.skipEG.bind(this),w=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);f();var S=f();if(h(5),b(3),f(),w(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var L=p();if(L===3&&b(1),w(),w(),b(1),E())for(t=L!==3?8:12,i=0;i<t;i++)E()&&D(i<6?16:64)}w();var N=p();if(N===0)p();else if(N===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();w(),b(1);var P=p(),V=p(),Y=h(1);Y===0&&b(1),b(1),E()&&(a=p(),o=p(),d=p(),c=p());var j=[1,1];if(E()&&E())switch(f()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:j=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(P+1)-2*a-2*o),height:(2-Y)*(V+1)*16-(Y?2:4)*(d+c),pixelRatio:j}},s.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},u}(),$v=function(){function u(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Ni(t,{removePKCS7Padding:!1})}var s=u.prototype;return s.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},s.decryptAacSample=function(e,t,i){var a=this,o=e[t].unit;if(!(o.length<=16)){var d=o.subarray(16,o.length-o.length%16),c=d.buffer.slice(d.byteOffset,d.byteOffset+d.length);this.decryptBuffer(c).then(function(f){var h=new Uint8Array(f);o.set(h,16),a.decrypter.isSync()||a.decryptAacSamples(e,t+1,i)})}},s.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},s.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),a=0,o=32;o<e.length-16;o+=160,a+=16)i.set(e.subarray(o,o+16),a);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),a=0,o=32;o<e.length-16;o+=160,a+=16)e.set(i.subarray(a,a+16),o);return e},s.decryptAvcSample=function(e,t,i,a,o){var d=this,c=Lo(o.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(h){o.data=d.getAvcDecryptedUnit(c,h),d.decrypter.isSync()||d.decryptAvcSamples(e,t,i+1,a)})},s.decryptAvcSamples=function(e,t,i,a){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void a();for(var o=e[t].units;!(i>=o.length);i++){var d=o[i];if(!(d.data.length<=48||d.type!==1&&d.type!==5||(this.decryptAvcSample(e,t,i,a,d),this.decrypter.isSync())))return}}},u}(),Di=188,jv=function(){function u(e,t,i){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=e,this.config=t,this.typeSupported=i}u.probe=function(e){var t=u.syncOffset(e);return t>0&&U.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},u.syncOffset=function(e){for(var t=e.length,i=Math.min(940,e.length-Di)+1,a=0;a<i;){for(var o=!1,d=a;d<t&&e[d]===71;d+=Di)if(o||id(e,d)!==0||(o=!0),o&&d+Di>i)return a;a++}return-1},u.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:To[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}};var s=u.prototype;return s.resetInitSegment=function(e,t,i,a){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=u.createTrack("video"),this._audioTrack=u.createTrack("audio",a),this._id3Track=u.createTrack("id3"),this._txtTrack=u.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=a},s.resetTimeStamp=function(){},s.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},s.demux=function(e,t,i,a){var o;i===void 0&&(i=!1),a===void 0&&(a=!1),i||(this.sampleAes=null);var d=this._avcTrack,c=this._audioTrack,f=this._id3Track,h=this._txtTrack,p=d.pid,E=d.pesData,b=c.pid,A=f.pid,w=c.pesData,D=f.pesData,S=null,L=this.pmtParsed,N=this._pmtId,P=e.length;if(this.remainderData&&(P=(e=yr(this.remainderData,e)).length,this.remainderData=null),P<Di&&!a)return this.remainderData=e,{audioTrack:c,videoTrack:d,id3Track:f,textTrack:h};var V=Math.max(0,u.syncOffset(e));(P-=(P-V)%Di)<e.byteLength&&!a&&(this.remainderData=new Uint8Array(e.buffer,P,e.buffer.byteLength-P));for(var Y=0,j=V;j<P;j+=Di)if(e[j]===71){var ie=!!(64&e[j+1]),Q=id(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+Di)continue}else X=j+4;switch(Q){case p:ie&&(E&&(o=mn(E))&&this.parseAVCPES(d,h,o,!1),E={data:[],size:0}),E&&(E.data.push(e.subarray(X,j+Di)),E.size+=j+Di-X);break;case b:if(ie){if(w&&(o=mn(w)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,o);break;case"mp3":this.parseMPEGPES(c,o)}w={data:[],size:0}}w&&(w.data.push(e.subarray(X,j+Di)),w.size+=j+Di-X);break;case A:ie&&(D&&(o=mn(D))&&this.parseID3PES(f,o),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+Di)),D.size+=j+Di-X);break;case 0:ie&&(X+=e[X]+1),N=this._pmtId=zv(e,X);break;case N:ie&&(X+=e[X]+1);var ce=Qv(e,X,this.typeSupported,i);(p=ce.avc)>0&&(d.pid=p),(b=ce.audio)>0&&(c.pid=b,c.segmentCodec=ce.segmentCodec),(A=ce.id3)>0&&(f.pid=A),S===null||L||(U.warn("MPEG-TS PMT found at "+j+" after unknown PID '"+S+"'. Backtracking to sync byte @"+V+" to parse all TS packets."),S=null,j=V-188),L=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=Q}}else Y++;if(Y>0){var oe=new Error("Found "+Y+" TS packet/s that do not start with 0x47");this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:oe,reason:oe.message})}d.pesData=E,c.pesData=w,f.pesData=D;var Ae={audioTrack:c,videoTrack:d,id3Track:f,textTrack:h};return a&&this.extractRemainingSamples(Ae),Ae},s.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},s.extractRemainingSamples=function(e){var t,i=e.audioTrack,a=e.videoTrack,o=e.id3Track,d=e.textTrack,c=a.pesData,f=i.pesData,h=o.pesData;if(c&&(t=mn(c))?(this.parseAVCPES(a,d,t,!0),a.pesData=null):a.pesData=c,f&&(t=mn(f))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t)}i.pesData=null}else f!=null&&f.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=f;h&&(t=mn(h))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=h},s.demuxSampleAes=function(e,t,i){var a=this.demux(e,i,!0,!this.config.progressive),o=this.sampleAes=new $v(this.observer,this.config,t);return this.decrypt(a,o)},s.decrypt=function(e,t){return new Promise(function(i){var a=e.audioTrack,o=e.videoTrack;a.samples&&a.segmentCodec==="aac"?t.decryptAacSamples(a.samples,0,function(){o.samples?t.decryptAvcSamples(o.samples,0,0,function(){i(e)}):i(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,function(){i(e)})})},s.destroy=function(){this._duration=0},s.parseAVCPES=function(e,t,i,a){var o,d=this,c=this.parseAVCNALu(e,i.data),f=this.avcSample,h=!1;i.data=null,f&&c.length&&!e.audFound&&(rd(f,e),f=this.avcSample=zo(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:o=!0,f||(f=d.avcSample=zo(!0,i.pts,i.dts,"")),f.frame=!0;var E=p.data;if(h&&E.length>4){var b=new Hh(E).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(f.key=!0)}break;case 5:o=!0,f||(f=d.avcSample=zo(!0,i.pts,i.dts,"")),f.key=!0,f.frame=!0;break;case 6:o=!0,wo(p.data,1,i.pts,t.samples);break;case 7:if(o=!0,h=!0,!e.sps){var A=p.data,w=new Hh(A).readSPS();e.width=w.width,e.height=w.height,e.pixelRatio=w.pixelRatio,e.sps=[A],e.duration=d._duration;for(var D=A.subarray(1,4),S="avc1.",L=0;L<3;L++){var N=D[L].toString(16);N.length<2&&(N="0"+N),S+=N}e.codec=S}break;case 8:o=!0,e.pps||(e.pps=[p.data]);break;case 9:o=!1,e.audFound=!0,f&&rd(f,e),f=d.avcSample=zo(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,f&&(f.debug+="unknown NAL "+p.type+" ")}f&&o&&f.units.push(p)}),a&&f&&(rd(f,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,a=this.avcSample;if(a&&a.units.length!==0||(a=e[e.length-1]),(t=a)!=null&&t.units){var o=a.units;i=o[o.length-1]}return i},s.parseAVCNALu=function(e,t){var i,a,o=t.byteLength,d=e.naluState||0,c=d,f=[],h=0,p=-1,E=0;for(d===-1&&(p=0,E=31&t[0],d=0,h=1);h<o;)if(i=t[h++],d)if(d!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,h-d-1),type:E};f.push(b)}else{var A=this.getLastNalUnit(e.samples);if(A&&(c&&h<=4-c&&A.state&&(A.data=A.data.subarray(0,A.data.byteLength-c)),(a=h-d-1)>0)){var w=new Uint8Array(A.data.byteLength+a);w.set(A.data,0),w.set(t.subarray(0,a),A.data.byteLength),A.data=w,A.state=0}}h<o?(p=h,E=31&t[h],d=0):d=-1}else d=0;else d=3;else d=i?0:2;else d=i?0:1;if(p>=0&&d>=0){var D={data:t.subarray(p,o),type:E,state:d};f.push(D)}if(f.length===0){var S=this.getLastNalUnit(e.samples);if(S){var L=new Uint8Array(S.data.byteLength+t.byteLength);L.set(S.data,0),L.set(t,S.data.byteLength),S.data=L}}return e.naluState=d,f},s.parseAACPES=function(e,t){var i,a,o,d=0,c=this.aacOverFlow,f=t.data;if(c){this.aacOverFlow=null;var h=c.missing,p=c.sample.unit.byteLength;if(h===-1){var E=new Uint8Array(p+f.byteLength);E.set(c.sample.unit,0),E.set(f,p),f=E}else{var b=p-h;c.sample.unit.set(f.subarray(0,h),b),e.samples.push(c.sample),d=c.missing}}for(i=d,a=f.length;i<a-1&&!$o(f,i);i++);if(i!==d){var A,w=i<a-1;A=w?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(U.warn("parsing error: "+A),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,levelRetry:w,error:D,reason:A}),!w)return}if(Ph(e,this.observer,f,i,this.audioCodec),t.pts!==void 0)o=t.pts;else{if(!c)return void U.warn("[tsdemuxer]: AAC PES unknown PTS");var S=Oh(e.samplerate);o=c.sample.pts+S}for(var L,N=0;i<a;){if(i+=(L=Nh(e,f,i,o,N)).length,L.missing){this.aacOverFlow=L;break}for(N++;i<a-1&&!$o(f,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,a=i.length,o=0,d=0,c=t.pts;if(c!==void 0)for(;d<a;)if(Bh(i,d)){var f=Fh(e,i,d,c,o);if(!f)break;d+=f.length,o++}else d++;else U.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=H({},t,{type:this._avcTrack?Tr:Aa,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else U.warn("[tsdemuxer]: ID3 PES unknown PTS")},u}();function zo(u,s,e,t){return{key:u,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function id(u,s){return((31&u[s+1])<<8)+u[s+2]}function zv(u,s){return(31&u[s+10])<<8|u[s+11]}function Qv(u,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},a=s+3+((15&u[s+1])<<8|u[s+2])-4;for(s+=12+((15&u[s+10])<<8|u[s+11]);s<a;){var o=id(u,s);switch(u[s]){case 207:if(!t){U.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=o);break;case 21:i.id3===-1&&(i.id3=o);break;case 219:if(!t){U.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=o);break;case 3:case 4:e.mpeg!==!0&&e.mp3!==!0?U.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=o,i.segmentCodec="mp3");break;case 36:U.warn("Unsupported HEVC stream type found")}s+=5+((15&u[s+3])<<8|u[s+4])}return i}function mn(u){var s,e,t,i,a,o=0,d=u.data;if(!u||u.size===0)return null;for(;d[0].length<19&&d.length>1;){var c=new Uint8Array(d[0].length+d[1].length);c.set(d[0]),c.set(d[1],d[0].length),d[0]=c,d.splice(1,1)}if(((s=d[0])[0]<<16)+(s[1]<<8)+s[2]===1){if((e=(s[4]<<8)+s[5])&&e>u.size-6)return null;var f=s[7];192&f&&(i=536870912*(14&s[9])+4194304*(255&s[10])+16384*(254&s[11])+128*(255&s[12])+(254&s[13])/2,64&f?i-(a=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(U.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var h=(t=s[8])+9;if(u.size<=h)return null;u.size-=h;for(var p=new Uint8Array(u.size),E=0,b=d.length;E<b;E++){var A=(s=d[E]).byteLength;if(h){if(h>A){h-=A;continue}s=s.subarray(h),A-=h,h=0}p.set(s,o),o+=A}return e&&(e-=t+3),{data:p,pts:i,dts:a,len:e}}return null}function rd(u,s){if(u.units.length&&u.frame){if(u.pts===void 0){var e=s.samples,t=e.length;if(!t)return void s.dropped++;var i=e[t-1];u.pts=i.pts,u.dts=i.dts}s.samples.push(u)}u.debug.length&&U.log(u.pts+"/"+u.dts+":"+u.debug)}var Xv=function(u){function s(){return u.apply(this,arguments)||this}z(s,u);var e=s.prototype;return e.resetInitSegment=function(t,i,a,o){u.prototype.resetInitSegment.call(this,t,i,a,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(Yv(t,i))return U.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,o){return td(a,o)&&4<=a.length-o}(t,i)},e.appendFrame=function(t,i,a){if(this.basePTS!==null)return Fh(t,i,a,this.basePTS,this.frameIndex)},s}(Ch),Gh=function(){function u(){}return u.getSilentFrame=function(s,e){if(s==="mp4a.40.2"){if(e===1)return new Uint8Array([0,200,0,128,35,128]);if(e===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(e===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(e===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(e===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(e===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(e===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(e===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(e===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])}},u}(),Jr=Math.pow(2,32)-1,ei=function(){function u(){}return u.init=function(){var s;for(s in u.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:[]},u.types)u.types.hasOwnProperty(s)&&(u.types[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]);var e=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]),t=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]);u.HDLR_TYPES={video:e,audio:t};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);u.STTS=u.STSC=u.STCO=a,u.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),u.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),u.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),u.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);u.FTYP=u.box(u.types.ftyp,o,c,o,d),u.DINF=u.box(u.types.dinf,u.box(u.types.dref,i))},u.box=function(s){for(var e=8,t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];for(var o=i.length,d=o;o--;)e+=i[o].byteLength;var c=new Uint8Array(e);for(c[0]=e>>24&255,c[1]=e>>16&255,c[2]=e>>8&255,c[3]=255&e,c.set(s,4),o=0,e=8;o<d;o++)c.set(i[o],e),e+=i[o].byteLength;return c},u.hdlr=function(s){return u.box(u.types.hdlr,u.HDLR_TYPES[s])},u.mdat=function(s){return u.box(u.types.mdat,s)},u.mdhd=function(s,e){e*=s;var t=Math.floor(e/(Jr+1)),i=Math.floor(e%(Jr+1));return u.box(u.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},u.mdia=function(s){return u.box(u.types.mdia,u.mdhd(s.timescale,s.duration),u.hdlr(s.type),u.minf(s))},u.mfhd=function(s){return u.box(u.types.mfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s]))},u.minf=function(s){return s.type==="audio"?u.box(u.types.minf,u.box(u.types.smhd,u.SMHD),u.DINF,u.stbl(s)):u.box(u.types.minf,u.box(u.types.vmhd,u.VMHD),u.DINF,u.stbl(s))},u.moof=function(s,e,t){return u.box(u.types.moof,u.mfhd(s),u.traf(t,e))},u.moov=function(s){for(var e=s.length,t=[];e--;)t[e]=u.trak(s[e]);return u.box.apply(null,[u.types.moov,u.mvhd(s[0].timescale,s[0].duration)].concat(t).concat(u.mvex(s)))},u.mvex=function(s){for(var e=s.length,t=[];e--;)t[e]=u.trex(s[e]);return u.box.apply(null,[u.types.mvex].concat(t))},u.mvhd=function(s,e){e*=s;var t=Math.floor(e/(Jr+1)),i=Math.floor(e%(Jr+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,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 u.box(u.types.mvhd,a)},u.sdtp=function(s){var e,t,i=s.samples||[],a=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,a[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return u.box(u.types.sdtp,a)},u.stbl=function(s){return u.box(u.types.stbl,u.stsd(s),u.box(u.types.stts,u.STTS),u.box(u.types.stsc,u.STSC),u.box(u.types.stsz,u.STSZ),u.box(u.types.stco,u.STCO))},u.avc1=function(s){var e,t,i,a=[],o=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(t));for(e=0;e<s.pps.length;e++)i=(t=s.pps[e]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(t));var d=u.box(u.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|s.sps.length].concat(a).concat([s.pps.length]).concat(o))),c=s.width,f=s.height,h=s.pixelRatio[0],p=s.pixelRatio[1];return u.box(u.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,c>>8&255,255&c,f>>8&255,255&f,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]),d,u.box(u.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),u.box(u.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,p>>24,p>>16&255,p>>8&255,255&p])))},u.esds=function(s){var e=s.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(s.config).concat([6,1,2]))},u.mp4a=function(s){var e=s.samplerate;return u.box(u.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),u.box(u.types.esds,u.esds(s)))},u.mp3=function(s){var e=s.samplerate;return u.box(u.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},u.stsd=function(s){return s.type==="audio"?s.segmentCodec==="mp3"&&s.codec==="mp3"?u.box(u.types.stsd,u.STSD,u.mp3(s)):u.box(u.types.stsd,u.STSD,u.mp4a(s)):u.box(u.types.stsd,u.STSD,u.avc1(s))},u.tkhd=function(s){var e=s.id,t=s.duration*s.timescale,i=s.width,a=s.height,o=Math.floor(t/(Jr+1)),d=Math.floor(t%(Jr+1));return u.box(u.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,d>>24,d>>16&255,d>>8&255,255&d,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,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))},u.traf=function(s,e){var t=u.sdtp(s),i=s.id,a=Math.floor(e/(Jr+1)),o=Math.floor(e%(Jr+1));return u.box(u.types.traf,u.box(u.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),u.box(u.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),u.trun(s,t.length+16+20+8+16+8+8),t)},u.trak=function(s){return s.duration=s.duration||4294967295,u.box(u.types.trak,u.tkhd(s),u.mdia(s))},u.trex=function(s){var e=s.id;return u.box(u.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},u.trun=function(s,e){var t,i,a,o,d,c,f=s.samples||[],h=f.length,p=12+16*h,E=new Uint8Array(p);for(e+=8+p,E.set([s.type==="video"?1:0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,255&h,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),t=0;t<h;t++)a=(i=f[t]).duration,o=i.size,d=i.flags,c=i.cts,E.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,61440&d.degradPrio,15&d.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*t);return u.box(u.types.trun,E)},u.initSegment=function(s){u.types||u.init();var e=u.moov(s),t=new Uint8Array(u.FTYP.byteLength+e.byteLength);return t.set(u.FTYP),t.set(e,u.FTYP.byteLength),t},u}();function ad(u,s,e,t){e===void 0&&(e=1),t===void 0&&(t=!1);var i=u*s*e;return t?Math.round(i):i}function _s(u,s){return s===void 0&&(s=!1),ad(u,1e3,1/9e4,s)}ei.types=void 0,ei.HDLR_TYPES=void 0,ei.STTS=void 0,ei.STSC=void 0,ei.STCO=void 0,ei.STSZ=void 0,ei.VMHD=void 0,ei.SMHD=void 0,ei.STSD=void 0,ei.FTYP=void 0,ei.DINF=void 0;var Qo=null,nd=null,sd=function(){function u(e,t,i,a){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Qo===null){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qo=o?parseInt(o[1]):0}if(nd===null){var d=navigator.userAgent.match(/Safari\/(\d+)/i);nd=d?parseInt(d[1]):0}}var s=u.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(a,o){var d=o.pts-a;return d<-4294967296?(t=!0,Fi(a,o.pts)):d>0?a:o.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),i},s.remux=function(e,t,i,a,o,d,c,f){var h,p,E,b,A,w,D=o,S=o,L=e.pid>-1,N=t.pid>-1,P=t.samples.length,V=e.samples.length>0,Y=c&&P>0||P>1;if((!L||V)&&(!N||Y)||this.ISGenerated||c){this.ISGenerated||(E=this.generateIS(e,t,o,d));var j,ie=this.isVideoContiguous,Q=-1;if(Y&&(Q=function(xe){for(var Le=0;Le<xe.length;Le++)if(xe[Le].key)return Le;return-1}(t.samples),!ie&&this.config.forceKeyFrameOnDiscontinuity))if(w=!0,Q>0){U.warn("[mp4-remuxer]: Dropped "+Q+" out of "+P+" video samples due to a missing keyframe");var X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Q),t.dropped+=Q,j=S+=(t.samples[0].pts-X)/t.inputTimeScale}else Q===-1&&(U.warn("[mp4-remuxer]: No keyframe found out of "+P+" video samples"),w=!1);if(this.ISGenerated){if(V&&Y){var ce=this.getVideoStartPts(t.samples),oe=(Fi(e.samples[0].pts,ce)-ce)/t.inputTimeScale;D+=Math.max(0,oe),S+=Math.max(0,-oe)}if(V){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),E=this.generateIS(e,t,o,d)),p=this.remuxAudio(e,D,this.isAudioContiguous,d,N||Y||f===Ri?S:void 0),Y){var Ae=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),E=this.generateIS(e,t,o,d)),h=this.remuxVideo(t,S,ie,Ae)}}else Y&&(h=this.remuxVideo(t,S,ie,0));h&&(h.firstKeyFrame=Q,h.independent=Q!==-1,h.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Vh(i,o,this._initPTS,this._initDTS)),a.samples.length&&(b=Kh(a,o,this._initPTS))),{audio:p,video:h,initSegment:E,independent:w,text:b,id3:A}},s.generateIS=function(e,t,i,a){var o,d,c,f=e.samples,h=t.samples,p=this.typeSupported,E={},b=this._initPTS,A=!b||a,w="audio/mp4";if(A&&(o=d=1/0),e.config&&f.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(w="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),E.audio={id:"audio",container:w,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):ei.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:o=d=f[0].pts-Math.round(c*i))),t.sps&&t.pps&&h.length&&(t.timescale=t.inputTimeScale,E.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:ei.initSegment([t]),metadata:{width:t.width,height:t.height}},A))if(c=t.inputTimeScale,b&&c===b.timescale)A=!1;else{var D=this.getVideoStartPts(h),S=Math.round(c*i);d=Math.min(d,Fi(h[0].dts,D)-S),o=Math.min(o,D-S)}if(Object.keys(E).length)return this.ISGenerated=!0,A?(this._initPTS={baseTime:o,timescale:c},this._initDTS={baseTime:d,timescale:c}):o=c=void 0,{tracks:E,initPTS:o,timescale:c}},s.remuxVideo=function(e,t,i,a){var o,d,c=e.inputTimeScale,f=e.samples,h=[],p=f.length,E=this._initPTS,b=this.nextAvcDts,A=8,w=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,L=!1;i&&b!==null||(b=t*c-(f[0].pts-Fi(f[0].dts,f[0].pts)));for(var N=E.baseTime*c/E.timescale,P=0;P<p;P++){var V=f[P];V.pts=Fi(V.pts-N,b),V.dts=Fi(V.dts-N,b),V.dts<f[P>0?P-1:P].dts&&(L=!0)}L&&f.sort(function(rl,wf){var zg=rl.dts-wf.dts,Qg=rl.pts-wf.pts;return zg||Qg}),o=f[0].dts;var Y=(d=f[f.length-1].dts)-o,j=Y?Math.round(Y/(p-1)):w||e.inputTimeScale/30;if(i){var ie=o-b,Q=ie>j,X=ie<-1;if((Q||X)&&(Q?U.warn("AVC: "+_s(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):U.warn("AVC: "+_s(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),!X||b>f[0].pts)){o=b;var ce=f[0].pts-ie;f[0].dts=o,f[0].pts=ce,U.log("Video: First PTS/DTS adjusted: "+_s(ce,!0)+"/"+_s(o,!0)+", delta: "+_s(ie,!0)+" ms")}}o=Math.max(0,o);for(var oe=0,Ae=0,xe=0;xe<p;xe++){for(var Le=f[xe],Me=Le.units,Oe=Me.length,Pe=0,Ke=0;Ke<Oe;Ke++)Pe+=Me[Ke].data.length;Ae+=Pe,oe+=Oe,Le.length=Pe,Le.dts=Math.max(Le.dts,o),D=Math.min(Le.pts,D),S=Math.max(Le.pts,S)}d=f[p-1].dts;var je,et=Ae+4*oe+8;try{je=new Uint8Array(et)}catch(rl){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:rl,bytes:et,reason:"fail allocating video mdat "+et})}var lt=new DataView(je.buffer);lt.setUint32(0,et),je.set(ei.types.mdat,4);for(var _i=!1,Kt=Number.POSITIVE_INFINITY,Qi=Number.POSITIVE_INFINITY,Bi=Number.NEGATIVE_INFINITY,Hi=Number.NEGATIVE_INFINITY,Wt=0;Wt<p;Wt++){for(var ti=f[Wt],sr=ti.units,ea=0,Ci=0,Ts=sr.length;Ci<Ts;Ci++){var As=sr[Ci],il=As.data,gn=As.data.byteLength;lt.setUint32(A,gn),A+=4,je.set(il,A),A+=gn,ea+=4+gn}var Oa=void 0;if(Wt<p-1)w=f[Wt+1].dts-ti.dts,Oa=f[Wt+1].pts-ti.pts;else{var Ss=this.config,Ir=Wt>0?ti.dts-f[Wt-1].dts:j;if(Oa=Wt>0?ti.pts-f[Wt-1].pts:j,Ss.stretchShortVideoTrack&&this.nextAudioPts!==null){var Wg=Math.floor(Ss.maxBufferHole*c),wd=(a?D+a*c:this.nextAudioPts)-ti.pts;wd>Wg?((w=wd-Ir)<0?w=Ir:_i=!0,U.log("[mp4-remuxer]: It is approximately "+wd/90+" ms to the next segment; using duration "+w/90+" ms for the last video frame.")):w=Ir}else w=Ir}var qg=Math.round(ti.pts-ti.dts);Kt=Math.min(Kt,w),Bi=Math.max(Bi,w),Qi=Math.min(Qi,Oa),Hi=Math.max(Hi,Oa),h.push(new Wh(ti.key,w,ea,qg))}if(h.length){if(Qo){if(Qo<70){var Af=h[0].flags;Af.dependsOn=2,Af.isNonSync=0}}else if(nd&&Hi-Qi<Bi-Kt&&j/Bi<.025&&h[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Ld=o,Xi=0,Sf=h.length;Xi<Sf;Xi++){var kf=Ld+h[Xi].duration,Yg=Ld+h[Xi].cts;if(Xi<Sf-1){var $g=kf+h[Xi+1].cts;h[Xi].duration=$g-Yg}else h[Xi].duration=Xi?h[Xi-1].duration:j;h[Xi].cts=0,Ld=kf}}}w=_i||!w?j:w,this.nextAvcDts=b=d+w,this.videoSampleDuration=w,this.isVideoContiguous=!0;var jg={data1:ei.moof(e.sequenceNumber++,o,H({},e,{samples:h})),data2:je,startPTS:D/c,endPTS:(S+w)/c,startDTS:o/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,jg},s.remuxAudio=function(e,t,i,a,o){var d=e.inputTimeScale,c=d/(e.samplerate?e.samplerate:d),f=e.segmentCodec==="aac"?1024:1152,h=f*c,p=this._initPTS,E=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=o!==void 0,w=e.samples,D=E?0:8,S=this.nextAudioPts||-1,L=t*d,N=p.baseTime*d/p.timescale;if(this.isAudioContiguous=i=i||w.length&&S>0&&(a&&Math.abs(L-S)<9e3||Math.abs(Fi(w[0].pts-N,L)-S)<20*h),w.forEach(function(Ci){Ci.pts=Fi(Ci.pts-N,L)}),!i||S<0){if(w=w.filter(function(Ci){return Ci.pts>=0}),!w.length)return;S=o===0?0:a&&!A?Math.max(0,L):w[0].pts}if(e.segmentCodec==="aac")for(var P=this.config.maxAudioFramesDrift,V=0,Y=S;V<w.length;V++){var j=w[V],ie=j.pts,Q=ie-Y,X=Math.abs(1e3*Q/d);if(Q<=-P*h&&A)V===0&&(U.warn("Audio frame @ "+(ie/d).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/d)+" ms."),this.nextAudioPts=S=Y=ie);else if(Q>=P*h&&X<1e4&&A){var ce=Math.round(Q/h);(Y=ie-ce*h)<0&&(ce--,Y+=h),V===0&&(this.nextAudioPts=S=Y),U.warn("[mp4-remuxer]: Injecting "+ce+" audio frame @ "+(Y/d).toFixed(3)+"s due to "+Math.round(1e3*Q/d)+" ms gap.");for(var oe=0;oe<ce;oe++){var Ae=Math.max(Y,0),xe=Gh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);xe||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=j.unit.subarray()),w.splice(V,0,{unit:xe,pts:Ae}),Y+=h,V++}}j.pts=Y,Y+=h}for(var Le,Me=null,Oe=null,Pe=0,Ke=w.length;Ke--;)Pe+=w[Ke].unit.byteLength;for(var je=0,et=w.length;je<et;je++){var lt=w[je],_i=lt.unit,Kt=lt.pts;if(Oe!==null)b[je-1].duration=Math.round((Kt-Oe)/c);else{if(i&&e.segmentCodec==="aac"&&(Kt=S),Me=Kt,!(Pe>0))return;Pe+=D;try{Le=new Uint8Array(Pe)}catch(Ci){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:Ci,bytes:Pe,reason:"fail allocating audio mdat "+Pe})}E||(new DataView(Le.buffer).setUint32(0,Pe),Le.set(ei.types.mdat,4))}Le.set(_i,D);var Qi=_i.byteLength;D+=Qi,b.push(new Wh(!0,f,Qi,0)),Oe=Kt}var Bi=b.length;if(Bi){var Hi=b[b.length-1];this.nextAudioPts=S=Oe+c*Hi.duration;var Wt=E?new Uint8Array(0):ei.moof(e.sequenceNumber++,Me/c,H({},e,{samples:b}));e.samples=[];var ti=Me/d,sr=S/d,ea={data1:Wt,data2:Le,startPTS:ti,endPTS:sr,startDTS:ti,endDTS:sr,type:"audio",hasAudio:!0,hasVideo:!1,nb:Bi};return this.isAudioContiguous=!0,ea}},s.remuxEmptyAudio=function(e,t,i,a){var o=e.inputTimeScale,d=o/(e.samplerate?e.samplerate:o),c=this.nextAudioPts,f=this._initDTS,h=9e4*f.baseTime/f.timescale,p=(c!==null?c:a.startDTS*o)+h,E=a.endDTS*o+h,b=1024*d,A=Math.ceil((E-p)/b),w=Gh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),w){for(var D=[],S=0;S<A;S++){var L=p+S*b;D.push({unit:w,pts:L,dts:L})}return e.samples=D,this.remuxAudio(e,t,i,!1)}U.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},u}();function Fi(u,s){var e;if(s===null)return u;for(e=s<u?-8589934592:8589934592;Math.abs(u-s)>4294967296;)u+=e;return u}function Vh(u,s,e,t){var i=u.samples.length;if(i){for(var a=u.inputTimeScale,o=0;o<i;o++){var d=u.samples[o];d.pts=Fi(d.pts-9e4*e.baseTime/e.timescale,s*a)/a,d.dts=Fi(d.dts-9e4*t.baseTime/t.timescale,s*a)/a}var c=u.samples;return u.samples=[],{samples:c}}}function Kh(u,s,e){var t=u.samples.length;if(t){for(var i=u.inputTimeScale,a=0;a<t;a++){var o=u.samples[a];o.pts=Fi(o.pts-9e4*e.baseTime/e.timescale,s*i)/i}u.samples.sort(function(c,f){return c.pts-f.pts});var d=u.samples;return u.samples=[],{samples:d}}}var wr,Wh=function(u,s,e,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=e,this.cts=t,this.flags=new Zv(u)},Zv=function(u){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=u?2:1,this.isNonSync=u?0:1},Jv=function(){function u(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var s=u.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},s.resetNextTimestamp=function(){this.lastEndTime=null},s.resetInitSegment=function(e,t,i,a){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(o,d){if(!o||!d)return o;var c=d.keyId;return c&&d.isCommonEncryption&&Je(o,["moov","trak"]).forEach(function(f){var h=Je(f,["mdia","minf","stbl","stsd"])[0].subarray(8),p=Je(h,["enca"]),E=p.length>0;E||(p=Je(h,["encv"])),p.forEach(function(b){Je(E?b.subarray(28):b.subarray(78),["sinf"]).forEach(function(A){var w=ns(A);if(w){var D=w.subarray(8,24);D.some(function(S){return S!==0})||(U.log("[eme] Patching keyId in 'enc"+(E?"a":"v")+">sinf>>tenc' box: "+Pi(D)+" -> "+Pi(c)),w.set(c,8))}})})}),o}(e,a)),this.emitInitSegment=!0},s.generateInitSegment=function(e){var t=this.audioCodec,i=this.videoCodec;if(e==null||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var a=this.initData=as(e);t||(t=qh(a.audio,gt)),i||(i=qh(a.video,Ct));var o={};a.audio&&a.video?o.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:a.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:a.video?o.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},s.remux=function(e,t,i,a,o,d){var c,f,h=this.initPTS,p=this.lastEndTime,E={audio:void 0,video:void 0,text:a,id3:i,initSegment:void 0};re(p)||(p=this.lastEndTime=o||0);var b=t.samples;if(b==null||!b.length)return E;var A={initPTS:void 0,timescale:1},w=this.initData;if((c=w)!=null&&c.length||(this.generateInitSegment(b),w=this.initData),(f=w)==null||!f.length)return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(Q,X){for(var ce=0,oe=0,Ae=0,xe=Je(Q,["moof","traf"]),Le=0;Le<xe.length;Le++){var Me=xe[Le],Oe=Je(Me,["tfhd"])[0],Pe=X[He(Oe,4)];if(Pe){var Ke=Pe.default,je=He(Oe,0)|(Ke==null?void 0:Ke.flags),et=Ke==null?void 0:Ke.duration;8&je&&(et=He(Oe,2&je?12:8));for(var lt=Pe.timescale||9e4,_i=Je(Me,["trun"]),Kt=0;Kt<_i.length;Kt++)!(ce=Wu(_i[Kt]))&&et&&(ce=et*He(_i[Kt],4)),Pe.type===Ct?oe+=ce/lt:Pe.type===gt&&(Ae+=ce/lt)}}if(oe===0&&Ae===0){for(var Qi=0,Bi=Je(Q,["sidx"]),Hi=0;Hi<Bi.length;Hi++){var Wt=So(Bi[Hi]);Wt!=null&&Wt.references&&(Qi+=Wt.references.reduce(function(ti,sr){return ti+sr.info.duration||0},0))}return Qi}return oe||Ae}(b,w),S=function(Q,X){return Je(X,["moof","traf"]).reduce(function(ce,oe){var Ae=Je(oe,["tfdt"])[0],xe=Ae[0],Le=Je(oe,["tfhd"]).reduce(function(Me,Oe){var Pe=He(Oe,4),Ke=Q[Pe];if(Ke){var je=He(Ae,4);if(xe===1){if(je===Ea)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),Me;je*=Ea+1,je+=He(Ae,8)}var et=je/(Ke.timescale||9e4);if(isFinite(et)&&(Me===null||et<Me))return et}return Me},null);return Le!==null&&isFinite(Le)&&(ce===null||Le<ce)?Le:ce},null)}(w,b),L=S===null?o:S;(function(Q,X,ce,oe){if(Q===null)return!0;var Ae=Math.max(oe,1),xe=X-Q.baseTime/Q.timescale;return Math.abs(xe-ce)>Ae}(h,L,o,D)||A.timescale!==h.timescale&&d)&&(A.initPTS=L-o,h&&h.timescale===1&&U.warn("Adjusting initPTS by "+(A.initPTS-h.baseTime)),this.initPTS=h={baseTime:A.initPTS,timescale:1});var N=e?L-h.baseTime/h.timescale:p,P=N+D;(function(Q,X,ce){Je(X,["moof","traf"]).forEach(function(oe){Je(oe,["tfhd"]).forEach(function(Ae){var xe=He(Ae,4),Le=Q[xe];if(Le){var Me=Le.timescale||9e4;Je(oe,["tfdt"]).forEach(function(Oe){var Pe=Oe[0],Ke=He(Oe,4);if(Pe===0)Ke-=ce*Me,rs(Oe,4,Ke=Math.max(Ke,0));else{Ke*=Math.pow(2,32),Ke+=He(Oe,8),Ke-=ce*Me,Ke=Math.max(Ke,0);var je=Math.floor(Ke/(Ea+1)),et=Math.floor(Ke%(Ea+1));rs(Oe,4,je),rs(Oe,8,et)}})}})})})(w,b,h.baseTime/h.timescale),D>0?this.lastEndTime=P:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!w.audio,Y=!!w.video,j="";V&&(j+="audio"),Y&&(j+="video");var ie={data1:b,startPTS:N,startDTS:N,endPTS:P,endDTS:P,type:j,hasAudio:V,hasVideo:Y,nb:1,dropped:0};return E.audio=ie.type==="audio"?ie:void 0,E.video=ie.type!=="audio"?ie:void 0,E.initSegment=A,E.id3=Vh(i,o,h,h),a.samples.length&&(E.text=Kh(a,o,h)),E},u}();function qh(u,s){var e=u==null?void 0:u.codec;return e&&e.length>4?e:e==="hvc1"||e==="hev1"?"hvc1.1.6.L120.90":e==="av01"?"av01.0.04M.08":e==="avc1"||s===Ct?"avc1.42e01e":"mp4a.40.5"}try{wr=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),wr=typeof self!="undefined"&&self.Date.now}var od=[{demux:Gv,remux:Jv},{demux:jv,remux:sd},{demux:Bv,remux:sd},{demux:Xv,remux:sd}],ld=function(){function u(e,t,i,a,o){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=e,this.typeSupported=t,this.config=i,this.vendor=a,this.id=o}var s=u.prototype;return s.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},s.push=function(e,t,i,a){var o=this,d=i.transmuxing;d.executeStart=wr();var c=new Uint8Array(e),f=this.currentTransmuxState,h=this.transmuxConfig;a&&(this.currentTransmuxState=a);var p=a||f,E=p.contiguous,b=p.discontinuity,A=p.trackSwitch,w=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,L=h.audioCodec,N=h.videoCodec,P=h.defaultInitPts,V=h.duration,Y=h.initSegmentData,j=function(xe,Le){var Me=null;return xe.byteLength>0&&Le!=null&&Le.key!=null&&Le.iv!==null&&Le.method!=null&&(Me=Le),Me}(c,t);if(j&&j.method==="AES-128"){var ie=this.getDecrypter();if(!ie.isSync())return this.decryptionPromise=ie.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(xe){var Le=o.push(xe,null,i);return o.decryptionPromise=null,Le}),this.decryptionPromise;var Q=ie.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(Q=ie.flush()),!Q)return d.executeEnd=wr(),ud(i);c=new Uint8Array(Q)}var X=this.needsProbing(b,A);if(X){var ce=this.configureTransmuxer(c);if(ce)return U.warn("[transmuxer] "+ce.message),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:ce,reason:ce.message}),d.executeEnd=wr(),ud(i)}(b||A||S||X)&&this.resetInitSegment(Y,L,N,V,t),(b||S||X)&&this.resetInitialTimestamp(P),E||this.resetContiguity();var oe=this.transmux(c,j,D,w,i),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,d.executeEnd=wr(),oe},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=wr();var a=this.decrypter,o=this.currentTransmuxState,d=this.decryptionPromise;if(d)return d.then(function(){return t.flush(e)});var c=[],f=o.timeOffset;if(a){var h=a.flush();h&&c.push(this.push(h,null,e))}var p=this.demuxer,E=this.remuxer;if(!p||!E)return i.executeEnd=wr(),[ud(e)];var b=p.flush(f);return Ma(b)?b.then(function(A){return t.flushRemux(c,A,e),c}):(this.flushRemux(c,b,e),c)},s.flushRemux=function(e,t,i){var a=t.audioTrack,o=t.videoTrack,d=t.id3Track,c=t.textTrack,f=this.currentTransmuxState,h=f.accurateTimeOffset,p=f.timeOffset;U.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var E=this.remuxer.remux(a,o,d,c,p,h,!0,this.id);e.push({remuxResult:E,chunkMeta:i}),i.transmuxing.executeEnd=wr()},s.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},s.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},s.resetInitSegment=function(e,t,i,a,o){var d=this.demuxer,c=this.remuxer;d&&c&&(d.resetInitSegment(e,t,i,a),c.resetInitSegment(e,t,i,o))},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(e,t,i,a,o){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,a,o):this.transmuxUnencrypted(e,i,a,o)},s.transmuxUnencrypted=function(e,t,i,a){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),d=o.audioTrack,c=o.videoTrack,f=o.id3Track,h=o.textTrack;return{remuxResult:this.remuxer.remux(d,c,f,h,t,i,!1,this.id),chunkMeta:a}},s.transmuxSampleAes=function(e,t,i,a,o){var d=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(c){return{remuxResult:d.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,i,a,!1,d.id),chunkMeta:o}})},s.configureTransmuxer=function(e){for(var t,i=this.config,a=this.observer,o=this.typeSupported,d=this.vendor,c=0,f=od.length;c<f;c++)if(od[c].demux.probe(e)){t=od[c];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var h=this.demuxer,p=this.remuxer,E=t.remux,b=t.demux;p&&p instanceof E||(this.remuxer=new E(a,i,o,d)),h&&h instanceof b||(this.demuxer=new b(a,i,o),this.probe=b.probe)},s.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},s.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new Ni(this.config)),e},u}(),ud=function(u){return{remuxResult:{},chunkMeta:u}};function Ma(u){return"then"in u&&u.then instanceof Function}var eg=function(u,s,e,t,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=u,this.videoCodec=s,this.initSegmentData=e,this.duration=t,this.defaultInitPts=i||null},tg=function(u,s,e,t,i,a){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=u,this.contiguous=s,this.accurateTimeOffset=e,this.trackSwitch=t,this.timeOffset=i,this.initSegmentChange=a},Yh={exports:{}};(function(u){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,f,h){this.fn=c,this.context=f,this.once=h||!1}function a(c,f,h,p,E){if(typeof h!="function")throw new TypeError("The listener must be a function");var b=new i(h,p||c,E),A=e?e+f:f;return c._events[A]?c._events[A].fn?c._events[A]=[c._events[A],b]:c._events[A].push(b):(c._events[A]=b,c._eventsCount++),c}function o(c,f){--c._eventsCount==0?c._events=new t:delete c._events[f]}function d(){this._events=new t,this._eventsCount=0}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(e=!1)),d.prototype.eventNames=function(){var c,f,h=[];if(this._eventsCount===0)return h;for(f in c=this._events)s.call(c,f)&&h.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},d.prototype.listeners=function(c){var f=e?e+c:c,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,E=h.length,b=new Array(E);p<E;p++)b[p]=h[p].fn;return b},d.prototype.listenerCount=function(c){var f=e?e+c:c,h=this._events[f];return h?h.fn?1:h.length:0},d.prototype.emit=function(c,f,h,p,E,b){var A=e?e+c:c;if(!this._events[A])return!1;var w,D,S=this._events[A],L=arguments.length;if(S.fn){switch(S.once&&this.removeListener(c,S.fn,void 0,!0),L){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,h),!0;case 4:return S.fn.call(S.context,f,h,p),!0;case 5:return S.fn.call(S.context,f,h,p,E),!0;case 6:return S.fn.call(S.context,f,h,p,E,b),!0}for(D=1,w=new Array(L-1);D<L;D++)w[D-1]=arguments[D];S.fn.apply(S.context,w)}else{var N,P=S.length;for(D=0;D<P;D++)switch(S[D].once&&this.removeListener(c,S[D].fn,void 0,!0),L){case 1:S[D].fn.call(S[D].context);break;case 2:S[D].fn.call(S[D].context,f);break;case 3:S[D].fn.call(S[D].context,f,h);break;case 4:S[D].fn.call(S[D].context,f,h,p);break;default:if(!w)for(N=1,w=new Array(L-1);N<L;N++)w[N-1]=arguments[N];S[D].fn.apply(S[D].context,w)}}return!0},d.prototype.on=function(c,f,h){return a(this,c,f,h,!1)},d.prototype.once=function(c,f,h){return a(this,c,f,h,!0)},d.prototype.removeListener=function(c,f,h,p){var E=e?e+c:c;if(!this._events[E])return this;if(!f)return o(this,E),this;var b=this._events[E];if(b.fn)b.fn!==f||p&&!b.once||h&&b.context!==h||o(this,E);else{for(var A=0,w=[],D=b.length;A<D;A++)(b[A].fn!==f||p&&!b[A].once||h&&b[A].context!==h)&&w.push(b[A]);w.length?this._events[E]=w.length===1?w[0]:w:o(this,E)}return this},d.prototype.removeAllListeners=function(c){var f;return c?(f=e?e+c:c,this._events[f]&&o(this,f)):(this._events=new t,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=e,d.EventEmitter=d,u.exports=d})(Yh);var Xo=de(Yh.exports);function dd(u,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,a=i.audio,o=i.video;return a&&$h(t,a),o&&$h(t,o),u.postMessage({event:"transmuxComplete",data:s},t),!0}function $h(u,s){s.data1&&u.push(s.data1.buffer),s.data2&&u.push(s.data2.buffer)}function jh(u,s,e){s.reduce(function(t,i){return dd(u,i)||t},!1)||u.postMessage({event:"transmuxComplete",data:s[0]}),u.postMessage({event:"flush",data:e})}r!==void 0&&r&&function(u){var s=new Xo,e=function(i,a){u.postMessage({event:i,data:a})};s.on(k.FRAG_DECRYPTED,e),s.on(k.ERROR,e);var t=function(){var i=function(o){var d=function(c){e("workerLog",{logType:o,message:c})};U[o]=d};for(var a in U)i(a)};u.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":var o=JSON.parse(a.config);u.transmuxer=new ld(s,a.typeSupported,o,a.vendor,a.id),it(o.debug,a.id),t(),e("init",null);break;case"configure":u.transmuxer.configure(a.config);break;case"demux":var d=u.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Ma(d)?(u.transmuxer.async=!0,d.then(function(h){dd(u,h)}).catch(function(h){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker push error"})})):(u.transmuxer.async=!1,dd(u,d));break;case"flush":var c=a.chunkMeta,f=u.transmuxer.flush(c);Ma(f)||u.transmuxer.async?(Ma(f)||(f=Promise.resolve(f)),f.then(function(h){jh(u,h,c)}).catch(function(h){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker flush error"})})):jh(u,f,c)}})}(self);var cd=nn()||{isTypeSupported:function(){return!1}},zh=function(){function u(e,t,i,a){var o=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var d=e.config;this.hls=e,this.id=t,this.useWorker=!!d.enableWorker,this.onTransmuxComplete=i,this.onFlush=a;var c=function(D,S){(S=S||{}).frag=o.frag,S.id=o.id,D===k.ERROR&&(o.error=S.error),o.hls.trigger(D,S)};this.observer=new Xo,this.observer.on(k.FRAG_DECRYPTED,c),this.observer.on(k.ERROR,c);var f,h,p,E,b={mp4:cd.isTypeSupported("video/mp4"),mpeg:cd.isTypeSupported("audio/mpeg"),mp3:cd.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(d.workerPath,0))this.transmuxer=new ld(this.observer,b,d,A,t);else try{d.workerPath?(U.log("loading Web Worker "+d.workerPath+' for "'+t+'"'),this.workerContext=(p=d.workerPath,E=new self.URL(p,self.location.href).href,{worker:new self.Worker(E),scriptURL:E})):(U.log('injecting Web Worker for "'+t+'"'),this.workerContext=(f=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+n.toString()+")(true);"],{type:"text/javascript"}),h=self.URL.createObjectURL(f),{worker:new self.Worker(h),objectURL:h})),this.onwmsg=function(D){return o.onWorkerMessage(D)};var w=this.workerContext.worker;w.addEventListener("message",this.onwmsg),w.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");d.enableWorker=!1,U.warn('Error in "'+t+'" Web Worker, fallback to inline'),o.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},w.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(d)})}catch(D){U.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new ld(this.observer,b,d,A,t)}}var s=u.prototype;return s.resetWorker=function(){if(this.workerContext){var e=this.workerContext,t=e.worker,i=e.objectURL;i&&self.URL.revokeObjectURL(i),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}},s.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},s.push=function(e,t,i,a,o,d,c,f,h,p){var E,b,A=this;h.transmuxing.start=self.performance.now();var w=this.transmuxer,D=d?d.start:o.start,S=o.decryptdata,L=this.frag,N=!(L&&o.cc===L.cc),P=!(L&&h.level===L.level),V=L?h.sn-L.sn:-1,Y=this.part?h.part-this.part.index:-1,j=V===0&&h.id>1&&h.id===(L==null?void 0:L.stats.chunkCount),ie=!P&&(V===1||V===0&&(Y===1||j&&Y<=0)),Q=self.performance.now();(P||V||o.stats.parsing.start===0)&&(o.stats.parsing.start=Q),!d||!Y&&ie||(d.stats.parsing.start=Q);var X=!(L&&((E=o.initSegment)==null?void 0:E.url)===((b=L.initSegment)==null?void 0:b.url)),ce=new tg(N,ie,f,P,D,X);if(!ie||N||X){U.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
21
21
  discontinuity: `+N+`
22
22
  trackSwitch: `+P+`
23
- contiguous: `+ee+`
23
+ contiguous: `+ie+`
24
24
  accurateTimeOffset: `+f+`
25
25
  timeOffset: `+D+`
26
- initSegmentChange: `+X);var ne=new Vv(i,r,t,c,p);this.configureTransmuxer(ne)}if(this.frag=o,this.part=u,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:h,state:ue},e instanceof ArrayBuffer?[e]:[]);else if(k){var Te=k.push(e,S,h,ue);Aa(Te)?(k.async=!0,Te.then(function(Me){A.handleTransmuxComplete(Me)}).catch(function(Me){A.transmuxerError(Me,h,"transmuxer-interface push error")})):(k.async=!1,this.handleTransmuxComplete(Te))}},s.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(i){var r=i.flush(e);Aa(r)||i.async?(Aa(r)||(r=Promise.resolve(r)),r.then(function(o){t.handleFlushResult(o,e)}).catch(function(o){t.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))},s.handleFlushResult=function(e,t){var i=this;e.forEach(function(r){i.handleTransmuxComplete(r)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var r,o=(r=this.workerContext)==null?void 0:r.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":H[t.data.logType]&&H[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)}},s.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},s.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d}(),Wv=function(){function d(e,t,i,r){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=r}var s=d.prototype;return s.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},s.poll=function(e,t){var i=this.config,r=this.media,o=this.stalled;if(r!==null){var u=r.currentTime,c=r.seeking,f=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,u===e){if(h||f)this.stalled=null;else if(!(r.paused&&!c||r.ended||r.playbackRate===0)&&ce.getBuffered(r).length){var p=ce.bufferInfo(r,u,0),y=p.len>0,b=p.nextStart||0;if(y||b){if(c){var A=p.len>2,k=!b||t&&t.start<=u||b-u>2&&!this.fragmentTracker.getPartialFragment(u);if(A||k)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(b,p.start||0)-u,L=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=!(L==null||(D=L.details)==null)&&D.live?2*L.details.targetduration:2,P=this.fragmentTracker.getPartialFragment(u);if(S>0&&(S<=N||P))return void this._trySkipBufferHole(P)}var V=self.performance.now();if(o!==null){var q=V-o;if(c||!(q>=250)||(this._reportStall(p),this.media)){var j=ce.bufferInfo(r,u,i.maxBufferHole);this._tryFixBufferStall(j,q)}}else this.stalled=V}}}else if(this.moved=!0,o!==null){if(this.stallReported){var ee=self.performance.now()-o;H.warn("playback not stuck anymore @"+u+", after "+Math.round(ee)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,o=this.media;if(o!==null){var u=o.currentTime,c=r.getPartialFragment(u);if(c&&(this._trySkipBufferHole(c)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-u<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(H.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},s._reportStall=function(e){var t=this.hls,i=this.media;if(!this.stallReported&&i){this.stallReported=!0;var r=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");H.warn(r.message),t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,r=this.media;if(r===null)return 0;var o=r.currentTime,u=ce.bufferInfo(r,o,0),c=o<u.start?u.start:u.nextStart;if(c){var f=u.len<=t.maxBufferHole,h=u.len>0&&u.len<1&&r.readyState<3,p=c-o;if(p>0&&(f||h)){if(p>t.maxBufferHole){var y=this.fragmentTracker,b=!1;if(o===0){var A=y.getAppendedFrag(0,et);A&&c<A.end&&(b=!0)}if(!b){var k=e||y.getAppendedFrag(o,et);if(k){for(var D=!1,S=k.end;S<c;){var L=y.getPartialFragment(S);if(!L){D=!0;break}S+=L.duration}if(D)return 0}}}var N=Math.max(c+.05,o+.1);if(H.warn("skipping hole, adjusting currentTime from "+o+" to "+N),this.moved=!0,this.stalled=null,r.currentTime=N,e&&!e.gap){var P=new Error("fragment loaded with buffer holes, seeking from "+o+" to "+N);i.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:P,reason:P.message,frag:e})}return N}}return 0},s._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,r=this.nudgeRetry;if(i!==null){var o=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){var u=o+(r+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+o+" to "+u);H.warn(c.message),i.currentTime=u,t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1})}else{var f=new Error("Playhead still not moving while enough data buffered @"+o+" after "+e.nudgeMaxRetry+" nudges");H.error(f.message),t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:f,fatal:!0})}}},d}(),qv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[stream-controller]",et)||this).audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.couldBacktrack=!1,o.backtrackFragment=null,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(w.ERROR,this.onError,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(w.ERROR,this.onError,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var o=r.startLevel;o===-1&&(r.config.testBandwidth&&this.levels.length>1?(o=0,this.bitrateTest=!0):o=r.nextAutoLevel),this.level=r.nextLoadLevel=o,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=Le,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Rt},e.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case tn:var t,i=this.levels,r=this.level,o=i==null||(t=i[r])==null?void 0:t.details;if(o&&(!o.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(o))break;this.state=Le;break}break;case Gr:var u,c=self.performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=Le)}this.state===Le&&this.doTickIdle(),this.onTickEnd()},e.onTickEnd=function(){d.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},e.doTickIdle=function(){var t=this.hls,i=this.levelLastLoaded,r=this.levels,o=this.media,u=t.config,c=t.nextLoadLevel;if(i!==null&&(o||!this.startFragRequested&&u.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&r!=null&&r[c]){var f=r[c],h=this.getMainFwdBufferInfo();if(h!==null){var p=this.getLevelDetails();if(p&&this._streamEnded(h,p)){var y={};return this.altAudio&&(y.type="video"),this.hls.trigger(w.BUFFER_EOS,y),void(this.state=ss)}t.loadLevel!==c&&t.manualLevel===-1&&this.log("Adapting to level "+c+" from level "+this.level),this.level=t.nextLoadLevel=c;var b=f.details;if(!b||this.state===tn||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=tn);var A=h.len,k=this.getMaxBufferLength(f.maxBitrate);if(!(A>=k)){this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);var D=this.backtrackFragment?this.backtrackFragment.start:h.end,S=this.getNextFragment(D,b);if(this.couldBacktrack&&!this.fragPrevious&&S&&S.sn!=="initSegment"&&this.fragmentTracker.getState(S)!==Se){var L,N=((L=this.backtrackFragment)!=null?L:S).sn-b.startSN,P=b.fragments[N-1];P&&S.cc===P.cc&&(S=P,this.fragmentTracker.removeFragment(P))}else this.backtrackFragment&&h.len&&(this.backtrackFragment=null);if(S&&this.isLoopLoading(S,D)){if(!S.gap){var V=this.audioOnly&&!this.altAudio?ht:Tt,q=(V===Tt?this.videoBuffer:this.mediaBuffer)||this.media;q&&this.afterBufferFlushed(q,V,et)}S=this.getNextFragmentLoopLoading(S,b,h,et,k)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,f,D))}}}},e.loadFragment=function(t,i,r){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===Z||o===ye?t.sn==="initSegment"?this._loadInitSegment(t,i):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,i)):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,et)},e.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},e.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.nextLevelSwitch=function(){var t=this.levels,i=this.media;if(i!=null&&i.readyState){var r,o=this.getAppendedFrag(i.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);var u=this.getLevelDetails();if(u!=null&&u.live){var c=this.getMainFwdBufferInfo();if(!c||c.len<2*u.targetduration)return}if(!i.paused&&t){var f=t[this.hls.nextLoadLevel],h=this.fragLastKbps;r=h&&this.fragCurrent?this.fragCurrent.duration*f.maxBitrate/(1e3*h)+1:0}else r=0;var p=this.getBufferedFrag(i.currentTime+r);if(p){var y=this.followingBufferedFrag(p);if(y){this.abortCurrentFrag();var b=y.maxStartPTS?y.maxStartPTS:y.start,A=y.duration,k=Math.max(p.end,b+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,.5*A),.75*A));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},e.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case gr:case Hr:case Gr:case yr:case No:this.state=Le}this.nextLoadPosition=this.getLoadPosition()},e.flushMainBuffer=function(t,i){d.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},e.onMediaAttached=function(t,i){d.prototype.onMediaAttached.call(this,t,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Wv(this.config,r,this.fragmentTracker,this.hls)},e.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.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)},e.onMediaPlaying=function(){this.tick()},e.onMediaSeeked=function(){var t=this.media,i=t?t.currentTime:null;oe(i)&&this.log("Media seeked to "+i.toFixed(3));var r=this.getMainFwdBufferInfo();r!==null&&r.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(r?r.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(w.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1},e.onManifestParsed=function(t,i){var r,o,u,c=!1,f=!1;i.levels.forEach(function(h){(r=h.audioCodec)&&(r.indexOf("mp4a.40.2")!==-1&&(c=!0),r.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=c&&f&&typeof((u=Eh())==null||(o=u.prototype)==null?void 0:o.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},e.onLevelLoading=function(t,i){var r=this.levels;if(r&&this.state===Le){var o=r[i.level];(!o.details||o.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(o.details))&&(this.state=tn)}},e.onLevelLoaded=function(t,i){var r,o=this.levels,u=i.level,c=i.details,f=c.totalduration;if(o){this.log("Level "+u+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+", cc ["+c.startCC+", "+c.endCC+"] duration:"+f);var h=o[u],p=this.fragCurrent;!p||this.state!==Hr&&this.state!==Gr||p.level===i.level&&p.urlId===h.urlId||!p.loader||this.abortCurrentFrag();var y=0;if(c.live||(r=h.details)!=null&&r.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;y=this.alignPlaylists(c,h.details)}if(h.details=c,this.levelLastLoaded=u,this.hls.trigger(w.LEVEL_UPDATED,{details:c,level:u}),this.state===tn){if(this.waitForCdnTuneIn(c))return;this.state=Le}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,y),this.tick()}else this.warn("Levels were reset while loading level "+u)},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,o=t.part,u=t.payload,c=this.levels;if(c){var f=c[r.level],h=f.details;if(!h)return this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset"),void this.fragmentTracker.removeFragment(r);var p=f.videoCodec,y=h.PTSKnown||!h.live,b=(i=r.initSegment)==null?void 0:i.data,A=this._getAudioCodec(f),k=this.transmuxer=this.transmuxer||new Uh(this.hls,et,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=o?o.index:-1,S=D!==-1,L=new he(r.level,r.sn,r.stats.chunkCount,u.byteLength,D,S),N=this.initPTS[r.cc];k.push(u,b,A,p,r,o,h.totalduration,y,L,N)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var r=this.altAudio;if(!i.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var u=this.hls;r&&(u.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),u.trigger(w.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var r=i.id,o=!!this.hls.audioTracks[r].url;if(o){var u=this.videoBuffer;u&&this.mediaBuffer!==u&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=u)}this.altAudio=o,this.tick()},e.onBufferCreated=function(t,i){var r,o,u=i.tracks,c=!1;for(var f in u){var h=u[f];if(h.id==="main"){if(o=f,r=h,f==="video"){var p=u[f];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&r?(this.log("Alternate track found, use "+o+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var r=i.frag,o=i.part;if(!r||r.type===et){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(o?" p: "+o.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===No&&(this.state=Le));var u=o?o.stats:r.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,o)}},e.onError=function(t,i){var r;if(i.fatal)this.state=en;else switch(i.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(et,i);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==tn||((r=i.context)==null?void 0:r.type)!==mr||(this.state=Le);break;case $.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="main")return;this.reduceLengthAndFlushBuffer(i)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.checkBuffer=function(){var t=this.media,i=this.gapController;if(t&&i&&t.readyState){if(this.loadedmetadata||!ce.getBuffered(t).length){var r=this.state!==Le?this.fragCurrent:null;i.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=Le,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var r=i.type;if(r!==ht||this.audioOnly&&!this.altAudio){var o=(r===Tt?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(o,r,et)}},e.onLevelsUpdated=function(t,i){this.levels=i.levels},e.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.seekToStartPos=function(){var t=this.media;if(t){var i=t.currentTime,r=this.startPosition;if(r>=0&&i<r){if(t.seeking)return void this.log("could not seek to "+r+", already seeking at "+i);var o=ce.getBuffered(t),u=(o.length?o.start(0):0)-r;u>0&&(u<this.config.maxBufferHole||u<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+u+" to match buffer start"),r+=u,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+i),t.currentTime=r}}},e._getAudioCodec=function(t){var i=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i=i.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),i},e._loadBitrateTestFrag=function(t,i){var r=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(o){var u=r.hls;if(o&&!r.fragContextChanged(t)){i.fragmentError=0,r.state=Le,r.startFragRequested=!1,r.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),u.trigger(w.FRAG_LOADED,o),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,r="main",o=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,y=f.level,b=u.video,A=u.text,k=u.id3,D=u.initSegment,S=y.details,L=this.altAudio?void 0:u.audio;if(this.fragContextChanged(h))this.fragmentTracker.removeFragment(h);else{if(this.state=yr,D){if(D!=null&&D.tracks){var N=h.initSegment||h;this._bufferInitSegment(y,D.tracks,N,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:r,tracks:D.tracks})}var P=D.initPTS,V=D.timescale;oe(P)&&(this.initPTS[h.cc]={baseTime:P,timescale:V},o.trigger(w.INIT_PTS_FOUND,{frag:h,id:r,initPTS:P,timescale:V}))}if(b&&u.independent!==!1){if(S){var q=b.startPTS,j=b.endPTS,ee=b.startDTS,z=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:q,endPTS:j,startDTS:ee,endDTS:z};else if(b.firstKeyFrame&&b.independent&&c.id===1&&(this.couldBacktrack=!0),b.dropped&&b.independent){var X=this.getMainFwdBufferInfo();if((X?X.end:this.getLoadPosition())+this.config.maxBufferHole<(b.firstKeyFramePTS?b.firstKeyFramePTS:q)-this.config.maxBufferHole)return void this.backtrack(h);h.setElementaryStreamInfo(b.type,h.start,j,h.start,z,!0)}h.setElementaryStreamInfo(b.type,q,j,ee,z),this.backtrackFragment&&(this.backtrackFragment=h),this.bufferFragmentData(b,h,p,c)}}else if(u.independent===!1)return void this.backtrack(h);if(L){var ue=L.startPTS,ne=L.endPTS,Te=L.startDTS,Me=L.endDTS;p&&(p.elementaryStreams[ht]={startPTS:ue,endPTS:ne,startDTS:Te,endDTS:Me}),h.setElementaryStreamInfo(ht,ue,ne,Te,Me),this.bufferFragmentData(L,h,p,c)}if(S&&k!=null&&(i=k.samples)!=null&&i.length){var _e={id:r,frag:h,details:S,samples:k.samples};o.trigger(w.FRAG_PARSING_METADATA,_e)}if(S&&A){var De={id:r,frag:h,details:S,samples:A.samples};o.trigger(w.FRAG_PARSING_USERDATA,De)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r,o){var u=this;if(this.state===yr){this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,f=i.video,h=i.audiovideo;if(c){var p=t.audioCodec,y=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(p&&(p=p.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),c.metadata.channelCount!==1&&y.indexOf("firefox")===-1&&(p="mp4a.40.5")),y.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(p="mp4a.40.2",this.log("Android: force audio codec to "+p)),t.audioCodec&&t.audioCodec!==p&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+p+'"'),c.levelCodec=p,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(p||"")+"/"+(t.audioCodec||"")+"/"+c.codec+"]")}f&&(f.levelCodec=t.videoCodec,f.id="main",this.log("Init video buffer, container:"+f.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+f.codec+"]")),h&&this.log("Init audiovideo buffer, container:"+h.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+h.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&u.hls.trigger(w.BUFFER_APPENDING,{type:b,data:A,frag:r,part:null,chunkMeta:o,parent:r.type})}),this.tick()}},e.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,et)},e.backtrack=function(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Le},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var r=t.currentTime;if(ce.isBuffered(t,r)?i=this.getAppendedFrag(r):ce.isBuffered(t,r+.1)&&(i=this.getAppendedFrag(r+.1)),i){this.backtrackFragment=null;var o=this.fragPlaying,u=i.level;o&&i.sn===o.sn&&o.level===u&&i.urlId===o.urlId||(this.fragPlaying=i,this.hls.trigger(w.FRAG_CHANGED,{frag:i}),o&&o.level===u||this.hls.trigger(w.LEVEL_SWITCHED,{level:u}))}}},M(s,[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var i=t.currentTime,r=this.currentFrag;if(r&&oe(i)&&oe(r.programDateTime)){var o=r.programDateTime+1e3*(i-r.start);return new Date(o)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),s}(Vd),an=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 s=d.prototype;return s.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},s.getTotalWeight=function(){return this.totalWeight_},s.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},d}(),Yv=function(){function d(e,t,i,r){r===void 0&&(r=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new an(e),this.fast_=new an(t),this.defaultTTFB_=r,this.ttfb_=new an(e)}var s=d.prototype;return s.update=function(e,t){var i=this.slow_,r=this.fast_,o=this.ttfb_;i.halfLife!==e&&(this.slow_=new an(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new an(t,r.getEstimate(),r.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new an(e,o.getEstimate(),o.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)},s.sampleTTFB=function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))},s.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},s.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},s.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},s.destroy=function(){},d}(),$v=function(){function d(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new Yv(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(e,t){var i,r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},s.onLevelSwitching=function(e,t){this.clearTimer()},s.getTimeToLoadFrag=function(e,t,i,r){return e+i/t+(r?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,r=t.stats,o=r.total,u=r.bwEstimate;oe(o)&&oe(u)&&(this.lastLevelLoadSec=8*o/u),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.autoLevelEnabled,o=i.media;if(e&&o){var u=performance.now(),c=t?t.stats:e.stats,f=t?t.duration:e.duration,h=u-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!o.paused&&o.playbackRate&&o.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var y=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(!(h<=Math.max(y,f/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*f/b)){var k=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&k>-1,S=this.bwEstimator.getEstimate(),L=i.levels,N=i.minAutoLevel,P=L[e.level],V=c.total||Math.max(c.loaded,Math.round(f*P.maxBitrate/8)),q=h-k;q<1&&D&&(q=Math.min(h,8*c.loaded/S));var j=D?1e3*c.loaded/q:0,ee=j?(V-c.loaded)/j:8*V/S+y/1e3;if(!(ee<=A)){var z,X=j?8*j:S,ue=Number.POSITIVE_INFINITY;for(z=e.level-1;z>N;z--){var ne=L[z].maxBitrate;if((ue=this.getTimeToLoadFrag(y/1e3,X,f*ne,!L[z].details))<A)break}ue>=ee||ue>10*f||(i.nextLoadLevel=z,D?this.bwEstimator.sample(h-Math.min(y,k),c.loaded):this.bwEstimator.sampleTTFB(h),this.clearTimer(),H.warn("[abr] Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+` is loading too slowly;
26
+ initSegmentChange: `+X);var oe=new eg(i,a,t,c,p);this.configureTransmuxer(oe)}if(this.frag=o,this.part=d,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:h,state:ce},e instanceof ArrayBuffer?[e]:[]);else if(w){var Ae=w.push(e,S,h,ce);Ma(Ae)?(w.async=!0,Ae.then(function(xe){A.handleTransmuxComplete(xe)}).catch(function(xe){A.transmuxerError(xe,h,"transmuxer-interface push error")})):(w.async=!1,this.handleTransmuxComplete(Ae))}},s.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(i){var a=i.flush(e);Ma(a)||i.async?(Ma(a)||(a=Promise.resolve(a)),a.then(function(o){t.handleFlushResult(o,e)}).catch(function(o){t.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))},s.handleFlushResult=function(e,t){var i=this;e.forEach(function(a){i.handleTransmuxComplete(a)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var a,o=(a=this.workerContext)==null?void 0:a.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":U[t.data.logType]&&U[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)}},s.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},s.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},u}(),ig=function(){function u(e,t,i,a){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=a}var s=u.prototype;return s.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},s.poll=function(e,t){var i=this.config,a=this.media,o=this.stalled;if(a!==null){var d=a.currentTime,c=a.seeking,f=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,d===e){if(h||f)this.stalled=null;else if(!(a.paused&&!c||a.ended||a.playbackRate===0)&&he.getBuffered(a).length){var p=he.bufferInfo(a,d,0),E=p.len>0,b=p.nextStart||0;if(E||b){if(c){var A=p.len>2,w=!b||t&&t.start<=d||b-d>2&&!this.fragmentTracker.getPartialFragment(d);if(A||w)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(b,p.start||0)-d,L=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=!(L==null||(D=L.details)==null)&&D.live?2*L.details.targetduration:2,P=this.fragmentTracker.getPartialFragment(d);if(S>0&&(S<=N||P))return void this._trySkipBufferHole(P)}var V=self.performance.now();if(o!==null){var Y=V-o;if(c||!(Y>=250)||(this._reportStall(p),this.media)){var j=he.bufferInfo(a,d,i.maxBufferHole);this._tryFixBufferStall(j,Y)}}else this.stalled=V}}}else if(this.moved=!0,o!==null){if(this.stallReported){var ie=self.performance.now()-o;U.warn("playback not stuck anymore @"+d+", after "+Math.round(ie)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,a=this.fragmentTracker,o=this.media;if(o!==null){var d=o.currentTime,c=a.getPartialFragment(d);if(c&&(this._trySkipBufferHole(c)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-d<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},s._reportStall=function(e){var t=this.hls,i=this.media;if(!this.stallReported&&i){this.stallReported=!0;var a=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");U.warn(a.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,a=this.media;if(a===null)return 0;var o=a.currentTime,d=he.bufferInfo(a,o,0),c=o<d.start?d.start:d.nextStart;if(c){var f=d.len<=t.maxBufferHole,h=d.len>0&&d.len<1&&a.readyState<3,p=c-o;if(p>0&&(f||h)){if(p>t.maxBufferHole){var E=this.fragmentTracker,b=!1;if(o===0){var A=E.getAppendedFrag(0,rt);A&&c<A.end&&(b=!0)}if(!b){var w=e||E.getAppendedFrag(o,rt);if(w){for(var D=!1,S=w.end;S<c;){var L=E.getPartialFragment(S);if(!L){D=!0;break}S+=L.duration}if(D)return 0}}}var N=Math.max(c+.05,o+.1);if(U.warn("skipping hole, adjusting currentTime from "+o+" to "+N),this.moved=!0,this.stalled=null,a.currentTime=N,e&&!e.gap){var P=new Error("fragment loaded with buffer holes, seeking from "+o+" to "+N);i.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:P,reason:P.message,frag:e})}return N}}return 0},s._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,a=this.nudgeRetry;if(i!==null){var o=i.currentTime;if(this.nudgeRetry++,a<e.nudgeMaxRetry){var d=o+(a+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+o+" to "+d);U.warn(c.message),i.currentTime=d,t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1})}else{var f=new Error("Playhead still not moving while enough data buffered @"+o+" after "+e.nudgeMaxRetry+" nudges");U.error(f.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,error:f,fatal:!0})}}},u}(),rg=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[stream-controller]",rt)||this).audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.couldBacktrack=!1,o.backtrackFragment=null,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}z(s,u);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(k.ERROR,this.onError,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(k.ERROR,this.onError,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var o=a.startLevel;o===-1&&(a.config.testBandwidth&&this.levels.length>1?(o=0,this.bitrateTest=!0):o=a.nextAutoLevel),this.level=a.nextLoadLevel=o,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=De,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Ut},e.stopLoad=function(){this._forceStartLoad=!1,u.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case fn:var t,i=this.levels,a=this.level,o=i==null||(t=i[a])==null?void 0:t.details;if(o&&(!o.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(o))break;this.state=De;break}break;case Zr:var d,c=self.performance.now(),f=this.retryDate;(!f||c>=f||(d=this.media)!=null&&d.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=De)}this.state===De&&this.doTickIdle(),this.onTickEnd()},e.onTickEnd=function(){u.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},e.doTickIdle=function(){var t=this.hls,i=this.levelLastLoaded,a=this.levels,o=this.media,d=t.config,c=t.nextLoadLevel;if(i!==null&&(o||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a!=null&&a[c]){var f=a[c],h=this.getMainFwdBufferInfo();if(h!==null){var p=this.getLevelDetails();if(p&&this._streamEnded(h,p)){var E={};return this.altAudio&&(E.type="video"),this.hls.trigger(k.BUFFER_EOS,E),void(this.state=ys)}t.loadLevel!==c&&t.manualLevel===-1&&this.log("Adapting to level "+c+" from level "+this.level),this.level=t.nextLoadLevel=c;var b=f.details;if(!b||this.state===fn||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=fn);var A=h.len,w=this.getMaxBufferLength(f.maxBitrate);if(!(A>=w)){this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);var D=this.backtrackFragment?this.backtrackFragment.start:h.end,S=this.getNextFragment(D,b);if(this.couldBacktrack&&!this.fragPrevious&&S&&S.sn!=="initSegment"&&this.fragmentTracker.getState(S)!==Re){var L,N=((L=this.backtrackFragment)!=null?L:S).sn-b.startSN,P=b.fragments[N-1];P&&S.cc===P.cc&&(S=P,this.fragmentTracker.removeFragment(P))}else this.backtrackFragment&&h.len&&(this.backtrackFragment=null);if(S&&this.isLoopLoading(S,D)){if(!S.gap){var V=this.audioOnly&&!this.altAudio?gt:Ct,Y=(V===Ct?this.videoBuffer:this.mediaBuffer)||this.media;Y&&this.afterBufferFlushed(Y,V,rt)}S=this.getNextFragmentLoopLoading(S,b,h,rt,w)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,f,D))}}}},e.loadFragment=function(t,i,a){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===Z||o===Te?t.sn==="initSegment"?this._loadInitSegment(t,i):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,i)):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,t,i,a)):this.clearTrackerIfNeeded(t)},e.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,rt)},e.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},e.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.nextLevelSwitch=function(){var t=this.levels,i=this.media;if(i!=null&&i.readyState){var a,o=this.getAppendedFrag(i.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);var d=this.getLevelDetails();if(d!=null&&d.live){var c=this.getMainFwdBufferInfo();if(!c||c.len<2*d.targetduration)return}if(!i.paused&&t){var f=t[this.hls.nextLoadLevel],h=this.fragLastKbps;a=h&&this.fragCurrent?this.fragCurrent.duration*f.maxBitrate/(1e3*h)+1:0}else a=0;var p=this.getBufferedFrag(i.currentTime+a);if(p){var E=this.followingBufferedFrag(p);if(E){this.abortCurrentFrag();var b=E.maxStartPTS?E.maxStartPTS:E.start,A=E.duration,w=Math.max(p.end,b+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,.5*A),.75*A));this.flushMainBuffer(w,Number.POSITIVE_INFINITY)}}}},e.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Sr:case Xr:case Zr:case kr:case Yo:this.state=De}this.nextLoadPosition=this.getLoadPosition()},e.flushMainBuffer=function(t,i){u.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},e.onMediaAttached=function(t,i){u.prototype.onMediaAttached.call(this,t,i);var a=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new ig(this.config,a,this.fragmentTracker,this.hls)},e.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),u.prototype.onMediaDetaching.call(this)},e.onMediaPlaying=function(){this.tick()},e.onMediaSeeked=function(){var t=this.media,i=t?t.currentTime:null;re(i)&&this.log("Media seeked to "+i.toFixed(3));var a=this.getMainFwdBufferInfo();a!==null&&a.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(a?a.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(k.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1},e.onManifestParsed=function(t,i){var a,o,d,c=!1,f=!1;i.levels.forEach(function(h){(a=h.audioCodec)&&(a.indexOf("mp4a.40.2")!==-1&&(c=!0),a.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=c&&f&&typeof((d=Dh())==null||(o=d.prototype)==null?void 0:o.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},e.onLevelLoading=function(t,i){var a=this.levels;if(a&&this.state===De){var o=a[i.level];(!o.details||o.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(o.details))&&(this.state=fn)}},e.onLevelLoaded=function(t,i){var a,o=this.levels,d=i.level,c=i.details,f=c.totalduration;if(o){this.log("Level "+d+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+", cc ["+c.startCC+", "+c.endCC+"] duration:"+f);var h=o[d],p=this.fragCurrent;!p||this.state!==Xr&&this.state!==Zr||p.level===i.level&&p.urlId===h.urlId||!p.loader||this.abortCurrentFrag();var E=0;if(c.live||(a=h.details)!=null&&a.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;E=this.alignPlaylists(c,h.details)}if(h.details=c,this.levelLastLoaded=d,this.hls.trigger(k.LEVEL_UPDATED,{details:c,level:d}),this.state===fn){if(this.waitForCdnTuneIn(c))return;this.state=De}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,E),this.tick()}else this.warn("Levels were reset while loading level "+d)},e._handleFragmentLoadProgress=function(t){var i,a=t.frag,o=t.part,d=t.payload,c=this.levels;if(c){var f=c[a.level],h=f.details;if(!h)return this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),void this.fragmentTracker.removeFragment(a);var p=f.videoCodec,E=h.PTSKnown||!h.live,b=(i=a.initSegment)==null?void 0:i.data,A=this._getAudioCodec(f),w=this.transmuxer=this.transmuxer||new zh(this.hls,rt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=o?o.index:-1,S=D!==-1,L=new fe(a.level,a.sn,a.stats.chunkCount,d.byteLength,D,S),N=this.initPTS[a.cc];w.push(d,b,A,p,a,o,h.totalduration,E,L,N)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var a=this.altAudio;if(!i.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var d=this.hls;a&&(d.trigger(k.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),d.trigger(k.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var a=i.id,o=!!this.hls.audioTracks[a].url;if(o){var d=this.videoBuffer;d&&this.mediaBuffer!==d&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=d)}this.altAudio=o,this.tick()},e.onBufferCreated=function(t,i){var a,o,d=i.tracks,c=!1;for(var f in d){var h=d[f];if(h.id==="main"){if(o=f,a=h,f==="video"){var p=d[f];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&a?(this.log("Alternate track found, use "+o+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var a=i.frag,o=i.part;if(!a||a.type===rt){if(this.fragContextChanged(a))return this.warn("Fragment "+a.sn+(o?" p: "+o.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Yo&&(this.state=De));var d=o?o.stats:a.stats;this.fragLastKbps=Math.round(8*d.total/(d.buffering.end-d.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,o)}},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;else switch(i.details){case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(rt,i);break;case W.LEVEL_LOAD_ERROR:case W.LEVEL_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==fn||((a=i.context)==null?void 0:a.type)!==_r||(this.state=De);break;case W.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="main")return;this.reduceLengthAndFlushBuffer(i)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case W.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.checkBuffer=function(){var t=this.media,i=this.gapController;if(t&&i&&t.readyState){if(this.loadedmetadata||!he.getBuffered(t).length){var a=this.state!==De?this.fragCurrent:null;i.poll(this.lastCurrentTime,a)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=De,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var a=i.type;if(a!==gt||this.audioOnly&&!this.altAudio){var o=(a===Ct?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(o,a,rt)}},e.onLevelsUpdated=function(t,i){this.levels=i.levels},e.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.seekToStartPos=function(){var t=this.media;if(t){var i=t.currentTime,a=this.startPosition;if(a>=0&&i<a){if(t.seeking)return void this.log("could not seek to "+a+", already seeking at "+i);var o=he.getBuffered(t),d=(o.length?o.start(0):0)-a;d>0&&(d<this.config.maxBufferHole||d<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+d+" to match buffer start"),a+=d,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+i),t.currentTime=a}}},e._getAudioCodec=function(t){var i=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i=i.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),i},e._loadBitrateTestFrag=function(t,i){var a=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(o){var d=a.hls;if(o&&!a.fragContextChanged(t)){i.fragmentError=0,a.state=De,a.startFragRequested=!1,a.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),d.trigger(k.FRAG_LOADED,o),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,a="main",o=this.hls,d=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level,b=d.video,A=d.text,w=d.id3,D=d.initSegment,S=E.details,L=this.altAudio?void 0:d.audio;if(this.fragContextChanged(h))this.fragmentTracker.removeFragment(h);else{if(this.state=kr,D){if(D!=null&&D.tracks){var N=h.initSegment||h;this._bufferInitSegment(E,D.tracks,N,c),o.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:D.tracks})}var P=D.initPTS,V=D.timescale;re(P)&&(this.initPTS[h.cc]={baseTime:P,timescale:V},o.trigger(k.INIT_PTS_FOUND,{frag:h,id:a,initPTS:P,timescale:V}))}if(b&&d.independent!==!1){if(S){var Y=b.startPTS,j=b.endPTS,ie=b.startDTS,Q=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:Y,endPTS:j,startDTS:ie,endDTS:Q};else if(b.firstKeyFrame&&b.independent&&c.id===1&&(this.couldBacktrack=!0),b.dropped&&b.independent){var X=this.getMainFwdBufferInfo();if((X?X.end:this.getLoadPosition())+this.config.maxBufferHole<(b.firstKeyFramePTS?b.firstKeyFramePTS:Y)-this.config.maxBufferHole)return void this.backtrack(h);h.setElementaryStreamInfo(b.type,h.start,j,h.start,Q,!0)}h.setElementaryStreamInfo(b.type,Y,j,ie,Q),this.backtrackFragment&&(this.backtrackFragment=h),this.bufferFragmentData(b,h,p,c)}}else if(d.independent===!1)return void this.backtrack(h);if(L){var ce=L.startPTS,oe=L.endPTS,Ae=L.startDTS,xe=L.endDTS;p&&(p.elementaryStreams[gt]={startPTS:ce,endPTS:oe,startDTS:Ae,endDTS:xe}),h.setElementaryStreamInfo(gt,ce,oe,Ae,xe),this.bufferFragmentData(L,h,p,c)}if(S&&w!=null&&(i=w.samples)!=null&&i.length){var Le={id:a,frag:h,details:S,samples:w.samples};o.trigger(k.FRAG_PARSING_METADATA,Le)}if(S&&A){var Me={id:a,frag:h,details:S,samples:A.samples};o.trigger(k.FRAG_PARSING_USERDATA,Me)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a,o){var d=this;if(this.state===kr){this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,f=i.video,h=i.audiovideo;if(c){var p=t.audioCodec,E=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(p&&(p=p.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),c.metadata.channelCount!==1&&E.indexOf("firefox")===-1&&(p="mp4a.40.5")),E.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(p="mp4a.40.2",this.log("Android: force audio codec to "+p)),t.audioCodec&&t.audioCodec!==p&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+p+'"'),c.levelCodec=p,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(p||"")+"/"+(t.audioCodec||"")+"/"+c.codec+"]")}f&&(f.levelCodec=t.videoCodec,f.id="main",this.log("Init video buffer, container:"+f.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+f.codec+"]")),h&&this.log("Init audiovideo buffer, container:"+h.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+h.codec+"]"),this.hls.trigger(k.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&d.hls.trigger(k.BUFFER_APPENDING,{type:b,data:A,frag:a,part:null,chunkMeta:o,parent:a.type})}),this.tick()}},e.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,rt)},e.backtrack=function(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=De},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var a=t.currentTime;if(he.isBuffered(t,a)?i=this.getAppendedFrag(a):he.isBuffered(t,a+.1)&&(i=this.getAppendedFrag(a+.1)),i){this.backtrackFragment=null;var o=this.fragPlaying,d=i.level;o&&i.sn===o.sn&&o.level===d&&i.urlId===o.urlId||(this.fragPlaying=i,this.hls.trigger(k.FRAG_CHANGED,{frag:i}),o&&o.level===d||this.hls.trigger(k.LEVEL_SWITCHED,{level:d}))}}},M(s,[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var i=t.currentTime,a=this.currentFrag;if(a&&re(i)&&re(a.programDateTime)){var o=a.programDateTime+1e3*(i-a.start);return new Date(o)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),s}(Ju),pn=function(){function u(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 s=u.prototype;return s.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},s.getTotalWeight=function(){return this.totalWeight_},s.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},u}(),ag=function(){function u(e,t,i,a){a===void 0&&(a=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new pn(e),this.fast_=new pn(t),this.defaultTTFB_=a,this.ttfb_=new pn(e)}var s=u.prototype;return s.update=function(e,t){var i=this.slow_,a=this.fast_,o=this.ttfb_;i.halfLife!==e&&(this.slow_=new pn(e,i.getEstimate(),i.getTotalWeight())),a.halfLife!==t&&(this.fast_=new pn(t,a.getEstimate(),a.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new pn(e,o.getEstimate(),o.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,a=8*t/i;this.fast_.sample(i,a),this.slow_.sample(i,a)},s.sampleTTFB=function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))},s.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},s.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},s.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},s.destroy=function(){},u}(),ng=function(){function u(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new ag(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(k.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(k.LEVEL_LOADED,this.onLevelLoaded,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(e,t){var i,a=t.frag;this.ignoreFragment(a)||(this.fragCurrent=a,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},s.onLevelSwitching=function(e,t){this.clearTimer()},s.getTimeToLoadFrag=function(e,t,i,a){return e+i/t+(a?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,a=t.stats,o=a.total,d=a.bwEstimate;re(o)&&re(d)&&(this.lastLevelLoadSec=8*o/d),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,a=i.autoLevelEnabled,o=i.media;if(e&&o){var d=performance.now(),c=t?t.stats:e.stats,f=t?t.duration:e.duration,h=d-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(a&&!o.paused&&o.playbackRate&&o.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(!(h<=Math.max(E,f/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*f/b)){var w=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&w>-1,S=this.bwEstimator.getEstimate(),L=i.levels,N=i.minAutoLevel,P=L[e.level],V=c.total||Math.max(c.loaded,Math.round(f*P.maxBitrate/8)),Y=h-w;Y<1&&D&&(Y=Math.min(h,8*c.loaded/S));var j=D?1e3*c.loaded/Y:0,ie=j?(V-c.loaded)/j:8*V/S+E/1e3;if(!(ie<=A)){var Q,X=j?8*j:S,ce=Number.POSITIVE_INFINITY;for(Q=e.level-1;Q>N;Q--){var oe=L[Q].maxBitrate;if((ce=this.getTimeToLoadFrag(E/1e3,X,f*oe,!L[Q].details))<A)break}ce>=ie||ce>10*f||(i.nextLoadLevel=Q,D?this.bwEstimator.sample(h-Math.min(E,w),c.loaded):this.bwEstimator.sampleTTFB(h),this.clearTimer(),U.warn("[abr] Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+` is loading too slowly;
27
27
  Time to underbuffer: `+A.toFixed(3)+` s
28
- Estimated load time for current fragment: `+ee.toFixed(3)+` s
29
- Estimated load time for down switch fragment: `+ue.toFixed(3)+` s
30
- TTFB estimate: `+k+`
31
- Current BW estimate: `+(oe(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
28
+ Estimated load time for current fragment: `+ie.toFixed(3)+` s
29
+ Estimated load time for down switch fragment: `+ce.toFixed(3)+` s
30
+ TTFB estimate: `+w+`
31
+ Current BW estimate: `+(re(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
32
32
  New BW estimate: `+(this.bwEstimator.getEstimate()/1024).toFixed(3)+` Kb/s
33
- Aborting and switching to level `+z),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(w.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part,o=r?r.stats:i.stats;if(i.type===et&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=r?r.duration:i.duration,c=this.hls.levels[i.level],f=(c.loaded?c.loaded.bytes:0)+o.loaded,h=(c.loaded?c.loaded.duration:0)+u;c.loaded={bytes:f,duration:h},c.realBitrate=Math.round(8*f/h)}if(i.bitrateTest){var p={stats:o,frag:i,part:r,id:i.type};this.onFragBuffered(w.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,r=t.part,o=r!=null&&r.stats.loaded?r.stats:i.stats;if(!o.aborted&&!this.ignoreFragment(i)){var u=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(u,o.loaded),o.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=u/1e3:this.bitrateTestDelay=0}},s.ignoreFragment=function(e){return e.type!==et||e.sn==="initSegment"},s.clearTimer=function(){self.clearInterval(this.timer)},s.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,o=i.config,u=i.minAutoLevel,c=i.media,f=t?t.duration:e?e.duration:0,h=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():o.abrEwmaDefaultEstimate,y=i.mainForwardBufferInfo,b=(y?y.len:0)/h,A=this.findBestLevel(p,u,r,b,o.abrBandWidthFactor,o.abrBandWidthUpFactor);if(A>=0)return A;H.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var k=f?Math.min(f,o.maxStarvationDelay):o.maxStarvationDelay,D=o.abrBandWidthFactor,S=o.abrBandWidthUpFactor;if(!b){var L=this.bitrateTestDelay;L&&(k=(f?Math.min(f,o.maxLoadingDelay):o.maxLoadingDelay)-L,H.trace("[abr] bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*k)+" ms"),D=S=1)}return A=this.findBestLevel(p,u,r,b+k,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,r,o,u){for(var c,f=this.fragCurrent,h=this.partCurrent,p=this.lastLoadedFragLevel,y=this.hls.levels,b=y[p],A=!(b==null||(c=b.details)==null||!c.live),k=b==null?void 0:b.codecSet,D=h?h.duration:f?f.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,L=t,N=-1,P=i;P>=t;P--){var V=y[P];if(!V||k&&V.codecSet!==k)V&&(L=Math.min(P,L),N=Math.max(P,N));else{N!==-1&&H.trace("[abr] Skipped level(s) "+L+"-"+N+' with CODECS:"'+y[N].attrs.CODECS+'"; not compatible with "'+b.attrs.CODECS+'"');var q=V.details,j=(h?q==null?void 0:q.partTarget:q==null?void 0:q.averagetargetduration)||D,ee=void 0;ee=P<=p?o*e:u*e;var z=y[P].maxBitrate,X=this.getTimeToLoadFrag(S,ee,z*j,q===void 0);if(H.trace("[abr] level:"+P+" adjustedbw-bitrate:"+Math.round(ee-z)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+r.toFixed(1)+" fetchDuration:"+X.toFixed(1)),ee>z&&(X===0||!oe(X)||A&&!this.bitrateTestDelay||X<r))return P}}return-1},M(d,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;var i=this.getNextABRAutoLevel();if(e!==-1){var r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),d}(),Bh=function(){function d(){this.chunks=[],this.dataLength=0}var s=d.prototype;return s.push=function(e){this.chunks.push(e),this.dataLength+=e.length},s.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(r,o){for(var u=new Uint8Array(o),c=0,f=0;f<r.length;f++){var h=r[f];u.set(h,c),c+=h.length}return u}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},d}(),jv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[audio-stream-controller]",_i)||this).videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.bufferedTrack=null,o.switchingTrack=null,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o.cachedTrackLoadedData=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.BUFFER_RESET,this.onBufferReset,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.BUFFER_RESET,this.onBufferReset,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var r=i.frag,o=i.id,u=i.initPTS,c=i.timescale;if(o==="main"){var f=r.cc;this.initPTS[r.cc]={baseTime:u,timescale:c},this.log("InitPTS for cc: "+f+" found from main: "+u),this.videoTrackCC=f,this.state===os&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Rt);var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i,this.state=Le):(this.loadedmetadata=!1,this.state=Ta),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case Le:this.doTickIdle();break;case Ta:var t,i=this.levels,r=this.trackId,o=i==null||(t=i[r])==null?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=os}break;case Gr:var u,c=performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Le);break;case os:var h=this.waitingData;if(h){var p=h.frag,y=h.part,b=h.cache,A=h.complete;if(this.initPTS[p.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Hr;var k={frag:p,part:y,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(k),A&&d.prototype._handleFragmentLoadComplete.call(this,k)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+p.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var D=this.getLoadPosition(),S=ce.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);Ja(S.end,this.config.maxFragLookUpTolerance,p)<0&&(this.log("Waiting fragment cc ("+p.cc+") @ "+p.start+" cancelled because another fragment at "+S.end+" is needed"),this.clearWaitingFragment())}}else this.state=Le}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Le)},e.resetLoadingState=function(){this.clearWaitingFragment(),d.prototype.resetLoadingState.call(this)},e.onTickEnd=function(){var t=this.media;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)},e.doTickIdle=function(){var t=this.hls,i=this.levels,r=this.media,o=this.trackId,u=t.config;if(i!=null&&i[o]&&(r||!this.startFragRequested&&u.startFragPrefetch)){var c=i[o],f=c.details;if(!f||f.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(f))this.state=Ta;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,ht,_i));var p=this.getFwdBufferInfo(h,_i);if(p!==null){var y=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,f))return t.trigger(w.BUFFER_EOS,{type:"audio"}),void(this.state=ss);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,et),k=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(k>=D)||b){var S=f.fragments[0].start,L=p.end;if(b&&r){var N=this.getLoadPosition();y&&b.attrs!==y.attrs&&(L=N),f.PTSKnown&&N<S&&(p.end>S||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=S+.05)}var P=this.getNextFragment(L,f),V=!1;if(P&&this.isLoopLoading(P,L)&&(V=!!P.gap,P=this.getNextFragmentLoopLoading(P,f,p,et,D)),P){var q=A&&P.start>A.end+f.targetduration;if(q||(A==null||!A.len)&&p.len){var j=this.getAppendedFrag(P.start,et);if(j===null||(V||(V=!!j.gap||!!q&&A.len===0),q&&!V||V&&p.nextStart&&p.nextStart<j.end))return}this.loadFragment(P,c,L)}else this.bufferFlushed=!0}}}}},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.min(Math.max(i,t),this.config.maxMaxBufferLength):i},e.onMediaDetaching=function(){this.videoBuffer=null,d.prototype.onMediaDetaching.call(this)},e.onAudioTracksUpdated=function(t,i){var r=i.audioTracks;this.resetTransmuxer(),this.levels=r.map(function(o){return new ga(o)})},e.onAudioTrackSwitching=function(t,i){var r=!!i.url;this.trackId=i.id;var o=this.fragCurrent;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=i,this.state=Le):(this.switchingTrack=null,this.bufferedTrack=i,this.state=Rt),this.tick()},e.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},e.onLevelLoaded=function(t,i){this.mainDetails=i.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(w.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var r;if(this.mainDetails!=null){var o=this.levels,u=i.details,c=i.id;if(o){this.log("Track "+c+" loaded ["+u.startSN+","+u.endSN+"]"+(u.lastPartSn?"[part-"+u.lastPartSn+"-"+u.lastPartIndex+"]":"")+",duration:"+u.totalduration);var f=o[c],h=0;if(u.live||(r=f.details)!=null&&r.live){var p=this.mainDetails;if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed||!p)return;!f.details&&u.hasProgramDateTime&&p.hasProgramDateTime?(wt(u,p),h=u.fragments[0].start):h=this.alignPlaylists(u,f.details)}f.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(f.details,h),this.state!==Ta||this.waitForCdnTuneIn(u)||(this.state=Le),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,o=t.part,u=t.payload,c=this.config,f=this.trackId,h=this.levels;if(h){var p=h[f];if(p){var y=p.details;if(!y)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new Uh(this.hls,_i,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var k=this.initPTS[r.cc],D=(i=r.initSegment)==null?void 0:i.data;if(k!==void 0){var S=o?o.index:-1,L=S!==-1,N=new he(r.level,r.sn,r.stats.chunkCount,u.byteLength,S,L);A.push(u,D,b,"",r,o,y.totalduration,!1,N,k)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+y.startSN+" ,"+y.endSN+"],track "+f),(this.waitingData=this.waitingData||{frag:r,part:o,cache:new Bh,complete:!1}).cache.push(new Uint8Array(u)),this.waitingVideoCC=this.videoTrackCC,this.state=os}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:d.prototype._handleFragmentLoadComplete.call(this,t)},e.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.onBufferCreated=function(t,i){var r=i.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var r,o=i.frag,u=i.part;if(o.type===_i)if(this.fragContextChanged(o))this.warn("Fragment "+o.sn+(u?" p: "+u.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(o.sn!=="initSegment"){this.fragPrevious=o;var c=this.switchingTrack;c&&(this.bufferedTrack=c,this.switchingTrack=null,this.hls.trigger(w.AUDIO_TRACK_SWITCHED,E({},c)))}this.fragBufferedComplete(o,u)}else this.loadedmetadata||o.type!==et||(r=this.videoBuffer||this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r;if(i.fatal)this.state=en;else switch(i.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_i,i);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ta||((r=i.context)==null?void 0:r.type)!==hi||(this.state=Le);break;case $.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="audio")return;this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.onBufferFlushed=function(t,i){i.type===ht&&(this.bufferFlushed=!0,this.state===ss&&(this.state=Le))},e._handleTransmuxComplete=function(t){var i,r="audio",o=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,y=f.level.details,b=u.audio,A=u.text,k=u.id3,D=u.initSegment;if(!this.fragContextChanged(h)&&y){if(this.state=yr,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){var S=h.initSegment||h;this._bufferInitSegment(D.tracks,S,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:r,tracks:D.tracks})}if(b){var L=b.startPTS,N=b.endPTS,P=b.startDTS,V=b.endDTS;p&&(p.elementaryStreams[ht]={startPTS:L,endPTS:N,startDTS:P,endDTS:V}),h.setElementaryStreamInfo(ht,L,N,P,V),this.bufferFragmentData(b,h,p,c)}if(k!=null&&(i=k.samples)!=null&&i.length){var q=F({id:r,frag:h,details:y},k);o.trigger(w.FRAG_PARSING_METADATA,q)}if(A){var j=F({id:r,frag:h,details:y},A);o.trigger(w.FRAG_PARSING_USERDATA,j)}}else this.fragmentTracker.removeFragment(h)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r){if(this.state===yr){t.video&&delete t.video;var o=t.audio;if(o){o.levelCodec=o.codec,o.id="audio",this.log("Init audio buffer, container:"+o.container+", codecs[parsed]=["+o.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,t);var u=o.initSegment;if(u!=null&&u.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:u};this.hls.trigger(w.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,r){var o,u=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||u===Z||u===ye?t.sn==="initSegment"?this._loadInitSegment(t,i):(o=i.details)!=null&&o.live&&!this.initPTS[t.cc]?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=os):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,r=this.media,o=this.bufferedTrack,u=o==null?void 0:o.attrs,c=t.attrs;r&&u&&(u.CHANNELS!==c.CHANNELS||u.NAME!==c.NAME||u.LANGUAGE!==c.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=t,this.switchingTrack=null,i.trigger(w.AUDIO_TRACK_SWITCHED,E({},t))},s}(Vd),zv=function(d){function s(t){var i;return(i=d.call(this,t,"[audio-track-controller]")||this).tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.registerListeners(),i}Q(s,d);var e=s.prototype;return e.registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,d.prototype.destroy.call(this)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.audioTracks||[]},e.onAudioTrackLoaded=function(t,i){var r=i.id,o=i.groupId,u=i.details,c=this.tracksInGroup[r];if(c&&c.groupId===o){var f=c.details;c.details=i.details,this.log("audio-track "+r+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+u.startSN+"-"+u.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Track with id:"+r+" and group:"+o+" not found in active group "+c.groupId)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.audioGroupIds){var r=i.audioGroupIds[i.urlId];if(this.groupId!==r){this.groupId=r||null;var o=this.tracks.filter(function(c){return!r||c.groupId===r});this.selectDefaultTrack&&!o.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=o;var u={audioTracks:o};this.log("Updating audio tracks, "+o.length+" track(s) found in group:"+r),this.hls.trigger(w.AUDIO_TRACKS_UPDATED,u),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===hi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(i))},e.setAudioTrack=function(t){var i=this.tracksInGroup;if(t<0||t>=i.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=this.currentTrack;i[this.trackId];var o=i[t],u=o.groupId,c=o.name;if(this.log("Switching to audio-track "+t+' "'+c+'" lang:'+o.lang+" group:"+u),this.trackId=t,this.currentTrack=o,this.selectDefaultTrack=!1,this.hls.trigger(w.AUDIO_TRACK_SWITCHING,E({},o)),!o.details||o.details.live){var f=this.switchParams(o.url,r==null?void 0:r.details);this.loadPlaylist(f)}}},e.selectInitialTrack=function(){var t=this.tracksInGroup,i=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(i!==-1)this.setAudioTrack(i);else{var r=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(r.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:r})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var o=i[r];if((!this.selectDefaultTrack||o.default)&&(!t||t.attrs["STABLE-RENDITION-ID"]!==void 0&&t.attrs["STABLE-RENDITION-ID"]===o.attrs["STABLE-RENDITION-ID"]||t.name===o.name&&t.lang===o.lang))return o.id}return-1},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,o=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist "+r+' "'+i.name+'" lang:'+i.lang+" group:"+o),this.clearTimer(),this.hls.trigger(w.AUDIO_TRACK_LOADING,{url:u,id:r,groupId:o,deliveryDirectives:t||null})}},M(s,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),s}(x);function Hh(d,s){if(d.length!==s.length)return!1;for(var e=0;e<d.length;e++)if(!Qv(d[e].attrs,s[e].attrs))return!1;return!0}function Qv(d,s){var e=d["STABLE-RENDITION-ID"];return e?e===s["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(function(t){return d[t]!==s[t]})}var Xv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[subtitle-stream-controller]",Ri)||this).levels=[],o.currentTrackId=-1,o.tracksBuffered=[],o.mainDetails=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=Le,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},e.onMediaDetaching=function(){this.tracksBuffered=[],d.prototype.onMediaDetaching.call(this)},e.onLevelLoaded=function(t,i){this.mainDetails=i.details},e.onSubtitleFragProcessed=function(t,i){var r=i.frag,o=i.success;if(this.fragPrevious=r,this.state=Le,o){var u=this.tracksBuffered[this.currentTrackId];if(u){for(var c,f=r.start,h=0;h<u.length;h++)if(f>=u[h].start&&f<=u[h].end){c=u[h];break}var p=r.start+r.duration;c?c.end=p:(c={start:f,end:p},u.push(c)),this.fragmentTracker.fragBuffered(r)}}},e.onBufferFlushing=function(t,i){var r=i.startOffset,o=i.endOffset;if(r===0&&o!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,c=this.levels;if(!c.length||!c[u]||!c[u].details)return;var f=o-c[u].details.targetduration;if(f<=0)return;i.endOffsetSubtitles=Math.max(0,f),this.tracksBuffered.forEach(function(h){for(var p=0;p<h.length;)if(h[p].end<=f)h.shift();else{if(!(h[p].start<f))break;h[p].start=f,p++}}),this.fragmentTracker.removeFragmentsInRange(r,f,Ri)}},e.onFragBuffered=function(t,i){var r;this.loadedmetadata||i.frag.type!==et||(r=this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r=i.frag;(r==null?void 0:r.type)===Ri&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Rt&&(this.state=Le))},e.onSubtitleTracksUpdated=function(t,i){var r=this,o=i.subtitleTracks;Hh(this.levels,o)?this.levels=o.map(function(u){return new ga(u)}):(this.tracksBuffered=[],this.levels=o.map(function(u){var c=new ga(u);return r.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ri),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var r,o=i.details,u=i.id,c=this.currentTrackId,f=this.levels;if(f.length){var h=f[c];if(!(u>=f.length||u!==c)&&h){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(o.live||(r=h.details)!=null&&r.live){var y=this.mainDetails;if(o.deltaUpdateFailed||!y)return;var b=y.fragments[0];h.details?(p=this.alignPlaylists(o,h.details))===0&&b&&Ea(o,p=b.start):o.hasProgramDateTime&&y.hasProgramDateTime?(wt(o,y),p=o.fragments[0].start):b&&Ea(o,p=b.start)}h.details=o,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(h.details,p),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Le&&(ba(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},e._handleFragmentLoadComplete=function(t){var i=this,r=t.frag,o=t.payload,u=r.decryptdata,c=this.hls;if(!this.fragContextChanged(r)&&o&&o.byteLength>0&&u&&u.key&&u.iv&&u.method==="AES-128"){var f=performance.now();this.decrypter.decrypt(new Uint8Array(o),u.key.buffer,u.iv.buffer).catch(function(h){throw c.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:r}),h}).then(function(h){var p=performance.now();c.trigger(w.FRAG_DECRYPTED,{frag:r,payload:h,stats:{tstart:f,tdecrypt:p}})}).catch(function(h){i.warn(h.name+": "+h.message),i.state=Le})}},e.doTick=function(){if(this.media){if(this.state===Le){var t=this.currentTrackId,i=this.levels,r=i[t];if(!i.length||!r||!r.details)return;var o=r.details,u=o.targetduration,c=this.config,f=this.getLoadPosition(),h=ce.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],f-u,c.maxBufferHole),p=h.end,y=h.len,b=this.getFwdBufferInfo(this.media,et);if(y>this.getMaxBufferLength(b==null?void 0:b.len)+u)return;var A=o.fragments,k=A.length,D=o.edge,S=null,L=this.fragPrevious;if(p<D){var N=c.maxFragLookUpTolerance;!(S=ba(L,A,Math.max(A[0].start,p),N))&&L&&L.start<A[0].start&&(S=A[0])}else S=A[k-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===Z&&this.loadFragment(S,r,p)}}else this.state=Le},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,r){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new Zv(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Vd),Zv=function(d){this.buffered=void 0;var s=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 s("end",e,d.length)},start:function(e){return s("start",e,d.length)}}},Jv=function(d){function s(t){var i;return(i=d.call(this,t,"[subtitle-track-controller]")||this).media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.registerListeners(),i}Q(s,d);var e=s.prototype;return e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},e.registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.onMediaAttached=function(t,i){this.media=i.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))},e.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},e.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),tu(this.media.textTracks).forEach(function(t){Br(t)}),this.subtitleTrack=-1,this.media=null)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.subtitleTracks},e.onSubtitleTrackLoaded=function(t,i){var r=i.id,o=i.details,u=this.trackId,c=this.tracksInGroup[u];if(c){var f=c.details;c.details=i.details,this.log("subtitle track "+r+" loaded ["+o.startSN+"-"+o.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Invalid subtitle track id "+r)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.textGroupIds){var r=i.textGroupIds[i.urlId],o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==r){var u=this.tracks.filter(function(h){return!r||h.groupId===r});this.tracksInGroup=u;var c=this.findTrackId(o==null?void 0:o.name)||this.findTrackId();this.groupId=r||null;var f={subtitleTracks:u};this.log("Updating subtitle tracks, "+u.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(w.SUBTITLE_TRACKS_UPDATED,f),c!==-1&&this.setSubtitleTrack(c,o)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId,o)}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var o=i[r];if((!this.selectDefaultTrack||o.default)&&(!t||t===o.name))return o.id}return-1},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===Ki&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.checkRetry(i)},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,o=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(w.SUBTITLE_TRACK_LOADING,{url:u,id:r,groupId:o,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,r=this.media,o=this.trackId;if(r){var u=tu(r.textTracks),c=u.filter(function(p){return p.groupId===i.groupId});if(t===-1)[].slice.call(u).forEach(function(p){p.mode="disabled"});else{var f=c[o];f&&(f.mode="disabled")}var h=c[t];h&&(h.mode=this.subtitleDisplay?"showing":"hidden")}},e.setSubtitleTrack=function(t,i){var r,o=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(r=o[t])!=null&&r.details)||t<-1||t>=o.length)){this.clearTimer();var u=o[t];if(this.log("Switching to subtitle-track "+t+(u?' "'+u.name+'" lang:'+u.lang+" group:"+u.groupId:"")),this.trackId=t,u){var c=u.id,f=u.groupId,h=f===void 0?"":f,p=u.name,y=u.type,b=u.url;this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:c,groupId:h,name:p,type:y,url:b});var A=this.switchParams(u.url,i==null?void 0:i.details);this.loadPlaylist(A)}else this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},e.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,i=tu(this.media.textTracks),r=0;r<i.length;r++)if(i[r].mode==="hidden")t=r;else if(i[r].mode==="showing"){t=r;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},M(s,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,i)}}]),s}(x);function tu(d){for(var s=[],e=0;e<d.length;e++){var t=d[e];t.kind!=="subtitles"&&t.kind!=="captions"||!t.label||s.push(d[e])}return s}var eg=function(){function d(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var s=d.prototype;return s.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},s.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},s.appendBlocker=function(e){var t,i=new Promise(function(o){t=o}),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,r=t[e],o=i[e];if(o.length){var u=o[0];try{u.execute()}catch(c){H.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(c),r!=null&&r.updating||(o.shift(),this.executeNext(e))}}},s.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},s.current=function(e){return this.queues[e][0]},d}(),Gh=$a(),Vh=/([ha]vc.)(?:\.[^.,]+)+/,tg=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.media,r=t.mediaSource;H.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(w.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){H.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){H.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,r=t._objectUrl;i&&i.src!==r&&H.error("Media element src was set while attaching MediaSource ("+r+" > "+i.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var s=d.prototype;return s.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},s.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_RESET,this.onBufferReset,this),e.on(w.BUFFER_APPENDING,this.onBufferAppending,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.BUFFER_EOS,this.onBufferEos,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(w.FRAG_PARSED,this.onFragParsed,this),e.on(w.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_RESET,this.onBufferReset,this),e.off(w.BUFFER_APPENDING,this.onBufferAppending,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.BUFFER_EOS,this.onBufferEos,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(w.FRAG_PARSED,this.onFragParsed,this),e.off(w.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new eg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},s.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},s.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,H.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Gh){var r=this.mediaSource=new Gh;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}},s.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(H.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){H.warn("[buffer-controller]: onMediaDetaching: "+r.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):H.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(w.MEDIA_DETACHED,void 0)},s.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(r){H.warn("[buffer-controller]: Failed to reset the "+t+" buffer",r)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,r=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(o){if(r){var u=i.tracks[o];if(u&&typeof u.buffer.changeType=="function"){var c=t[o],f=c.id,h=c.codec,p=c.levelCodec,y=c.container,b=c.metadata,A=(u.levelCodec||u.codec).replace(Vh,"$1"),k=(p||h).replace(Vh,"$1");if(A!==k){var D=y+";codecs="+(p||h);i.appendChangeType(o,D),H.log("[buffer-controller]: switching codec "+A+" to "+k),i.tracks[o]={buffer:u.buffer,codec:h,container:y,levelCodec:p,metadata:b,id:f}}}}else i.pendingTracks[o]=t[o]}),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,r=this.operationQueue,o={execute:function(){var u=i.sourceBuffer[e];u&&(H.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),u.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(u){H.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",u)}};r.append(o,e)},s.onBufferAppending=function(e,t){var i=this,r=this.hls,o=this.operationQueue,u=this.tracks,c=t.data,f=t.type,h=t.frag,p=t.part,y=t.chunkMeta,b=y.buffering[f],A=self.performance.now();b.start=A;var k=h.stats.buffering,D=p?p.stats.buffering:null;k.start===0&&(k.start=A),D&&D.start===0&&(D.start=A);var S=u.audio,L=!1;f==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||y.id===1||this.lastMpegAudioChunk.sn!==y.sn,this.lastMpegAudioChunk=y);var N=h.start,P={execute:function(){if(b.executeStart=self.performance.now(),L){var V=i.sourceBuffer[f];if(V){var q=N-V.timestampOffset;Math.abs(q)>=.1&&(H.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+q+") sn: "+h.sn+")"),V.timestampOffset=N)}}i.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,k.first===0&&(k.first=V),D&&D.first===0&&(D.first=V);var q=i.sourceBuffer,j={};for(var ee in q)j[ee]=ce.getBuffered(q[ee]);i.appendError=0,i.hls.trigger(w.BUFFER_APPENDED,{type:f,frag:h,part:p,chunkMeta:y,parent:h.type,timeRanges:j})},onError:function(V){H.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",V);var q={type:le.MEDIA_ERROR,parent:h.type,details:$.BUFFER_APPEND_ERROR,frag:h,part:p,chunkMeta:y,error:V,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?q.details=$.BUFFER_FULL_ERROR:(i.appendError++,q.details=$.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(H.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),q.fatal=!0)),r.trigger(w.ERROR,q)}};o.append(P,f)},s.onBufferFlushing=function(e,t){var i=this,r=this.operationQueue,o=function(u){return{execute:i.removeExecutor.bind(i,u,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(w.BUFFER_FLUSHED,{type:u})},onError:function(c){H.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",c)}}};t.type?r.append(o(t.type),t.type):this.getSourceBufferTypes().forEach(function(u){r.append(o(u),u)})},s.onFragParsed=function(e,t){var i=this,r=t.frag,o=t.part,u=[],c=o?o.elementaryStreams:r.elementaryStreams;c[Qi]?u.push("audiovideo"):(c[ht]&&u.push("audio"),c[Tt]&&u.push("video")),u.length===0&&H.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var f=self.performance.now();r.stats.buffering.end=f,o&&(o.stats.buffering.end=f);var h=o?o.stats:r.stats;i.hls.trigger(w.FRAG_BUFFERED,{frag:r,part:o,stats:h,id:r.type})},u)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(r,o){var u=i.sourceBuffer[o];return!u||t.type&&t.type!==o||(u.ending=!0,u.ended||(u.ended=!0,H.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),r&&!(u&&!u.ended)},!0)&&(H.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(o){var u=i.sourceBuffer[o];u&&(u.ending=!1)});var r=i.mediaSource;r&&r.readyState==="open"?(H.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()):r&&H.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+r.readyState)}))},s.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())},s.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,r=this.sourceBuffer;if(i&&t!==null){var o=this.getSourceBufferTypes();if(o.length){var u=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(oe(u)&&!(u<0)){var c=i.currentTime,f=t.levelTargetDuration,h=Math.max(u,f),p=Math.floor(c/f)*f-h;o.forEach(function(y){var b=r[y];if(b){var A=ce.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(w.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(w.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*f)return void H.info("[buffer-controller]: Cannot flush "+y+" back buffer while SourceBuffer is in ended state");e.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:y})}}})}}}},s.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,r=this.mediaSource,o=e.fragments[0].start+e.totalduration,u=i.duration,c=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(H.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(o>c&&o>u||!oe(u))&&(H.log("[buffer-controller]: Updating Media Source duration to "+o.toFixed(3)),r.duration=o)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var r=Math.max(0,i[0].start),o=Math.max(r,r+e.totalduration);t.setLiveSeekableRange(r,o)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(w.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(function(c){t.executeNext(c)});else{var u=new Error("could not create source buffer for media codec(s)");this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:u,reason:u.message})}}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(var r in e)if(!t[r]){var o=e[r];if(!o)throw Error("source buffer exists for track "+r+", however track does not");var u=o.levelCodec||o.codec,c=o.container+";codecs="+u;H.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=t[r]=i.addSourceBuffer(c),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[r]={buffer:f,codec:u,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(p){H.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:c})}}},s._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},s._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},s._onSBUpdateError=function(e,t){var i=new Error(e+" SourceBuffer error");H.error("[buffer-controller]: "+i,t),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},s.removeExecutor=function(e,t,i){var r=this.media,o=this.mediaSource,u=this.operationQueue,c=this.sourceBuffer[e];if(!r||!o||!c)return H.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void u.shiftAndExecuteNext(e);var f=oe(r.duration)?r.duration:1/0,h=oe(o.duration)?o.duration:1/0,p=Math.max(0,t),y=Math.min(i,f,h);y>p&&!c.ending?(c.ended=!1,H.log("[buffer-controller]: Removing ["+p+","+y+"] from the "+e+" SourceBuffer"),c.remove(p,y)):u.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];if(!r)return H.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);r.ended=!1,r.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return H.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var r=this.operationQueue,o=t.map(function(u){return r.appendBlocker(u)});Promise.all(o).then(function(){e(),t.forEach(function(u){var c=i.sourceBuffer[u];c!=null&&c.updating||r.shiftAndExecuteNext(u)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];if(r){var o=i.bind(this,e);this.listeners[e].push({event:t,listener:o}),r.addEventListener(t,o)}},s.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},d}(),Kh={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},Wh=function(d){var s=d;return Kh.hasOwnProperty(d)&&(s=Kh[d]),String.fromCharCode(s)},Sa=15,br=100,ig={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},rg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ag={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ng={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],og=function(){function d(){this.time=null,this.verboseLevel=0}return d.prototype.log=function(s,e){if(this.verboseLevel>=s){var t=typeof e=="function"?e():e;H.log(this.time+" ["+s+"] "+t)}},d}(),ka=function(d){for(var s=[],e=0;e<d.length;e++)s.push(d[e].toString(16));return s},qh=function(){function d(e,t,i,r,o){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=r||"black",this.flash=o||!1}var s=d.prototype;return s.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},s.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},s.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},s.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},s.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},s.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),lg=function(){function d(e,t,i,r,o,u){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new qh(t,i,r,o,u)}var s=d.prototype;return s.reset=function(){this.uchar=" ",this.penState.reset()},s.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},s.setPenState=function(e){this.penState.copy(e)},s.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},s.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},s.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),dg=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<br;t++)this.chars.push(new lg);this.logger=e,this.pos=0,this.currPenState=new qh}var s=d.prototype;return s.equals=function(e){for(var t=!0,i=0;i<br;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<br;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<br;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},s.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>br&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=br)},s.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)},s.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},s.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=Wh(e);this.pos>=br?this.logger.log(0,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))},s.clearFromPos=function(e){var t;for(t=e;t<br;t++)this.chars[t].reset()},s.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},s.clearToEndOfRow=function(){this.clearFromPos(this.pos)},s.getTextString=function(){for(var e=[],t=!0,i=0;i<br;i++){var r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),iu=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<Sa;t++)this.rows.push(new dg(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var s=d.prototype;return s.reset=function(){for(var e=0;e<Sa;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<Sa;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<Sa;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<Sa;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},s.backSpace=function(){this.rows[this.currRow].backSpace()},s.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},s.insertChar=function(e){this.rows[this.currRow].insertChar(e)},s.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},s.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},s.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},s.setPAC=function(e){this.logger.log(2,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<Sa;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var u=o.rows[r].cueStartTime,c=this.logger.time;if(u&&c!==null&&u<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[t-this.nrRollUpRows+f+1].copy(o.rows[r+f])}}this.currRow=t;var h=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,y=Math.max(p-1,0);h.setCursor(e.indent),e.color=h.chars[y].penState.foreground}var b={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(b)},s.setBkgData=function(e){this.logger.log(2,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},s.setRollUpRows=function(e){this.nrRollUpRows=e},s.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(1,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(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},s.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=-1,o=0;o<Sa;o++){var u=this.rows[o].getTextString();u&&(r=o+1,e?t.push("Row "+r+": '"+u+"'"):t.push(u.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
34
- `)),i},s.getTextAndFormat=function(){return this.rows},d}(),Yh=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 iu(i),this.nonDisplayedMemory=new iu(i),this.lastOutputScreen=new iu(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var s=d.prototype;return s.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},s.getHandler=function(){return this.outputFilter},s.setHandler=function(e){this.outputFilter=e},s.setPAC=function(e){this.writeScreen.setPAC(e)},s.setBkgData=function(e){this.writeScreen.setBkgData(e)},s.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,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)},s.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return r+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},s.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},s.ccBS=function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},s.ccAOF=function(){},s.ccAON=function(){},s.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},s.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},s.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},s.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},s.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},s.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},s.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},s.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},s.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},s.ccEOC=function(){var e=this;if(this.logger.log(2,"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(1,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},s.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},s.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(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},s.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))},s.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},d}(),$h=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new og;this.channels=[null,new Yh(e,t,r),new Yh(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var s=d.prototype;return s.getHandler=function(e){return this.channels[e].getHandler()},s.setHandler=function(e,t){this.channels[e].setHandler(t)},s.addData=function(e,t){var i,r,o,u=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(r=127&t[c],o=127&t[c+1],r!==0||o!==0){if(this.logger.log(3,"["+ka([t[c],t[c+1]])+"] -> ("+ka([r,o])+")"),(i=this.parseCmd(r,o))||(i=this.parseMidrow(r,o)),i||(i=this.parsePAC(r,o)),i||(i=this.parseBackgroundAttributes(r,o)),!i&&(u=this.parseChars(r,o))){var f=this.currentChannel;f&&f>0?this.channels[f].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||u||this.logger.log(2,"Couldn't parse cleaned data "+ka([r,o])+" orig: "+ka([t[c],t[c+1]]))}},s.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(jh(e,t,i))return nn(null,null,i),this.logger.log(3,"Repeated command ("+ka([e,t])+") is dropped"),!0;var r=e===20||e===21||e===23?1:2,o=this.channels[r];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),nn(e,t,i),this.currentChannel=r,!0},s.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(0,"Mismatch channel in midrow parsing"),!1;var r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+ka([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,r=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(jh(e,t,r))return nn(null,null,r),!0;var o=e<=23?1:2;i=t>=64&&t<=95?o===1?ig[e]:ag[e]:o===1?rg[e]:ng[e];var u=this.channels[o];return!!u&&(u.setPAC(this.interpretPAC(i,t)),nn(e,t,r),this.currentChannel=o,!0)},s.interpretPAC=function(e,t){var i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,r.underline=(1&i)==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},s.parseChars=function(e,t){var i,r,o=null,u=null;if(e>=25?(i=2,u=e-8):(i=1,u=e),u>=17&&u<=19?(r=u===17?t+80:u===18?t+112:t+144,this.logger.log(2,"Special char '"+Wh(r)+"' in channel "+i),o=[r]):e>=32&&e<=127&&(o=t===0?[e]:[e,t]),o){var c=ka(o);this.logger.log(3,"Char codes = "+c.join(",")),nn(e,t,this.cmdHistory)}return o},s.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 r={};e===16||e===24?(i=Math.floor((t-32)/2),r.background=sg[i],t%2==1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(r),nn(e,t,this.cmdHistory),!0},s.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}},s.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},d}();function nn(d,s,e){e.a=d,e.b=s}function jh(d,s,e){return e.a===d&&e.b===s}var Vo=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 s=d.prototype;return s.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},s.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)},s.reset=function(){this.cueRanges=[],this.startTime=null},d}(),ru=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var d=["","lr","rl"],s=["start","middle","end","left","right"];function e(o,u){if(typeof u!="string"||!Array.isArray(o))return!1;var c=u.toLowerCase();return!!~o.indexOf(c)&&c}function t(o){return e(s,o)}function i(o){for(var u=arguments.length,c=new Array(u>1?u-1:0),f=1;f<u;f++)c[f-1]=arguments[f];for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var y in p)o[y]=p[y]}return o}function r(o,u,c){var f=this,h={enumerable:!0};f.hasBeenReset=!1;var p="",y=!1,b=o,A=u,k=c,D=null,S="",L=!0,N="auto",P="start",V=50,q="middle",j=50,ee="middle";Object.defineProperty(f,"id",i({},h,{get:function(){return p},set:function(z){p=""+z}})),Object.defineProperty(f,"pauseOnExit",i({},h,{get:function(){return y},set:function(z){y=!!z}})),Object.defineProperty(f,"startTime",i({},h,{get:function(){return b},set:function(z){if(typeof z!="number")throw new TypeError("Start time must be set to a number.");b=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},h,{get:function(){return A},set:function(z){if(typeof z!="number")throw new TypeError("End time must be set to a number.");A=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},h,{get:function(){return k},set:function(z){k=""+z,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},h,{get:function(){return D},set:function(z){D=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},h,{get:function(){return S},set:function(z){var X=function(ue){return e(d,ue)}(z);if(X===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},h,{get:function(){return L},set:function(z){L=!!z,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},h,{get:function(){return N},set:function(z){if(typeof z!="number"&&z!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},h,{get:function(){return P},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");P=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},h,{get:function(){return V},set:function(z){if(z<0||z>100)throw new Error("Position must be between 0 and 100.");V=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},h,{get:function(){return q},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");q=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},h,{get:function(){return j},set:function(z){if(z<0||z>100)throw new Error("Size must be between 0 and 100.");j=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},h,{get:function(){return ee},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");ee=X,this.hasBeenReset=!0}})),f.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}(),ug=function(){function d(){}return d.prototype.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},d}();function zh(d){function s(t,i,r,o){return 3600*(0|t)+60*(0|i)+(0|r)+parseFloat(o||0)}var e=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?s(e[2],e[3],0,e[4]):s(e[1],e[2],e[3],e[4]):null}var cg=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},s.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},s.has=function(e){return e in this.values},s.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},s.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},s.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 Qh(d,s,e,t){var i=t?d.split(t):[d];for(var r in i)if(typeof i[r]=="string"){var o=i[r].split(e);o.length===2&&s(o[0],o[1])}}var au=new ru(0,0,""),Ko=au.align==="middle"?"middle":"center";function hg(d,s,e){var t=d;function i(){var o=zh(d);if(o===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),o}function r(){d=d.replace(/^\s+/,"")}if(r(),s.startTime=i(),r(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),r(),s.endTime=i(),r(),function(o,u){var c=new cg;Qh(o,function(p,y){var b;switch(p){case"region":for(var A=e.length-1;A>=0;A--)if(e[A].id===y){c.set(p,e[A].region);break}break;case"vertical":c.alt(p,y,["rl","lr"]);break;case"line":b=y.split(","),c.integer(p,b[0]),c.percent(p,b[0])&&c.set("snapToLines",!1),c.alt(p,b[0],["auto"]),b.length===2&&c.alt("lineAlign",b[1],["start",Ko,"end"]);break;case"position":b=y.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Ko,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,y);break;case"align":c.alt(p,y,["start",Ko,"end","left","right"])}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&au.line===-1&&(f=-1),u.line=f,u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100),u.align=c.get("align",Ko);var h=c.get("position","auto");h==="auto"&&au.position===50&&(h=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=h}(d,s)}function Xh(d){return d.replace(/<br(?: \/)?>/gi,`
35
- `)}var fg=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new ug,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(e){var t=this;function i(){var f=t.buffer,h=0;for(f=Xh(f);h<f.length&&f[h]!=="\r"&&f[h]!==`
33
+ Aborting and switching to level `+Q),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(k.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part,o=a?a.stats:i.stats;if(i.type===rt&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var d=a?a.duration:i.duration,c=this.hls.levels[i.level],f=(c.loaded?c.loaded.bytes:0)+o.loaded,h=(c.loaded?c.loaded.duration:0)+d;c.loaded={bytes:f,duration:h},c.realBitrate=Math.round(8*f/h)}if(i.bitrateTest){var p={stats:o,frag:i,part:a,id:i.type};this.onFragBuffered(k.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,a=t.part,o=a!=null&&a.stats.loaded?a.stats:i.stats;if(!o.aborted&&!this.ignoreFragment(i)){var d=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(d,o.loaded),o.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0}},s.ignoreFragment=function(e){return e.type!==rt||e.sn==="initSegment"},s.clearTimer=function(){self.clearInterval(this.timer)},s.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,a=i.maxAutoLevel,o=i.config,d=i.minAutoLevel,c=i.media,f=t?t.duration:e?e.duration:0,h=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():o.abrEwmaDefaultEstimate,E=i.mainForwardBufferInfo,b=(E?E.len:0)/h,A=this.findBestLevel(p,d,a,b,o.abrBandWidthFactor,o.abrBandWidthUpFactor);if(A>=0)return A;U.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var w=f?Math.min(f,o.maxStarvationDelay):o.maxStarvationDelay,D=o.abrBandWidthFactor,S=o.abrBandWidthUpFactor;if(!b){var L=this.bitrateTestDelay;L&&(w=(f?Math.min(f,o.maxLoadingDelay):o.maxLoadingDelay)-L,U.trace("[abr] bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*w)+" ms"),D=S=1)}return A=this.findBestLevel(p,d,a,b+w,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,a,o,d){for(var c,f=this.fragCurrent,h=this.partCurrent,p=this.lastLoadedFragLevel,E=this.hls.levels,b=E[p],A=!(b==null||(c=b.details)==null||!c.live),w=b==null?void 0:b.codecSet,D=h?h.duration:f?f.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,L=t,N=-1,P=i;P>=t;P--){var V=E[P];if(!V||w&&V.codecSet!==w)V&&(L=Math.min(P,L),N=Math.max(P,N));else{N!==-1&&U.trace("[abr] Skipped level(s) "+L+"-"+N+' with CODECS:"'+E[N].attrs.CODECS+'"; not compatible with "'+b.attrs.CODECS+'"');var Y=V.details,j=(h?Y==null?void 0:Y.partTarget:Y==null?void 0:Y.averagetargetduration)||D,ie=void 0;ie=P<=p?o*e:d*e;var Q=E[P].maxBitrate,X=this.getTimeToLoadFrag(S,ie,Q*j,Y===void 0);if(U.trace("[abr] level:"+P+" adjustedbw-bitrate:"+Math.round(ie-Q)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+a.toFixed(1)+" fetchDuration:"+X.toFixed(1)),ie>Q&&(X===0||!re(X)||A&&!this.bitrateTestDelay||X<a))return P}}return-1},M(u,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;var i=this.getNextABRAutoLevel();if(e!==-1){var a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),u}(),Qh=function(){function u(){this.chunks=[],this.dataLength=0}var s=u.prototype;return s.push=function(e){this.chunks.push(e),this.dataLength+=e.length},s.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(a,o){for(var d=new Uint8Array(o),c=0,f=0;f<a.length;f++){var h=a[f];d.set(h,c),c+=h.length}return d}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},u}(),sg=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[audio-stream-controller]",Ri)||this).videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.bufferedTrack=null,o.switchingTrack=null,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o.cachedTrackLoadedData=null,o._registerListeners(),o}z(s,u);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},e._registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.BUFFER_RESET,this.onBufferReset,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.BUFFER_RESET,this.onBufferReset,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var a=i.frag,o=i.id,d=i.initPTS,c=i.timescale;if(o==="main"){var f=a.cc;this.initPTS[a.cc]={baseTime:d,timescale:c},this.log("InitPTS for cc: "+f+" found from main: "+d),this.videoTrackCC=f,this.state===bs&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Ut);var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i,this.state=De):(this.loadedmetadata=!1,this.state=Ca),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case De:this.doTickIdle();break;case Ca:var t,i=this.levels,a=this.trackId,o=i==null||(t=i[a])==null?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=bs}break;case Zr:var d,c=performance.now(),f=this.retryDate;(!f||c>=f||(d=this.media)!=null&&d.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=De);break;case bs:var h=this.waitingData;if(h){var p=h.frag,E=h.part,b=h.cache,A=h.complete;if(this.initPTS[p.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Xr;var w={frag:p,part:E,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(w),A&&u.prototype._handleFragmentLoadComplete.call(this,w)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+p.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var D=this.getLoadPosition(),S=he.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);cn(S.end,this.config.maxFragLookUpTolerance,p)<0&&(this.log("Waiting fragment cc ("+p.cc+") @ "+p.start+" cancelled because another fragment at "+S.end+" is needed"),this.clearWaitingFragment())}}else this.state=De}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=De)},e.resetLoadingState=function(){this.clearWaitingFragment(),u.prototype.resetLoadingState.call(this)},e.onTickEnd=function(){var t=this.media;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)},e.doTickIdle=function(){var t=this.hls,i=this.levels,a=this.media,o=this.trackId,d=t.config;if(i!=null&&i[o]&&(a||!this.startFragRequested&&d.startFragPrefetch)){var c=i[o],f=c.details;if(!f||f.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(f))this.state=Ca;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,gt,Ri));var p=this.getFwdBufferInfo(h,Ri);if(p!==null){var E=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,f))return t.trigger(k.BUFFER_EOS,{type:"audio"}),void(this.state=ys);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,rt),w=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(w>=D)||b){var S=f.fragments[0].start,L=p.end;if(b&&a){var N=this.getLoadPosition();E&&b.attrs!==E.attrs&&(L=N),f.PTSKnown&&N<S&&(p.end>S||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=S+.05)}var P=this.getNextFragment(L,f),V=!1;if(P&&this.isLoopLoading(P,L)&&(V=!!P.gap,P=this.getNextFragmentLoopLoading(P,f,p,rt,D)),P){var Y=A&&P.start>A.end+f.targetduration;if(Y||(A==null||!A.len)&&p.len){var j=this.getAppendedFrag(P.start,rt);if(j===null||(V||(V=!!j.gap||!!Y&&A.len===0),Y&&!V||V&&p.nextStart&&p.nextStart<j.end))return}this.loadFragment(P,c,L)}else this.bufferFlushed=!0}}}}},e.getMaxBufferLength=function(t){var i=u.prototype.getMaxBufferLength.call(this);return t?Math.min(Math.max(i,t),this.config.maxMaxBufferLength):i},e.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},e.onAudioTracksUpdated=function(t,i){var a=i.audioTracks;this.resetTransmuxer(),this.levels=a.map(function(o){return new wa(o)})},e.onAudioTrackSwitching=function(t,i){var a=!!i.url;this.trackId=i.id;var o=this.fragCurrent;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),a?this.setInterval(100):this.resetTransmuxer(),a?(this.switchingTrack=i,this.state=De):(this.switchingTrack=null,this.bufferedTrack=i,this.state=Ut),this.tick()},e.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},e.onLevelLoaded=function(t,i){this.mainDetails=i.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(k.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var a;if(this.mainDetails!=null){var o=this.levels,d=i.details,c=i.id;if(o){this.log("Track "+c+" loaded ["+d.startSN+","+d.endSN+"]"+(d.lastPartSn?"[part-"+d.lastPartSn+"-"+d.lastPartIndex+"]":"")+",duration:"+d.totalduration);var f=o[c],h=0;if(d.live||(a=f.details)!=null&&a.live){var p=this.mainDetails;if(d.fragments[0]||(d.deltaUpdateFailed=!0),d.deltaUpdateFailed||!p)return;!f.details&&d.hasProgramDateTime&&p.hasProgramDateTime?(Ot(d,p),h=d.fragments[0].start):h=this.alignPlaylists(d,f.details)}f.details=d,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&d.live||this.setStartPosition(f.details,h),this.state!==Ca||this.waitForCdnTuneIn(d)||(this.state=De),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,a=t.frag,o=t.part,d=t.payload,c=this.config,f=this.trackId,h=this.levels;if(h){var p=h[f];if(p){var E=p.details;if(!E)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(a.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new zh(this.hls,Ri,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var w=this.initPTS[a.cc],D=(i=a.initSegment)==null?void 0:i.data;if(w!==void 0){var S=o?o.index:-1,L=S!==-1,N=new fe(a.level,a.sn,a.stats.chunkCount,d.byteLength,S,L);A.push(d,D,b,"",a,o,E.totalduration,!1,N,w)}else this.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+E.startSN+" ,"+E.endSN+"],track "+f),(this.waitingData=this.waitingData||{frag:a,part:o,cache:new Qh,complete:!1}).cache.push(new Uint8Array(d)),this.waitingVideoCC=this.videoTrackCC,this.state=bs}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},e._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:u.prototype._handleFragmentLoadComplete.call(this,t)},e.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.onBufferCreated=function(t,i){var a=i.tracks.audio;a&&(this.mediaBuffer=a.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var a,o=i.frag,d=i.part;if(o.type===Ri)if(this.fragContextChanged(o))this.warn("Fragment "+o.sn+(d?" p: "+d.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(o.sn!=="initSegment"){this.fragPrevious=o;var c=this.switchingTrack;c&&(this.bufferedTrack=c,this.switchingTrack=null,this.hls.trigger(k.AUDIO_TRACK_SWITCHED,y({},c)))}this.fragBufferedComplete(o,d)}else this.loadedmetadata||o.type!==rt||(a=this.videoBuffer||this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;else switch(i.details){case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ri,i);break;case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ca||((a=i.context)==null?void 0:a.type)!==yi||(this.state=De);break;case W.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="audio")return;this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case W.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.onBufferFlushed=function(t,i){i.type===gt&&(this.bufferFlushed=!0,this.state===ys&&(this.state=De))},e._handleTransmuxComplete=function(t){var i,a="audio",o=this.hls,d=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level.details,b=d.audio,A=d.text,w=d.id3,D=d.initSegment;if(!this.fragContextChanged(h)&&E){if(this.state=kr,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){var S=h.initSegment||h;this._bufferInitSegment(D.tracks,S,c),o.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:a,tracks:D.tracks})}if(b){var L=b.startPTS,N=b.endPTS,P=b.startDTS,V=b.endDTS;p&&(p.elementaryStreams[gt]={startPTS:L,endPTS:N,startDTS:P,endDTS:V}),h.setElementaryStreamInfo(gt,L,N,P,V),this.bufferFragmentData(b,h,p,c)}if(w!=null&&(i=w.samples)!=null&&i.length){var Y=H({id:a,frag:h,details:E},w);o.trigger(k.FRAG_PARSING_METADATA,Y)}if(A){var j=H({id:a,frag:h,details:E},A);o.trigger(k.FRAG_PARSING_USERDATA,j)}}else this.fragmentTracker.removeFragment(h)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a){if(this.state===kr){t.video&&delete t.video;var o=t.audio;if(o){o.levelCodec=o.codec,o.id="audio",this.log("Init audio buffer, container:"+o.container+", codecs[parsed]=["+o.codec+"]"),this.hls.trigger(k.BUFFER_CODECS,t);var d=o.initSegment;if(d!=null&&d.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:a,parent:i.type,data:d};this.hls.trigger(k.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,a){var o,d=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||d===Z||d===Te?t.sn==="initSegment"?this._loadInitSegment(t,i):(o=i.details)!=null&&o.live&&!this.initPTS[t.cc]?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=bs):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,t,i,a)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,a=this.media,o=this.bufferedTrack,d=o==null?void 0:o.attrs,c=t.attrs;a&&d&&(d.CHANNELS!==c.CHANNELS||d.NAME!==c.NAME||d.LANGUAGE!==c.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=t,this.switchingTrack=null,i.trigger(k.AUDIO_TRACK_SWITCHED,y({},t))},s}(Ju),og=function(u){function s(t){var i;return(i=u.call(this,t,"[audio-track-controller]")||this).tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.registerListeners(),i}z(s,u);var e=s.prototype;return e.registerListeners=function(){var t=this.hls;t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,u.prototype.destroy.call(this)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.audioTracks||[]},e.onAudioTrackLoaded=function(t,i){var a=i.id,o=i.groupId,d=i.details,c=this.tracksInGroup[a];if(c&&c.groupId===o){var f=c.details;c.details=i.details,this.log("audio-track "+a+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+d.startSN+"-"+d.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,f)}else this.warn("Track with id:"+a+" and group:"+o+" not found in active group "+c.groupId)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.audioGroupIds){var a=i.audioGroupIds[i.urlId];if(this.groupId!==a){this.groupId=a||null;var o=this.tracks.filter(function(c){return!a||c.groupId===a});this.selectDefaultTrack&&!o.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=o;var d={audioTracks:o};this.log("Updating audio tracks, "+o.length+" track(s) found in group:"+a),this.hls.trigger(k.AUDIO_TRACKS_UPDATED,d),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===yi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(i))},e.setAudioTrack=function(t){var i=this.tracksInGroup;if(t<0||t>=i.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var a=this.currentTrack;i[this.trackId];var o=i[t],d=o.groupId,c=o.name;if(this.log("Switching to audio-track "+t+' "'+c+'" lang:'+o.lang+" group:"+d),this.trackId=t,this.currentTrack=o,this.selectDefaultTrack=!1,this.hls.trigger(k.AUDIO_TRACK_SWITCHING,y({},o)),!o.details||o.details.live){var f=this.switchParams(o.url,a==null?void 0:a.details);this.loadPlaylist(f)}}},e.selectInitialTrack=function(){var t=this.tracksInGroup,i=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(i!==-1)this.setAudioTrack(i);else{var a=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(a.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:a})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,a=0;a<i.length;a++){var o=i[a];if((!this.selectDefaultTrack||o.default)&&(!t||t.attrs["STABLE-RENDITION-ID"]!==void 0&&t.attrs["STABLE-RENDITION-ID"]===o.attrs["STABLE-RENDITION-ID"]||t.name===o.name&&t.lang===o.lang))return o.id}return-1},e.loadPlaylist=function(t){u.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var a=i.id,o=i.groupId,d=i.url;if(t)try{d=t.addDirectives(d)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist "+a+' "'+i.name+'" lang:'+i.lang+" group:"+o),this.clearTimer(),this.hls.trigger(k.AUDIO_TRACK_LOADING,{url:d,id:a,groupId:o,deliveryDirectives:t||null})}},M(s,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),s}(x);function Xh(u,s){if(u.length!==s.length)return!1;for(var e=0;e<u.length;e++)if(!lg(u[e].attrs,s[e].attrs))return!1;return!0}function lg(u,s){var e=u["STABLE-RENDITION-ID"];return e?e===s["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(function(t){return u[t]!==s[t]})}var ug=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[subtitle-stream-controller]",Oi)||this).levels=[],o.currentTrackId=-1,o.tracksBuffered=[],o.mainDetails=null,o._registerListeners(),o}z(s,u);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},e._registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=De,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},e.onMediaDetaching=function(){this.tracksBuffered=[],u.prototype.onMediaDetaching.call(this)},e.onLevelLoaded=function(t,i){this.mainDetails=i.details},e.onSubtitleFragProcessed=function(t,i){var a=i.frag,o=i.success;if(this.fragPrevious=a,this.state=De,o){var d=this.tracksBuffered[this.currentTrackId];if(d){for(var c,f=a.start,h=0;h<d.length;h++)if(f>=d[h].start&&f<=d[h].end){c=d[h];break}var p=a.start+a.duration;c?c.end=p:(c={start:f,end:p},d.push(c)),this.fragmentTracker.fragBuffered(a)}}},e.onBufferFlushing=function(t,i){var a=i.startOffset,o=i.endOffset;if(a===0&&o!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,c=this.levels;if(!c.length||!c[d]||!c[d].details)return;var f=o-c[d].details.targetduration;if(f<=0)return;i.endOffsetSubtitles=Math.max(0,f),this.tracksBuffered.forEach(function(h){for(var p=0;p<h.length;)if(h[p].end<=f)h.shift();else{if(!(h[p].start<f))break;h[p].start=f,p++}}),this.fragmentTracker.removeFragmentsInRange(a,f,Oi)}},e.onFragBuffered=function(t,i){var a;this.loadedmetadata||i.frag.type!==rt||(a=this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var a=i.frag;(a==null?void 0:a.type)===Oi&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ut&&(this.state=De))},e.onSubtitleTracksUpdated=function(t,i){var a=this,o=i.subtitleTracks;Xh(this.levels,o)?this.levels=o.map(function(d){return new wa(d)}):(this.tracksBuffered=[],this.levels=o.map(function(d){var c=new wa(d);return a.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Oi),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var a,o=i.details,d=i.id,c=this.currentTrackId,f=this.levels;if(f.length){var h=f[c];if(!(d>=f.length||d!==c)&&h){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(o.live||(a=h.details)!=null&&a.live){var E=this.mainDetails;if(o.deltaUpdateFailed||!E)return;var b=E.fragments[0];h.details?(p=this.alignPlaylists(o,h.details))===0&&b&&Ia(o,p=b.start):o.hasProgramDateTime&&E.hasProgramDateTime?(Ot(o,E),p=o.fragments[0].start):b&&Ia(o,p=b.start)}h.details=o,this.levelLastLoaded=d,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(h.details,p),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===De&&(Ra(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},e._handleFragmentLoadComplete=function(t){var i=this,a=t.frag,o=t.payload,d=a.decryptdata,c=this.hls;if(!this.fragContextChanged(a)&&o&&o.byteLength>0&&d&&d.key&&d.iv&&d.method==="AES-128"){var f=performance.now();this.decrypter.decrypt(new Uint8Array(o),d.key.buffer,d.iv.buffer).catch(function(h){throw c.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:a}),h}).then(function(h){var p=performance.now();c.trigger(k.FRAG_DECRYPTED,{frag:a,payload:h,stats:{tstart:f,tdecrypt:p}})}).catch(function(h){i.warn(h.name+": "+h.message),i.state=De})}},e.doTick=function(){if(this.media){if(this.state===De){var t=this.currentTrackId,i=this.levels,a=i[t];if(!i.length||!a||!a.details)return;var o=a.details,d=o.targetduration,c=this.config,f=this.getLoadPosition(),h=he.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],f-d,c.maxBufferHole),p=h.end,E=h.len,b=this.getFwdBufferInfo(this.media,rt);if(E>this.getMaxBufferLength(b==null?void 0:b.len)+d)return;var A=o.fragments,w=A.length,D=o.edge,S=null,L=this.fragPrevious;if(p<D){var N=c.maxFragLookUpTolerance;!(S=Ra(L,A,Math.max(A[0].start,p),N))&&L&&L.start<A[0].start&&(S=A[0])}else S=A[w-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===Z&&this.loadFragment(S,a,p)}}else this.state=De},e.getMaxBufferLength=function(t){var i=u.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,a){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,t,i,a))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new dg(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Ju),dg=function(u){this.buffered=void 0;var s=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 u[t][e]};this.buffered={get length(){return u.length},end:function(e){return s("end",e,u.length)},start:function(e){return s("start",e,u.length)}}},cg=function(u){function s(t){var i;return(i=u.call(this,t,"[subtitle-track-controller]")||this).media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.registerListeners(),i}z(s,u);var e=s.prototype;return e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,u.prototype.destroy.call(this)},e.registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.ERROR,this.onError,this)},e.onMediaAttached=function(t,i){this.media=i.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))},e.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},e.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),hd(this.media.textTracks).forEach(function(t){Qr(t)}),this.subtitleTrack=-1,this.media=null)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.subtitleTracks},e.onSubtitleTrackLoaded=function(t,i){var a=i.id,o=i.details,d=this.trackId,c=this.tracksInGroup[d];if(c){var f=c.details;c.details=i.details,this.log("subtitle track "+a+" loaded ["+o.startSN+"-"+o.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,f)}else this.warn("Invalid subtitle track id "+a)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.textGroupIds){var a=i.textGroupIds[i.urlId],o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==a){var d=this.tracks.filter(function(h){return!a||h.groupId===a});this.tracksInGroup=d;var c=this.findTrackId(o==null?void 0:o.name)||this.findTrackId();this.groupId=a||null;var f={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(k.SUBTITLE_TRACKS_UPDATED,f),c!==-1&&this.setSubtitleTrack(c,o)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId,o)}},e.findTrackId=function(t){for(var i=this.tracksInGroup,a=0;a<i.length;a++){var o=i[a];if((!this.selectDefaultTrack||o.default)&&(!t||t===o.name))return o.id}return-1},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===zi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.checkRetry(i)},e.loadPlaylist=function(t){u.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var a=i.id,o=i.groupId,d=i.url;if(t)try{d=t.addDirectives(d)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(k.SUBTITLE_TRACK_LOADING,{url:d,id:a,groupId:o,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,a=this.media,o=this.trackId;if(a){var d=hd(a.textTracks),c=d.filter(function(p){return p.groupId===i.groupId});if(t===-1)[].slice.call(d).forEach(function(p){p.mode="disabled"});else{var f=c[o];f&&(f.mode="disabled")}var h=c[t];h&&(h.mode=this.subtitleDisplay?"showing":"hidden")}},e.setSubtitleTrack=function(t,i){var a,o=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(a=o[t])!=null&&a.details)||t<-1||t>=o.length)){this.clearTimer();var d=o[t];if(this.log("Switching to subtitle-track "+t+(d?' "'+d.name+'" lang:'+d.lang+" group:"+d.groupId:"")),this.trackId=t,d){var c=d.id,f=d.groupId,h=f===void 0?"":f,p=d.name,E=d.type,b=d.url;this.hls.trigger(k.SUBTITLE_TRACK_SWITCH,{id:c,groupId:h,name:p,type:E,url:b});var A=this.switchParams(d.url,i==null?void 0:i.details);this.loadPlaylist(A)}else this.hls.trigger(k.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},e.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,i=hd(this.media.textTracks),a=0;a<i.length;a++)if(i[a].mode==="hidden")t=a;else if(i[a].mode==="showing"){t=a;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},M(s,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,i)}}]),s}(x);function hd(u){for(var s=[],e=0;e<u.length;e++){var t=u[e];t.kind!=="subtitles"&&t.kind!=="captions"||!t.label||s.push(u[e])}return s}var hg=function(){function u(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var s=u.prototype;return s.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},s.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},s.appendBlocker=function(e){var t,i=new Promise(function(o){t=o}),a={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(a,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,a=t[e],o=i[e];if(o.length){var d=o[0];try{d.execute()}catch(c){U.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(c),a!=null&&a.updating||(o.shift(),this.executeNext(e))}}},s.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},s.current=function(e){return this.queues[e][0]},u}(),Zh=nn(),Jh=/([ha]vc.)(?:\.[^.,]+)+/,fg=function(){function u(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.media,a=t.mediaSource;U.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(k.MEDIA_ATTACHED,{media:i})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){U.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,a=t._objectUrl;i&&i.src!==a&&U.error("Media element src was set while attaching MediaSource ("+a+" > "+i.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var s=u.prototype;return s.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},s.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},s.registerListeners=function(){var e=this.hls;e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_RESET,this.onBufferReset,this),e.on(k.BUFFER_APPENDING,this.onBufferAppending,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.BUFFER_EOS,this.onBufferEos,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(k.FRAG_PARSED,this.onFragParsed,this),e.on(k.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_RESET,this.onBufferReset,this),e.off(k.BUFFER_APPENDING,this.onBufferAppending,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.BUFFER_EOS,this.onBufferEos,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(k.FRAG_PARSED,this.onFragParsed,this),e.off(k.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new hg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},s.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},s.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,U.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Zh){var a=this.mediaSource=new Zh;a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(a),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}},s.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(U.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(a){U.warn("[buffer-controller]: onMediaDetaching: "+a.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):U.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(k.MEDIA_DETACHED,void 0)},s.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(a){U.warn("[buffer-controller]: Failed to reset the "+t+" buffer",a)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,a=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(o){if(a){var d=i.tracks[o];if(d&&typeof d.buffer.changeType=="function"){var c=t[o],f=c.id,h=c.codec,p=c.levelCodec,E=c.container,b=c.metadata,A=(d.levelCodec||d.codec).replace(Jh,"$1"),w=(p||h).replace(Jh,"$1");if(A!==w){var D=E+";codecs="+(p||h);i.appendChangeType(o,D),U.log("[buffer-controller]: switching codec "+A+" to "+w),i.tracks[o]={buffer:d.buffer,codec:h,container:E,levelCodec:p,metadata:b,id:f}}}}else i.pendingTracks[o]=t[o]}),a||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,a=this.operationQueue,o={execute:function(){var d=i.sourceBuffer[e];d&&(U.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),d.changeType(t)),a.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(d){U.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",d)}};a.append(o,e)},s.onBufferAppending=function(e,t){var i=this,a=this.hls,o=this.operationQueue,d=this.tracks,c=t.data,f=t.type,h=t.frag,p=t.part,E=t.chunkMeta,b=E.buffering[f],A=self.performance.now();b.start=A;var w=h.stats.buffering,D=p?p.stats.buffering:null;w.start===0&&(w.start=A),D&&D.start===0&&(D.start=A);var S=d.audio,L=!1;f==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||E.id===1||this.lastMpegAudioChunk.sn!==E.sn,this.lastMpegAudioChunk=E);var N=h.start,P={execute:function(){if(b.executeStart=self.performance.now(),L){var V=i.sourceBuffer[f];if(V){var Y=N-V.timestampOffset;Math.abs(Y)>=.1&&(U.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+Y+") sn: "+h.sn+")"),V.timestampOffset=N)}}i.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,w.first===0&&(w.first=V),D&&D.first===0&&(D.first=V);var Y=i.sourceBuffer,j={};for(var ie in Y)j[ie]=he.getBuffered(Y[ie]);i.appendError=0,i.hls.trigger(k.BUFFER_APPENDED,{type:f,frag:h,part:p,chunkMeta:E,parent:h.type,timeRanges:j})},onError:function(V){U.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",V);var Y={type:se.MEDIA_ERROR,parent:h.type,details:W.BUFFER_APPEND_ERROR,frag:h,part:p,chunkMeta:E,error:V,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?Y.details=W.BUFFER_FULL_ERROR:(i.appendError++,Y.details=W.BUFFER_APPEND_ERROR,i.appendError>a.config.appendErrorMaxRetry&&(U.error("[buffer-controller]: Failed "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),a.trigger(k.ERROR,Y)}};o.append(P,f)},s.onBufferFlushing=function(e,t){var i=this,a=this.operationQueue,o=function(d){return{execute:i.removeExecutor.bind(i,d,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(k.BUFFER_FLUSHED,{type:d})},onError:function(c){U.warn("[buffer-controller]: Failed to remove from "+d+" SourceBuffer",c)}}};t.type?a.append(o(t.type),t.type):this.getSourceBufferTypes().forEach(function(d){a.append(o(d),d)})},s.onFragParsed=function(e,t){var i=this,a=t.frag,o=t.part,d=[],c=o?o.elementaryStreams:a.elementaryStreams;c[tr]?d.push("audiovideo"):(c[gt]&&d.push("audio"),c[Ct]&&d.push("video")),d.length===0&&U.warn("Fragments must have at least one ElementaryStreamType set. type: "+a.type+" level: "+a.level+" sn: "+a.sn),this.blockBuffers(function(){var f=self.performance.now();a.stats.buffering.end=f,o&&(o.stats.buffering.end=f);var h=o?o.stats:a.stats;i.hls.trigger(k.FRAG_BUFFERED,{frag:a,part:o,stats:h,id:a.type})},d)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(a,o){var d=i.sourceBuffer[o];return!d||t.type&&t.type!==o||(d.ending=!0,d.ended||(d.ended=!0,U.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),a&&!(d&&!d.ended)},!0)&&(U.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(o){var d=i.sourceBuffer[o];d&&(d.ending=!1)});var a=i.mediaSource;a&&a.readyState==="open"?(U.log("[buffer-controller]: Calling mediaSource.endOfStream()"),a.endOfStream()):a&&U.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+a.readyState)}))},s.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())},s.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,a=this.sourceBuffer;if(i&&t!==null){var o=this.getSourceBufferTypes();if(o.length){var d=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(re(d)&&!(d<0)){var c=i.currentTime,f=t.levelTargetDuration,h=Math.max(d,f),p=Math.floor(c/f)*f-h;o.forEach(function(E){var b=a[E];if(b){var A=he.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(k.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(k.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*f)return void U.info("[buffer-controller]: Cannot flush "+E+" back buffer while SourceBuffer is in ended state");e.trigger(k.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:E})}}})}}}},s.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,a=this.mediaSource,o=e.fragments[0].start+e.totalduration,d=i.duration,c=re(a.duration)?a.duration:0;e.live&&t.config.liveDurationInfinity?(U.log("[buffer-controller]: Media Source duration is set to Infinity"),a.duration=1/0,this.updateSeekableRange(e)):(o>c&&o>d||!re(d))&&(U.log("[buffer-controller]: Updating Media Source duration to "+o.toFixed(3)),a.duration=o)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var a=Math.max(0,i[0].start),o=Math.max(a,a+e.totalduration);t.setLiveSeekableRange(a,o)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,a=Object.keys(i).length;if(a&&!e||a===2){this.createSourceBuffers(i),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(k.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(function(c){t.executeNext(c)});else{var d=new Error("could not create source buffer for media codec(s)");this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:d,reason:d.message})}}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(var a in e)if(!t[a]){var o=e[a];if(!o)throw Error("source buffer exists for track "+a+", however track does not");var d=o.levelCodec||o.codec,c=o.container+";codecs="+d;U.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=t[a]=i.addSourceBuffer(c),h=a;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[a]={buffer:f,codec:d,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(p){U.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:c})}}},s._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},s._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},s._onSBUpdateError=function(e,t){var i=new Error(e+" SourceBuffer error");U.error("[buffer-controller]: "+i,t),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(t)},s.removeExecutor=function(e,t,i){var a=this.media,o=this.mediaSource,d=this.operationQueue,c=this.sourceBuffer[e];if(!a||!o||!c)return U.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void d.shiftAndExecuteNext(e);var f=re(a.duration)?a.duration:1/0,h=re(o.duration)?o.duration:1/0,p=Math.max(0,t),E=Math.min(i,f,h);E>p&&!c.ending?(c.ended=!1,U.log("[buffer-controller]: Removing ["+p+","+E+"] from the "+e+" SourceBuffer"),c.remove(p,E)):d.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var i=this.operationQueue,a=this.sourceBuffer[t];if(!a)return U.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);a.ended=!1,a.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return U.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var a=this.operationQueue,o=t.map(function(d){return a.appendBlocker(d)});Promise.all(o).then(function(){e(),t.forEach(function(d){var c=i.sourceBuffer[d];c!=null&&c.updating||a.shiftAndExecuteNext(d)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var a=this.sourceBuffer[e];if(a){var o=i.bind(this,e);this.listeners[e].push({event:t,listener:o}),a.addEventListener(t,o)}},s.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},u}(),ef={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},tf=function(u){var s=u;return ef.hasOwnProperty(u)&&(s=ef[u]),String.fromCharCode(s)},xa=15,Lr=100,mg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},pg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},vg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},gg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Eg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],yg=function(){function u(){this.time=null,this.verboseLevel=0}return u.prototype.log=function(s,e){if(this.verboseLevel>=s){var t=typeof e=="function"?e():e;U.log(this.time+" ["+s+"] "+t)}},u}(),Pa=function(u){for(var s=[],e=0;e<u.length;e++)s.push(u[e].toString(16));return s},rf=function(){function u(e,t,i,a,o){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=a||"black",this.flash=o||!1}var s=u.prototype;return s.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},s.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var a=t[i];e.hasOwnProperty(a)&&(this[a]=e[a])}},s.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},s.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},s.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},s.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},u}(),bg=function(){function u(e,t,i,a,o,d){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new rf(t,i,a,o,d)}var s=u.prototype;return s.reset=function(){this.uchar=" ",this.penState.reset()},s.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},s.setPenState=function(e){this.penState.copy(e)},s.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},s.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},s.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},u}(),_g=function(){function u(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<Lr;t++)this.chars.push(new bg);this.logger=e,this.pos=0,this.currPenState=new rf}var s=u.prototype;return s.equals=function(e){for(var t=!0,i=0;i<Lr;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<Lr;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<Lr;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},s.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Lr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Lr)},s.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)},s.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},s.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=tf(e);this.pos>=Lr?this.logger.log(0,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))},s.clearFromPos=function(e){var t;for(t=e;t<Lr;t++)this.chars[t].reset()},s.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},s.clearToEndOfRow=function(){this.clearFromPos(this.pos)},s.getTextString=function(){for(var e=[],t=!0,i=0;i<Lr;i++){var a=this.chars[i].uchar;a!==" "&&(t=!1),e.push(a)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},u}(),fd=function(){function u(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<xa;t++)this.rows.push(new _g(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var s=u.prototype;return s.reset=function(){for(var e=0;e<xa;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<xa;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<xa;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<xa;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},s.backSpace=function(){this.rows[this.currRow].backSpace()},s.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},s.insertChar=function(e){this.rows[this.currRow].insertChar(e)},s.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},s.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},s.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},s.setPAC=function(e){this.logger.log(2,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<xa;i++)this.rows[i].clear();var a=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var d=o.rows[a].cueStartTime,c=this.logger.time;if(d&&c!==null&&d<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[t-this.nrRollUpRows+f+1].copy(o.rows[a+f])}}this.currRow=t;var h=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,E=Math.max(p-1,0);h.setCursor(e.indent),e.color=h.chars[E].penState.foreground}var b={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(b)},s.setBkgData=function(e){this.logger.log(2,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},s.setRollUpRows=function(e){this.nrRollUpRows=e},s.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(1,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(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},s.getDisplayText=function(e){e=e||!1;for(var t=[],i="",a=-1,o=0;o<xa;o++){var d=this.rows[o].getTextString();d&&(a=o+1,e?t.push("Row "+a+": '"+d+"'"):t.push(d.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
34
+ `)),i},s.getTextAndFormat=function(){return this.rows},u}(),af=function(){function u(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 fd(i),this.nonDisplayedMemory=new fd(i),this.lastOutputScreen=new fd(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var s=u.prototype;return s.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},s.getHandler=function(){return this.outputFilter},s.setHandler=function(e){this.outputFilter=e},s.setPAC=function(e){this.writeScreen.setPAC(e)},s.setBkgData=function(e){this.writeScreen.setBkgData(e)},s.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,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)},s.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return a+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},s.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},s.ccBS=function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},s.ccAOF=function(){},s.ccAON=function(){},s.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},s.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},s.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},s.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},s.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},s.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},s.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},s.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},s.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},s.ccEOC=function(){var e=this;if(this.logger.log(2,"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(1,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},s.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},s.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(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},s.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))},s.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},u}(),nf=function(){function u(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var a=new yg;this.channels=[null,new af(e,t,a),new af(e+1,i,a)],this.cmdHistory={a:null,b:null},this.logger=a}var s=u.prototype;return s.getHandler=function(e){return this.channels[e].getHandler()},s.setHandler=function(e,t){this.channels[e].setHandler(t)},s.addData=function(e,t){var i,a,o,d=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(a=127&t[c],o=127&t[c+1],a!==0||o!==0){if(this.logger.log(3,"["+Pa([t[c],t[c+1]])+"] -> ("+Pa([a,o])+")"),(i=this.parseCmd(a,o))||(i=this.parseMidrow(a,o)),i||(i=this.parsePAC(a,o)),i||(i=this.parseBackgroundAttributes(a,o)),!i&&(d=this.parseChars(a,o))){var f=this.currentChannel;f&&f>0?this.channels[f].insertChars(d):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||d||this.logger.log(2,"Couldn't parse cleaned data "+Pa([a,o])+" orig: "+Pa([t[c],t[c+1]]))}},s.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(sf(e,t,i))return vn(null,null,i),this.logger.log(3,"Repeated command ("+Pa([e,t])+") is dropped"),!0;var a=e===20||e===21||e===23?1:2,o=this.channels[a];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),vn(e,t,i),this.currentChannel=a,!0},s.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(0,"Mismatch channel in midrow parsing"),!1;var a=this.channels[i];return!!a&&(a.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Pa([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,a=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(sf(e,t,a))return vn(null,null,a),!0;var o=e<=23?1:2;i=t>=64&&t<=95?o===1?mg[e]:vg[e]:o===1?pg[e]:gg[e];var d=this.channels[o];return!!d&&(d.setPAC(this.interpretPAC(i,t)),vn(e,t,a),this.currentChannel=o,!0)},s.interpretPAC=function(e,t){var i,a={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,a.underline=(1&i)==1,i<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(a.italics=!0,a.color="white"):a.indent=4*Math.floor((i-16)/2),a},s.parseChars=function(e,t){var i,a,o=null,d=null;if(e>=25?(i=2,d=e-8):(i=1,d=e),d>=17&&d<=19?(a=d===17?t+80:d===18?t+112:t+144,this.logger.log(2,"Special char '"+tf(a)+"' in channel "+i),o=[a]):e>=32&&e<=127&&(o=t===0?[e]:[e,t]),o){var c=Pa(o);this.logger.log(3,"Char codes = "+c.join(",")),vn(e,t,this.cmdHistory)}return o},s.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 a={};e===16||e===24?(i=Math.floor((t-32)/2),a.background=Eg[i],t%2==1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(a),vn(e,t,this.cmdHistory),!0},s.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}},s.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},u}();function vn(u,s,e){e.a=u,e.b=s}function sf(u,s,e){return e.a===u&&e.b===s}var Zo=function(){function u(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 s=u.prototype;return s.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},s.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)},s.reset=function(){this.cueRanges=[],this.startTime=null},u}(),md=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var u=["","lr","rl"],s=["start","middle","end","left","right"];function e(o,d){if(typeof d!="string"||!Array.isArray(o))return!1;var c=d.toLowerCase();return!!~o.indexOf(c)&&c}function t(o){return e(s,o)}function i(o){for(var d=arguments.length,c=new Array(d>1?d-1:0),f=1;f<d;f++)c[f-1]=arguments[f];for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var E in p)o[E]=p[E]}return o}function a(o,d,c){var f=this,h={enumerable:!0};f.hasBeenReset=!1;var p="",E=!1,b=o,A=d,w=c,D=null,S="",L=!0,N="auto",P="start",V=50,Y="middle",j=50,ie="middle";Object.defineProperty(f,"id",i({},h,{get:function(){return p},set:function(Q){p=""+Q}})),Object.defineProperty(f,"pauseOnExit",i({},h,{get:function(){return E},set:function(Q){E=!!Q}})),Object.defineProperty(f,"startTime",i({},h,{get:function(){return b},set:function(Q){if(typeof Q!="number")throw new TypeError("Start time must be set to a number.");b=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},h,{get:function(){return A},set:function(Q){if(typeof Q!="number")throw new TypeError("End time must be set to a number.");A=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},h,{get:function(){return w},set:function(Q){w=""+Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},h,{get:function(){return D},set:function(Q){D=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},h,{get:function(){return S},set:function(Q){var X=function(ce){return e(u,ce)}(Q);if(X===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},h,{get:function(){return L},set:function(Q){L=!!Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},h,{get:function(){return N},set:function(Q){if(typeof Q!="number"&&Q!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},h,{get:function(){return P},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");P=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},h,{get:function(){return V},set:function(Q){if(Q<0||Q>100)throw new Error("Position must be between 0 and 100.");V=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},h,{get:function(){return Y},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");Y=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},h,{get:function(){return j},set:function(Q){if(Q<0||Q>100)throw new Error("Size must be between 0 and 100.");j=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},h,{get:function(){return ie},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");ie=X,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),Tg=function(){function u(){}return u.prototype.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},u}();function of(u){function s(t,i,a,o){return 3600*(0|t)+60*(0|i)+(0|a)+parseFloat(o||0)}var e=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?s(e[2],e[3],0,e[4]):s(e[1],e[2],e[3],e[4]):null}var Ag=function(){function u(){this.values=Object.create(null)}var s=u.prototype;return s.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},s.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},s.has=function(e){return e in this.values},s.alt=function(e,t,i){for(var a=0;a<i.length;++a)if(t===i[a]){this.set(e,t);break}},s.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},s.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},u}();function lf(u,s,e,t){var i=t?u.split(t):[u];for(var a in i)if(typeof i[a]=="string"){var o=i[a].split(e);o.length===2&&s(o[0],o[1])}}var pd=new md(0,0,""),Jo=pd.align==="middle"?"middle":"center";function Sg(u,s,e){var t=u;function i(){var o=of(u);if(o===null)throw new Error("Malformed timestamp: "+t);return u=u.replace(/^[^\sa-zA-Z-]+/,""),o}function a(){u=u.replace(/^\s+/,"")}if(a(),s.startTime=i(),a(),u.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);u=u.slice(3),a(),s.endTime=i(),a(),function(o,d){var c=new Ag;lf(o,function(p,E){var b;switch(p){case"region":for(var A=e.length-1;A>=0;A--)if(e[A].id===E){c.set(p,e[A].region);break}break;case"vertical":c.alt(p,E,["rl","lr"]);break;case"line":b=E.split(","),c.integer(p,b[0]),c.percent(p,b[0])&&c.set("snapToLines",!1),c.alt(p,b[0],["auto"]),b.length===2&&c.alt("lineAlign",b[1],["start",Jo,"end"]);break;case"position":b=E.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Jo,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,E);break;case"align":c.alt(p,E,["start",Jo,"end","left","right"])}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&pd.line===-1&&(f=-1),d.line=f,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",Jo);var h=c.get("position","auto");h==="auto"&&pd.position===50&&(h=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=h}(u,s)}function uf(u){return u.replace(/<br(?: \/)?>/gi,`
35
+ `)}var kg=function(){function u(){this.state="INITIAL",this.buffer="",this.decoder=new Tg,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=u.prototype;return s.parse=function(e){var t=this;function i(){var f=t.buffer,h=0;for(f=uf(f);h<f.length&&f[h]!=="\r"&&f[h]!==`
36
36
  `;)++h;var p=f.slice(0,h);return f[h]==="\r"&&++h,f[h]===`
37
- `&&++h,t.buffer=f.slice(h),p}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var o=(r=i()).match(/^()?WEBVTT([ \t].*)?$/);if(o==null||!o[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var u=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(u?u=!1:r=i(),t.state){case"HEADER":/:/.test(r)?Qh(r,function(f,h){},/:/):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new ru(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{hg(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var c=r.indexOf("-->")!==-1;if(!r||c&&(u=!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+=`
38
- `),t.cue.text+=r;continue;case"BADCUE":r||(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},s.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
37
+ `&&++h,t.buffer=f.slice(h),p}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var a="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var o=(a=i()).match(/^()?WEBVTT([ \t].*)?$/);if(o==null||!o[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var d=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(d?d=!1:a=i(),t.state){case"HEADER":/:/.test(a)?lf(a,function(f,h){},/:/):a||(t.state="ID");continue;case"NOTE":a||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){t.state="NOTE";break}if(!a)continue;if(t.cue=new md(0,0,""),t.state="CUE",a.indexOf("-->")===-1){t.cue.id=a;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Sg(a,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var c=a.indexOf("-->")!==-1;if(!a||c&&(d=!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+=`
38
+ `),t.cue.text+=a;continue;case"BADCUE":a||(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},s.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
39
39
 
40
- `,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}(),mg=/\r\n|\n\r|\n|\r/g,nu=function(d,s,e){return e===void 0&&(e=0),d.slice(e,e+s.length)===s},su=function(d){for(var s=5381,e=d.length;e;)s=33*s^d.charCodeAt(--e);return(s>>>0).toString()};function ou(d,s,e){return su(d.toString())+su(s.toString())+su(e)}function pg(d,s,e,t,i,r,o){var u,c,f,h=new fg,p=Ei(new Uint8Array(d)).trim().replace(mg,`
40
+ `,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},u}(),wg=/\r\n|\n\r|\n|\r/g,vd=function(u,s,e){return e===void 0&&(e=0),u.slice(e,e+s.length)===s},gd=function(u){for(var s=5381,e=u.length;e;)s=33*s^u.charCodeAt(--e);return(s>>>0).toString()};function Ed(u,s,e){return gd(u.toString())+gd(s.toString())+gd(e)}function Lg(u,s,e,t,i,a,o){var d,c,f,h=new kg,p=Li(new Uint8Array(u)).trim().replace(wg,`
41
41
  `).split(`
42
- `),y=[],b=(u=s.baseTime,(c=s.timescale)===void 0&&(c=1),$d(u,9e4,1/c)),A="00:00.000",k=0,D=0,S=!0;h.oncue=function(L){var N=e[t],P=e.ccOffset,V=(k-b)/9e4;N!=null&&N.new&&(D!==void 0?P=e.ccOffset=N.start:function(z,X,ue){var ne=z[X],Te=z[ne.prevCC];if(!Te||!Te.new&&ne.new)return z.ccOffset=z.presentationOffset=ne.start,void(ne.new=!1);for(;(Me=Te)!=null&&Me.new;){var Me;z.ccOffset+=ne.start-Te.start,ne.new=!1,Te=z[(ne=Te).prevCC]}z.presentationOffset=ue}(e,t,V)),V&&(P=V-e.presentationOffset);var q=L.endTime-L.startTime,j=Ci(9e4*(L.startTime+P-D),9e4*i)/9e4;L.startTime=Math.max(j,0),L.endTime=Math.max(j+q,0);var ee=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(ee)),L.id||(L.id=ou(L.startTime,L.endTime,ee)),L.endTime>0&&y.push(L)},h.onparsingerror=function(L){f=L},h.onflush=function(){f?o(f):r(y)},p.forEach(function(L){if(S){if(nu(L,"X-TIMESTAMP-MAP=")){S=!1,L.slice(16).split(",").forEach(function(N){nu(N,"LOCAL:")?A=N.slice(6):nu(N,"MPEGTS:")&&(k=parseInt(N.slice(7)))});try{D=function(N){var P=parseInt(N.slice(-3)),V=parseInt(N.slice(-6,-4)),q=parseInt(N.slice(-9,-7)),j=N.length>9?parseInt(N.substring(0,N.indexOf(":"))):0;if(!(oe(P)&&oe(V)&&oe(q)&&oe(j)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+N);return P+=1e3*V,(P+=6e4*q)+36e5*j}(A)/1e3}catch(N){f=N}return}L===""&&(S=!1)}h.parse(L+`
43
- `)}),h.flush()}var lu="stpp.ttml.im1t",Zh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Jh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,vg={left:"start",center:"center",right:"end",start:"start",end:"end"};function ef(d,s,e,t){var i=ze(new Uint8Array(d),["mdat"]);if(i.length!==0){var r,o,u,c,f=i.map(function(p){return Ei(p)}),h=(r=s.baseTime,o=1,(u=s.timescale)===void 0&&(u=1),c===void 0&&(c=!1),$d(r,o,1/u,c));try{f.forEach(function(p){return e(function(y,b){var A=new DOMParser().parseFromString(y,"text/xml").getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var k={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(k).reduce(function(V,q){return V[q]=A.getAttribute("ttp:"+q)||k[q],V},{}),S=A.getAttribute("xml:space")!=="preserve",L=tf(du(A,"styling","style")),N=tf(du(A,"layout","region")),P=du(A,"body","[begin]");return[].map.call(P,function(V){var q=rf(V,S);if(!q||!V.hasAttribute("begin"))return null;var j=cu(V.getAttribute("begin"),D),ee=cu(V.getAttribute("dur"),D),z=cu(V.getAttribute("end"),D);if(j===null)throw af(V);if(z===null){if(ee===null)throw af(V);z=j+ee}var X=new ru(j-b,z-b,q);X.id=ou(X.startTime,X.endTime,X.text);var ue=function(Me,_e,De){var xe="http://www.w3.org/ns/ttml#styling",Ce=null,He=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],We=Me!=null&&Me.hasAttribute("style")?Me.getAttribute("style"):null;return We&&De.hasOwnProperty(We)&&(Ce=De[We]),He.reduce(function(Qe,ot){var mi=uu(_e,xe,ot)||uu(Me,xe,ot)||uu(Ce,xe,ot);return mi&&(Qe[ot]=mi),Qe},{})}(N[V.getAttribute("region")],L[V.getAttribute("style")],L),ne=ue.textAlign;if(ne){var Te=vg[ne];Te&&(X.lineAlign=Te),X.align=ne}return F(X,ue),X}).filter(function(V){return V!==null})}(p,h))})}catch(p){t(p)}}else t(new Error("Could not parse IMSC1 mdat"))}function du(d,s,e){var t=d.getElementsByTagName(s)[0];return t?[].slice.call(t.querySelectorAll(e)):[]}function tf(d){return d.reduce(function(s,e){var t=e.getAttribute("xml:id");return t&&(s[t]=e),s},{})}function rf(d,s){return[].slice.call(d.childNodes).reduce(function(e,t,i){var r;return t.nodeName==="br"&&i?e+`
44
- `:(r=t.childNodes)!=null&&r.length?rf(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function uu(d,s,e){return d&&d.hasAttributeNS(s,e)?d.getAttributeNS(s,e):null}function af(d){return new Error("Could not parse ttml timestamp "+d)}function cu(d,s){if(!d)return null;var e=zh(d);return e===null&&(Zh.test(d)?e=function(t,i){var r=Zh.exec(t),o=(0|r[4])+(0|r[5])/i.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+o/i.frameRate}(d,s):Jh.test(d)&&(e=function(t,i){var r=Jh.exec(t),o=Number(r[1]);switch(r[2]){case"h":return 3600*o;case"m":return 60*o;case"ms":return 1e3*o;case"f":return o/i.frameRate;case"t":return o/i.tickRate}return o}(d,s))),e}var gg=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.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 Vo(this,"textTrack1"),i=new Vo(this,"textTrack2"),r=new Vo(this,"textTrack3"),o=new Vo(this,"textTrack4");this.cea608Parser1=new $h(1,t,i),this.cea608Parser2=new $h(3,r,o)}e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,r,o){for(var u,c,f,h,p=!1,y=o.length;y--;){var b=o[y],A=(u=b[0],c=b[1],f=t,h=i,Math.min(c,h)-Math.max(u,f));if(A>=0&&(b[0]=Math.min(b[0],t),b[1]=Math.max(b[1],i),p=!0,A/(i-t)>.5))return}if(p||o.push([t,i]),this.config.renderTextTracksNatively){var k=this.captionsTracks[e];this.Cues.newCue(k,t,i,r)}else{var D=this.Cues.newCue(null,t,i,r);this.hls.trigger(w.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,r=t.frag,o=t.id,u=t.initPTS,c=t.timescale,f=this.unparsedVttFrags;o==="main"&&(this.initPTS[r.cc]={baseTime:u,timescale:c}),f.length&&(this.unparsedVttFrags=[],f.forEach(function(h){i.onFragLoaded(w.FRAG_LOADED,h)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var r=t.textTracks[i];if(r[e])return r}return null},s.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},s.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,i=this.captionsTracks,r=this.media,o=t[e],u=o.label,c=o.languageCode,f=this.getExistingTrack(e);if(f)i[e]=f,Br(i[e]),fa(i[e],r);else{var h=this.createTextTrack("captions",u,c);h&&(h[e]=!0,i[e]=h)}}},s.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(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},s.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},s.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Br(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}},s.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.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},s._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Br(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,r=t.subtitleTracks||[],o=r.some(function(f){return f.textCodec===lu});if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(Hh(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:null;this.tracks.forEach(function(f,h){var p;if(u&&h<u.length){for(var y=null,b=0;b<u.length;b++)if(yg(u[b],f)){y=u[b];break}y&&(p=y)}if(p)Br(p);else{var A=i._captionsOrSubtitlesFromCharacteristics(f);(p=i.createTextTrack(A,f.name,f.lang))&&(p.mode="disabled")}p&&(p.groupId=f.groupId,i.textTracks.push(p))})}else if(this.tracks.length){var c=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s._captionsOrSubtitlesFromCharacteristics=function(e){if(e.attrs.CHARACTERISTICS){var t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"},s.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(r){var o=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(o){var u="textTrack"+o[1],c=i.captionsProperties[u];c&&(c.label=r.name,r.lang&&(c.languageCode=r.lang),c.media=r)}})},s.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]},s.onFragLoading=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2,o=this.lastSn,u=this.lastPartIndex;if(this.enabled&&i&&r&&t.frag.type===et){var c,f,h=t.frag.sn,p=(c=t==null||(f=t.part)==null?void 0:f.index)!=null?c:-1;h===o+1||h===o&&p===u+1||(i.reset(),r.reset()),this.lastSn=h,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.payload,o=this.initPTS,u=this.unparsedVttFrags;if(i.type===Ri)if(r.byteLength){if(!o[i.cc])return u.push(t),void(o.length&&this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var c=i.decryptdata,f="stats"in t;if(c==null||!c.encrypted||f){var h=this.tracks[i.level],p=this.vttCCs;p[i.cc]||(p[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===lu?this._parseIMSC1(i,r):this._parseVTTs(i,r,p)}}else this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,r=this.hls;ef(t,this.initPTS[e.cc],function(o){i._appendCues(o,e.level),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(o){H.log("Failed to parse IMSC1: "+o),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:o})})},s._parseVTTs=function(e,t,i){var r,o=this,u=this.hls;pg((r=e.initSegment)!=null&&r.data?hr(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],i,e.cc,e.start,function(c){o._appendCues(c,e.level),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){o._fallbackToIMSC1(e,t),H.log("Failed to parse VTT cue: "+c),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||ef(t,this.initPTS[e.cc],function(){r.textCodec=lu,i._parseIMSC1(e,t)},function(){r.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(function(c){return Ro(r,c)})}else{var o=this.tracks[t];if(!o)return;var u=o.default?"default":"subtitles"+t;i.trigger(w.CUES_PARSED,{type:"subtitles",cues:e,track:u})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Ri){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(w.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r){var o=t.frag,u=t.samples;if(o.type!==et||this.closedCaptionsForLevel(o)!=="NONE")for(var c=0;c<u.length;c++){var f=u[c].bytes;if(f){var h=this.extractCea608Data(f);i.addData(u[c].pts,h[0]),r.addData(u[c].pts,h[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,o=t.endOffsetSubtitles,u=t.type,c=this.media;if(c&&!(c.currentTime<r)){if(!u||u==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(p){return Zn(f[p],i,r)})}if(this.config.renderTextTracksNatively&&i===0&&o!==void 0){var h=this.textTracks;Object.keys(h).forEach(function(p){return Zn(h[p],i,o)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],r=2,o=0;o<i;o++){var u=e[r++],c=127&e[r++],f=127&e[r++];if((c!==0||f!==0)&&(4&u)!=0){var h=3&u;h!==0&&h!==1||(t[h].push(c),t[h].push(f))}}return t},d}();function yg(d,s){return!!d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}var Eg=function(){function d(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(e,t){var i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null},s.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this,i=this.hls.levels;if(!i.length)return-1;var r=i.filter(function(o,u){return t.isLevelAllowed(o)&&u<=e});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},s.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())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t},s.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},d.getMaxLevelByMediaSize=function(e,t,i){if(e==null||!e.length)return-1;for(var r,o,u=e.length-1,c=0;c<e.length;c+=1){var f=e[c];if((f.width>=t||f.height>=i)&&(r=f,!(o=e[c+1])||r.width!==o.width||r.height!==o.height)){u=c;break}}return u},M(d,[{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 e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}}]),d}(),bg=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 s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},s.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},s.checkFPS=function(e,t,i){var r=performance.now();if(t){if(this.lastTime){var o=r-this.lastTime,u=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,f=1e3*u/o,h=this.hls;if(h.trigger(w.FPS_DROP,{currentDropped:u,currentDecoded:c,totalDroppedFrames:i}),f>0&&u>h.config.fpsDroppedMonitoringThreshold*c){var p=h.currentLevel;H.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=p)&&(p-=1,h.trigger(w.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:h.currentLevel}),h.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},s.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}(),Wo="[eme]",nf=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=H.debug.bind(H,Wo),this.log=H.log.bind(H,Wo),this.warn=H.warn.bind(H,Wo),this.error=H.error.bind(H,Wo),this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,r=t.widevineLicenseUrl,o=i[e];if(o)return o.licenseUrl;if(e===je.WIDEVINE&&r)return r;throw new Error('no license server URL configured for key-system "'+e+'"')},s.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},s.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,r=function(c,f,h){return!!c&&h.indexOf(c)===f},o=i.map(function(c){return c.audioCodec}).filter(r),u=i.map(function(c){return c.videoCodec}).filter(r);return o.length+u.length===0&&u.push("avc1.42e01e"),new Promise(function(c,f){(function h(p){var y=p.shift();t.getMediaKeysPromise(y,o,u).then(function(b){return c({keySystem:y,mediaKeys:b})}).catch(function(b){p.length?h(p):f(b instanceof Mi?b:new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:b,fatal:!0},b.message))})})(e)})},s.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var r="Configured requestMediaKeySystemAccess is not a function "+i;return Nr===null&&self.location.protocol==="http:"&&(r="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(r))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var r=this,o=function(h,p,y,b){var A;switch(h){case je.FAIRPLAY:A=["cenc","sinf"];break;case je.WIDEVINE:case je.PLAYREADY:A=["cenc"];break;case je.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+h)}return function(k,D,S,L){return[{initDataTypes:k,persistentState:L.persistentState||"not-allowed",distinctiveIdentifier:L.distinctiveIdentifier||"not-allowed",sessionTypes:L.sessionTypes||[L.sessionType||"temporary"],audioCapabilities:D.map(function(N){return{contentType:'audio/mp4; codecs="'+N+'"',robustness:L.audioRobustness||"",encryptionScheme:L.audioEncryptionScheme||null}}),videoCapabilities:S.map(function(N){return{contentType:'video/mp4; codecs="'+N+'"',robustness:L.videoRobustness||"",encryptionScheme:L.videoEncryptionScheme||null}})}]}(A,p,y,b)}(e,t,i,this.config.drmSystemOptions),u=this.keySystemAccessPromises[e],c=u==null?void 0:u.keySystemAccess;if(!c){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(o)),c=this.requestMediaKeySystemAccess(e,o);var f=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(h){r.log('Failed to obtain access to key-system "'+e+'": '+h)}),c.then(function(h){r.log('Access for key-system "'+h.keySystem+'" obtained');var p=r.fetchServerCertificate(e);return r.log('Create media-keys for "'+e+'"'),f.mediaKeys=h.createMediaKeys().then(function(y){return r.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?r.setMediaKeysServerCertificate(y,e,b):y})}),f.mediaKeys.catch(function(y){r.error('Failed to create media-keys for "'+e+'"}: '+y)}),f.mediaKeys})}return c.then(function(){return u.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,r=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+Ii(t.keyId||[]));var o=r.createSession(),u={decryptdata:t,keySystem:i,mediaKeys:r,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(u),u},s.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},s.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 Ii(e.keyId)},s.updateKeySession=function(e,t){var i,r=e.mediaKeysSession;return this.log('Updating key-session "'+r.sessionId+'" for keyID '+Ii(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
45
- } (data length: `+(t&&t.byteLength)+")"),r.update(t)},s.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},s.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,r){var o=ur(t.config),u=e.map(ci).filter(function(c){return!!c&&o.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(u).then(function(c){var f=c.keySystem,h=Zi(f);h?i(h):r(new Error('Unable to find format for key-system "'+f+'"'))}).catch(r)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,r=this.getKeyIdString(i),o="(keyId: "+r+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+o);var u=this.keyIdToKeySessionPromise[r];return u||(u=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(i).then(function(c){var f=c.keySystem,h=c.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+o),t.attemptSetMediaKeys(f,h).then(function(){t.throwIfDestroyed();var p=t.createMediaKeySessionContext({keySystem:f,mediaKeys:h,decryptdata:i});return t.generateRequestWithPreferredKeySession(p,"cenc",i.pssh,"playlist-key")})})).catch(function(c){return t.handleError(c)}),u},s.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},s.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Mi?this.hls.trigger(w.ERROR,e.data):this.hls.trigger(w.ERROR,{type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},s.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var r=ci(e.keyFormat),o=r?[r]:ur(this.config);return this.attemptKeySystemAccess(o)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=ur(this.config)),e.length===0)throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},s._onMediaEncrypted=function(e){var t=this,i=e.initDataType,r=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),r!==null){var o,u;if(i==="sinf"&&this.config.drmSystems[je.FAIRPLAY]){var c=At(new Uint8Array(r));try{var f=_t(JSON.parse(c).sinf),h=qn(new Uint8Array(f));if(!h)return;o=h.subarray(8,24),u=je.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=function(N){if(!(N instanceof ArrayBuffer)||N.byteLength<32)return null;var P={version:0,systemId:"",kids:null,data:null},V=new DataView(N),q=V.getUint32(0);if(N.byteLength!==q&&q>44||V.getUint32(4)!==1886614376||(P.version=V.getUint32(8)>>>24,P.version>1))return null;P.systemId=Ii(new Uint8Array(N,12,16));var j=V.getUint32(28);if(P.version===0){if(q-32<j)return null;P.data=new Uint8Array(N,32,j)}else if(P.version===1){P.kids=[];for(var ee=0;ee<j;ee++)P.kids.push(new Uint8Array(N,32+16*ee,16))}return P}(r);if(p===null)return;p.version===0&&p.systemId===ut&&p.data&&(o=p.data.subarray(8,24)),u=function(N){if(N===ut)return je.WIDEVINE}(p.systemId)}if(u&&o){for(var y=Ii(o),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,k=b[y],D=function(){var N=A[S],P=N.decryptdata;if(P.pssh||!P.keyId)return"continue";var V=Ii(P.keyId);return y===V||P.uri.replace(/-/g,"").indexOf(y)!==-1?(k=b[V],delete b[V],P.pssh=new Uint8Array(r),P.keyId=o,k=b[y]=k.then(function(){return t.generateRequestWithPreferredKeySession(N,i,r,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var L=D();if(L!=="continue"&&L==="break")break}k||(k=b[y]=this.getKeySystemSelectionPromise([u]).then(function(N){var P,V=N.keySystem,q=N.mediaKeys;t.throwIfDestroyed();var j=new ca("ISO-23001-7",y,(P=Zi(V))!=null?P:"");return j.pssh=new Uint8Array(r),j.keyId=o,t.attemptSetMediaKeys(V,q).then(function(){t.throwIfDestroyed();var ee=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:q});return t.generateRequestWithPreferredKeySession(ee,i,r,"encrypted-event-no-match")})})),k.catch(function(N){return t.handleError(N)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,r=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var o=Promise.all(r).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(o),o.then(function(){i.log('Media-keys set for "'+e+'"'),r.push(o),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(u){return r.indexOf(u)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,r){var o,u,c=this,f=(o=this.config.drmSystems)==null||(u=o[e.keySystem])==null?void 0:u.generateRequest;if(f)try{var h=f.call(this.hls,t,i,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,i=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(k){var p;if(this.warn(k.message),(p=this.hls)!=null&&p.config.debug)throw k}if(i===null)return this.log('Skipping key-session request for "'+r+'" (no initData)'),Promise.resolve(e);var y=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+r+'": '+y+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new Go;e.mediaKeysSession.onmessage=function(k){var D=e.mediaKeysSession;if(D){var S=k.messageType,L=k.message;c.log('"'+S+'" message event for session "'+D.sessionId+'" message size: '+L.byteLength),S==="license-request"||S==="license-renewal"?c.renewLicense(e,L).catch(function(N){c.handleError(N),b.emit("error",N)}):S==="license-release"?e.keySystem===je.FAIRPLAY&&(c.updateKeySession(e,Gi("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(k){if(e.mediaKeysSession){c.onKeyStatusChange(e);var D=e.keyStatus;b.emit("keyStatus",D),D==="expired"&&(c.warn(e.keySystem+" expired for key "+y),c.renewKeySession(e))}else b.emit("error",new Error("invalid state"))};var A=new Promise(function(k,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?k():S==="output-restricted"?D(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+S+'"')):S==="expired"?D(new Error("key expired while generating request")):c.warn('unhandled key status change "'+S+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var k;c.log('Request generated for key-session "'+((k=e.mediaKeysSession)==null?void 0:k.sessionId)+'" keyId: '+y)}).catch(function(k){throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:k,fatal:!1},"Error generating key-session request: "+k)}).then(function(){return A}).catch(function(k){throw b.removeAllListeners(),c.removeSession(e),k}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,r){t.log('key status change "'+i+'" for keyStatuses keyId: '+Ii("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))+" session keyId: "+Ii(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},s.fetchServerCertificate=function(e){var t=this.config,i=new t.loader(t),r=this.getServerCertificateUrl(e);return r?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(o,u){var c={responseType:"arraybuffer",url:r},f=t.certLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(y,b,A,k){o(y.data)},onError:function(y,b,A,k){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:E({url:c.url,data:void 0},y)},'"'+e+'" certificate request failed ('+r+"). Status: "+y.code+" ("+y.text+")"))},onTimeout:function(y,b,A){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:{url:c.url,data:void 0}},'"'+e+'" certificate request timed out ('+r+")"))},onAbort:function(y,b,A){u(new Error("aborted"))}};i.load(c,h,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var r=this;return new Promise(function(o,u){e.setServerCertificate(i).then(function(c){r.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),o(e)}).catch(function(c){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})},s.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(r){return i.updateKeySession(e,new Uint8Array(r)).catch(function(o){throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:o,fatal:!0},o.message)})})},s.setupLicenseXHR=function(e,t,i,r){var o=this,u=this.config.licenseXhrSetup;return u?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return u.call(o.hls,e,t,i,r)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),u.call(o.hls,e,t,i,r)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||r}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))},s.requestLicense=function(e,t){var i=this,r=this.config.keyLoadPolicy.default;return new Promise(function(o,u){var c=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+c);var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return u(new Error("invalid state"));if(f.readyState===4)if(f.status===200){i._requestLicenseFailureCount=0;var h=f.response;i.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var p=i.config.licenseResponseCallback;if(p)try{h=p.call(i.hls,f,c,e)}catch(k){i.error(k)}o(h)}else{var y=r.errorRetry,b=y?y.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||f.status>=400&&f.status<500)u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:c,data:void 0,code:f.status,text:f.statusText}},"License Request XHR failed ("+c+"). Status: "+f.status+" ("+f.statusText+")"));else{var A=b-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+A+" attempts left"),i.requestLicense(e,t).then(o,u)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=f,i.setupLicenseXHR(f,c,e,t).then(function(h){var p=h.xhr,y=h.licenseChallenge;p.send(y)})})},s.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)}},s.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={},ca.clearKeyUriToKeyIdMap();var r=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(o){return e.removeSession(o)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(o){e.log("Could not clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))}))).then(function(){r&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(o){e.log("Could not close sessions and clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))})},s.onManifestLoading=function(){this.keyFormatPromise=null},s.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var r=i.reduce(function(o,u){return o.indexOf(u.keyFormat)===-1&&o.push(u.keyFormat),o},[]);this.log("Selecting key-system from session-keys "+r.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(r)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,r=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var o=this.mediaKeySessions.indexOf(e);return o>-1&&this.mediaKeySessions.splice(o,1),i.remove().catch(function(u){t.log("Could not remove session: "+u)}).then(function(){return i.close()}).catch(function(u){t.log("Could not close session: "+u)})}},d}();nf.CDMCleanupPromise=void 0;var Mi=function(d){function s(e,t){var i;return(i=d.call(this,t)||this).data=void 0,e.error||(e.error=new Error(t)),i.data=e,e.err=e.error,i}return Q(s,d),s}(Ae(Error)),_g="m",qo="a",hu="v",fu="av",sf="i",Tg="tt",Ag=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(o){try{t.apply(o,{ot:_g,su:!t.initialized})}catch(u){H.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=function(o){try{var u=o.frag,c=t.hls.levels[u.level],f=t.getObjectType(u),h={d:1e3*u.duration,ot:f};f!==hu&&f!==qo&&f!=fu||(h.br=c.bitrate/1e3,h.tb=t.getTopBandwidth(f)/1e3,h.bl=t.getBufferLength(f)),t.apply(o,h)}catch(p){H.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,r=i.cmcd;r!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||d.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHED,this.onMediaDetached,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHED,this.onMediaDetached,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this)},s.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},s.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},s.onBufferCreated=function(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer},s.createData=function(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},s.apply=function(e,t){t===void 0&&(t={}),F(t,this.createData());var i=t.ot===sf||t.ot===hu||t.ot===fu;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var r=d.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),F(e.headers,r)}else{var o=d.toQuery(t);if(!o)return;e.url=d.appendQueryToUri(e.url,o)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?Tg:e.sn==="initSegment"?sf:t==="audio"?qo:t==="main"?this.hls.audioTracks.length?hu:fu:void 0},s.getTopBandwidth=function(e){var t,i=0,r=this.hls;if(e===qo)t=r.audioTracks;else{var o=r.maxAutoLevel,u=o>-1?o+1:r.levels.length;t=r.levels.slice(0,u)}for(var c,f=we(t);!(c=f()).done;){var h=c.value;h.bitrate>i&&(i=h.bitrate)}return i>0?i:NaN},s.getBufferLength=function(e){var t=this.hls.media,i=e===qo?this.audioBuffer:this.videoBuffer;return i&&t?1e3*ce.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},s.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var o=r.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var o=r.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},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=[],r=function(k){return!Number.isNaN(k)&&k!=null&&k!==""&&k!==!1},o=function(k){return Math.round(k)},u=function(k){return 100*o(k/100)},c={br:o,d:o,bl:u,dl:u,mtp:u,nor:function(k){return encodeURIComponent(k)},rtp:u,tb:o},f=we(Object.keys(e||{}).sort());!(t=f()).done;){var h=t.value,p=e[h];if(r(p)&&!(h==="v"&&p===1||h=="pr"&&p===1)){var y=c[h];y&&(p=y(p));var b=typeof p,A=void 0;A=h==="ot"||h==="sf"||h==="st"?h+"="+p:b==="boolean"?h:b==="number"?h+"="+p:h+"="+JSON.stringify(p),i.push(A)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],o={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},u=0,c=Object.keys(e);u<c.length;u++){var f=c[u];r[o[f]!=null?o[f]:1][f]=e[f]}for(var h=0;h<r.length;h++){var p=d.serialize(r[h]);p&&(t["CMCD-"+i[h]]=p)}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}(),Sg=function(){function d(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=H.log.bind(H,"[content-steering]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.ERROR,this.onError,this))},s.startLoad=function(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){var e=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)},s.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)},s.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},s.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(i){return i!==e}))},s.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},s.onManifestLoaded=function(e,t){var i=t.contentSteering;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())},s.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},s.onError=function(e,t){var i=t.errorAction;if((i==null?void 0:i.action)===T&&i.flags===R){var r=this.pathwayPriority,o=this.pathwayId;this.penalizedPathways[o]||(this.penalizedPathways[o]=performance.now()),!r&&this.levels&&(r=this.levels.reduce(function(u,c){return u.indexOf(c.pathwayId)===-1&&u.push(c.pathwayId),u},[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==o)}},s.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){var i=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+i+'"'),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},s.getLevelsForPathway=function(e){return this.levels===null?[]:this.levels.filter(function(t){return e===t.pathwayId})},s.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(function(p){r-i[p]>3e5&&delete i[p]});for(var o=0;o<e.length;o++){var u=e[o];if(!i[u]){if(u===this.pathwayId)return;var c=this.hls.nextLoadLevel,f=this.hls.levels[c];if((t=this.getLevelsForPathway(u)).length>0){this.log('Setting Pathway to "'+u+'"'),this.pathwayId=u,this.hls.trigger(w.LEVELS_UPDATED,{levels:t});var h=this.hls.levels[c];f&&h&&this.levels&&(h.attrs["STABLE-VARIANT-ID"]!==f.attrs["STABLE-VARIANT-ID"]&&h.bitrate!==f.bitrate&&this.log("Unstable Pathways change from bitrate "+f.bitrate+" to "+h.bitrate),this.hls.nextLoadLevel=c);break}}}},s.clonePathways=function(e){var t=this,i=this.levels;if(i){var r={},o={};e.forEach(function(u){var c=u.ID,f=u["BASE-ID"],h=u["URI-REPLACEMENT"];if(!i.some(function(y){return y.pathwayId===c})){var p=t.getLevelsForPathway(f).map(function(y){var b=F({},y);b.details=void 0,b.url=lf(y.uri,y.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h);var A=new it(y.attrs);A["PATHWAY-ID"]=c;var k=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;k&&(r[A.AUDIO]=k,A.AUDIO=k),D&&(o[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new ga(b);return Y(S,"audio",k),Y(S,"text",D),S});i.push.apply(i,p),of(t.audioTracks,r,h,c),of(t.subtitleTracks,o,h,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,r=this.hls.config,o=r.loader;this.loader&&this.loader.destroy(),this.loader=new o(r);try{t=new self.URL(e)}catch{return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if(t.protocol!=="data:"){var u=0|(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+u)}var c={responseType:"json",url:t.href},f=r.steeringManifestLoadPolicy.default,h=f.errorRetry||f.timeoutRetry||{},p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},y={onSuccess:function(b,A,k,D){i.log('Loaded steering manifest: "'+t+'"');var S=b.data;if(S.VERSION===1){i.updated=performance.now(),i.timeToLoad=S.TTL;var L=S["RELOAD-URI"],N=S["PATHWAY-CLONES"],P=S["PATHWAY-PRIORITY"];if(L)try{i.uri=new self.URL(L,t).href}catch{return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: "+L)}i.scheduleRefresh(i.uri||k.url),N&&i.clonePathways(N),P&&i.updatePathwayPriority(P)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,k,D){if(i.log("Error loading steering manifest: "+b.code+" "+b.text+" ("+A.url+")"),i.stopLoad(),b.code===410)return i.enabled=!1,void i.log("Steering manifest "+A.url+" no longer available");var S=1e3*i.timeToLoad;if(b.code!==429)i.scheduleRefresh(i.uri||A.url,S);else{var L=i.loader;if(typeof(L==null?void 0:L.getResponseHeader)=="function"){var N=L.getResponseHeader("Retry-After");N&&(S=1e3*parseFloat(N))}i.log("Steering manifest "+A.url+" rate limited")}},onTimeout:function(b,A,k){i.log("Timeout loading steering manifest ("+A.url+")"),i.scheduleRefresh(i.uri||A.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(c,p,y)},s.scheduleRefresh=function(e,t){var i=this;t===void 0&&(t=1e3*this.timeToLoad),self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(function(){i.loadSteeringManifest(e)},t)},d}();function of(d,s,e,t){d&&Object.keys(s).forEach(function(i){var r=d.filter(function(o){return o.groupId===i}).map(function(o){var u=F({},o);return u.details=void 0,u.attrs=new it(u.attrs),u.url=u.attrs.URI=lf(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",e),u.groupId=u.attrs["GROUP-ID"]=s[i],u.attrs["PATHWAY-ID"]=t,u});d.push.apply(d,r)})}function lf(d,s,e,t){var i,r=t.HOST,o=t.PARAMS,u=t[e];s&&(i=u==null?void 0:u[s])&&(d=i);var c=new self.URL(d);return r&&!i&&(c.host=r),o&&Object.keys(o).sort().forEach(function(f){f&&c.searchParams.set(f,o[f])}),c.href}var kg=/^age:\s*[\d.]+\s*$/im,df=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 xt,this.retryDelay=0}var s=d.prototype;return s.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},s.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()))},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},s.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.loadInternal()},s.loadInternal=function(){var e=this,t=this.config,i=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var u=this.xhrSetup;u?Promise.resolve().then(function(){if(!e.stats.aborted)return u(r,i.url)}).catch(function(c){return r.open("GET",i.url,!0),u(r,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(r,i,t)}).catch(function(c){e.callbacks.onError({code:r.status,text:c.message},i,r,o)}):this.openAndSendXhr(r,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var r=this.context.headers,o=i.loadPolicy,u=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(r)for(var f in r)e.setRequestHeader(f,r[f]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=u&&oe(u)?u:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()},s.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var r=t.readyState,o=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var u=t.status,c=t.responseType!=="text";if(u>=200&&u<300&&(c&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);var f=c?t.response:t.responseText,h=t.responseType==="arraybuffer"?f.byteLength:f.length;if(i.loaded=i.total=h,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(i,e,f,t),!this.callbacks)return;var y={url:t.responseURL,data:f,code:u};this.callbacks.onSuccess(y,i,e,t)}else{var b=o.loadPolicy.errorRetry;Za(b,i.retry,!1,u)?this.retry(b):(H.error(u+" while loading "+e.url),this.callbacks.onError({code:u,text:t.statusText},e,t,i))}}}},s.loadtimeout=function(){var e,t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry;if(Za(t,this.stats.retry,!0))this.retry(t);else{H.warn("timeout while loading "+this.context.url);var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},s.retry=function(e){var t=this.context,i=this.stats;this.retryDelay=as(e,i.retry),i.retry++,H.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+t.url+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},s.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},s.getCacheAge=function(){var e=null;if(this.loader&&kg.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},d}(),wg=/(\d+)-(\d+)\/(\d+)/,uf=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||Lg,this.controller=new self.AbortController,this.stats=new xt}var s=d.prototype;return s.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},s.abortInternal=function(){var e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},s.load=function(e,t,i){var r=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var u=function(A,k){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:k,headers:new self.Headers(F({},A.headers))};return A.rangeEnd&&D.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),D}(e,this.controller.signal),c=i.onProgress,f=e.responseType==="arraybuffer",h=f?"byteLength":"length",p=t.loadPolicy,y=p.maxTimeToFirstByteMs,b=p.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,u),self.clearTimeout(this.requestTimeout),t.timeout=y&&oe(y)?y:b,this.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(o,e,r.response)},t.timeout),self.fetch(this.request).then(function(A){r.response=r.loader=A;var k=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(r.requestTimeout),t.timeout=b,r.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(o,e,r.response)},b-(k-o.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Ig(S||"fetch, bad network response",D,A)}return o.loading.first=k,o.total=function(L){var N=L.get("Content-Range");if(N){var P=function(q){var j=wg.exec(q);if(j)return parseInt(j[2])-parseInt(j[1])+1}(N);if(oe(P))return P}var V=L.get("Content-Length");if(V)return parseInt(V)}(A.headers)||o.total,c&&oe(t.highWaterMark)?r.loadProgressively(A,o,e,t.highWaterMark,c):f?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var k=r.response;self.clearTimeout(r.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var D=A[h];D&&(o.loaded=o.total=D);var S={url:k.url,data:A,code:k.status};c&&!oe(t.highWaterMark)&&c(o,e,A,k),i.onSuccess(S,o,e,k)}).catch(function(A){if(self.clearTimeout(r.requestTimeout),!o.aborted){var k=A&&A.code||0,D=A?A.message:null;i.onError({code:k,text:D},e,A?A.details:null,o)}})},s.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},s.loadProgressively=function(e,t,i,r,o){r===void 0&&(r=0);var u=new Bh,c=e.body.getReader();return function f(){return c.read().then(function(h){if(h.done)return u.dataLength&&o(t,i,u.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=h.value,y=p.length;return t.loaded+=y,y<r||u.dataLength?(u.push(p),u.dataLength>=r&&o(t,i,u.flush(),e)):o(t,i,p,e),f()}).catch(function(){return Promise.reject()})}()},d}();function Lg(d,s){return new self.Request(d.url,s)}var Ig=function(d){function s(e,t,i){var r;return(r=d.call(this,e)||this).code=void 0,r.details=void 0,r.code=t,r.details=i,r}return Q(s,d),s}(Ae(Error)),Rg=/\s/,Dg=E(E({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,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:df,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$v,bufferController:tg,capLevelController:Eg,errorController:O,fpsController:bg,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:Nr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(d,s,e,t){for(var i,r,o,u,c,f=[],h=self.VTTCue||self.TextTrackCue,p=0;p<t.rows.length;p++)if(o=!0,u=0,c="",!(i=t.rows[p]).isEmpty()){for(var y,b=0;b<i.chars.length;b++)Rg.test(i.chars[b].uchar)&&o?u++:(c+=i.chars[b].uchar,o=!1);i.cueStartTime=s,s===e&&(e+=1e-4),u>=16?u--:u++;var A=Xh(c.trim()),k=ou(s,e,A);d!=null&&(y=d.cues)!=null&&y.getCueById(k)||((r=new h(s,e,A)).id=k,r.line=p+1,r.align="left",r.position=10+Math.min(80,10*Math.floor(8*u/32)),f.push(r))}return d&&f.length&&(f.sort(function(D,S){return D.line==="auto"||S.line==="auto"?0:D.line>8&&S.line>8?S.line-D.line:D.line-S.line}),f.forEach(function(D){return Ro(d,D)})),f}},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:Xv,subtitleTrackController:Jv,timelineController:gg,audioStreamController:jv,audioTrackController:zv,emeController:nf,cmcdController:Ag,contentSteeringController:Sg});function mu(d){return d&&typeof d=="object"?Array.isArray(d)?d.map(mu):Object.keys(d).reduce(function(s,e){return s[e]=mu(d[e]),s},{}):d}function Cg(d){var s=d.loader;s!==uf&&s!==df?(H.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(d.loader=uf,d.progressive=!0,d.enableSoftwareAES=!0,H.log("[config]: Progressive streaming enabled, using FetchLoader"))}var cf=function(){function d(e){e===void 0&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Go,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,Je(e.debug||!1,"Hls instance");var t=this.config=function(ue,ne){if((ne.liveSyncDurationCount||ne.liveMaxLatencyDurationCount)&&(ne.liveSyncDuration||ne.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(ne.liveMaxLatencyDurationCount!==void 0&&(ne.liveSyncDurationCount===void 0||ne.liveMaxLatencyDurationCount<=ne.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(ne.liveMaxLatencyDuration!==void 0&&(ne.liveSyncDuration===void 0||ne.liveMaxLatencyDuration<=ne.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var Te=mu(ue),Me=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(_e){var De=(_e==="level"?"playlist":_e)+"LoadPolicy",xe=ne[De]===void 0,Ce=[];Me.forEach(function(He){var We=_e+"Loading"+He,Qe=ne[We];if(Qe!==void 0&&xe){Ce.push(We);var ot=Te[De].default;switch(ne[De]={default:ot},He){case"TimeOut":ot.maxLoadTimeMs=Qe,ot.maxTimeToFirstByteMs=Qe;break;case"MaxRetry":ot.errorRetry.maxNumRetry=Qe,ot.timeoutRetry.maxNumRetry=Qe;break;case"RetryDelay":ot.errorRetry.retryDelayMs=Qe,ot.timeoutRetry.retryDelayMs=Qe;break;case"MaxRetryTimeout":ot.errorRetry.maxRetryDelayMs=Qe,ot.timeoutRetry.maxRetryDelayMs=Qe}}}),Ce.length&&H.warn('hls.js config: "'+Ce.join('", "')+'" setting(s) are deprecated, use "'+De+'": '+JSON.stringify(ne[De]))}),E(E({},Te),ne)}(d.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Cg(t);var i=t.abrController,r=t.bufferController,o=t.capLevelController,u=t.errorController,c=t.fpsController,f=new u(this),h=this.abrController=new i(this),p=this.bufferController=new r(this),y=this.capLevelController=new o(this),b=new c(this),A=new St(this),k=new Fd(this),D=t.contentSteeringController,S=D?new D(this):null,L=this.levelController=new G(this,S),N=new be(this),P=new yt(this.config),V=this.streamController=new qv(this,N,P);y.setStreamController(V),b.setStreamController(V);var q=[A,L,V];S&&q.splice(1,0,S),this.networkControllers=q;var j=[h,p,y,b,k,N];this.audioTrackController=this.createController(t.audioTrackController,q);var ee=t.audioStreamController;ee&&q.push(new ee(this,N,P)),this.subtitleTrackController=this.createController(t.subtitleTrackController,q);var z=t.subtitleStreamController;z&&q.push(new z(this,N,P)),this.createController(t.timelineController,j),P.emeController=this.emeController=this.createController(t.emeController,j),this.cmcdController=this.createController(t.cmcdController,j),this.latencyController=this.createController(Ud,j),this.coreComponents=j,q.push(f);var X=f.onErrorOut;typeof X=="function"&&this.on(w.ERROR,X,f)}d.isSupported=function(){return function(){var e=$a();if(!e)return!1;var t=Eh(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!r}()};var s=d.prototype;return s.createController=function(e,t){if(e){var i=new e(this);return t&&t.push(i),i}return null},s.on=function(e,t,i){i===void 0&&(i=this),this._emitter.on(e,t,i)},s.once=function(e,t,i){i===void 0&&(i=this),this._emitter.once(e,t,i)},s.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},s.off=function(e,t,i,r){i===void 0&&(i=this),this._emitter.off(e,t,i,r)},s.listeners=function(e){return this._emitter.listeners(e)},s.emit=function(e,t,i){return this._emitter.emit(e,t,i)},s.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){H.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1},s.listenerCount=function(e){return this._emitter.listenerCount(e)},s.destroy=function(){H.log("destroy"),this.trigger(w.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},s.attachMedia=function(e){H.log("attachMedia"),this._media=e,this.trigger(w.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){H.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,r=this.url=dt.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});H.log("loadSource:"+r),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(w.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),H.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){H.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){H.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){H.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},s.removeLevel=function(e,t){t===void 0&&(t=0),this.levelController.removeLevel(e,t)},M(d,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){H.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){H.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){H.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){H.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){H.log("set startLevel:"+e),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(H.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){Jn.indexOf(e)>-1&&(this._maxHdcpLevel=e)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,r=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,r)for(var o=e;o--;){var u=t[o].attrs["HDCP-LEVEL"];if(u&&u<=r)return o}return e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{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}}],[{key:"version",get:function(){return"1.4.1"}},{key:"Events",get:function(){return w}},{key:"ErrorTypes",get:function(){return le}},{key:"ErrorDetails",get:function(){return $}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Dg},set:function(e){d.defaultConfig=e}}]),d}();return cf.defaultConfig=void 0,cf},typeof ep=="object"&&typeof Pc!="undefined"?Pc.exports=m():typeof define=="function"&&define.amd?define(m):(l=typeof globalThis!="undefined"?globalThis:l||self).Hls=m()})(!1)});var on=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class n extends on{}globalThis.DocumentFragment=n}var hs=class extends on{},yu=class extends on{},qg={get(n){},define(n,a,l){},upgrade(n){},whenDefined(n){return Promise.resolve(hs)}},fs,Eu=class{constructor(a,l={}){Dt(this,fs,void 0);Oi(this,fs,l==null?void 0:l.detail)}get detail(){return at(this,fs)}initCustomEvent(){}};fs=new WeakMap;function Yg(n,a){return new hs}var Ef={document:{createElement:Yg},DocumentFragment,customElements:qg,CustomEvent:Eu,EventTarget:on,HTMLElement:hs,HTMLVideoElement:yu},bf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Ft=bf?Ef:globalThis,Si=bf?Ef.document:globalThis.document;var ve={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},ms={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},Pe={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},U={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"media-fullscreen-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_TIME:"media-preview-time",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered",MEDIA_STREAM_TYPE:"media-stream-type",MEDIA_TARGET_LIVE_WINDOW:"media-target-live-window",MEDIA_TIME_IS_LIVE:"media-time-is-live"},V0=Object.entries(ms).reduce((n,[a,l])=>{let m=U[a];return m&&(n[l]=m),n},{userinactivechange:"user-inactive"}),_f=Object.entries(U).reduce((n,[a,l])=>{let m=ms[a];return m&&(n[l]=m),n},{"user-inactive":"userinactivechange"}),ln={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},La={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var bu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Tr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Yi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var Jt={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:n=1}={})=>`current playback rate ${n}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},ct={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:n=30}={})=>`seek forward ${n} seconds`,SEEK_BACK_N_SECS:({seekOffset:n=30}={})=>`seek back ${n} seconds`,SEEK_LIVE:()=>"seek to live",PLAYING_LIVE:()=>"playing live"},jg={...Jt,...ct};function jo(n,a=!1){return n.split("_").map(function(l,m){return(m||a?l[0].toUpperCase():l[0].toLowerCase())+l.slice(1).toLowerCase()}).join("")}function Tf(n){return n.replace(/[-_]([a-z])/g,(a,l)=>l.toUpperCase())}function Af(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function zo(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var Qo=n=>new Promise(a=>setTimeout(a,n));var Sf=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],zg=(n,a)=>{let l=n===1?Sf[a].singular:Sf[a].plural;return`${n} ${l}`},Ia=n=>{if(!Af(n))return"";let a=Math.abs(n),l=a!==n,m=new Date(0,0,0,0,0,a,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,B)=>M&&zg(M,B)).filter(M=>M).join(", ")}${l?" remaining":""}`};function ki(n,a){let l=!1;n<0&&(l=!0,n=0-n),n=n<0?0:n;let m=Math.floor(n%60),v=Math.floor(n/60%60),E=Math.floor(n/3600),I=Math.floor(a/60%60),M=Math.floor(a/3600);return(isNaN(n)||n===1/0)&&(E=v=m="-"),E=E>0||M>0?E+":":"",v=((E||I>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(l?"-":"")+E+v+m}var Qg=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function kf(n=Qg){return Array.from(n).map((a,l)=>[Number(n.start(l).toFixed(3)),Number(n.end(l).toFixed(3))].join(":")).join(" ")}var Xo=(n,a,l=".value")=>{let m=n.querySelector(l);!m||(m.textContent=a)},Zg=(n,a)=>{let l=`slot[name="${a}"]`,m=n.shadowRoot.querySelector(l);return m?m.children:[]},Zo=(n,a)=>Zg(n,a)[0],ps=(n,a)=>!n||!a?!1:n.contains(a)?!0:ps(n,a.getRootNode().host),Ra=(n,a)=>{if(!n)return null;let l=n.closest(a);return l||Ra(n.getRootNode().host,a)};function Ct(n,a){var l;let m;for(m of n.querySelectorAll("style")){let v;try{v=(l=m.sheet)==null?void 0:l.cssRules}catch{continue}for(let E of v!=null?v:[])if(E.selectorText===a)return E}return m!=null&&m.sheet?(m.sheet.insertRule(`${a}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}var Jo=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},_u=class{observe(){}},wf={ResizeObserver:_u,HTMLElement:class extends Jo{},DocumentFragment:class extends Jo{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},Jg={createElement:function(){return new wf.HTMLElement},addEventListener(){},removeEventListener(){}},Lf=typeof window=="undefined"||typeof window.customElements=="undefined",W=Lf?wf:window,ie=Lf?Jg:window.document;var ey=Object.defineProperty,ty=(n,a,l)=>a in n?ey(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,iy=(n,a,l)=>(ty(n,typeof a!="symbol"?a+"":a,l),l),If=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ni=(n,a,l)=>(If(n,a,"read from private field"),l?l.call(n):a.get(n)),el=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},tl=(n,a,l,m)=>(If(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ir,il,dn,rl,Rf=ie.createElement("template");Rf.innerHTML=`
42
+ `),E=[],b=(d=s.baseTime,(c=s.timescale)===void 0&&(c=1),ad(d,9e4,1/c)),A="00:00.000",w=0,D=0,S=!0;h.oncue=function(L){var N=e[t],P=e.ccOffset,V=(w-b)/9e4;N!=null&&N.new&&(D!==void 0?P=e.ccOffset=N.start:function(Q,X,ce){var oe=Q[X],Ae=Q[oe.prevCC];if(!Ae||!Ae.new&&oe.new)return Q.ccOffset=Q.presentationOffset=oe.start,void(oe.new=!1);for(;(xe=Ae)!=null&&xe.new;){var xe;Q.ccOffset+=oe.start-Ae.start,oe.new=!1,Ae=Q[(oe=Ae).prevCC]}Q.presentationOffset=ce}(e,t,V)),V&&(P=V-e.presentationOffset);var Y=L.endTime-L.startTime,j=Fi(9e4*(L.startTime+P-D),9e4*i)/9e4;L.startTime=Math.max(j,0),L.endTime=Math.max(j+Y,0);var ie=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(ie)),L.id||(L.id=Ed(L.startTime,L.endTime,ie)),L.endTime>0&&E.push(L)},h.onparsingerror=function(L){f=L},h.onflush=function(){f?o(f):a(E)},p.forEach(function(L){if(S){if(vd(L,"X-TIMESTAMP-MAP=")){S=!1,L.slice(16).split(",").forEach(function(N){vd(N,"LOCAL:")?A=N.slice(6):vd(N,"MPEGTS:")&&(w=parseInt(N.slice(7)))});try{D=function(N){var P=parseInt(N.slice(-3)),V=parseInt(N.slice(-6,-4)),Y=parseInt(N.slice(-9,-7)),j=N.length>9?parseInt(N.substring(0,N.indexOf(":"))):0;if(!(re(P)&&re(V)&&re(Y)&&re(j)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+N);return P+=1e3*V,(P+=6e4*Y)+36e5*j}(A)/1e3}catch(N){f=N}return}L===""&&(S=!1)}h.parse(L+`
43
+ `)}),h.flush()}var yd="stpp.ttml.im1t",df=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,cf=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ig={left:"start",center:"center",right:"end",start:"start",end:"end"};function hf(u,s,e,t){var i=Je(new Uint8Array(u),["mdat"]);if(i.length!==0){var a,o,d,c,f=i.map(function(p){return Li(p)}),h=(a=s.baseTime,o=1,(d=s.timescale)===void 0&&(d=1),c===void 0&&(c=!1),ad(a,o,1/d,c));try{f.forEach(function(p){return e(function(E,b){var A=new DOMParser().parseFromString(E,"text/xml").getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var w={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(w).reduce(function(V,Y){return V[Y]=A.getAttribute("ttp:"+Y)||w[Y],V},{}),S=A.getAttribute("xml:space")!=="preserve",L=ff(bd(A,"styling","style")),N=ff(bd(A,"layout","region")),P=bd(A,"body","[begin]");return[].map.call(P,function(V){var Y=mf(V,S);if(!Y||!V.hasAttribute("begin"))return null;var j=Td(V.getAttribute("begin"),D),ie=Td(V.getAttribute("dur"),D),Q=Td(V.getAttribute("end"),D);if(j===null)throw pf(V);if(Q===null){if(ie===null)throw pf(V);Q=j+ie}var X=new md(j-b,Q-b,Y);X.id=Ed(X.startTime,X.endTime,X.text);var ce=function(xe,Le,Me){var Oe="http://www.w3.org/ns/ttml#styling",Pe=null,Ke=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],je=xe!=null&&xe.hasAttribute("style")?xe.getAttribute("style"):null;return je&&Me.hasOwnProperty(je)&&(Pe=Me[je]),Ke.reduce(function(et,lt){var _i=_d(Le,Oe,lt)||_d(xe,Oe,lt)||_d(Pe,Oe,lt);return _i&&(et[lt]=_i),et},{})}(N[V.getAttribute("region")],L[V.getAttribute("style")],L),oe=ce.textAlign;if(oe){var Ae=Ig[oe];Ae&&(X.lineAlign=Ae),X.align=oe}return H(X,ce),X}).filter(function(V){return V!==null})}(p,h))})}catch(p){t(p)}}else t(new Error("Could not parse IMSC1 mdat"))}function bd(u,s,e){var t=u.getElementsByTagName(s)[0];return t?[].slice.call(t.querySelectorAll(e)):[]}function ff(u){return u.reduce(function(s,e){var t=e.getAttribute("xml:id");return t&&(s[t]=e),s},{})}function mf(u,s){return[].slice.call(u.childNodes).reduce(function(e,t,i){var a;return t.nodeName==="br"&&i?e+`
44
+ `:(a=t.childNodes)!=null&&a.length?mf(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function _d(u,s,e){return u&&u.hasAttributeNS(s,e)?u.getAttributeNS(s,e):null}function pf(u){return new Error("Could not parse ttml timestamp "+u)}function Td(u,s){if(!u)return null;var e=of(u);return e===null&&(df.test(u)?e=function(t,i){var a=df.exec(t),o=(0|a[4])+(0|a[5])/i.subFrameRate;return 3600*(0|a[1])+60*(0|a[2])+(0|a[3])+o/i.frameRate}(u,s):cf.test(u)&&(e=function(t,i){var a=cf.exec(t),o=Number(a[1]);switch(a[2]){case"h":return 3600*o;case"m":return 60*o;case"ms":return 1e3*o;case"f":return o/i.frameRate;case"t":return o/i.tickRate}return o}(u,s))),e}var Rg=function(){function u(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.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 Zo(this,"textTrack1"),i=new Zo(this,"textTrack2"),a=new Zo(this,"textTrack3"),o=new Zo(this,"textTrack4");this.cea608Parser1=new nf(1,t,i),this.cea608Parser2=new nf(3,a,o)}e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=u.prototype;return s.destroy=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,a,o){for(var d,c,f,h,p=!1,E=o.length;E--;){var b=o[E],A=(d=b[0],c=b[1],f=t,h=i,Math.min(c,h)-Math.max(d,f));if(A>=0&&(b[0]=Math.min(b[0],t),b[1]=Math.max(b[1],i),p=!0,A/(i-t)>.5))return}if(p||o.push([t,i]),this.config.renderTextTracksNatively){var w=this.captionsTracks[e];this.Cues.newCue(w,t,i,a)}else{var D=this.Cues.newCue(null,t,i,a);this.hls.trigger(k.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,a=t.frag,o=t.id,d=t.initPTS,c=t.timescale,f=this.unparsedVttFrags;o==="main"&&(this.initPTS[a.cc]={baseTime:d,timescale:c}),f.length&&(this.unparsedVttFrags=[],f.forEach(function(h){i.onFragLoaded(k.FRAG_LOADED,h)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var a=t.textTracks[i];if(a[e])return a}return null},s.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},s.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,i=this.captionsTracks,a=this.media,o=t[e],d=o.label,c=o.languageCode,f=this.getExistingTrack(e);if(f)i[e]=f,Qr(i[e]),Ta(i[e],a);else{var h=this.createTextTrack("captions",d,c);h&&(h[e]=!0,i[e]=h)}}},s.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(k.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var a=this.media;if(a)return a.addTextTrack(e,t,i)},s.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},s.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Qr(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}},s.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.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},s._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Qr(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,a=t.subtitleTracks||[],o=a.some(function(f){return f.textCodec===yd});if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(Xh(this.tracks,a))return void(this.tracks=a);if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:null;this.tracks.forEach(function(f,h){var p;if(d&&h<d.length){for(var E=null,b=0;b<d.length;b++)if(Dg(d[b],f)){E=d[b];break}E&&(p=E)}if(p)Qr(p);else{var A=i._captionsOrSubtitlesFromCharacteristics(f);(p=i.createTextTrack(A,f.name,f.lang))&&(p.mode="disabled")}p&&(p.groupId=f.groupId,i.textTracks.push(p))})}else if(this.tracks.length){var c=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(k.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s._captionsOrSubtitlesFromCharacteristics=function(e){if(e.attrs.CHARACTERISTICS){var t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"},s.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(a){var o=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(o){var d="textTrack"+o[1],c=i.captionsProperties[d];c&&(c.label=a.name,a.lang&&(c.languageCode=a.lang),c.media=a)}})},s.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]},s.onFragLoading=function(e,t){var i=this.cea608Parser1,a=this.cea608Parser2,o=this.lastSn,d=this.lastPartIndex;if(this.enabled&&i&&a&&t.frag.type===rt){var c,f,h=t.frag.sn,p=(c=t==null||(f=t.part)==null?void 0:f.index)!=null?c:-1;h===o+1||h===o&&p===d+1||(i.reset(),a.reset()),this.lastSn=h,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.payload,o=this.initPTS,d=this.unparsedVttFrags;if(i.type===Oi)if(a.byteLength){if(!o[i.cc])return d.push(t),void(o.length&&this.hls.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var c=i.decryptdata,f="stats"in t;if(c==null||!c.encrypted||f){var h=this.tracks[i.level],p=this.vttCCs;p[i.cc]||(p[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===yd?this._parseIMSC1(i,a):this._parseVTTs(i,a,p)}}else this.hls.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,a=this.hls;hf(t,this.initPTS[e.cc],function(o){i._appendCues(o,e.level),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(o){U.log("Failed to parse IMSC1: "+o),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:o})})},s._parseVTTs=function(e,t,i){var a,o=this,d=this.hls;Lg((a=e.initSegment)!=null&&a.data?yr(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],i,e.cc,e.start,function(c){o._appendCues(c,e.level),d.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){o._fallbackToIMSC1(e,t),U.log("Failed to parse VTT cue: "+c),d.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,a=this.tracks[e.level];a.textCodec||hf(t,this.initPTS[e.cc],function(){a.textCodec=yd,i._parseIMSC1(e,t)},function(){a.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[t];if(!a||a.mode==="disabled")return;e.forEach(function(c){return Uo(a,c)})}else{var o=this.tracks[t];if(!o)return;var d=o.default?"default":"subtitles"+t;i.trigger(k.CUES_PARSED,{type:"subtitles",cues:e,track:d})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Oi){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(k.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,a=this.cea608Parser2;if(this.enabled&&i&&a){var o=t.frag,d=t.samples;if(o.type!==rt||this.closedCaptionsForLevel(o)!=="NONE")for(var c=0;c<d.length;c++){var f=d[c].bytes;if(f){var h=this.extractCea608Data(f);i.addData(d[c].pts,h[0]),a.addData(d[c].pts,h[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,o=t.endOffsetSubtitles,d=t.type,c=this.media;if(c&&!(c.currentTime<a)){if(!d||d==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(p){return hs(f[p],i,a)})}if(this.config.renderTextTracksNatively&&i===0&&o!==void 0){var h=this.textTracks;Object.keys(h).forEach(function(p){return hs(h[p],i,o)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],a=2,o=0;o<i;o++){var d=e[a++],c=127&e[a++],f=127&e[a++];if((c!==0||f!==0)&&(4&d)!=0){var h=3&d;h!==0&&h!==1||(t[h].push(c),t[h].push(f))}}return t},u}();function Dg(u,s){return!!u&&u.label===s.name&&!(u.textTrack1||u.textTrack2)}var Cg=function(){function u(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var s=u.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(e,t){var i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null},s.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this,i=this.hls.levels;if(!i.length)return-1;var a=i.filter(function(o,d){return t.isLevelAllowed(o)&&d<=e});return this.clientRect=null,u.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},s.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())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t},s.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},u.getMaxLevelByMediaSize=function(e,t,i){if(e==null||!e.length)return-1;for(var a,o,d=e.length-1,c=0;c<e.length;c+=1){var f=e[c];if((f.width>=t||f.height>=i)&&(a=f,!(o=e[c+1])||a.width!==o.width||a.height!==o.height)){d=c;break}}return d},M(u,[{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 e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}}]),u}(),Mg=function(){function u(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 s=u.prototype;return s.setStreamController=function(e){this.streamController=e},s.registerListeners=function(){this.hls.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},s.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var a=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=a,a&&typeof a.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},s.checkFPS=function(e,t,i){var a=performance.now();if(t){if(this.lastTime){var o=a-this.lastTime,d=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,f=1e3*d/o,h=this.hls;if(h.trigger(k.FPS_DROP,{currentDropped:d,currentDecoded:c,totalDroppedFrames:i}),f>0&&d>h.config.fpsDroppedMonitoringThreshold*c){var p=h.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=p)&&(p-=1,h.trigger(k.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:h.currentLevel}),h.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},s.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)},u}(),el="[eme]",vf=function(){function u(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=u.CDMCleanupPromise?[u.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,el),this.log=U.log.bind(U,el),this.warn=U.warn.bind(U,el),this.error=U.error.bind(U,el),this.hls=e,this.config=e.config,this.registerListeners()}var s=u.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},s.registerListeners=function(){this.hls.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,a=t.widevineLicenseUrl,o=i[e];if(o)return o.licenseUrl;if(e===Ze.WIDEVINE&&a)return a;throw new Error('no license server URL configured for key-system "'+e+'"')},s.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},s.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,a=function(c,f,h){return!!c&&h.indexOf(c)===f},o=i.map(function(c){return c.audioCodec}).filter(a),d=i.map(function(c){return c.videoCodec}).filter(a);return o.length+d.length===0&&d.push("avc1.42e01e"),new Promise(function(c,f){(function h(p){var E=p.shift();t.getMediaKeysPromise(E,o,d).then(function(b){return c({keySystem:E,mediaKeys:b})}).catch(function(b){p.length?h(p):f(b instanceof Ui?b:new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_ACCESS,error:b,fatal:!0},b.message))})})(e)})},s.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var a="Configured requestMediaKeySystemAccess is not a function "+i;return $r===null&&self.location.protocol==="http:"&&(a="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(a))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var a=this,o=function(h,p,E,b){var A;switch(h){case Ze.FAIRPLAY:A=["cenc","sinf"];break;case Ze.WIDEVINE:case Ze.PLAYREADY:A=["cenc"];break;case Ze.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+h)}return function(w,D,S,L){return[{initDataTypes:w,persistentState:L.persistentState||"not-allowed",distinctiveIdentifier:L.distinctiveIdentifier||"not-allowed",sessionTypes:L.sessionTypes||[L.sessionType||"temporary"],audioCapabilities:D.map(function(N){return{contentType:'audio/mp4; codecs="'+N+'"',robustness:L.audioRobustness||"",encryptionScheme:L.audioEncryptionScheme||null}}),videoCapabilities:S.map(function(N){return{contentType:'video/mp4; codecs="'+N+'"',robustness:L.videoRobustness||"",encryptionScheme:L.videoEncryptionScheme||null}})}]}(A,p,E,b)}(e,t,i,this.config.drmSystemOptions),d=this.keySystemAccessPromises[e],c=d==null?void 0:d.keySystemAccess;if(!c){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(o)),c=this.requestMediaKeySystemAccess(e,o);var f=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(h){a.log('Failed to obtain access to key-system "'+e+'": '+h)}),c.then(function(h){a.log('Access for key-system "'+h.keySystem+'" obtained');var p=a.fetchServerCertificate(e);return a.log('Create media-keys for "'+e+'"'),f.mediaKeys=h.createMediaKeys().then(function(E){return a.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?a.setMediaKeysServerCertificate(E,e,b):E})}),f.mediaKeys.catch(function(E){a.error('Failed to create media-keys for "'+e+'"}: '+E)}),f.mediaKeys})}return c.then(function(){return d.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,a=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+Pi(t.keyId||[]));var o=a.createSession(),d={decryptdata:t,keySystem:i,mediaKeys:a,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(d),d},s.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),a=this.getKeyIdString(t);this.keyIdToKeySessionPromise[a]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},s.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 Pi(e.keyId)},s.updateKeySession=function(e,t){var i,a=e.mediaKeysSession;return this.log('Updating key-session "'+a.sessionId+'" for keyID '+Pi(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
45
+ } (data length: `+(t&&t.byteLength)+")"),a.update(t)},s.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},s.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,a){var o=gr(t.config),d=e.map(Ei).filter(function(c){return!!c&&o.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(d).then(function(c){var f=c.keySystem,h=rr(f);h?i(h):a(new Error('Unable to find format for key-system "'+f+'"'))}).catch(a)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,a=this.getKeyIdString(i),o="(keyId: "+a+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+o);var d=this.keyIdToKeySessionPromise[a];return d||(d=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(i).then(function(c){var f=c.keySystem,h=c.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+o),t.attemptSetMediaKeys(f,h).then(function(){t.throwIfDestroyed();var p=t.createMediaKeySessionContext({keySystem:f,mediaKeys:h,decryptdata:i});return t.generateRequestWithPreferredKeySession(p,"cenc",i.pssh,"playlist-key")})})).catch(function(c){return t.handleError(c)}),d},s.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},s.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Ui?this.hls.trigger(k.ERROR,e.data):this.hls.trigger(k.ERROR,{type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},s.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var a=Ei(e.keyFormat),o=a?[a]:gr(this.config);return this.attemptKeySystemAccess(o)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=gr(this.config)),e.length===0)throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},s._onMediaEncrypted=function(e){var t=this,i=e.initDataType,a=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),a!==null){var o,d;if(i==="sinf"&&this.config.drmSystems[Ze.FAIRPLAY]){var c=Mt(new Uint8Array(a));try{var f=Rt(JSON.parse(c).sinf),h=ns(new Uint8Array(f));if(!h)return;o=h.subarray(8,24),d=Ze.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=function(N){if(!(N instanceof ArrayBuffer)||N.byteLength<32)return null;var P={version:0,systemId:"",kids:null,data:null},V=new DataView(N),Y=V.getUint32(0);if(N.byteLength!==Y&&Y>44||V.getUint32(4)!==1886614376||(P.version=V.getUint32(8)>>>24,P.version>1))return null;P.systemId=Pi(new Uint8Array(N,12,16));var j=V.getUint32(28);if(P.version===0){if(Y-32<j)return null;P.data=new Uint8Array(N,32,j)}else if(P.version===1){P.kids=[];for(var ie=0;ie<j;ie++)P.kids.push(new Uint8Array(N,32+16*ie,16))}return P}(a);if(p===null)return;p.version===0&&p.systemId===ct&&p.data&&(o=p.data.subarray(8,24)),d=function(N){if(N===ct)return Ze.WIDEVINE}(p.systemId)}if(d&&o){for(var E=Pi(o),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,w=b[E],D=function(){var N=A[S],P=N.decryptdata;if(P.pssh||!P.keyId)return"continue";var V=Pi(P.keyId);return E===V||P.uri.replace(/-/g,"").indexOf(E)!==-1?(w=b[V],delete b[V],P.pssh=new Uint8Array(a),P.keyId=o,w=b[E]=w.then(function(){return t.generateRequestWithPreferredKeySession(N,i,a,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var L=D();if(L!=="continue"&&L==="break")break}w||(w=b[E]=this.getKeySystemSelectionPromise([d]).then(function(N){var P,V=N.keySystem,Y=N.mediaKeys;t.throwIfDestroyed();var j=new ba("ISO-23001-7",E,(P=rr(V))!=null?P:"");return j.pssh=new Uint8Array(a),j.keyId=o,t.attemptSetMediaKeys(V,Y).then(function(){t.throwIfDestroyed();var ie=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:Y});return t.generateRequestWithPreferredKeySession(ie,i,a,"encrypted-event-no-match")})})),w.catch(function(N){return t.handleError(N)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,a=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var o=Promise.all(a).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(o),o.then(function(){i.log('Media-keys set for "'+e+'"'),a.push(o),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(d){return a.indexOf(d)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,a){var o,d,c=this,f=(o=this.config.drmSystems)==null||(d=o[e.keySystem])==null?void 0:d.generateRequest;if(f)try{var h=f.call(this.hls,t,i,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,i=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(w){var p;if(this.warn(w.message),(p=this.hls)!=null&&p.config.debug)throw w}if(i===null)return this.log('Skipping key-session request for "'+a+'" (no initData)'),Promise.resolve(e);var E=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+a+'": '+E+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new Xo;e.mediaKeysSession.onmessage=function(w){var D=e.mediaKeysSession;if(D){var S=w.messageType,L=w.message;c.log('"'+S+'" message event for session "'+D.sessionId+'" message size: '+L.byteLength),S==="license-request"||S==="license-renewal"?c.renewLicense(e,L).catch(function(N){c.handleError(N),b.emit("error",N)}):S==="license-release"?e.keySystem===Ze.FAIRPLAY&&(c.updateKeySession(e,$i("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(w){if(e.mediaKeysSession){c.onKeyStatusChange(e);var D=e.keyStatus;b.emit("keyStatus",D),D==="expired"&&(c.warn(e.keySystem+" expired for key "+E),c.renewKeySession(e))}else b.emit("error",new Error("invalid state"))};var A=new Promise(function(w,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?w():S==="output-restricted"?D(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+S+'"')):S==="expired"?D(new Error("key expired while generating request")):c.warn('unhandled key status change "'+S+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var w;c.log('Request generated for key-session "'+((w=e.mediaKeysSession)==null?void 0:w.sessionId)+'" keyId: '+E)}).catch(function(w){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_SESSION,error:w,fatal:!1},"Error generating key-session request: "+w)}).then(function(){return A}).catch(function(w){throw b.removeAllListeners(),c.removeSession(e),w}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,a){t.log('key status change "'+i+'" for keyStatuses keyId: '+Pi("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))+" session keyId: "+Pi(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},s.fetchServerCertificate=function(e){var t=this.config,i=new t.loader(t),a=this.getServerCertificateUrl(e);return a?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(o,d){var c={responseType:"arraybuffer",url:a},f=t.certLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(E,b,A,w){o(E.data)},onError:function(E,b,A,w){d(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:y({url:c.url,data:void 0},E)},'"'+e+'" certificate request failed ('+a+"). Status: "+E.code+" ("+E.text+")"))},onTimeout:function(E,b,A){d(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:{url:c.url,data:void 0}},'"'+e+'" certificate request timed out ('+a+")"))},onAbort:function(E,b,A){d(new Error("aborted"))}};i.load(c,h,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var a=this;return new Promise(function(o,d){e.setServerCertificate(i).then(function(c){a.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),o(e)}).catch(function(c){d(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})},s.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(a){return i.updateKeySession(e,new Uint8Array(a)).catch(function(o){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:o,fatal:!0},o.message)})})},s.setupLicenseXHR=function(e,t,i,a){var o=this,d=this.config.licenseXhrSetup;return d?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return d.call(o.hls,e,t,i,a)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),d.call(o.hls,e,t,i,a)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||a}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:a}))},s.requestLicense=function(e,t){var i=this,a=this.config.keyLoadPolicy.default;return new Promise(function(o,d){var c=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+c);var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return d(new Error("invalid state"));if(f.readyState===4)if(f.status===200){i._requestLicenseFailureCount=0;var h=f.response;i.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var p=i.config.licenseResponseCallback;if(p)try{h=p.call(i.hls,f,c,e)}catch(w){i.error(w)}o(h)}else{var E=a.errorRetry,b=E?E.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||f.status>=400&&f.status<500)d(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:c,data:void 0,code:f.status,text:f.statusText}},"License Request XHR failed ("+c+"). Status: "+f.status+" ("+f.statusText+")"));else{var A=b-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+A+" attempts left"),i.requestLicense(e,t).then(o,d)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=f,i.setupLicenseXHR(f,c,e,t).then(function(h){var p=h.xhr,E=h.licenseChallenge;p.send(E)})})},s.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)}},s.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={},ba.clearKeyUriToKeyIdMap();var a=i.length;u.CDMCleanupPromise=Promise.all(i.map(function(o){return e.removeSession(o)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(o){e.log("Could not clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))}))).then(function(){a&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(o){e.log("Could not close sessions and clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))})},s.onManifestLoading=function(){this.keyFormatPromise=null},s.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var a=i.reduce(function(o,d){return o.indexOf(d.keyFormat)===-1&&o.push(d.keyFormat),o},[]);this.log("Selecting key-system from session-keys "+a.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(a)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,a=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var o=this.mediaKeySessions.indexOf(e);return o>-1&&this.mediaKeySessions.splice(o,1),i.remove().catch(function(d){t.log("Could not remove session: "+d)}).then(function(){return i.close()}).catch(function(d){t.log("Could not close session: "+d)})}},u}();vf.CDMCleanupPromise=void 0;var Ui=function(u){function s(e,t){var i;return(i=u.call(this,t)||this).data=void 0,e.error||(e.error=new Error(t)),i.data=e,e.err=e.error,i}return z(s,u),s}(_e(Error)),xg="m",tl="a",Ad="v",Sd="av",gf="i",Pg="tt",Og=function(){function u(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(o){try{t.apply(o,{ot:xg,su:!t.initialized})}catch(d){U.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(o){try{var d=o.frag,c=t.hls.levels[d.level],f=t.getObjectType(d),h={d:1e3*d.duration,ot:f};f!==Ad&&f!==tl&&f!=Sd||(h.br=c.bitrate/1e3,h.tb=t.getTopBandwidth(f)/1e3,h.bl=t.getBufferLength(f)),t.apply(o,h)}catch(p){U.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,a=i.cmcd;a!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||u.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHED,this.onMediaDetached,this),e.on(k.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHED,this.onMediaDetached,this),e.off(k.BUFFER_CREATED,this.onBufferCreated,this)},s.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},s.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},s.onBufferCreated=function(e,t){var i,a;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(a=t.tracks.video)==null?void 0:a.buffer},s.createData=function(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},s.apply=function(e,t){t===void 0&&(t={}),H(t,this.createData());var i=t.ot===gf||t.ot===Ad||t.ot===Sd;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var a=u.toHeaders(t);if(!Object.keys(a).length)return;e.headers||(e.headers={}),H(e.headers,a)}else{var o=u.toQuery(t);if(!o)return;e.url=u.appendQueryToUri(e.url,o)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?Pg:e.sn==="initSegment"?gf:t==="audio"?tl:t==="main"?this.hls.audioTracks.length?Ad:Sd:void 0},s.getTopBandwidth=function(e){var t,i=0,a=this.hls;if(e===tl)t=a.audioTracks;else{var o=a.maxAutoLevel,d=o>-1?o+1:a.levels.length;t=a.levels.slice(0,d)}for(var c,f=ye(t);!(c=f()).done;){var h=c.value;h.bitrate>i&&(i=h.bitrate)}return i>0?i:NaN},s.getBufferLength=function(e){var t=this.hls.media,i=e===tl?this.audioBuffer:this.videoBuffer;return i&&t?1e3*he.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},s.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function a(d){this.loader=void 0,this.loader=new i(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(d,c,f){t(d),this.loader.load(d,c,f)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function a(d){this.loader=void 0,this.loader=new i(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(d,c,f){t(d),this.loader.load(d,c,f)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},u.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},u.serialize=function(e){for(var t,i=[],a=function(w){return!Number.isNaN(w)&&w!=null&&w!==""&&w!==!1},o=function(w){return Math.round(w)},d=function(w){return 100*o(w/100)},c={br:o,d:o,bl:d,dl:d,mtp:d,nor:function(w){return encodeURIComponent(w)},rtp:d,tb:o},f=ye(Object.keys(e||{}).sort());!(t=f()).done;){var h=t.value,p=e[h];if(a(p)&&!(h==="v"&&p===1||h=="pr"&&p===1)){var E=c[h];E&&(p=E(p));var b=typeof p,A=void 0;A=h==="ot"||h==="sf"||h==="st"?h+"="+p:b==="boolean"?h:b==="number"?h+"="+p:h+"="+JSON.stringify(p),i.push(A)}}return i.join(",")},u.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],a=[{},{},{},{}],o={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},d=0,c=Object.keys(e);d<c.length;d++){var f=c[d];a[o[f]!=null?o[f]:1][f]=e[f]}for(var h=0;h<a.length;h++){var p=u.serialize(a[h]);p&&(t["CMCD-"+i[h]]=p)}return t},u.toQuery=function(e){return"CMCD="+encodeURIComponent(u.serialize(e))},u.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},u}(),Ng=function(){function u(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=U.log.bind(U,"[content-steering]:"),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.ERROR,this.onError,this))},s.startLoad=function(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){var e=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)},s.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)},s.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},s.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(i){return i!==e}))},s.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},s.onManifestLoaded=function(e,t){var i=t.contentSteering;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())},s.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},s.onError=function(e,t){var i=t.errorAction;if((i==null?void 0:i.action)===T&&i.flags===R){var a=this.pathwayPriority,o=this.pathwayId;this.penalizedPathways[o]||(this.penalizedPathways[o]=performance.now()),!a&&this.levels&&(a=this.levels.reduce(function(d,c){return d.indexOf(c.pathwayId)===-1&&d.push(c.pathwayId),d},[])),a&&a.length>1&&(this.updatePathwayPriority(a),i.resolved=this.pathwayId!==o)}},s.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){var i=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+i+'"'),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},s.getLevelsForPathway=function(e){return this.levels===null?[]:this.levels.filter(function(t){return e===t.pathwayId})},s.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var i=this.penalizedPathways,a=performance.now();Object.keys(i).forEach(function(p){a-i[p]>3e5&&delete i[p]});for(var o=0;o<e.length;o++){var d=e[o];if(!i[d]){if(d===this.pathwayId)return;var c=this.hls.nextLoadLevel,f=this.hls.levels[c];if((t=this.getLevelsForPathway(d)).length>0){this.log('Setting Pathway to "'+d+'"'),this.pathwayId=d,this.hls.trigger(k.LEVELS_UPDATED,{levels:t});var h=this.hls.levels[c];f&&h&&this.levels&&(h.attrs["STABLE-VARIANT-ID"]!==f.attrs["STABLE-VARIANT-ID"]&&h.bitrate!==f.bitrate&&this.log("Unstable Pathways change from bitrate "+f.bitrate+" to "+h.bitrate),this.hls.nextLoadLevel=c);break}}}},s.clonePathways=function(e){var t=this,i=this.levels;if(i){var a={},o={};e.forEach(function(d){var c=d.ID,f=d["BASE-ID"],h=d["URI-REPLACEMENT"];if(!i.some(function(E){return E.pathwayId===c})){var p=t.getLevelsForPathway(f).map(function(E){var b=H({},E);b.details=void 0,b.url=yf(E.uri,E.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h);var A=new nt(E.attrs);A["PATHWAY-ID"]=c;var w=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;w&&(a[A.AUDIO]=w,A.AUDIO=w),D&&(o[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new wa(b);return $(S,"audio",w),$(S,"text",D),S});i.push.apply(i,p),Ef(t.audioTracks,a,h,c),Ef(t.subtitleTracks,o,h,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,a=this.hls.config,o=a.loader;this.loader&&this.loader.destroy(),this.loader=new o(a);try{t=new self.URL(e)}catch{return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if(t.protocol!=="data:"){var d=0|(this.hls.bandwidthEstimate||a.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+d)}var c={responseType:"json",url:t.href},f=a.steeringManifestLoadPolicy.default,h=f.errorRetry||f.timeoutRetry||{},p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},E={onSuccess:function(b,A,w,D){i.log('Loaded steering manifest: "'+t+'"');var S=b.data;if(S.VERSION===1){i.updated=performance.now(),i.timeToLoad=S.TTL;var L=S["RELOAD-URI"],N=S["PATHWAY-CLONES"],P=S["PATHWAY-PRIORITY"];if(L)try{i.uri=new self.URL(L,t).href}catch{return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: "+L)}i.scheduleRefresh(i.uri||w.url),N&&i.clonePathways(N),P&&i.updatePathwayPriority(P)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,w,D){if(i.log("Error loading steering manifest: "+b.code+" "+b.text+" ("+A.url+")"),i.stopLoad(),b.code===410)return i.enabled=!1,void i.log("Steering manifest "+A.url+" no longer available");var S=1e3*i.timeToLoad;if(b.code!==429)i.scheduleRefresh(i.uri||A.url,S);else{var L=i.loader;if(typeof(L==null?void 0:L.getResponseHeader)=="function"){var N=L.getResponseHeader("Retry-After");N&&(S=1e3*parseFloat(N))}i.log("Steering manifest "+A.url+" rate limited")}},onTimeout:function(b,A,w){i.log("Timeout loading steering manifest ("+A.url+")"),i.scheduleRefresh(i.uri||A.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(c,p,E)},s.scheduleRefresh=function(e,t){var i=this;t===void 0&&(t=1e3*this.timeToLoad),self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(function(){i.loadSteeringManifest(e)},t)},u}();function Ef(u,s,e,t){u&&Object.keys(s).forEach(function(i){var a=u.filter(function(o){return o.groupId===i}).map(function(o){var d=H({},o);return d.details=void 0,d.attrs=new nt(d.attrs),d.url=d.attrs.URI=yf(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",e),d.groupId=d.attrs["GROUP-ID"]=s[i],d.attrs["PATHWAY-ID"]=t,d});u.push.apply(u,a)})}function yf(u,s,e,t){var i,a=t.HOST,o=t.PARAMS,d=t[e];s&&(i=d==null?void 0:d[s])&&(u=i);var c=new self.URL(u);return a&&!i&&(c.host=a),o&&Object.keys(o).sort().forEach(function(f){f&&c.searchParams.set(f,o[f])}),c.href}var Fg=/^age:\s*[\d.]+\s*$/im,bf=function(){function u(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 Gt,this.retryDelay=0}var s=u.prototype;return s.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},s.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()))},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},s.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.loadInternal()},s.loadInternal=function(){var e=this,t=this.config,i=this.context;if(t){var a=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var d=this.xhrSetup;d?Promise.resolve().then(function(){if(!e.stats.aborted)return d(a,i.url)}).catch(function(c){return a.open("GET",i.url,!0),d(a,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(a,i,t)}).catch(function(c){e.callbacks.onError({code:a.status,text:c.message},i,a,o)}):this.openAndSendXhr(a,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var a=this.context.headers,o=i.loadPolicy,d=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(a)for(var f in a)e.setRequestHeader(f,a[f]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=d&&re(d)?d:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()},s.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var a=t.readyState,o=this.config;if(!i.aborted&&a>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),a===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var d=t.status,c=t.responseType!=="text";if(d>=200&&d<300&&(c&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);var f=c?t.response:t.responseText,h=t.responseType==="arraybuffer"?f.byteLength:f.length;if(i.loaded=i.total=h,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(i,e,f,t),!this.callbacks)return;var E={url:t.responseURL,data:f,code:d};this.callbacks.onSuccess(E,i,e,t)}else{var b=o.loadPolicy.errorRetry;dn(b,i.retry,!1,d)?this.retry(b):(U.error(d+" while loading "+e.url),this.callbacks.onError({code:d,text:t.statusText},e,t,i))}}}},s.loadtimeout=function(){var e,t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry;if(dn(t,this.stats.retry,!0))this.retry(t);else{U.warn("timeout while loading "+this.context.url);var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},s.retry=function(e){var t=this.context,i=this.stats;this.retryDelay=Es(e,i.retry),i.retry++,U.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+t.url+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},s.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},s.getCacheAge=function(){var e=null;if(this.loader&&Fg.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},u}(),Ug=/(\d+)-(\d+)\/(\d+)/,_f=function(){function u(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||Bg,this.controller=new self.AbortController,this.stats=new Gt}var s=u.prototype;return s.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},s.abortInternal=function(){var e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},s.load=function(e,t,i){var a=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var d=function(A,w){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(H({},A.headers))};return A.rangeEnd&&D.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),D}(e,this.controller.signal),c=i.onProgress,f=e.responseType==="arraybuffer",h=f?"byteLength":"length",p=t.loadPolicy,E=p.maxTimeToFirstByteMs,b=p.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,d),self.clearTimeout(this.requestTimeout),t.timeout=E&&re(E)?E:b,this.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(o,e,a.response)},t.timeout),self.fetch(this.request).then(function(A){a.response=a.loader=A;var w=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(a.requestTimeout),t.timeout=b,a.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(o,e,a.response)},b-(w-o.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Hg(S||"fetch, bad network response",D,A)}return o.loading.first=w,o.total=function(L){var N=L.get("Content-Range");if(N){var P=function(Y){var j=Ug.exec(Y);if(j)return parseInt(j[2])-parseInt(j[1])+1}(N);if(re(P))return P}var V=L.get("Content-Length");if(V)return parseInt(V)}(A.headers)||o.total,c&&re(t.highWaterMark)?a.loadProgressively(A,o,e,t.highWaterMark,c):f?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var w=a.response;self.clearTimeout(a.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var D=A[h];D&&(o.loaded=o.total=D);var S={url:w.url,data:A,code:w.status};c&&!re(t.highWaterMark)&&c(o,e,A,w),i.onSuccess(S,o,e,w)}).catch(function(A){if(self.clearTimeout(a.requestTimeout),!o.aborted){var w=A&&A.code||0,D=A?A.message:null;i.onError({code:w,text:D},e,A?A.details:null,o)}})},s.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},s.loadProgressively=function(e,t,i,a,o){a===void 0&&(a=0);var d=new Qh,c=e.body.getReader();return function f(){return c.read().then(function(h){if(h.done)return d.dataLength&&o(t,i,d.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=h.value,E=p.length;return t.loaded+=E,E<a||d.dataLength?(d.push(p),d.dataLength>=a&&o(t,i,d.flush(),e)):o(t,i,p,e),f()}).catch(function(){return Promise.reject()})}()},u}();function Bg(u,s){return new self.Request(u.url,s)}var Hg=function(u){function s(e,t,i){var a;return(a=u.call(this,e)||this).code=void 0,a.details=void 0,a.code=t,a.details=i,a}return z(s,u),s}(_e(Error)),Gg=/\s/,Vg=y(y({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,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:bf,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ng,bufferController:fg,capLevelController:Cg,errorController:O,fpsController:Mg,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:$r,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(u,s,e,t){for(var i,a,o,d,c,f=[],h=self.VTTCue||self.TextTrackCue,p=0;p<t.rows.length;p++)if(o=!0,d=0,c="",!(i=t.rows[p]).isEmpty()){for(var E,b=0;b<i.chars.length;b++)Gg.test(i.chars[b].uchar)&&o?d++:(c+=i.chars[b].uchar,o=!1);i.cueStartTime=s,s===e&&(e+=1e-4),d>=16?d--:d++;var A=uf(c.trim()),w=Ed(s,e,A);u!=null&&(E=u.cues)!=null&&E.getCueById(w)||((a=new h(s,e,A)).id=w,a.line=p+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*d/32)),f.push(a))}return u&&f.length&&(f.sort(function(D,S){return D.line==="auto"||S.line==="auto"?0:D.line>8&&S.line>8?S.line-D.line:D.line-S.line}),f.forEach(function(D){return Uo(u,D)})),f}},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:ug,subtitleTrackController:cg,timelineController:Rg,audioStreamController:sg,audioTrackController:og,emeController:vf,cmcdController:Og,contentSteeringController:Ng});function kd(u){return u&&typeof u=="object"?Array.isArray(u)?u.map(kd):Object.keys(u).reduce(function(s,e){return s[e]=kd(u[e]),s},{}):u}function Kg(u){var s=u.loader;s!==_f&&s!==bf?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(u.loader=_f,u.progressive=!0,u.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}var Tf=function(){function u(e){e===void 0&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Xo,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,it(e.debug||!1,"Hls instance");var t=this.config=function(ce,oe){if((oe.liveSyncDurationCount||oe.liveMaxLatencyDurationCount)&&(oe.liveSyncDuration||oe.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(oe.liveMaxLatencyDurationCount!==void 0&&(oe.liveSyncDurationCount===void 0||oe.liveMaxLatencyDurationCount<=oe.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(oe.liveMaxLatencyDuration!==void 0&&(oe.liveSyncDuration===void 0||oe.liveMaxLatencyDuration<=oe.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var Ae=kd(ce),xe=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(Le){var Me=(Le==="level"?"playlist":Le)+"LoadPolicy",Oe=oe[Me]===void 0,Pe=[];xe.forEach(function(Ke){var je=Le+"Loading"+Ke,et=oe[je];if(et!==void 0&&Oe){Pe.push(je);var lt=Ae[Me].default;switch(oe[Me]={default:lt},Ke){case"TimeOut":lt.maxLoadTimeMs=et,lt.maxTimeToFirstByteMs=et;break;case"MaxRetry":lt.errorRetry.maxNumRetry=et,lt.timeoutRetry.maxNumRetry=et;break;case"RetryDelay":lt.errorRetry.retryDelayMs=et,lt.timeoutRetry.retryDelayMs=et;break;case"MaxRetryTimeout":lt.errorRetry.maxRetryDelayMs=et,lt.timeoutRetry.maxRetryDelayMs=et}}}),Pe.length&&U.warn('hls.js config: "'+Pe.join('", "')+'" setting(s) are deprecated, use "'+Me+'": '+JSON.stringify(oe[Me]))}),y(y({},Ae),oe)}(u.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Kg(t);var i=t.abrController,a=t.bufferController,o=t.capLevelController,d=t.errorController,c=t.fpsController,f=new d(this),h=this.abrController=new i(this),p=this.bufferController=new a(this),E=this.capLevelController=new o(this),b=new c(this),A=new xt(this),w=new ju(this),D=t.contentSteeringController,S=D?new D(this):null,L=this.levelController=new G(this,S),N=new we(this),P=new At(this.config),V=this.streamController=new rg(this,N,P);E.setStreamController(V),b.setStreamController(V);var Y=[A,L,V];S&&Y.splice(1,0,S),this.networkControllers=Y;var j=[h,p,E,b,w,N];this.audioTrackController=this.createController(t.audioTrackController,Y);var ie=t.audioStreamController;ie&&Y.push(new ie(this,N,P)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Y);var Q=t.subtitleStreamController;Q&&Y.push(new Q(this,N,P)),this.createController(t.timelineController,j),P.emeController=this.emeController=this.createController(t.emeController,j),this.cmcdController=this.createController(t.cmcdController,j),this.latencyController=this.createController(zu,j),this.coreComponents=j,Y.push(f);var X=f.onErrorOut;typeof X=="function"&&this.on(k.ERROR,X,f)}u.isSupported=function(){return function(){var e=nn();if(!e)return!1;var t=Dh(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!a}()};var s=u.prototype;return s.createController=function(e,t){if(e){var i=new e(this);return t&&t.push(i),i}return null},s.on=function(e,t,i){i===void 0&&(i=this),this._emitter.on(e,t,i)},s.once=function(e,t,i){i===void 0&&(i=this),this._emitter.once(e,t,i)},s.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},s.off=function(e,t,i,a){i===void 0&&(i=this),this._emitter.off(e,t,i,a)},s.listeners=function(e){return this._emitter.listeners(e)},s.emit=function(e,t,i){return this._emitter.emit(e,t,i)},s.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){U.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1},s.listenerCount=function(e){return this._emitter.listenerCount(e)},s.destroy=function(){U.log("destroy"),this.trigger(k.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},s.attachMedia=function(e){U.log("attachMedia"),this._media=e,this.trigger(k.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){U.log("detachMedia"),this.trigger(k.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,a=this.url=Ge.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});U.log("loadSource:"+a),t&&i&&(i!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(k.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),U.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){U.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){U.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},s.removeLevel=function(e,t){t===void 0&&(t=0),this.levelController.removeLevel(e,t)},M(u,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){U.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){U.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){U.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){U.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){U.log("set startLevel:"+e),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(U.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){fs.indexOf(e)>-1&&(this._maxHdcpLevel=e)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var i=e.length,a=0;a<i;a++)if(e[a].maxBitrate>=t)return a;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,a=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,a)for(var o=e;o--;){var d=t[o].attrs["HDCP-LEVEL"];if(d&&d<=a)return o}return e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{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}}],[{key:"version",get:function(){return"1.4.3"}},{key:"Events",get:function(){return k}},{key:"ErrorTypes",get:function(){return se}},{key:"ErrorDetails",get:function(){return W}},{key:"DefaultConfig",get:function(){return u.defaultConfig?u.defaultConfig:Vg},set:function(e){u.defaultConfig=e}}]),u}();return Tf.defaultConfig=void 0,Tf},typeof vp=="object"&&typeof Kc!="undefined"?Kc.exports=m():typeof define=="function"&&define.amd?define(m):(l=typeof globalThis!="undefined"?globalThis:l||self).Hls=m()})(!1)});var En=class{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}};if(typeof DocumentFragment=="undefined"){class n extends En{}globalThis.DocumentFragment=n}var ks=class extends En{},Rd=class extends En{},rE={get(n){},define(n,r,l){},upgrade(n){},whenDefined(n){return Promise.resolve(ks)}},ws,Dd=class{constructor(r,l={}){Bt(this,ws,void 0);Gi(this,ws,l==null?void 0:l.detail)}get detail(){return ot(this,ws)}initCustomEvent(){}};ws=new WeakMap;function aE(n,r){return new ks}var Df={document:{createElement:aE},DocumentFragment,customElements:rE,CustomEvent:Dd,EventTarget:En,HTMLElement:ks,HTMLVideoElement:Rd},Cf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",qt=Cf?Df:globalThis,Mi=Cf?Df.document:globalThis.document;var Ie={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},yn={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange"},Ne={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},F={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"mediafullscreenunavailable",MEDIA_PIP_UNAVAILABLE:"mediapipunavailable",MEDIA_CAST_UNAVAILABLE:"mediacastunavailable",MEDIA_PAUSED:"mediapaused",MEDIA_HAS_PLAYED:"mediahasplayed",MEDIA_ENDED:"mediaended",MEDIA_MUTED:"mediamuted",MEDIA_VOLUME_LEVEL:"mediavolumelevel",MEDIA_VOLUME:"mediavolume",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailable",MEDIA_IS_PIP:"mediaispip",MEDIA_IS_CASTING:"mediaiscasting",MEDIA_SUBTITLES_LIST:"mediasubtitleslist",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowing",MEDIA_IS_FULLSCREEN:"mediaisfullscreen",MEDIA_PLAYBACK_RATE:"mediaplaybackrate",MEDIA_CURRENT_TIME:"mediacurrenttime",MEDIA_DURATION:"mediaduration",MEDIA_SEEKABLE:"mediaseekable",MEDIA_PREVIEW_TIME:"mediapreviewtime",MEDIA_PREVIEW_IMAGE:"mediapreviewimage",MEDIA_PREVIEW_COORDS:"mediapreviewcoords",MEDIA_LOADING:"medialoading",MEDIA_BUFFERED:"mediabuffered",MEDIA_STREAM_TYPE:"mediastreamtype",MEDIA_TARGET_LIVE_WINDOW:"mediatargetlivewindow",MEDIA_TIME_IS_LIVE:"mediatimeislive"},J0=Object.entries(yn).reduce((n,[r,l])=>{let m=F[r];return m&&(n[l]=m),n},{userinactivechange:"userinactive"}),Mf=Object.entries(F).reduce((n,[r,l])=>{let m=yn[r];return m&&(n[l]=m),n},{userinactive:"userinactivechange"}),bn={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},al={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var Cd={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Rr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Zi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var si={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:n=1}={})=>`current playback rate ${n}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},yt={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:n=30}={})=>`seek forward ${n} seconds`,SEEK_BACK_N_SECS:({seekOffset:n=30}={})=>`seek back ${n} seconds`,SEEK_LIVE:()=>"seek to live",PLAYING_LIVE:()=>"playing live"},sE={...si,...yt};function nl(n,r=!1){return n.split("_").map(function(l,m){return(m||r?l[0].toUpperCase():l[0].toLowerCase())+l.slice(1).toLowerCase()}).join("")}function xf(n){return n.replace(/[-_]([a-z])/g,(r,l)=>l.toUpperCase())}function Pf(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function sl(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var ol=n=>new Promise(r=>setTimeout(r,n));var Of=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],oE=(n,r)=>{let l=n===1?Of[r].singular:Of[r].plural;return`${n} ${l}`},Na=n=>{if(!Pf(n))return"";let r=Math.abs(n),l=r!==n,m=new Date(0,0,0,0,0,r,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,B)=>M&&oE(M,B)).filter(M=>M).join(", ")}${l?" remaining":""}`};function or(n,r){let l=!1;n<0&&(l=!0,n=0-n),n=n<0?0:n;let m=Math.floor(n%60),v=Math.floor(n/60%60),y=Math.floor(n/3600),I=Math.floor(r/60%60),M=Math.floor(r/3600);return(isNaN(n)||n===1/0)&&(y=v=m="-"),y=y>0||M>0?y+":":"",v=((y||I>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(l?"-":"")+y+v+m}var lE=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function Nf(n=lE){return Array.from(n).map((r,l)=>[Number(n.start(l).toFixed(3)),Number(n.end(l).toFixed(3))].join(":")).join(" ")}var Ff=(n,r,l=".value")=>{let m=n.querySelector(l);!m||(m.textContent=r)},dE=(n,r)=>{let l=`slot[name="${r}"]`,m=n.shadowRoot.querySelector(l);return m?m.children:[]},Uf=(n,r)=>dE(n,r)[0],Ls=(n,r)=>!n||!r?!1:n.contains(r)?!0:Ls(n,r.getRootNode().host),Fa=(n,r)=>{if(!n)return null;let l=n.closest(r);return l||Fa(n.getRootNode().host,r)};function ft(n,r){var l;let m;for(m of n.querySelectorAll("style")){let v;try{v=(l=m.sheet)==null?void 0:l.cssRules}catch{continue}for(let y of v!=null?v:[])if(y.selectorText===r)return y}return m!=null&&m.sheet?(m.sheet.insertRule(`${r}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}function St(n,r){let l=n.getAttribute(r);return l!=null?+l:void 0}function Lt(n,r,l){if(St(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.setAttribute(r,`${+l}`)}}function mt(n,r){return n.hasAttribute(r)}function bt(n,r,l){if(mt(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.toggleAttribute(r,l)}}function Ht(n,r){var l;return(l=n.getAttribute(r))!=null?l:void 0}function Yt(n,r,l){if(Ht(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.setAttribute(r,`${l}`)}}var ll=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Md=class{observe(){}},Bf={ResizeObserver:Md,HTMLElement:class extends ll{},DocumentFragment:class extends ll{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},cE={createElement:function(){return new Bf.HTMLElement},addEventListener(){},removeEventListener(){}},Hf=typeof window=="undefined"||typeof window.customElements=="undefined",q=Hf?Bf:window,ae=Hf?cE:window.document;var hE=Object.defineProperty,fE=(n,r,l)=>r in n?hE(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,mE=(n,r,l)=>(fE(n,typeof r!="symbol"?r+"":r,l),l),Gf=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Vi=(n,r,l)=>(Gf(n,r,"read from private field"),l?l.call(n):r.get(n)),ul=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},dl=(n,r,l,m)=>(Gf(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),lr,cl,_n,hl,Vf=ae.createElement("template");Vf.innerHTML=`
46
46
  <style>
47
47
  :host {
48
48
  font: var(--media-font,
@@ -90,38 +90,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
90
90
  min-width: 100%;
91
91
  }
92
92
  </style>
93
- `;var al=class extends W.HTMLElement{constructor(a={}){if(super(),el(this,ir,void 0),iy(this,"preventClick",!1),el(this,il,m=>{this.preventClick||this.handleClick(m)}),el(this,dn,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",Ni(this,dn));return}this.preventClick||this.handleClick(m)}),el(this,rl,m=>{let{metaKey:v,altKey:E,key:I}=m;if(v||E||!this.keysUsed.includes(I)){this.removeEventListener("keyup",Ni(this,dn));return}this.addEventListener("keyup",Ni(this,dn),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});let m=Rf.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),this.shadowRoot.appendChild(m)}let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Ni(this,il)),this.addEventListener("keydown",Ni(this,rl)),this.setAttribute("tabindex","0")}disable(){this.removeEventListener("click",Ni(this,il)),this.removeEventListener("keydown",Ni(this,rl)),this.removeEventListener("keyup",Ni(this,dn)),this.removeAttribute("tabindex")}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER?(l&&((E=(v=Ni(this,ir))==null?void 0:v.unassociateElement)==null||E.call(v,this),tl(this,ir,null)),m&&(tl(this,ir,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Ni(this,ir))==null?void 0:M.associateElement)==null||B.call(M,this))):a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a,l,m;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(tl(this,ir,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ni(this,ir))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;this.disable(),(l=(a=Ni(this,ir))==null?void 0:a.unassociateElement)==null||l.call(a,this),tl(this,ir,null)}get keysUsed(){return["Enter"," "]}handleClick(a){}};ir=new WeakMap;il=new WeakMap;dn=new WeakMap;rl=new WeakMap;W.customElements.get("media-chrome-button")||W.customElements.define("media-chrome-button",al);var Et=al;var ry=`<svg aria-hidden="true" viewBox="0 0 26 24">
93
+ `;var pt=class extends q.HTMLElement{constructor(r={}){if(super(),ul(this,lr,void 0),mE(this,"preventClick",!1),ul(this,cl,m=>{this.preventClick||this.handleClick(m)}),ul(this,_n,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",Vi(this,_n));return}this.preventClick||this.handleClick(m)}),ul(this,hl,m=>{let{metaKey:v,altKey:y,key:I}=m;if(v||y||!this.keysUsed.includes(I)){this.removeEventListener("keyup",Vi(this,_n));return}this.addEventListener("keyup",Vi(this,_n),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});let m=Vf.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),this.shadowRoot.appendChild(m)}let{style:l}=ft(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Vi(this,cl)),this.addEventListener("keydown",Vi(this,hl)),this.tabIndex=0}disable(){this.removeEventListener("click",Vi(this,cl)),this.removeEventListener("keydown",Vi(this,hl)),this.removeEventListener("keyup",Vi(this,_n)),this.tabIndex=-1}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Ne.MEDIA_CONTROLLER?(l&&((y=(v=Vi(this,lr))==null?void 0:v.unassociateElement)==null||y.call(v,this),dl(this,lr,null)),m&&(dl(this,lr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Vi(this,lr))==null?void 0:M.associateElement)==null||B.call(M,this))):r==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var r,l,m;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(dl(this,lr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=Vi(this,lr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var r,l;this.disable(),(l=(r=Vi(this,lr))==null?void 0:r.unassociateElement)==null||l.call(r,this),dl(this,lr,null)}get keysUsed(){return["Enter"," "]}handleClick(r){}};lr=new WeakMap;cl=new WeakMap;_n=new WeakMap;hl=new WeakMap;q.customElements.get("media-chrome-button")||q.customElements.define("media-chrome-button",pt);var pE=`<svg aria-hidden="true" viewBox="0 0 26 24">
94
94
  <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/>
95
95
  </svg>
96
- `,Df=ie.createElement("template");Df.innerHTML=`
97
- <slot name="airplay">${ry}</slot>
98
- `;var Tu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Df,...a})}connectedCallback(){this.setAttribute("aria-label",ct.AIRPLAY()),super.connectedCallback()}handleClick(){let a=new W.CustomEvent(ve.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(a)}};W.customElements.get("media-airplay-button")||W.customElements.define("media-airplay-button",Tu);var ay='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',ny='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',Mf=ie.createElement("template");Mf.innerHTML=`
96
+ `,Kf=ae.createElement("template");Kf.innerHTML=`
97
+ <slot name="airplay">${pE}</slot>
98
+ `;var xd=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Kf,...r})}connectedCallback(){this.setAttribute("aria-label",yt.AIRPLAY()),super.connectedCallback()}get mediaAirplayUnavailable(){return Ht(this,F.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(r){Yt(this,F.MEDIA_AIRPLAY_UNAVAILABLE,r)}handleClick(){let r=new q.CustomEvent(Ie.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(r)}};q.customElements.get("media-airplay-button")||q.customElements.define("media-airplay-button",xd);var vE='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',gE='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',qf=ae.createElement("template");qf.innerHTML=`
99
99
  <style>
100
- :host([${U.MEDIA_IS_CASTING}]) slot:not([name=exit]) > *,
101
- :host([${U.MEDIA_IS_CASTING}]) ::slotted(:not([slot=exit])) {
100
+ :host([${F.MEDIA_IS_CASTING}]) slot:not([name=exit]):not([name=icon]) {
102
101
  display: none !important;
103
102
  }
104
103
 
105
104
 
106
- :host(:not([${U.MEDIA_IS_CASTING}])) slot:not([name=enter]) > *,
107
- :host(:not([${U.MEDIA_IS_CASTING}])) ::slotted(:not([slot=enter])) {
105
+ :host(:not([${F.MEDIA_IS_CASTING}])) slot:not([name=enter]):not([name=icon]) {
108
106
  display: none !important;
109
107
  }
110
108
  </style>
111
109
 
112
- <slot name="enter">${ay}</slot>
113
- <slot name="exit">${ny}</slot>
114
- `;var Cf=n=>{let l=n.getAttribute(U.MEDIA_IS_CASTING)!=null?ct.EXIT_CAST():ct.ENTER_CAST();n.setAttribute("aria-label",l)},Au=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_CASTING,U.MEDIA_CAST_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Mf,...a})}connectedCallback(){Cf(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_CASTING&&Cf(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_CASTING)!=null?ve.MEDIA_EXIT_CAST_REQUEST:ve.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-cast-button")||W.customElements.define("media-cast-button",Au);var xf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Wr=(n,a,l)=>(xf(n,a,"read from private field"),l?l.call(n):a.get(n)),sy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},nl=(n,a,l,m)=>(xf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pi,Pf=ie.createElement("template");Pf.innerHTML=`
110
+ <slot name="icon">
111
+ <slot name="enter">${vE}</slot>
112
+ <slot name="exit">${gE}</slot>
113
+ </slot>
114
+ `;var Wf=n=>{let l=n.getAttribute(F.MEDIA_IS_CASTING)!=null?yt.EXIT_CAST():yt.ENTER_CAST();n.setAttribute("aria-label",l)},Pd=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_CASTING,F.MEDIA_CAST_UNAVAILABLE]}constructor(r={}){super({slotTemplate:qf,...r})}connectedCallback(){Wf(this),super.connectedCallback()}attributeChangedCallback(r,l,m){r===F.MEDIA_IS_CASTING&&Wf(this),super.attributeChangedCallback(r,l,m)}get mediaIsCasting(){return mt(this,F.MEDIA_IS_CASTING)}set mediaIsCasting(r){bt(this,F.MEDIA_IS_CASTING,r)}get mediaCastUnavailable(){return Ht(this,F.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(r){Yt(this,F.MEDIA_CAST_UNAVAILABLE,r)}handleClick(){let r=this.mediaIsCasting?Ie.MEDIA_EXIT_CAST_REQUEST:Ie.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-cast-button")||q.customElements.define("media-cast-button",Pd);var Yf=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},ta=(n,r,l)=>(Yf(n,r,"read from private field"),l?l.call(n):r.get(n)),EE=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},fl=(n,r,l,m)=>(Yf(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Ti,$f=ae.createElement("template");$f.innerHTML=`
115
115
  <style>
116
116
  :host {
117
117
  display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
118
118
  box-sizing: border-box;
119
119
  }
120
120
  </style>
121
- `;var Su=class extends W.HTMLElement{constructor(a={}){if(super(),sy(this,pi,void 0),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=Pf.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,U.MEDIA_PAUSED]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=Wr(this,pi))==null?void 0:v.unassociateElement)==null||E.call(v,this),nl(this,pi,null)),m&&(nl(this,pi,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Wr(this,pi))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m,v;this.setAttribute("tabindex",-1),this.setAttribute("aria-hidden",!0),nl(this,pi,oy(this)),this.getAttribute(Pe.MEDIA_CONTROLLER)&&((l=(a=Wr(this,pi))==null?void 0:a.associateElement)==null||l.call(a,this)),(m=Wr(this,pi))==null||m.addEventListener("pointerdown",this),(v=Wr(this,pi))==null||v.addEventListener("click",this)}disconnectedCallback(){var a,l,m,v;this.getAttribute(Pe.MEDIA_CONTROLLER)&&((l=(a=Wr(this,pi))==null?void 0:a.unassociateElement)==null||l.call(a,this)),(m=Wr(this,pi))==null||m.removeEventListener("pointerdown",this),(v=Wr(this,pi))==null||v.removeEventListener("click",this),nl(this,pi,null)}handleEvent(a){var l;let m=(l=a.composedPath())==null?void 0:l[0];if(!!["video","media-controller"].includes(m==null?void 0:m.localName)){if(a.type==="pointerdown")this._pointerType=a.pointerType;else if(a.type==="click"){let{clientX:E,clientY:I}=a,{left:M,top:B,width:F,height:Q}=this.getBoundingClientRect(),re=E-M,te=I-B;if(re<0||te<0||re>F||te>Q||F===0&&Q===0)return;let{pointerType:se=this._pointerType}=a;if(this._pointerType=void 0,se===bu.TOUCH){this.handleTap(a);return}else if(se===bu.MOUSE){this.handleMouseClick(a);return}}}}handleTap(a){}handleMouseClick(a){let l=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(l,{composed:!0,bubbles:!0}))}};pi=new WeakMap;function oy(n){var a;let l=n.getAttribute(Pe.MEDIA_CONTROLLER);return l?(a=n.getRootNode())==null?void 0:a.getElementById(l):Ra(n,"media-controller")}W.customElements.get("media-gesture-receiver")||W.customElements.define("media-gesture-receiver",Su);var Of=ie.createElement("template");Of.innerHTML=`
121
+ `;var Od=class extends q.HTMLElement{constructor(r={}){if(super(),EE(this,Ti,void 0),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=$f.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PAUSED]}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Ne.MEDIA_CONTROLLER&&(l&&((y=(v=ta(this,Ti))==null?void 0:v.unassociateElement)==null||y.call(v,this),fl(this,Ti,null)),m&&(fl(this,Ti,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=ta(this,Ti))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var r,l,m,v;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),fl(this,Ti,yE(this)),this.getAttribute(Ne.MEDIA_CONTROLLER)&&((l=(r=ta(this,Ti))==null?void 0:r.associateElement)==null||l.call(r,this)),(m=ta(this,Ti))==null||m.addEventListener("pointerdown",this),(v=ta(this,Ti))==null||v.addEventListener("click",this)}disconnectedCallback(){var r,l,m,v;this.getAttribute(Ne.MEDIA_CONTROLLER)&&((l=(r=ta(this,Ti))==null?void 0:r.unassociateElement)==null||l.call(r,this)),(m=ta(this,Ti))==null||m.removeEventListener("pointerdown",this),(v=ta(this,Ti))==null||v.removeEventListener("click",this),fl(this,Ti,null)}handleEvent(r){var l;let m=(l=r.composedPath())==null?void 0:l[0];if(!!["video","media-controller"].includes(m==null?void 0:m.localName)){if(r.type==="pointerdown")this._pointerType=r.pointerType;else if(r.type==="click"){let{clientX:y,clientY:I}=r,{left:M,top:B,width:H,height:z}=this.getBoundingClientRect(),J=y-M,ee=I-B;if(J<0||ee<0||J>H||ee>z||H===0&&z===0)return;let{pointerType:le=this._pointerType}=r;if(this._pointerType=void 0,le===Cd.TOUCH){this.handleTap(r);return}else if(le===Cd.MOUSE){this.handleMouseClick(r);return}}}}get mediaPaused(){return mt(this,F.MEDIA_PAUSED)}set mediaPaused(r){bt(this,F.MEDIA_PAUSED,r)}handleTap(r){}handleMouseClick(r){let l=this.mediaPaused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(l,{composed:!0,bubbles:!0}))}};Ti=new WeakMap;function yE(n){var r;let l=n.getAttribute(Ne.MEDIA_CONTROLLER);return l?(r=n.getRootNode())==null?void 0:r.getElementById(l):Fa(n,"media-controller")}q.customElements.get("media-gesture-receiver")||q.customElements.define("media-gesture-receiver",Od);var ut={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive"},jf=ae.createElement("template");jf.innerHTML=`
122
122
  <style>
123
123
 
124
- :host([media-is-fullscreen]) ::slotted([slot=media]) {
124
+ :host([${F.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
125
125
  outline: none;
126
126
  }
127
127
 
@@ -133,7 +133,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
133
133
  background-color: var(--media-background-color, #000);
134
134
  }
135
135
 
136
- :host(:not([audio])) [part~=layer]:not([part~=media-layer]) {
136
+ :host(:not([${ut.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
137
137
  position: absolute;
138
138
  top: 0;
139
139
  left: 0;
@@ -146,15 +146,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
146
146
  background: none;
147
147
  }
148
148
 
149
+ slot[name=media] {
150
+ display: var(--media-slot-display, contents);
151
+ }
152
+
153
+
154
+ :host([${ut.AUDIO}]) slot[name=media] {
155
+ display: var(--media-slot-display, none);
156
+ }
157
+
149
158
 
150
- :host([audio]) [part~=layer][part~=gesture-layer] {
159
+ :host([${ut.AUDIO}]) [part~=layer][part~=gesture-layer] {
151
160
  height: 0;
152
161
  display: block;
153
162
  }
154
163
 
155
164
 
156
- :host(:not([audio])[gestures-disabled]) ::slotted([slot=gestures-chrome]),
157
- :host(:not([audio])[gestures-disabled]) media-gesture-receiver[slot=gestures-chrome] {
165
+ :host(:not([${ut.AUDIO}])[${ut.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
166
+ :host(:not([${ut.AUDIO}])[${ut.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
158
167
  display: none;
159
168
  }
160
169
 
@@ -163,13 +172,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
163
172
  pointer-events: auto;
164
173
  }
165
174
 
166
- :host(:not([audio])) *[part~=layer][part~=centered-layer] {
175
+ :host(:not([${ut.AUDIO}])) *[part~=layer][part~=centered-layer] {
167
176
  align-items: center;
168
177
  justify-content: center;
169
178
  }
170
179
 
171
- :host(:not([audio])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
172
- :host(:not([audio])) media-gesture-receiver[slot=gestures-chrome] {
180
+ :host(:not([${ut.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
181
+ :host(:not([${ut.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
173
182
  align-self: stretch;
174
183
  flex-grow: 1;
175
184
  }
@@ -189,7 +198,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
189
198
  }
190
199
 
191
200
 
192
- :host(:not([audio])) .spacer {
201
+ :host(:not([${ut.AUDIO}])) .spacer {
193
202
  flex-grow: 1;
194
203
  }
195
204
 
@@ -201,13 +210,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
201
210
  }
202
211
 
203
212
 
204
- ::slotted(:not([slot=media]):not([no-auto-hide])) {
213
+ ::slotted(:not([slot=media]):not([${ut.NO_AUTOHIDE}])) {
205
214
  opacity: 1;
206
215
  transition: opacity 0.25s;
207
216
  }
208
217
 
209
218
 
210
- :host([user-inactive]:not([${U.MEDIA_PAUSED}]):not([${U.MEDIA_IS_CASTING}]):not([audio])) ::slotted(:not([slot=media]):not([no-auto-hide])) {
219
+ :host([${ut.USER_INACTIVE}]:not([${F.MEDIA_PAUSED}]):not([${F.MEDIA_IS_CASTING}]):not([${ut.AUDIO}])) ::slotted(:not([slot=media]):not([${ut.NO_AUTOHIDE}])) {
211
220
  opacity: 0;
212
221
  transition: opacity 1s;
213
222
  }
@@ -216,7 +225,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
216
225
  align-self: stretch;
217
226
  }
218
227
 
219
- :host([${U.MEDIA_HAS_PLAYED}]) ::slotted([slot=poster]) {
228
+ :host([${F.MEDIA_HAS_PLAYED}]) ::slotted([slot=poster]) {
220
229
  display: none;
221
230
  }
222
231
  </style>
@@ -233,7 +242,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
233
242
 
234
243
  <slot part="bottom chrome"></slot>
235
244
  </span>
236
- `;var ly=Object.values(U),dy="sm:384 md:576 lg:768 xl:960",uy=n=>{var a;for(let l of n){let m=l.target;if(!m.isConnected)continue;let v=(a=m.getAttribute("breakpoints"))!=null?a:dy,E=cy(v),I=hy(E,l.contentRect);Object.keys(E).forEach(M=>{if(I.includes(M)){m.hasAttribute(`breakpoint-${M}`)||m.setAttribute(`breakpoint-${M}`,"");return}m.removeAttribute(`breakpoint-${M}`)})}};function cy(n){let a=n.split(/\s+/);return Object.fromEntries(a.map(l=>l.split(":")))}function hy(n,a){return Object.keys(n).filter(l=>a.width>=n[l])}var sl=class extends W.HTMLElement{constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Of.content.cloneNode(!0)));let a=I=>{let M=this.media;for(let B of I)B.type==="childList"&&(B.removedNodes.forEach(F=>{if(F.slot=="media"&&B.target==this){let Q=B.previousSibling&&B.previousSibling.previousElementSibling;if(!Q||!M)this.mediaUnsetCallback(F);else{let re=Q.slot!=="media";for(;(Q=Q.previousSibling)!==null;)Q.slot=="media"&&(re=!1);re&&this.mediaUnsetCallback(F)}}}),M&&B.addedNodes.forEach(F=>{F==M&&this.handleMediaUpdated(M).then(Q=>this.mediaSetCallback(Q))}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(uy);this.resizeObserver=m,m.observe(this);let v=this.media,E=this.querySelector(":scope > slot[slot=media]");E&&E.addEventListener("slotchange",()=>{if(!E.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(v);return}this.media&&(v=this.media,this.handleMediaUpdated(this.media).then(M=>this.mediaSetCallback(M)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(ly)}attributeChangedCallback(a,l,m){a.toLowerCase()=="autohide"&&(this.autohide=m)}get media(){let a=this.querySelector(":scope > [slot=media]");return(a==null?void 0:a.nodeName)=="SLOT"&&(a=a.assignedElements({flatten:!0})[0]),a}mediaSetCallback(a){this._mediaClickPlayToggle=()=>{let l=a.paused?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(l,{composed:!0,bubbles:!0}))}}handleMediaUpdated(a){let l=E=>Promise.resolve(E),m=E=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',E),Promise.reject(E));if(!a)return m(a);let v=a.nodeName.toLowerCase();return v.includes("-")?W.customElements.whenDefined(v).then(()=>l(a)):l(a)}mediaUnsetCallback(a){}connectedCallback(){let l=this.getAttribute("audio")!=null?Jt.AUDIO_PLAYER():Jt.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",l),this.media&&this.handleMediaUpdated(this.media).then(I=>this.mediaSetCallback(I)),this.setAttribute("user-inactive","user-inactive");let m=()=>{if(this.autohide<0||this.hasAttribute("user-inactive"))return;this.setAttribute("user-inactive","");let I=new W.CustomEvent(ms.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(I)},v=()=>{if(!this.hasAttribute("user-inactive"))return;this.removeAttribute("user-inactive");let I=new W.CustomEvent(ms.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(I)},E=()=>{v(),W.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=W.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{E()}),this.addEventListener("pointerup",I=>{I.pointerType==="touch"?[this,this.media].includes(I.target)&&!this.hasAttribute("user-inactive")?m():E():I.composedPath().some(M=>{var B;return["media-play-button","media-fullscreen-button"].includes((B=M==null?void 0:M.nodeName)==null?void 0:B.toLowerCase())})&&E()}),this.addEventListener("pointermove",I=>{I.pointerType==="mouse"&&I.target!==this&&(v(),W.clearTimeout(this._inactiveTimeout),[this,this.media].includes(I.target)&&E())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute("media-keyboard-control","")}),W.addEventListener("mouseup",()=>{this.removeAttribute("media-keyboard-control")})}set autohide(a){a=Number(a),this._autohide=isNaN(a)?0:a}get autohide(){return this._autohide===void 0?2:this._autohide}};W.customElements.get("media-container-temp")||W.customElements.define("media-container-temp",sl);var Nf=sl;var Ff=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},ei=(n,a,l)=>(Ff(n,a,"read from private field"),l?l.call(n):a.get(n)),ku=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},wu=(n,a,l,m)=>(Ff(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),un,cn,wi,ol=class{constructor(a,l){ku(this,un,void 0),ku(this,cn,void 0),ku(this,wi,new Set),wu(this,un,a),wu(this,cn,l)}[Symbol.iterator](){return ei(this,wi).values()}get length(){return ei(this,wi).size}get value(){var a;return(a=[...ei(this,wi)].join(" "))!=null?a:""}set value(a){var l;a!==this.value&&(wu(this,wi,new Set),this.add(...(l=a==null?void 0:a.split(" "))!=null?l:[]))}toString(){return this.value}item(a){return[...ei(this,wi)][a]}values(){return ei(this,wi).values()}keys(){return ei(this,wi).keys()}forEach(a){ei(this,wi).forEach(a)}add(...a){var l,m;a.forEach(v=>ei(this,wi).add(v)),!(this.value===""&&!((l=ei(this,un))!=null&&l.hasAttribute(`${ei(this,cn)}`)))&&((m=ei(this,un))==null||m.setAttribute(`${ei(this,cn)}`,`${this.value}`))}remove(...a){var l;a.forEach(m=>ei(this,wi).delete(m)),(l=ei(this,un))==null||l.setAttribute(`${ei(this,cn)}`,`${this.value}`)}contains(a){return ei(this,wi).has(a)}toggle(a,l){return typeof l!="undefined"?l?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,l){this.remove(a),this.add(l)}};un=new WeakMap;cn=new WeakMap;wi=new WeakMap;var Lu=(n="")=>n.split(/\s+/),Uf=(n="")=>{let[a,l]=n.split(":"),m=l?decodeURIComponent(l):void 0;return{language:a,label:m}},vs=(n="",a={})=>Lu(n).map(l=>{let m=Uf(l);return{...a,...m}}),fy=n=>Array.isArray(n)?n.map(a=>typeof a=="string"?Uf(a):a):typeof n=="string"?vs(n):[n],Iu=({label:n,language:a}={})=>n?`${a}:${encodeURIComponent(n)}`:a,gs=(n=[])=>Array.prototype.map.call(n,Iu).join(" "),my=(n,a)=>l=>l[n]===a,Bf=n=>{let a=Object.entries(n).map(([l,m])=>my(l,m));return l=>a.every(m=>m(l))},ys=(n,a=[],l=[])=>{let m=fy(l).map(Bf),v=E=>m.some(I=>I(E));Array.from(a).filter(v).forEach(E=>{E.mode=n})},hn=(n,a=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let l=typeof a=="function"?a:Bf(a);return Array.from(n.textTracks).filter(l)},Ru=n=>{let a=!!n.getAttribute(U.MEDIA_CAPTIONS_SHOWING),l=!n.hasAttribute("no-subtitles-fallback")&&!!n.getAttribute(U.MEDIA_SUBTITLES_SHOWING);return a||l},Da=(n,a=!1)=>{var l,m,v,E;if(Ru(n)){let M=n.getAttribute(U.MEDIA_CAPTIONS_SHOWING);if(M){let F=new window.CustomEvent(ve.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(F)}let B=n.getAttribute(U.MEDIA_SUBTITLES_SHOWING);if(B&&!n.hasAttribute("no-subtitles-fallback")){let F=new window.CustomEvent(ve.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:B});n.dispatchEvent(F)}}else if(!a){let[M]=(m=Lu((l=n.getAttribute(U.MEDIA_CAPTIONS_LIST))!=null?l:""))!=null?m:[];if(M){let B=new window.CustomEvent(ve.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(B)}else if(n.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{let[B]=(E=Lu((v=n.getAttribute(U.MEDIA_SUBTITLES_LIST))!=null?v:""))!=null?E:[];if(B){let F=new window.CustomEvent(ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:B});n.dispatchEvent(F)}}}};var Vt={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};ie.fullscreenElement===void 0&&(Vt.enter="webkitRequestFullScreen",Vt.exit=ie.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",Vt.event="webkitfullscreenchange",Vt.element="webkitFullscreenElement",Vt.error="webkitfullscreenerror",Vt.enabled="webkitFullscreenEnabled");var ll,Du=()=>{var n,a;return ll||(ll=(a=(n=ie)==null?void 0:n.createElement)==null?void 0:a.call(n,"video"),ll)},Hf=async(n=Du())=>{if(!n)return!1;let a=n.volume;return n.volume=a/2+.1,await Qo(0),n.volume!==a},py=(n=Du())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",vy=(n=Du())=>{let a=ie[Vt.enabled];return!a&&n&&(a="webkitSupportsFullscreen"in n),a},Cu=vy(),Gf=py(),Vf=!!W.WebKitPlaybackTargetAvailabilityEvent,Kf=!!W.chrome;var dl,Wf=Hf().then(n=>(dl=n,dl)),gy=Object.values(Yi),Mu=n=>hn(n.media,{kind:ln.SUBTITLES}),xu=n=>hn(n.media,{kind:ln.CAPTIONS}),yy=n=>hn(n.media,{kind:ln.SUBTITLES,mode:La.SHOWING}),Ey=n=>hn(n.media,{kind:ln.CAPTIONS,mode:La.SHOWING}),vi={MEDIA_PAUSED:{get:function(n){let{media:a}=n;return a?a.paused:!0},mediaEvents:["play","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(n){let{media:a}=n;return a?!a.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(n){let{media:a}=n;return!a||typeof a.playbackRate=="undefined"?1:a.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(n){let{media:a}=n;return!a||typeof a.muted=="undefined"?!1:a.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(n){let{media:a}=n;return!a||typeof a.volume=="undefined"?1:Number(a.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(n){let{media:a}=n,l="high";if(!a||typeof a.volume=="undefined")return l;let{muted:m,volume:v}=a;return v===0||m?l="off":v<.5?l="low":v<.75&&(l="medium"),l},mediaEvents:["volumechange"]},MEDIA_CURRENT_TIME:{get:function(n){let{media:a}=n;return!a||typeof a.currentTime=="undefined"?0:a.currentTime},mediaEvents:["timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(n){let{media:a}=n;return!a||!Number.isFinite(a.duration)?NaN:a.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(n){var a;let{media:l}=n;if(!((a=l==null?void 0:l.seekable)!=null&&a.length))return;let m=l.seekable.start(0),v=l.seekable.end(l.seekable.length-1);if(!(!m&&!v))return[Number(m.toFixed(3)),Number(v.toFixed(3))].join(":")},mediaEvents:["loadedmetadata","emptied","progress"]},MEDIA_LOADING:{get:function(n){var a;return((a=n.media)==null?void 0:a.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(n){var a;kf((a=n.media)==null?void 0:a.buffered)},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(n){let{media:a}=n;if(!a)return;let{streamType:l}=a;if(gy.includes(l)){if(l===Yi.UNKNOWN){let v=n.getAttribute("default-stream-type");return[Yi.LIVE,Yi.ON_DEMAND].includes(v)?v:void 0}return l}let m=a.duration;if(m===1/0)return Yi.LIVE;if(Number.isFinite(m))return Yi.ON_DEMAND;{let v=n.getAttribute("default-stream-type");if([Yi.LIVE,Yi.ON_DEMAND].includes(v))return v}},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(n){let{media:a}=n;if(!a)return Number.NaN;let{targetLiveWindow:l}=a,m=vi.MEDIA_STREAM_TYPE.get(n);return(l==null||Number.isNaN(l))&&m===Yi.LIVE?0:l},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(n){let{media:a}=n;if(!a)return!1;if(typeof a.liveEdgeStart=="number")return Number.isNaN(a.liveEdgeStart)?!1:a.currentTime>=a.liveEdgeStart;if(!(vi.MEDIA_STREAM_TYPE.get(n)==="live"))return!1;let m=a.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,E=m.end(m.length-1)-v;return a.currentTime>=E},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(n,a){let m=!!ie[Vt.element]&&(a==null?void 0:a.target);return ps(n.fullscreenElement,m)},rootEvents:[Vt.event]},MEDIA_IS_PIP:{get:function(n,a){var l;let m=n.media;if(!m)return!1;if(a)return a.type=="enterpictureinpicture";{let v=(l=n.getRootNode().pictureInPictureElement)!=null?l:ie.pictureInPictureElement;return ps(m,v)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_CASTING:{get:function(n,a){var l;let{media:m}=n;if(!m)return!1;let v=(l=globalThis.CastableVideoElement)==null?void 0:l.castElement,E=ps(m,v);return(a==null?void 0:a.type)==="castchange"&&(a==null?void 0:a.detail)==="CONNECTING"&&(E="connecting"),E},mediaEvents:["entercast","leavecast","castchange"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(n,a){if(!Vf)return Tr.UNSUPPORTED;if(!!a&&a.availability!=="available"&&a.availability==="not-available")return Tr.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"]},MEDIA_CAST_UNAVAILABLE:{get:function(){var n;let a=(n=globalThis.CastableVideoElement)==null?void 0:n.castState;if(!Kf||!a)return Tr.UNSUPPORTED;if(!a.includes("CONNECT"))return Tr.UNAVAILABLE},mediaEvents:["castchange"]},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return Cu?void 0:Tr.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return Gf?void 0:Tr.UNSUPPORTED}},MEDIA_VOLUME_UNAVAILABLE:{get:function(n){if(dl!==void 0&&!dl)return Tr.UNSUPPORTED;let{media:a}=n;if(a&&typeof a.volume=="undefined")return Tr.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_CAPTIONS_LIST:{get:function(n){return gs(xu(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_LIST:{get:function(n){return gs(Mu(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_CAPTIONS_SHOWING:{get:function(n){return gs(Ey(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]},MEDIA_SUBTITLES_SHOWING:{get:function(n){return gs(yy(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]}},ul={MEDIA_PLAY_REQUEST:(n,a,l)=>{let m=vi.MEDIA_STREAM_TYPE.get(l),v=l.getAttribute("noautoseektolive")===null;m==Yi.LIVE&&v&&ul.MEDIA_SEEK_TO_LIVE_REQUEST(n),n.play().catch(()=>{})},MEDIA_PAUSE_REQUEST:n=>n.pause(),MEDIA_MUTE_REQUEST:n=>n.muted=!0,MEDIA_UNMUTE_REQUEST:n=>{n.muted=!1,n.volume===0&&(n.volume=.25)},MEDIA_VOLUME_REQUEST:(n,a,l)=>{let m=a.detail;if(n.volume=m,m>0&&n.muted&&(n.muted=!1),!l.hasAttribute("novolumepref"))try{W.localStorage.setItem("media-chrome-pref-volume",m.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(n,a,l)=>{if(!Cu){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}ie.pictureInPictureElement&&ie.exitPictureInPicture(),l[Vt.enter]?l.fullscreenElement[Vt.enter]():n.webkitEnterFullscreen?n.webkitEnterFullscreen():n.requestFullscreen?n.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{ie[Vt.exit]()},MEDIA_ENTER_PIP_REQUEST:n=>{if(!ie.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!n.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}ie[Vt.element]&&ie[Vt.exit]();let a=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};n.requestPictureInPicture().catch(l=>{if(l.code===11)if(n.readyState===0&&n.preload==="none"){let m=()=>{n.removeEventListener("loadedmetadata",v),n.preload="none"},v=()=>{n.requestPictureInPicture().catch(a),m()};n.addEventListener("loadedmetadata",v),n.preload="metadata",setTimeout(()=>{n.readyState===0&&a(),m()},1e3)}else throw l;else throw l})},MEDIA_EXIT_PIP_REQUEST:()=>{ie.pictureInPictureElement&&ie.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:n=>{var a;!((a=globalThis.CastableVideoElement)!=null&&a.castEnabled)||(ie[Vt.element]&&ie[Vt.exit](),n.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var n;(n=globalThis.CastableVideoElement)!=null&&n.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:(n,a)=>{let l=a.detail;(n.readyState>0||n.readyState===void 0)&&(n.currentTime=l)},MEDIA_PLAYBACK_RATE_REQUEST:(n,a)=>{n.playbackRate=a.detail},MEDIA_PREVIEW_REQUEST:(n,a,l)=>{var m;if(!n)return;let v=a.detail;v===null&&l.propagateMediaState(U.MEDIA_PREVIEW_TIME,void 0),l.propagateMediaState(U.MEDIA_PREVIEW_TIME,v);let[E]=hn(n,{kind:ln.METADATA,label:"thumbnails"});if(!(E&&E.cues))return;if(v===null){l.propagateMediaState(U.MEDIA_PREVIEW_IMAGE,void 0),l.propagateMediaState(U.MEDIA_PREVIEW_COORDS,void 0);return}let I=Array.prototype.find.call(E.cues,Q=>Q.startTime>=v);if(!I)return;let M=/'^(?:[a-z]+:)?\/\//i.test(I.text)||(m=n.querySelector('track[label="thumbnails"]'))==null?void 0:m.src,B=new URL(I.text,M),F=new URLSearchParams(B.hash).get("#xywh");l.propagateMediaState(U.MEDIA_PREVIEW_IMAGE,B.href),l.propagateMediaState(U.MEDIA_PREVIEW_COORDS,F.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:(n,a,l)=>{let m=xu(l),{detail:v=[]}=a;ys(La.SHOWING,m,v)},MEDIA_DISABLE_CAPTIONS_REQUEST:(n,a,l)=>{let m=xu(l),{detail:v=[]}=a;ys(La.DISABLED,m,v)},MEDIA_SHOW_SUBTITLES_REQUEST:(n,a,l)=>{let m=Mu(l),{detail:v=[]}=a;ys(La.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:(n,a,l)=>{let m=Mu(l),{detail:v=[]}=a;ys(La.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:n=>{if(!!n){if(!(n.webkitShowPlaybackTargetPicker&&W.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}n.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:n=>{let a=n.seekable;if(!a){console.warn("MediaController: Media element does not support seeking to live.");return}if(!a.length){console.warn("MediaController: Media is unable to seek to live.");return}n.currentTime=a.end(a.length-1)}};var Nu=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ca=(n,a,l)=>(Nu(n,a,"read from private field"),l?l.call(n):a.get(n)),cl=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},qf=(n,a,l,m)=>(Nu(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),fn=(n,a,l)=>(Nu(n,a,"access private method"),l),qr,Es,mn,_s,hl,Pu,jf=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],by=10,Yf=0,fl=class extends Nf{constructor(){super(),cl(this,mn),cl(this,hl),cl(this,qr,new ol(this,"hotkeys")),cl(this,Es,void 0),vi.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&Wf.then(()=>{this.propagateMediaState(U.MEDIA_VOLUME_UNAVAILABLE,vi.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(ul).forEach(a=>{let l=`_handle${jo(a,!0)}`;this[l]=m=>{if(m.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}ul[a](this.media,m,this)},this.addEventListener(ve[a],this[l])}),this._mediaStatePropagators={},Object.keys(vi).forEach(a=>{this._mediaStatePropagators[a]=l=>{this.propagateMediaState(U[a],vi[a].get(this,l))}}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat("nohotkeys","hotkeys","default-stream-type")}get fullscreenElement(){var a;return(a=Ca(this,Es))!=null?a:this}set fullscreenElement(a){this.hasAttribute("fullscreen-element")&&this.removeAttribute("fullscreen-element"),qf(this,Es,a)}attributeChangedCallback(a,l,m){var v;if(a==="nohotkeys")m!==l&&m===""?(this.hasAttribute("hotkeys")&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):m!==l&&m===null&&this.enableHotkeys();else if(a==="hotkeys")Ca(this,qr).value=m;else if(a==="default-stream-type")this.propagateMediaState(U.MEDIA_STREAM_TYPE);else if(a==="fullscreen-element"){let E=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;qf(this,Es,E)}super.attributeChangedCallback(a,l,m)}mediaSetCallback(a){if(super.mediaSetCallback(a),a.hasAttribute("tabindex")||a.setAttribute("tabindex",-1),Object.keys(vi).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:E}=vi[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{a.addEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().addEventListener(M,I)}),E==null||E.forEach(M=>{var B;(B=a.textTracks)==null||B.addEventListener(M,I)})}),!this.hasAttribute("novolumepref"))try{let l=W.localStorage.getItem("media-chrome-pref-volume");l!==null&&(a.volume=l)}catch(l){console.debug("Error getting volume pref",l)}}mediaUnsetCallback(a){super.mediaUnsetCallback(a),Object.keys(vi).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:E}=vi[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{a.removeEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().removeEventListener(M,I)}),E==null||E.forEach(M=>{var B;(B=a.textTracks)==null||B.removeEventListener(M,I)})}),this.propagateMediaState(U.MEDIA_PAUSED,!0)}propagateMediaState(a,l){let m=this.getAttribute(a);if($f(this.mediaStateReceivers,a,l),m===this.getAttribute(a))return;let v=new W.CustomEvent(_f[a],{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(v)}associateElement(a){if(!a)return;let{associatedElementSubscriptions:l}=this;if(l.has(a))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),E=Sy(a,m,v);Object.keys(ve).forEach(I=>{a.addEventListener(ve[I],this[`_handle${jo(I,!0)}`])}),l.set(a,E)}unassociateElement(a){if(!a)return;let{associatedElementSubscriptions:l}=this;if(!l.has(a))return;l.get(a)(),l.delete(a),Object.keys(ve).forEach(v=>{a.removeEventListener(ve[v],this[`_handle${jo(v,!0)}`])})}registerMediaStateReceiver(a){if(!a)return;let l=this.mediaStateReceivers;l.indexOf(a)>-1||(l.push(a),Object.keys(vi).forEach(v=>{let E=vi[v];$f([a],U[v],E.get(this))}))}unregisterMediaStateReceiver(a){let l=this.mediaStateReceivers,m=l.indexOf(a);m<0||l.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",fn(this,hl,Pu))}disableHotkeys(){this.removeEventListener("keydown",fn(this,hl,Pu)),this.removeEventListener("keyup",fn(this,mn,_s))}get hotkeys(){return Ca(this,qr)}keyboardShortcutHandler(a){var l,m,v,E;if(((E=(v=(l=a.target.getAttribute("keysused"))==null?void 0:l.split(" "))!=null?v:(m=a.target)==null?void 0:m.keysUsed)!=null?E:[]).map(se=>se==="Space"?" ":se).filter(Boolean).includes(a.key))return;let M,B,F,Q,re,te=by;if(!Ca(this,qr).contains(`no${a.key.toLowerCase()}`)&&!(a.key===" "&&Ca(this,qr).contains("nospace")))switch(a.key){case" ":case"k":M=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ve.MEDIA_UNMUTE_REQUEST:ve.MEDIA_MUTE_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ve.MEDIA_EXIT_FULLSCREEN_REQUEST:ve.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":Da(this);break;case"ArrowLeft":B=this.getAttribute(U.MEDIA_CURRENT_TIME),F=B&&!Number.isNaN(+B)?+B:Yf,Q=Math.max(F-te,0),re=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:Q}),this.dispatchEvent(re);break;case"ArrowRight":B=this.getAttribute(U.MEDIA_CURRENT_TIME),F=B&&!Number.isNaN(+B)?+B:Yf,Q=Math.max(F+te,0),re=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:Q}),this.dispatchEvent(re);break;default:break}}};qr=new WeakMap;Es=new WeakMap;mn=new WeakSet;_s=function(n){let{key:a}=n;if(!jf.includes(a)){this.removeEventListener("keyup",fn(this,mn,_s));return}this.keyboardShortcutHandler(n)};hl=new WeakSet;Pu=function(n){let{metaKey:a,altKey:l,key:m}=n;if(a||l||!jf.includes(m)){this.removeEventListener("keyup",fn(this,mn,_s));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ca(this,qr).contains(`no${m.toLowerCase()}`)||m===" "&&Ca(this,qr).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",fn(this,mn,_s),{once:!0})};var _y=Object.values(U),zf=n=>{var a,l,m,v;let{observedAttributes:E}=n.constructor;!E&&((a=n.nodeName)==null?void 0:a.includes("-"))&&(W.customElements.upgrade(n),{observedAttributes:E}=n.constructor);let I=(v=(m=(l=n==null?void 0:n.getAttribute)==null?void 0:l.call(n,Pe.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(E||I)?(E||I).filter(M=>_y.includes(M)):[]},Ou=n=>!!zf(n).length,Ty=async(n,a,l)=>(n.isConnected||await Qo(0),l==null?n.removeAttribute(a):typeof l=="boolean"?l?n.setAttribute(a,""):n.removeAttribute(a):Number.isNaN(l)?n.removeAttribute(a):n.setAttribute(a,l)),Ay=n=>{var a;return!!((a=n.closest)!=null&&a.call(n,'*[slot="media"]'))},bs=(n,a)=>{if(Ay(n))return;let l=(v,E)=>{var I,M;Ou(v)&&E(v);let{children:B=[]}=v!=null?v:{},F=(M=(I=v==null?void 0:v.shadowRoot)==null?void 0:I.children)!=null?M:[];[...B,...F].forEach(re=>bs(re,E))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Ou(n)){W.customElements.whenDefined(m).then(()=>{l(n,a)});return}l(n,a)},$f=(n,a,l)=>{n.forEach(m=>{!zf(m).includes(a)||Ty(m,a,l)})},Sy=(n,a,l)=>{bs(n,a);let m=B=>{var F;let Q=(F=B==null?void 0:B.composedPath()[0])!=null?F:B.target;a(Q)},v=B=>{var F;let Q=(F=B==null?void 0:B.composedPath()[0])!=null?F:B.target;l(Q)};n.addEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v);let E=B=>{B.forEach(F=>{let{addedNodes:Q=[],removedNodes:re=[],type:te,target:se,attributeName:pe}=F;te==="childList"?(Array.prototype.forEach.call(Q,Ae=>bs(Ae,a)),Array.prototype.forEach.call(re,Ae=>bs(Ae,l))):te==="attributes"&&pe===Pe.MEDIA_CHROME_ATTRIBUTES&&(Ou(se)?a(se):l(se))})},I=new MutationObserver(E);return I.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{bs(n,l),I.disconnect(),n.removeEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v)}};W.customElements.get("media-controller")||W.customElements.define("media-controller",fl);var Ts=fl;var Xf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ar=(n,a,l)=>(Xf(n,a,"read from private field"),l?l.call(n):a.get(n)),ml=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},As=(n,a,l,m)=>(Xf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pl,rr,vl,gl,Zf=ie.createElement("template"),Qf=`
245
+ `;var bE=Object.values(F),_E="sm:384 md:576 lg:768 xl:960",TE=n=>{var r;for(let l of n){let m=l.target;if(!m.isConnected)continue;let v=(r=m.getAttribute(ut.BREAKPOINTS))!=null?r:_E,y=AE(v),I=SE(y,l.contentRect),M=!1;if(Object.keys(y).forEach(B=>{if(I.includes(B)){m.hasAttribute(`breakpoint${B}`)||(m.setAttribute(`breakpoint${B}`,""),M=!0);return}m.hasAttribute(`breakpoint${B}`)&&(m.removeAttribute(`breakpoint${B}`),M=!0)}),M){let B=new CustomEvent(yn.BREAKPOINTS_CHANGE,{detail:I});m.dispatchEvent(B)}}};function AE(n){let r=n.split(/\s+/);return Object.fromEntries(r.map(l=>l.split(":")))}function SE(n,r){return Object.keys(n).filter(l=>r.width>=n[l])}var ml=class extends q.HTMLElement{constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jf.content.cloneNode(!0)));let r=I=>{let M=this.media;for(let B of I)B.type==="childList"&&(B.removedNodes.forEach(H=>{if(H.slot=="media"&&B.target==this){let z=B.previousSibling&&B.previousSibling.previousElementSibling;if(!z||!M)this.mediaUnsetCallback(H);else{let J=z.slot!=="media";for(;(z=z.previousSibling)!==null;)z.slot=="media"&&(J=!1);J&&this.mediaUnsetCallback(H)}}}),M&&B.addedNodes.forEach(H=>{H==M&&this.handleMediaUpdated(M).then(z=>this.mediaSetCallback(z))}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(TE);this.resizeObserver=m,m.observe(this);let v=this.media,y=this.querySelector(":scope > slot[slot=media]");y&&y.addEventListener("slotchange",()=>{if(!y.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(v);return}this.media&&(v=this.media,this.handleMediaUpdated(this.media).then(M=>this.mediaSetCallback(M)))})}static get observedAttributes(){return[ut.AUTOHIDE,ut.GESTURES_DISABLED].concat(bE)}attributeChangedCallback(r,l,m){r.toLowerCase()==ut.AUTOHIDE&&(this.autohide=m)}get media(){let r=this.querySelector(":scope > [slot=media]");return(r==null?void 0:r.nodeName)=="SLOT"&&(r=r.assignedElements({flatten:!0})[0]),r}mediaSetCallback(r){this._mediaClickPlayToggle=()=>{let l=r.paused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(l,{composed:!0,bubbles:!0}))}}handleMediaUpdated(r){let l=y=>Promise.resolve(y),m=y=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',y),Promise.reject(y));if(!r)return m(r);let v=r.nodeName.toLowerCase();return v.includes("-")?q.customElements.whenDefined(v).then(()=>l(r)):l(r)}mediaUnsetCallback(r){}connectedCallback(){let l=this.getAttribute(ut.AUDIO)!=null?si.AUDIO_PLAYER():si.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",l),this.media&&this.handleMediaUpdated(this.media).then(I=>this.mediaSetCallback(I)),this.setAttribute(ut.USER_INACTIVE,"");let m=()=>{if(this.autohide<0||this.hasAttribute(ut.USER_INACTIVE))return;this.setAttribute(ut.USER_INACTIVE,"");let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(I)},v=()=>{if(!this.hasAttribute(ut.USER_INACTIVE))return;this.removeAttribute(ut.USER_INACTIVE);let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(I)},y=()=>{v(),q.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=q.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{y()}),this.addEventListener("pointerup",I=>{I.pointerType==="touch"?[this,this.media].includes(I.target)&&!this.hasAttribute(ut.USER_INACTIVE)?m():y():I.composedPath().some(M=>{var B;return["media-play-button","media-fullscreen-button"].includes((B=M==null?void 0:M.nodeName)==null?void 0:B.toLowerCase())})&&y()}),this.addEventListener("pointermove",I=>{I.pointerType==="mouse"&&(v(),q.clearTimeout(this._inactiveTimeout),[this,this.media].includes(I.target)&&y())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute(ut.KEYBOARD_CONTROL,"")}),q.addEventListener("mouseup",()=>{this.removeAttribute(ut.KEYBOARD_CONTROL)})}set autohide(r){r=Number(r),this._autohide=isNaN(r)?0:r}get autohide(){return this._autohide===void 0?2:this._autohide}};var zf=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Xt=(n,r,l)=>(zf(n,r,"read from private field"),l?l.call(n):r.get(n)),Is=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},pl=(n,r,l,m)=>(zf(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Tn,An,vl,Ua,Dr,ia,Sn=class{constructor(r,l,{defaultValue:m}={defaultValue:void 0}){Is(this,Dr),Is(this,Tn,void 0),Is(this,An,void 0),Is(this,vl,void 0),Is(this,Ua,new Set),pl(this,Tn,r),pl(this,An,l),pl(this,vl,new Set(m))}[Symbol.iterator](){return Xt(this,Dr,ia).values()}get length(){return Xt(this,Dr,ia).size}get value(){var r;return(r=[...Xt(this,Dr,ia)].join(" "))!=null?r:""}set value(r){var l;r!==this.value&&(pl(this,Ua,new Set),this.add(...(l=r==null?void 0:r.split(" "))!=null?l:[]))}toString(){return this.value}item(r){return[...Xt(this,Dr,ia)][r]}values(){return Xt(this,Dr,ia).values()}forEach(r){Xt(this,Dr,ia).forEach(r)}add(...r){var l,m;r.forEach(v=>Xt(this,Ua).add(v)),!(this.value===""&&!((l=Xt(this,Tn))!=null&&l.hasAttribute(`${Xt(this,An)}`)))&&((m=Xt(this,Tn))==null||m.setAttribute(`${Xt(this,An)}`,`${this.value}`))}remove(...r){var l;r.forEach(m=>Xt(this,Ua).delete(m)),(l=Xt(this,Tn))==null||l.setAttribute(`${Xt(this,An)}`,`${this.value}`)}contains(r){return Xt(this,Dr,ia).has(r)}toggle(r,l){return typeof l!="undefined"?l?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,l){return this.remove(r),this.add(l),r===l}};Tn=new WeakMap;An=new WeakMap;vl=new WeakMap;Ua=new WeakMap;Dr=new WeakSet;ia=function(){return Xt(this,Ua).size?Xt(this,Ua):Xt(this,vl)};var Qf=(n="")=>n.split(/\s+/),Xf=(n="")=>{let[r,l,m]=n.split(":"),v=m?decodeURIComponent(m):void 0;return r=r==="cc"?"captions":"subtitles",{kind:r,language:l,label:v}},kn=(n="",r={})=>Qf(n).map(l=>{let m=Xf(l);return{...r,...m}}),kE=n=>Array.isArray(n)?n.map(r=>typeof r=="string"?Xf(r):r):typeof n=="string"?kn(n):[n],Nd=({kind:n,label:r,language:l}={kind:"subtitles"})=>r?`${n==="captions"?"cc":"sb"}:${l}:${encodeURIComponent(r)}`:l,Rs=(n=[])=>Array.prototype.map.call(n,Nd).join(" "),wE=(n,r)=>l=>l[n]===r,Zf=n=>{let r=Object.entries(n).map(([l,m])=>wE(l,m));return l=>r.every(m=>m(l))},Fd=(n,r=[],l=[])=>{let m=kE(l).map(Zf),v=y=>m.some(I=>I(y));Array.from(r).filter(v).forEach(y=>{y.mode=n})},gl=(n,r=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let l=typeof r=="function"?r:Zf(r);return Array.from(n.textTracks).filter(l)},Ud=n=>!!n.getAttribute(F.MEDIA_SUBTITLES_SHOWING),Cr=(n,r)=>{var l,m;let v=Ud(n);if(v||r===!1){let y=n.getAttribute(F.MEDIA_SUBTITLES_SHOWING);if(y){let I=new window.CustomEvent(Ie.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else if(!v||r===!0){let[y]=(m=Qf((l=n.getAttribute(F.MEDIA_SUBTITLES_LIST))!=null?l:""))!=null?m:[];if(y){let I=new window.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else console.error("Attempting to enable captions or subtitles but none are available! Please verify your media content if this is unexpected.")};var It={enter:"requestFullscreen",exit:"exitFullscreen",rootEvents:["fullscreenchange"],mediaEvents:[],element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};ae.fullscreenElement===void 0&&(It.enter="webkitRequestFullScreen",It.exit=ae.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",It.rootEvents=["webkitfullscreenchange"],It.mediaEvents=["webkitbeginfullscreen","webkitendfullscreen"],It.element="webkitFullscreenElement",It.error="webkitfullscreenerror",It.enabled="webkitFullscreenEnabled");var El,Bd=()=>{var n,r;return El||(El=(r=(n=ae)==null?void 0:n.createElement)==null?void 0:r.call(n,"video"),El)},Jf=async(n=Bd())=>{if(!n)return!1;let r=n.volume;return n.volume=r/2+.1,await ol(0),n.volume!==r},LE=(n=Bd())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",IE=(n=Bd())=>{let r=ae[It.enabled];return!r&&n&&(r="webkitSupportsFullscreen"in n),r},Hd=IE(),em=LE(),tm=!!q.WebKitPlaybackTargetAvailabilityEvent,im=!!q.chrome;var yl,rm=Jf().then(n=>(yl=n,yl)),RE=Object.values(Zi),Gd=n=>gl(n.media,r=>[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)).sort((r,l)=>r.kind>=l.kind?1:-1),DE=n=>gl(n.media,r=>r.mode===al.SHOWING&&[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)),Ai={MEDIA_PAUSED:{get:function(n){let{media:r}=n;return r?r.paused:!0},mediaEvents:["play","playing","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(n){let{media:r}=n;return r?!r.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_ENDED:{get:function(n){let{media:r}=n;return r?r.ended:!1},mediaEvents:["seeked","ended","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(n){let{media:r}=n;return!r||typeof r.playbackRate=="undefined"?1:r.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(n){let{media:r}=n;return!r||typeof r.muted=="undefined"?!1:r.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(n){let{media:r}=n;return!r||typeof r.volume=="undefined"?1:Number(r.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(n){let{media:r}=n,l="high";if(!r||typeof r.volume=="undefined")return l;let{muted:m,volume:v}=r;return v===0||m?l="off":v<.5?l="low":v<.75&&(l="medium"),l},mediaEvents:["volumechange"]},MEDIA_CURRENT_TIME:{get:function(n){let{media:r}=n;return!r||typeof r.currentTime=="undefined"?0:r.currentTime},mediaEvents:["timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(n){let{media:r}=n;return!r||!Number.isFinite(r.duration)?NaN:r.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(n){var r;let{media:l}=n;if(!((r=l==null?void 0:l.seekable)!=null&&r.length))return;let m=l.seekable.start(0),v=l.seekable.end(l.seekable.length-1);if(!(!m&&!v))return[Number(m.toFixed(3)),Number(v.toFixed(3))].join(":")},mediaEvents:["loadedmetadata","emptied","progress"]},MEDIA_LOADING:{get:function(n){var r;return((r=n.media)==null?void 0:r.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(n){var r;return Nf((r=n.media)==null?void 0:r.buffered)},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(n){let{media:r}=n;if(!r)return;let{streamType:l}=r;if(RE.includes(l)){if(l===Zi.UNKNOWN){let v=n.getAttribute("defaultstreamtype");return[Zi.LIVE,Zi.ON_DEMAND].includes(v)?v:void 0}return l}let m=r.duration;if(m===1/0)return Zi.LIVE;if(Number.isFinite(m))return Zi.ON_DEMAND;{let v=n.getAttribute("defaultstreamtype");if([Zi.LIVE,Zi.ON_DEMAND].includes(v))return v}},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(n){let{media:r}=n;if(!r)return Number.NaN;let{targetLiveWindow:l}=r,m=Ai.MEDIA_STREAM_TYPE.get(n);return(l==null||Number.isNaN(l))&&m===Zi.LIVE?0:l},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(n){let{media:r}=n;if(!r)return!1;if(typeof r.liveEdgeStart=="number")return Number.isNaN(r.liveEdgeStart)?!1:r.currentTime>=r.liveEdgeStart;if(!(Ai.MEDIA_STREAM_TYPE.get(n)==="live"))return!1;let m=r.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,y=m.end(m.length-1)-v;return r.currentTime>=y},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(n,r){var l;let m=n.media;if(m&&ae[It.element]===void 0&&"webkitDisplayingFullscreen"in m)return m.webkitDisplayingFullscreen&&m.webkitPresentationMode==="fullscreen";let v;return r?v=ae[It.element]?r.target:null:v=(l=n.getRootNode().fullscreenElement)!=null?l:ae[It.element],Ls(n.fullscreenElement,v)},rootEvents:It.rootEvents,mediaEvents:It.mediaEvents},MEDIA_IS_PIP:{get:function(n,r){var l;let m=n.media;if(!m)return!1;if(r)return r.type=="enterpictureinpicture";{let v=(l=n.getRootNode().pictureInPictureElement)!=null?l:ae.pictureInPictureElement;return Ls(m,v)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_CASTING:{get:function(n,r){var l;let{media:m}=n;if(!m)return!1;let v=(l=globalThis.CastableVideoElement)==null?void 0:l.castElement,y=Ls(m,v);return(r==null?void 0:r.type)==="castchange"&&(r==null?void 0:r.detail)==="CONNECTING"&&(y="connecting"),y},mediaEvents:["entercast","leavecast","castchange"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(n,r){if(!tm)return Rr.UNSUPPORTED;if(!!r&&r.availability!=="available"&&r.availability==="not-available")return Rr.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"]},MEDIA_CAST_UNAVAILABLE:{get:function(){var n;let r=(n=globalThis.CastableVideoElement)==null?void 0:n.castState;if(!im||!r)return Rr.UNSUPPORTED;if(!r.includes("CONNECT"))return Rr.UNAVAILABLE},mediaEvents:["castchange"]},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return Hd?void 0:Rr.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return em?void 0:Rr.UNSUPPORTED}},MEDIA_VOLUME_UNAVAILABLE:{get:function(n){if(yl!==void 0&&!yl)return Rr.UNSUPPORTED;let{media:r}=n;if(r&&typeof r.volume=="undefined")return Rr.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_SUBTITLES_LIST:{get:function(n){return Rs(Gd(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_SHOWING:{get:function(n){return n.hasAttribute("defaultsubtitles")&&!n.hasAttribute(F.MEDIA_HAS_PLAYED)&&!n.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)&&Cr(n,!0),Rs(DE(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]}},bl={MEDIA_PLAY_REQUEST:(n,r,l)=>{var m;let v=Ai.MEDIA_STREAM_TYPE.get(l),y=l.getAttribute("noautoseektolive")===null;v==Zi.LIVE&&y&&bl.MEDIA_SEEK_TO_LIVE_REQUEST(n),(m=n.play())==null||m.catch(()=>{})},MEDIA_PAUSE_REQUEST:n=>n.pause(),MEDIA_MUTE_REQUEST:n=>n.muted=!0,MEDIA_UNMUTE_REQUEST:n=>{n.muted=!1,n.volume===0&&(n.volume=.25)},MEDIA_VOLUME_REQUEST:(n,r,l)=>{let m=r.detail;if(n.volume=m,m>0&&n.muted&&(n.muted=!1),!l.hasAttribute("novolumepref"))try{q.localStorage.setItem("media-chrome-pref-volume",m.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(n,r,l)=>{if(!Hd){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}ae.pictureInPictureElement&&ae.exitPictureInPicture(),l[It.enter]?l.fullscreenElement[It.enter]():n.webkitEnterFullscreen?n.webkitEnterFullscreen():n.requestFullscreen?n.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{ae[It.exit]()},MEDIA_ENTER_PIP_REQUEST:n=>{if(!ae.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!n.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}ae[It.element]&&ae[It.exit]();let r=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};n.requestPictureInPicture().catch(l=>{if(l.code===11)if(n.readyState===0&&n.preload==="none"){let m=()=>{n.removeEventListener("loadedmetadata",v),n.preload="none"},v=()=>{n.requestPictureInPicture().catch(r),m()};n.addEventListener("loadedmetadata",v),n.preload="metadata",setTimeout(()=>{n.readyState===0&&r(),m()},1e3)}else throw l;else throw l})},MEDIA_EXIT_PIP_REQUEST:()=>{ae.pictureInPictureElement&&ae.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:n=>{var r;!((r=globalThis.CastableVideoElement)!=null&&r.castEnabled)||(ae[It.element]&&ae[It.exit](),n.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var n;(n=globalThis.CastableVideoElement)!=null&&n.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:(n,r)=>{let l=r.detail;(n.readyState>0||n.readyState===void 0)&&(n.currentTime=l)},MEDIA_PLAYBACK_RATE_REQUEST:(n,r)=>{n.playbackRate=r.detail},MEDIA_PREVIEW_REQUEST:(n,r,l)=>{var m;if(!n)return;let v=r.detail;v===null&&l.propagateMediaState(F.MEDIA_PREVIEW_TIME,void 0),l.propagateMediaState(F.MEDIA_PREVIEW_TIME,v);let[y]=gl(n,{kind:bn.METADATA,label:"thumbnails"});if(!(y&&y.cues))return;if(v===null){l.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,void 0),l.propagateMediaState(F.MEDIA_PREVIEW_COORDS,void 0);return}let I=Array.prototype.find.call(y.cues,z=>z.startTime>=v);if(!I)return;let M=/'^(?:[a-z]+:)?\/\//i.test(I.text)||(m=n.querySelector('track[label="thumbnails"]'))==null?void 0:m.src,B=new URL(I.text,M),H=new URLSearchParams(B.hash).get("#xywh");l.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,B.href),l.propagateMediaState(F.MEDIA_PREVIEW_COORDS,H.split(",").join(" "))},MEDIA_SHOW_SUBTITLES_REQUEST:(n,r,l)=>{let m=Gd(l),{detail:v=[]}=r;Fd(al.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:(n,r,l)=>{let m=Gd(l),{detail:v=[]}=r;Fd(al.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:n=>{if(!!n){if(!(n.webkitShowPlaybackTargetPicker&&q.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}n.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:n=>{let r=n.seekable;if(!r){console.warn("MediaController: Media element does not support seeking to live.");return}if(!r.length){console.warn("MediaController: Media is unable to seek to live.");return}n.currentTime=r.end(r.length-1)}};var Wd=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Ha=(n,r,l)=>(Wd(n,r,"read from private field"),l?l.call(n):r.get(n)),_l=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},am=(n,r,l,m)=>(Wd(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),wn=(n,r,l)=>(Wd(n,r,"access private method"),l),ra,Ds,Ln,Cs,Tl,Vd,om=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],CE=10,nm=0,Si={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys"},Al=class extends ml{constructor(){super(),_l(this,Ln),_l(this,Tl),_l(this,ra,new Sn(this,Si.HOTKEYS)),_l(this,Ds,void 0),Ai.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&rm.then(()=>{this.propagateMediaState(F.MEDIA_VOLUME_UNAVAILABLE,Ai.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(bl).forEach(r=>{let l=`_handle${nl(r,!0)}`;this[l]=m=>{if(m.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}bl[r](this.media,m,this)},this.addEventListener(Ie[r],this[l])}),this._mediaStatePropagators={},Object.keys(Ai).forEach(r=>{this._mediaStatePropagators[r]=l=>{this.propagateMediaState(F[r],Ai[r].get(this,l))}}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(Si.NO_HOTKEYS,Si.HOTKEYS,Si.DEFAULT_STREAM_TYPE,Si.DEFAULT_SUBTITLES)}get fullscreenElement(){var r;return(r=Ha(this,Ds))!=null?r:this}set fullscreenElement(r){this.hasAttribute(Si.FULLSCREEN_ELEMENT)&&this.removeAttribute(Si.FULLSCREEN_ELEMENT),am(this,Ds,r)}attributeChangedCallback(r,l,m){var v;if(r===Si.NO_HOTKEYS)m!==l&&m===""?(this.hasAttribute(Si.HOTKEYS)&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):m!==l&&m===null&&this.enableHotkeys();else if(r===Si.HOTKEYS)Ha(this,ra).value=m;else if(r===Si.DEFAULT_SUBTITLES&&m!==l&&m==="")Cr(this,!0);else if(r===Si.DEFAULT_STREAM_TYPE)this.propagateMediaState(F.MEDIA_STREAM_TYPE);else if(r===Si.FULLSCREEN_ELEMENT){let y=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;am(this,Ds,y)}super.attributeChangedCallback(r,l,m)}mediaSetCallback(r){if(super.mediaSetCallback(r),r.hasAttribute("tabindex")||(r.tabIndex=-1),Object.keys(Ai).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Ai[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{r.addEventListener(M,I),I()}),v==null||v.forEach(M=>{this.getRootNode().addEventListener(M,I),I()}),y==null||y.forEach(M=>{var B;(B=r.textTracks)==null||B.addEventListener(M,I),I()})}),!this.hasAttribute("novolumepref"))try{let l=q.localStorage.getItem("media-chrome-pref-volume");l!==null&&(r.volume=l)}catch(l){console.debug("Error getting volume pref",l)}}mediaUnsetCallback(r){super.mediaUnsetCallback(r),Object.keys(Ai).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Ai[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{r.removeEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().removeEventListener(M,I)}),y==null||y.forEach(M=>{var B;(B=r.textTracks)==null||B.removeEventListener(M,I)})}),this.propagateMediaState(F.MEDIA_PAUSED,!0)}propagateMediaState(r,l){let m=this.getAttribute(r);if(sm(this.mediaStateReceivers,r,l),m===this.getAttribute(r))return;let v=new q.CustomEvent(Mf[r],{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(v)}associateElement(r){if(!r)return;let{associatedElementSubscriptions:l}=this;if(l.has(r))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),y=OE(r,m,v);Object.keys(Ie).forEach(I=>{r.addEventListener(Ie[I],this[`_handle${nl(I,!0)}`])}),l.set(r,y)}unassociateElement(r){if(!r)return;let{associatedElementSubscriptions:l}=this;if(!l.has(r))return;l.get(r)(),l.delete(r),Object.keys(Ie).forEach(v=>{r.removeEventListener(Ie[v],this[`_handle${nl(v,!0)}`])})}registerMediaStateReceiver(r){if(!r)return;let l=this.mediaStateReceivers;l.indexOf(r)>-1||(l.push(r),Object.keys(Ai).forEach(v=>{let y=Ai[v];sm([r],F[v],y.get(this))}))}unregisterMediaStateReceiver(r){let l=this.mediaStateReceivers,m=l.indexOf(r);m<0||l.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",wn(this,Tl,Vd))}disableHotkeys(){this.removeEventListener("keydown",wn(this,Tl,Vd)),this.removeEventListener("keyup",wn(this,Ln,Cs))}get hotkeys(){return Ha(this,ra)}keyboardShortcutHandler(r){var l,m,v,y;if(((y=(v=(l=r.target.getAttribute(Si.KEYS_USED))==null?void 0:l.split(" "))!=null?v:(m=r.target)==null?void 0:m.keysUsed)!=null?y:[]).map(le=>le==="Space"?" ":le).filter(Boolean).includes(r.key))return;let M,B,H,z,J,ee=CE;if(!Ha(this,ra).contains(`no${r.key.toLowerCase()}`)&&!(r.key===" "&&Ha(this,ra).contains("nospace")))switch(r.key){case" ":case"k":M=this.getAttribute(F.MEDIA_PAUSED)!=null?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?Ie.MEDIA_UNMUTE_REQUEST:Ie.MEDIA_MUTE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?Ie.MEDIA_EXIT_FULLSCREEN_REQUEST:Ie.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":Cr(this);break;case"ArrowLeft":B=this.getAttribute(F.MEDIA_CURRENT_TIME),H=B&&!Number.isNaN(+B)?+B:nm,z=Math.max(H-ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;case"ArrowRight":B=this.getAttribute(F.MEDIA_CURRENT_TIME),H=B&&!Number.isNaN(+B)?+B:nm,z=Math.max(H+ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;default:break}}};ra=new WeakMap;Ds=new WeakMap;Ln=new WeakSet;Cs=function(n){let{key:r}=n;if(!om.includes(r)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}this.keyboardShortcutHandler(n)};Tl=new WeakSet;Vd=function(n){let{metaKey:r,altKey:l,key:m}=n;if(r||l||!om.includes(m)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ha(this,ra).contains(`no${m.toLowerCase()}`)||m===" "&&Ha(this,ra).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",wn(this,Ln,Cs),{once:!0})};var ME=Object.values(F),lm=n=>{var r,l,m,v;let{observedAttributes:y}=n.constructor;!y&&((r=n.nodeName)==null?void 0:r.includes("-"))&&(q.customElements.upgrade(n),{observedAttributes:y}=n.constructor);let I=(v=(m=(l=n==null?void 0:n.getAttribute)==null?void 0:l.call(n,Ne.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(y||I)?(y||I).filter(M=>ME.includes(M)):[]},Kd=n=>!!lm(n).length,xE=async(n,r,l)=>(n.isConnected||await ol(0),l==null?n.removeAttribute(r):typeof l=="boolean"?l?n.setAttribute(r,""):n.removeAttribute(r):Number.isNaN(l)?n.removeAttribute(r):n.setAttribute(r,l)),PE=n=>{var r;return!!((r=n.closest)!=null&&r.call(n,'*[slot="media"]'))},Ba=(n,r)=>{if(PE(n))return;let l=(v,y)=>{var I,M;Kd(v)&&y(v);let{children:B=[]}=v!=null?v:{},H=(M=(I=v==null?void 0:v.shadowRoot)==null?void 0:I.children)!=null?M:[];[...B,...H].forEach(J=>Ba(J,y))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Kd(n)){q.customElements.whenDefined(m).then(()=>{l(n,r)});return}l(n,r)},sm=(n,r,l)=>{n.forEach(m=>{!lm(m).includes(r)||xE(m,r,l)})},OE=(n,r,l)=>{Ba(n,r);let m=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;r(ee)},v=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;l(ee)};n.addEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v);let y=z=>{z.forEach(J=>{let{addedNodes:ee=[],removedNodes:le=[],type:me,target:_e,attributeName:ge}=J;me==="childList"?(Array.prototype.forEach.call(ee,ye=>Ba(ye,r)),Array.prototype.forEach.call(le,ye=>Ba(ye,l))):me==="attributes"&&ge===Ne.MEDIA_CHROME_ATTRIBUTES&&(Kd(_e)?r(_e):l(_e))})},I=[],M=z=>{let J=z.target;J.name!=="media"&&(I.forEach(ee=>Ba(ee,l)),I=[...J.assignedElements({flatten:!0})],I.forEach(ee=>Ba(ee,r)))};n.addEventListener("slotchange",M);let B=new MutationObserver(y);return B.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{Ba(n,l),n.removeEventListener("slotchange",M),B.disconnect(),n.removeEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v)}};q.customElements.get("media-controller")||q.customElements.define("media-controller",Al);var qd=Al;var dm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Mr=(n,r,l)=>(dm(n,r,"read from private field"),l?l.call(n):r.get(n)),Sl=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Ms=(n,r,l,m)=>(dm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),kl,ur,wl,Ll,cm=ae.createElement("template"),um=`
237
246
  height: var(--thumb-height);
238
247
  width: var(--media-range-thumb-width, 10px);
239
248
  border: var(--media-range-thumb-border, none);
@@ -244,7 +253,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
244
253
  transition: var(--media-range-thumb-transition, none);
245
254
  transform: var(--media-range-thumb-transform, none);
246
255
  opacity: var(--media-range-thumb-opacity, 1);
247
- `,Fu=`
256
+ `,Yd=`
248
257
  min-width: 40px;
249
258
  height: var(--track-height);
250
259
  border: var(--media-range-track-border, none);
@@ -256,7 +265,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
256
265
  transition: var(--media-range-track-transition, none);
257
266
  transform: translate(var(--media-range-track-translate-x, 0), var(--media-range-track-translate-y, 0));
258
267
  cursor: pointer;
259
- `;Zf.innerHTML=`
268
+ `;cm.innerHTML=`
260
269
  <style>
261
270
  :host {
262
271
  --thumb-height: var(--media-range-thumb-height, 10px);
@@ -314,19 +323,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
314
323
 
315
324
  input[type=range]::-webkit-slider-thumb {
316
325
  -webkit-appearance: none;
317
- ${Qf}
326
+ ${um}
318
327
 
319
328
  margin-top: calc(calc(0px - var(--thumb-height) + var(--track-height)) / 2);
320
329
  }
321
330
 
322
331
 
323
332
  input[type=range]::-moz-range-thumb {
324
- ${Qf}
333
+ ${um}
325
334
  translate: var(--media-range-track-translate-x, 0) var(--media-range-track-translate-y, 0);
326
335
  }
327
336
 
328
- input[type=range]::-webkit-slider-runnable-track { ${Fu} }
329
- input[type=range]::-moz-range-track { ${Fu} }
337
+ input[type=range]::-webkit-slider-runnable-track { ${Yd} }
338
+ input[type=range]::-moz-range-track { ${Yd} }
330
339
  input[type=range]::-ms-track {
331
340
 
332
341
  width: 100%;
@@ -336,7 +345,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
336
345
  border-color: transparent;
337
346
  color: transparent;
338
347
 
339
- ${Fu}
348
+ ${Yd}
340
349
  }
341
350
 
342
351
  #background,
@@ -396,26 +405,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
396
405
  <div id="hoverzone"></div>
397
406
  <input id="range" type="range" min="0" max="1000" step="any" value="0">
398
407
  </div>
399
- `;var yl=class extends W.HTMLElement{constructor(){super(),ml(this,pl,void 0),ml(this,rr,void 0),ml(this,vl,()=>{if(this.range.matches(":focus-visible")){let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),ml(this,gl,()=>{let{style:l}=Ct(this.shadowRoot,":host");l.removeProperty("--_focus-visible-box-shadow")}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Zf.content.cloneNode(!0)));let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-block))`),this.container=this.shadowRoot.querySelector("#container"),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this)),As(this,pl,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER?(l&&((E=(v=Ar(this,rr))==null?void 0:v.unassociateElement)==null||E.call(v,this),As(this,rr,null)),m&&(As(this,rr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Ar(this,rr))==null?void 0:M.associateElement)==null||B.call(M,this))):(a==="disabled"||a==="aria-disabled"&&l!==m)&&(m==null?this.range.removeAttribute(a):this.range.setAttribute(a,m))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(As(this,rr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ar(this,rr))==null?void 0:l.associateElement)==null||m.call(l,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Ar(this,vl)),this.shadowRoot.addEventListener("focusout",Ar(this,gl))}disconnectedCallback(){var a,l;(l=(a=Ar(this,rr))==null?void 0:a.unassociateElement)==null||l.call(a,this),As(this,rr,null),this.shadowRoot.removeEventListener("focusin",Ar(this,vl)),this.shadowRoot.removeEventListener("focusout",Ar(this,gl))}updatePointerBar(a){let l=this.range.getBoundingClientRect(),m=(a.clientX-l.left)/l.width;m=Math.max(0,Math.min(1,m));let{style:v}=Ct(this.shadowRoot,"#pointer");v.setProperty("width",`${m*l.width}px`)}updateBar(){let a=this.getBarColors(),l="linear-gradient(to right, ",m=0;a.forEach(E=>{E[1]<m||(l=l+`${E[0]} ${m}%, ${E[0]} ${E[1]}%,`,m=E[1])}),l=l.slice(0,l.length-1)+")";let{style:v}=Ct(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",l)}getBarColors(){let a=this.range,l=a.value-a.min,m=a.max-a.min,v=l/m*100,E=0;return a.value>a.min&&a.value<a.max&&(E=Ar(this,pl)*(.5-v/100)/a.offsetWidth*100),[["var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)))",v+E],["var(--media-range-track-color, transparent)",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};pl=new WeakMap;rr=new WeakMap;vl=new WeakMap;gl=new WeakMap;W.customElements.get("media-chrome-range")||W.customElements.define("media-chrome-range",yl);var Ss=yl;var Jf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},El=(n,a,l)=>(Jf(n,a,"read from private field"),l?l.call(n):a.get(n)),ky=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},bl=(n,a,l,m)=>(Jf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ar,em=ie.createElement("template");em.innerHTML=`
408
+ `;var Ga=class extends q.HTMLElement{constructor(){super(),Sl(this,kl,void 0),Sl(this,ur,void 0),Sl(this,wl,()=>{if(this.range.matches(":focus-visible")){let{style:l}=ft(this.shadowRoot,":host");l.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),Sl(this,Ll,()=>{let{style:l}=ft(this.shadowRoot,":host");l.removeProperty("--_focus-visible-box-shadow")}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(cm.content.cloneNode(!0)));let{style:r}=ft(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-block))`),this.container=this.shadowRoot.querySelector("#container"),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this)),Ms(this,kl,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Ne.MEDIA_CONTROLLER?(l&&((y=(v=Mr(this,ur))==null?void 0:v.unassociateElement)==null||y.call(v,this),Ms(this,ur,null)),m&&(Ms(this,ur,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Mr(this,ur))==null?void 0:M.associateElement)==null||B.call(M,this))):(r==="disabled"||r==="aria-disabled"&&l!==m)&&(m==null?this.range.removeAttribute(r):this.range.setAttribute(r,m))}connectedCallback(){var r,l,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Ms(this,ur,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=Mr(this,ur))==null?void 0:l.associateElement)==null||m.call(l,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Mr(this,wl)),this.shadowRoot.addEventListener("focusout",Mr(this,Ll))}disconnectedCallback(){var r,l;(l=(r=Mr(this,ur))==null?void 0:r.unassociateElement)==null||l.call(r,this),Ms(this,ur,null),this.shadowRoot.removeEventListener("focusin",Mr(this,wl)),this.shadowRoot.removeEventListener("focusout",Mr(this,Ll))}updatePointerBar(r){let l=this.range.getBoundingClientRect(),m=(r.clientX-l.left)/l.width;m=Math.max(0,Math.min(1,m));let{style:v}=ft(this.shadowRoot,"#pointer");v.setProperty("width",`${m*l.width}px`)}updateBar(){let r=this.getBarColors(),l="linear-gradient(to right, ",m=0;r.forEach(y=>{y[1]<m||(l=l+`${y[0]} ${m}%, ${y[0]} ${y[1]}%,`,m=y[1])}),l=l.slice(0,l.length-1)+")";let{style:v}=ft(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",l)}getBarColors(){let r=this.range,l=r.value-r.min,m=r.max-r.min,v=l/m*100,y=0;return r.value>r.min&&r.value<r.max&&(y=Mr(this,kl)*(.5-v/100)/r.offsetWidth*100),[["var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)))",v+y],["var(--media-range-track-color, transparent)",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};kl=new WeakMap;ur=new WeakMap;wl=new WeakMap;Ll=new WeakMap;q.customElements.get("media-chrome-range")||q.customElements.define("media-chrome-range",Ga);var hm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Il=(n,r,l)=>(hm(n,r,"read from private field"),l?l.call(n):r.get(n)),NE=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Rl=(n,r,l,m)=>(hm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),dr,fm=ae.createElement("template");fm.innerHTML=`
400
409
  <style>
401
410
  :host {
402
411
 
403
412
  box-sizing: border-box;
404
413
  display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
405
414
  color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
406
- --media-loading-icon-width: 44px;
415
+ --media-loading-indicator-icon-height: 44px;
407
416
  }
408
417
 
409
418
  media-time-range,
410
419
  ::slotted(media-time-range),
411
- ::slotted(media-progress-range),
412
420
  ::slotted(media-clip-selector) {
413
421
  flex-grow: 1;
414
422
  }
423
+
424
+ media-time-range,
425
+ ::slotted(media-time-range),
426
+ ::slotted(media-clip-selector),
427
+ media-volume-range,
428
+ ::slotted(media-volume-range) {
429
+ height: var(--_range-auto-size, calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)));
430
+ }
415
431
  </style>
416
432
 
417
433
  <slot></slot>
418
- `;var Uu=class extends W.HTMLElement{constructor(){super(),ky(this,ar,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(em.content.cloneNode(!0)))}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=El(this,ar))==null?void 0:v.unassociateElement)==null||E.call(v,this),bl(this,ar,null)),m&&(bl(this,ar,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=El(this,ar))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(bl(this,ar,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=El(this,ar))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=El(this,ar))==null?void 0:a.unassociateElement)==null||l.call(a,this),bl(this,ar,null)}};ar=new WeakMap;W.customElements.get("media-control-bar")||W.customElements.define("media-control-bar",Uu);var tm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},_l=(n,a,l)=>(tm(n,a,"read from private field"),l?l.call(n):a.get(n)),wy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Tl=(n,a,l,m)=>(tm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),nr,im=ie.createElement("template");im.innerHTML=`
434
+ `;var $d=class extends q.HTMLElement{constructor(){super(),NE(this,dr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(fm.content.cloneNode(!0))),this.shadowRoot.querySelector("slot").addEventListener("slotchange",({target:r})=>{let l=r.assignedElements({flatten:!0}).every(y=>["media-time-range","media-volume-range"].includes(y.nodeName.toLowerCase())),{style:m}=ft(this.shadowRoot,":host"),v=l?"unset":"initial";m.setProperty("--_range-auto-size",v)})}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Ne.MEDIA_CONTROLLER&&(l&&((y=(v=Il(this,dr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Rl(this,dr,null)),m&&(Rl(this,dr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Il(this,dr))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var r,l,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Rl(this,dr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=Il(this,dr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var r,l;(l=(r=Il(this,dr))==null?void 0:r.unassociateElement)==null||l.call(r,this),Rl(this,dr,null)}};dr=new WeakMap;q.customElements.get("media-control-bar")||q.customElements.define("media-control-bar",$d);var mm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Dl=(n,r,l)=>(mm(n,r,"read from private field"),l?l.call(n):r.get(n)),FE=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Cl=(n,r,l,m)=>(mm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),cr,pm=ae.createElement("template");pm.innerHTML=`
419
435
  <style>
420
436
  :host {
421
437
  font: var(--media-font,
@@ -424,7 +440,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
424
440
  var(--media-text-content-height, var(--media-control-height, 24px))
425
441
  var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
426
442
  color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
427
- background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
443
+ background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));
428
444
  padding: var(--media-control-padding, 10px);
429
445
  display: inline-flex;
430
446
  justify-content: center;
@@ -448,49 +464,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
448
464
  }
449
465
  </style>
450
466
  <slot></slot>
451
- `;var Al=class extends W.HTMLElement{constructor(){super(),wy(this,nr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(im.content.cloneNode(!0)));let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=_l(this,nr))==null?void 0:v.unassociateElement)==null||E.call(v,this),Tl(this,nr,null)),m&&(Tl(this,nr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=_l(this,nr))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(Tl(this,nr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=_l(this,nr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=_l(this,nr))==null?void 0:a.unassociateElement)==null||l.call(a,this),Tl(this,nr,null)}};nr=new WeakMap;W.customElements.get("media-text-display")||W.customElements.define("media-text-display",Al);var Yr=Al;var am=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},rm=(n,a,l)=>(am(n,a,"read from private field"),l?l.call(n):a.get(n)),Ly=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Iy=(n,a,l,m)=>(am(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ks,Bu=class extends Yr{constructor(){super(),Ly(this,ks,void 0),Iy(this,ks,this.shadowRoot.querySelector("slot")),rm(this,ks).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME]}attributeChangedCallback(a,l,m){a===U.MEDIA_CURRENT_TIME&&(rm(this,ks).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};ks=new WeakMap;W.customElements.get("media-current-time-display")||W.customElements.define("media-current-time-display",Bu);var sm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},nm=(n,a,l)=>(sm(n,a,"read from private field"),l?l.call(n):a.get(n)),Ry=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Dy=(n,a,l,m)=>(sm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ws,Hu=class extends Yr{constructor(){super(),Ry(this,ws,void 0),Dy(this,ws,this.shadowRoot.querySelector("slot")),nm(this,ws).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_DURATION]}attributeChangedCallback(a,l,m){a===U.MEDIA_DURATION&&(nm(this,ws).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};ws=new WeakMap;W.customElements.get("media-duration-display")||W.customElements.define("media-duration-display",Hu);var dm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Gu=(n,a,l)=>(dm(n,a,"read from private field"),l?l.call(n):a.get(n)),Cy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},My=(n,a,l,m)=>(dm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pn,om=["Enter"," "],xy="&nbsp;/&nbsp;",lm=(n,{timesSep:a=xy}={})=>{var l,m,v;let E=n.getAttribute("remaining")!=null,I=n.getAttribute("show-duration")!=null,M=(l=n.mediaCurrentTime)!=null?l:0,B=(v=(m=n.mediaDuration)!=null?m:n.mediaSeekableEnd)!=null?v:0,F=E?ki(0-(B-M)):ki(M);return I?`${F}${a}${ki(B)}`:F},Py="video not loaded, unknown time.",Oy=n=>{let a=n.mediaCurrentTime,l=n.mediaDuration||n.mediaSeekableEnd;if(a==null||l==null){n.setAttribute("aria-valuetext",Py);return}let m=n.hasAttribute("remaining"),v=n.hasAttribute("show-duration"),E=m?Ia(0-(l-a)):Ia(a);if(!v){n.setAttribute("aria-valuetext",E);return}let I=Ia(l),M=`${E} of ${I}`;n.setAttribute("aria-valuetext",M)},Vu=class extends Yr{constructor(){super(),Cy(this,pn,void 0),My(this,pn,this.shadowRoot.querySelector("slot")),Gu(this,pn).innerHTML=`${lm(this)}`;let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("cursor","pointer")}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,"remaining","show-duration","disabled"]}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Jt.PLAYBACK_TIME());let a=l=>{let{key:m}=l;if(!om.includes(m)){this.removeEventListener("keyup",a);return}this.toggleTimeDisplay()};this.addEventListener("keydown",l=>{let{metaKey:m,altKey:v,key:E}=l;if(m||v||!om.includes(E)){this.removeEventListener("keyup",a);return}this.addEventListener("keyup",a)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining","")}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(a,l,m){if([U.MEDIA_CURRENT_TIME,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,"remaining","show-duration"].includes(a)){let v=lm(this);Oy(this),v!==Gu(this,pn).innerHTML&&(Gu(this,pn).innerHTML=v)}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable());super.attributeChangedCallback(a,l,m)}enable(){this.setAttribute("tabindex",0)}disable(){this.removeAttribute("tabindex")}get mediaDuration(){let a=this.getAttribute(U.MEDIA_DURATION);return a!=null?+a:void 0}get mediaCurrentTime(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME);return a!=null?+a:void 0}get mediaSeekable(){let a=this.getAttribute(U.MEDIA_SEEKABLE);if(!!a)return a.split(":").map(l=>+l)}get mediaSeekableEnd(){var a;let[,l]=(a=this.mediaSeekable)!=null?a:[];return l}get mediaSeekableStart(){var a;let[l]=(a=this.mediaSeekable)!=null?a:[];return l}};pn=new WeakMap;W.customElements.get("media-time-display")||W.customElements.define("media-time-display",Vu);var Ny=`<svg aria-hidden="true" viewBox="0 0 26 24">
467
+ `;var xr=class extends q.HTMLElement{constructor(){super(),FE(this,cr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(pm.content.cloneNode(!0)));let{style:r}=ft(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Ne.MEDIA_CONTROLLER&&(l&&((y=(v=Dl(this,cr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Cl(this,cr,null)),m&&(Cl(this,cr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Dl(this,cr))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var r,l,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Cl(this,cr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=Dl(this,cr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var r,l;(l=(r=Dl(this,cr))==null?void 0:r.unassociateElement)==null||l.call(r,this),Cl(this,cr,null)}};cr=new WeakMap;q.customElements.get("media-text-display")||q.customElements.define("media-text-display",xr);var gm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},vm=(n,r,l)=>(gm(n,r,"read from private field"),l?l.call(n):r.get(n)),UE=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},BE=(n,r,l,m)=>(gm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),xs,jd=class extends xr{constructor(){super(),UE(this,xs,void 0),BE(this,xs,this.shadowRoot.querySelector("slot")),vm(this,xs).textContent=or(0)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_DURATION]}attributeChangedCallback(r,l,m){r===F.MEDIA_DURATION&&(vm(this,xs).textContent=or(m)),super.attributeChangedCallback(r,l,m)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}};xs=new WeakMap;q.customElements.get("media-duration-display")||q.customElements.define("media-duration-display",jd);var _m=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},zd=(n,r,l)=>(_m(n,r,"read from private field"),l?l.call(n):r.get(n)),HE=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},GE=(n,r,l,m)=>(_m(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),In,Pr={REMAINING:"remaining",SHOW_DURATION:"showduration"},Em=[...Object.values(Pr),F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE],ym=["Enter"," "],VE="&nbsp;/&nbsp;",bm=(n,{timesSep:r=VE}={})=>{var l,m,v,y;let I=n.hasAttribute(Pr.REMAINING),M=n.hasAttribute(Pr.SHOW_DURATION),B=(l=n.mediaCurrentTime)!=null?l:0,[,H]=(m=n.mediaSeekable)!=null?m:[],z=(y=(v=n.mediaDuration)!=null?v:H)!=null?y:0,J=I?or(0-(z-B)):or(B);return M?`${J}${r}${or(z)}`:J},KE="video not loaded, unknown time.",WE=n=>{var r;let l=n.mediaCurrentTime,[,m]=(r=n.mediaSeekable)!=null?r:[],v=n.mediaDuration||m;if(l==null||v==null){n.setAttribute("aria-valuetext",KE);return}let y=n.hasAttribute(Pr.REMAINING),I=n.hasAttribute(Pr.SHOW_DURATION),M=y?Na(0-(v-l)):Na(l);if(!I){n.setAttribute("aria-valuetext",M);return}let B=Na(v),H=`${M} of ${B}`;n.setAttribute("aria-valuetext",H)},Qd=class extends xr{constructor(){super(),HE(this,In,void 0),GE(this,In,this.shadowRoot.querySelector("slot")),zd(this,In).innerHTML=`${bm(this)}`;let{style:r}=ft(this.shadowRoot,":host");r.setProperty("cursor","pointer");let{style:l}=ft(this.shadowRoot,":host(:hover)");l.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))")}static get observedAttributes(){return[...super.observedAttributes,...Em,"disabled"]}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",si.PLAYBACK_TIME());let r=l=>{let{key:m}=l;if(!ym.includes(m)){this.removeEventListener("keyup",r);return}this.toggleTimeDisplay()};this.addEventListener("keydown",l=>{let{metaKey:m,altKey:v,key:y}=l;if(m||v||!ym.includes(y)){this.removeEventListener("keyup",r);return}this.addEventListener("keyup",r)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining","")}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(r,l,m){Em.includes(r)?this.update():r==="disabled"&&m!==l&&(m==null?this.enable():this.disable()),super.attributeChangedCallback(r,l,m)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return mt(this,Pr.REMAINING)}set remaining(r){bt(this,Pr.REMAINING,r)}get showDuration(){return mt(this,Pr.SHOW_DURATION)}set showDuration(r){bt(this,Pr.SHOW_DURATION,r)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}get mediaCurrentTime(){return St(this,F.MEDIA_CURRENT_TIME)}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}get mediaSeekable(){let r=this.getAttribute(F.MEDIA_SEEKABLE);if(!!r)return r.split(":").map(l=>+l)}set mediaSeekable(r){if(r==null){this.removeAttribute(F.MEDIA_SEEKABLE);return}this.setAttribute(F.MEDIA_SEEKABLE,r.join(":"))}update(){let r=bm(this);WE(this),r!==zd(this,In).innerHTML&&(zd(this,In).innerHTML=r)}};In=new WeakMap;q.customElements.get("media-time-display")||q.customElements.define("media-time-display",Qd);var qE=`<svg aria-hidden="true" viewBox="0 0 26 24">
452
468
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
453
- </svg>`,Fy=`<svg aria-hidden="true" viewBox="0 0 26 24">
469
+ </svg>`,YE=`<svg aria-hidden="true" viewBox="0 0 26 24">
454
470
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
455
- </svg>`,cm=ie.createElement("template");cm.innerHTML=`
471
+ </svg>`,km=ae.createElement("template");km.innerHTML=`
456
472
  <style>
457
- :host([aria-checked="true"]) slot:not([name=on]) > *,
458
- :host([aria-checked="true"]) ::slotted(:not([slot=on])) {
459
- display: none !important;
460
- }
473
+ :host([aria-checked="true"]) slot[name=off] {
474
+ display: none !important;
475
+ }
461
476
 
462
-
463
- :host(:not([aria-checked="true"])) slot:not([name=off]) > *,
464
- :host(:not([aria-checked="true"])) ::slotted(:not([slot=off])) {
465
- display: none !important;
466
- }
477
+
478
+ :host(:not([aria-checked="true"])) slot[name=on] {
479
+ display: none !important;
480
+ }
467
481
  </style>
468
-
469
- <slot name="on">${Ny}</slot>
470
- <slot name="off">${Fy}</slot>
471
- `;var um=n=>{n.setAttribute("aria-checked",Ru(n))},Ku=class extends Et{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",U.MEDIA_CAPTIONS_LIST,U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_LIST,U.MEDIA_SUBTITLES_SHOWING]}constructor(a={}){super({slotTemplate:cm,...a}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Jt.CLOSED_CAPTIONS()),um(this)}attributeChangedCallback(a,l,m){if([U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_SHOWING].includes(a)&&um(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){let v=!this.hasAttribute("no-subtitles-fallback");if((v?[U.MEDIA_CAPTIONS_LIST,U.MEDIA_SUBTITLES_LIST]:[U.MEDIA_CAPTIONS_LIST]).includes(a)){let I=!!this.getAttribute(U.MEDIA_CAPTIONS_LIST)||!!(v&&this.getAttribute(U.MEDIA_SUBTITLES_LIST));this._captionsReady!==I&&(this._captionsReady=I,this._captionsReady&&Da(this))}}super.attributeChangedCallback(a,l,m)}handleClick(){Da(this)}};W.customElements.get("media-captions-button")||W.customElements.define("media-captions-button",Ku);var Wu="30",Uy=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">${Wu}</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg>`,mm=ie.createElement("template");mm.innerHTML=`
472
- <slot name="forward">${Uy}</slot>
473
- `;var By=0,hm=n=>{let a=Math.abs(+n.getAttribute("seek-offset")),l=ct.SEEK_FORWARD_N_SECS({seekOffset:a});n.setAttribute("aria-label",l)},fm=n=>{let a=Zo(n,"forward"),l=n.getAttribute("seek-offset");Xo(a,l)},qu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(a={}){super({slotTemplate:mm,...a})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Wu),hm(this),fm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a==="seek-offset"&&(m==null&&this.setAttribute("seek-offset",Wu),fm(this),hm(this)),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME),l=+this.getAttribute("seek-offset"),v=(a&&!Number.isNaN(+a)?+a:By)+l,E=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-seek-forward-button")||W.customElements.define("media-seek-forward-button",qu);var Hy=`<svg aria-hidden="true" viewBox="0 0 26 24">
482
+
483
+ <slot name="icon">
484
+ <slot name="on">${qE}</slot>
485
+ <slot name="off">${YE}</slot>
486
+ </slot>
487
+ `;var Tm=n=>{n.setAttribute("aria-checked",Ud(n))},Am=(n,r)=>{let l=n.getAttribute(r);return l?kn(l):[]},Sm=(n,r,l)=>{if(!l){n.removeAttribute(r);return}let m=Rs(l);n.getAttribute(r)!==m&&n.setAttribute(r,m)},Xd=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}constructor(r={}){super({slotTemplate:km,...r}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",si.CLOSED_CAPTIONS()),Tm(this)}attributeChangedCallback(r,l,m){r===F.MEDIA_SUBTITLES_SHOWING&&Tm(this),super.attributeChangedCallback(r,l,m)}get mediaSubtitlesList(){return Am(this,F.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(r){Sm(this,F.MEDIA_SUBTITLES_LIST,r)}get mediaSubtitlesShowing(){return Am(this,F.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(r){Sm(this,F.MEDIA_SUBTITLES_SHOWING,r)}handleClick(){Cr(this)}};q.customElements.get("media-captions-button")||q.customElements.define("media-captions-button",Xd);function Rn(n){let r=Math.abs(n.seekOffset),l=yt.SEEK_BACK_N_SECS({seekOffset:r});n.setAttribute("aria-label",l)}function Dn(n,r){let l=Uf(n,r),m=n.seekOffset;Ff(l,m)}var Ml={SEEK_OFFSET:"seekoffset"},wm=30,$E=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">${wm}</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg>`,Lm=ae.createElement("template");Lm.innerHTML=`
488
+ <slot name="forward">${$E}</slot>
489
+ `;var jE=0,Zd=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,Ml.SEEK_OFFSET]}constructor(r={}){super({slotTemplate:Lm,...r})}connectedCallback(){Rn(this),Dn(this,"forward"),super.connectedCallback()}attributeChangedCallback(r,l,m){r===Ml.SEEK_OFFSET&&(Dn(this,"forward"),Rn(this)),super.attributeChangedCallback(r,l,m)}get seekOffset(){var r;return(r=St(this,Ml.SEEK_OFFSET))!=null?r:wm}set seekOffset(r){Lt(this,Ml.SEEK_OFFSET,r)}get mediaCurrentTime(){var r;return(r=St(this,F.MEDIA_CURRENT_TIME))!=null?r:jE}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}handleClick(){let r=this.mediaCurrentTime+this.seekOffset,l=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(l)}};q.customElements.get("media-seek-forward-button")||q.customElements.define("media-seek-forward-button",Zd);var zE=`<svg aria-hidden="true" viewBox="0 0 26 24">
474
490
  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
475
- </svg>`,Gy=`<svg aria-hidden="true" viewBox="0 0 26 24">
491
+ </svg>`,QE=`<svg aria-hidden="true" viewBox="0 0 26 24">
476
492
  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
477
- </svg>`,vm=ie.createElement("template");vm.innerHTML=`
493
+ </svg>`,Rm=ae.createElement("template");Rm.innerHTML=`
478
494
  <style>
479
- :host([${U.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]) > *,
480
- :host([${U.MEDIA_IS_FULLSCREEN}]) ::slotted(:not([slot=exit])) {
495
+ :host([${F.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]):not([name=icon]) {
481
496
  display: none !important;
482
497
  }
483
498
 
484
499
 
485
- :host(:not([${U.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]) > *,
486
- :host(:not([${U.MEDIA_IS_FULLSCREEN}])) ::slotted(:not([slot=enter])) {
500
+ :host(:not([${F.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]):not([name=icon]) {
487
501
  display: none !important;
488
502
  }
489
503
  </style>
490
504
 
491
- <slot name="enter">${Hy}</slot>
492
- <slot name="exit">${Gy}</slot>
493
- `;var pm=n=>{let l=n.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ct.EXIT_FULLSCREEN():ct.ENTER_FULLSCREEN();n.setAttribute("aria-label",l)},Yu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_FULLSCREEN,U.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(a={}){super({slotTemplate:vm,...a})}connectedCallback(){pm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_FULLSCREEN&&pm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ve.MEDIA_EXIT_FULLSCREEN_REQUEST:ve.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-fullscreen-button")||W.customElements.define("media-fullscreen-button",Yu);var{MEDIA_TIME_IS_LIVE:vn,MEDIA_PAUSED:Ma}=U,{MEDIA_SEEK_TO_LIVE_REQUEST:Vy,MEDIA_PLAY_REQUEST:Ky}=ve,Wy='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>',gm=ie.createElement("template");gm.innerHTML=`
505
+ <slot name="icon">
506
+ <slot name="enter">${zE}</slot>
507
+ <slot name="exit">${QE}</slot>
508
+ </slot>
509
+ `;var Im=n=>{let r=n.mediaIsFullscreen?yt.EXIT_FULLSCREEN():yt.ENTER_FULLSCREEN();n.setAttribute("aria-label",r)},Jd=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_FULLSCREEN,F.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Rm,...r})}connectedCallback(){Im(this),super.connectedCallback()}attributeChangedCallback(r,l,m){r===F.MEDIA_IS_FULLSCREEN&&Im(this),super.attributeChangedCallback(r,l,m)}get mediaFullscreenUnavailable(){return Ht(this,F.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(r){Yt(this,F.MEDIA_FULLSCREEN_UNAVAILABLE,r)}get mediaIsFullscreen(){return mt(this,F.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(r){bt(this,F.MEDIA_IS_FULLSCREEN,r)}handleClick(){let r=this.mediaIsFullscreen?Ie.MEDIA_EXIT_FULLSCREEN_REQUEST:Ie.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-fullscreen-button")||q.customElements.define("media-fullscreen-button",Jd);var{MEDIA_TIME_IS_LIVE:xl,MEDIA_PAUSED:Ps}=F,{MEDIA_SEEK_TO_LIVE_REQUEST:XE,MEDIA_PLAY_REQUEST:ZE}=Ie,JE='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>',Dm=ae.createElement("template");Dm.innerHTML=`
494
510
  <style>
495
511
 
496
512
  slot[name=indicator] > *,
@@ -501,97 +517,94 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
501
517
  color: var(--media-live-button-icon-color, rgb(140, 140, 140));
502
518
  }
503
519
 
504
- :host([${vn}]:not([${Ma}])) slot[name=indicator] > *,
505
- :host([${vn}]:not([${Ma}])) ::slotted([slot=indicator]) {
506
- fill: var(--media-live-indicator-color, rgb(255, 0, 0));
507
- color: var(--media-live-indicator-color, rgb(255, 0, 0));
520
+ :host([${xl}]:not([${Ps}])) slot[name=indicator] > *,
521
+ :host([${xl}]:not([${Ps}])) ::slotted([slot=indicator]) {
522
+ fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));
523
+ color: var(--media-live-button-indicator-color, rgb(255, 0, 0));
508
524
  }
509
525
 
510
- :host([${vn}]:not([${Ma}])) {
526
+ :host([${xl}]:not([${Ps}])) {
511
527
  cursor: not-allowed;
512
528
  }
513
529
 
514
530
  </style>
515
531
 
516
- <slot name="indicator">${Wy}</slot>
532
+ <slot name="indicator">${JE}</slot>
517
533
 
518
534
  <slot name="spacer">&nbsp;</slot><slot name="text">LIVE</slot>
519
- `;var $u=class extends Et{static get observedAttributes(){return[...super.observedAttributes,Ma,vn]}constructor(a={}){super({slotTemplate:gm,...a}),this.setAttribute("aria-label",ct.SEEK_LIVE())}attributeChangedCallback(a,l,m){super.attributeChangedCallback(a,l,m),this.hasAttribute(Ma)||!this.hasAttribute(vn)?(this.setAttribute("aria-label",ct.SEEK_LIVE()),this.removeAttribute("aria-disabled")):(this.setAttribute("aria-label",ct.PLAYING_LIVE()),this.setAttribute("aria-disabled","true"))}handleClick(){!this.hasAttribute(Ma)&&this.hasAttribute(vn)||(this.dispatchEvent(new W.CustomEvent(Vy,{composed:!0,bubbles:!0})),this.hasAttribute(Ma)&&this.dispatchEvent(new W.CustomEvent(Ky,{composed:!0,bubbles:!0})))}};W.customElements.get("media-live-button")||W.customElements.define("media-live-button",$u);var qy=`<svg aria-hidden="true" viewBox="0 0 24 24">
535
+ `;var ec=class extends pt{static get observedAttributes(){return[...super.observedAttributes,Ps,xl]}constructor(r={}){super({slotTemplate:Dm,...r}),this.setAttribute("aria-label",yt.SEEK_LIVE())}attributeChangedCallback(r,l,m){super.attributeChangedCallback(r,l,m),this.mediaPaused||!this.mediaTimeIsLive?(this.setAttribute("aria-label",yt.SEEK_LIVE()),this.removeAttribute("aria-disabled")):(this.setAttribute("aria-label",yt.PLAYING_LIVE()),this.setAttribute("aria-disabled","true"))}get mediaPaused(){return mt(this,F.MEDIA_PAUSED)}set mediaPaused(r){bt(this,F.MEDIA_PAUSED,r)}get mediaTimeIsLive(){return mt(this,F.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(r){bt(this,F.MEDIA_TIME_IS_LIVE,r)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new q.CustomEvent(XE,{composed:!0,bubbles:!0})),this.hasAttribute(Ps)&&this.dispatchEvent(new q.CustomEvent(ZE,{composed:!0,bubbles:!0})))}};q.customElements.get("media-live-button")||q.customElements.define("media-live-button",ec);var{MEDIA_VOLUME_LEVEL:Os}=F,ey=`<svg aria-hidden="true" viewBox="0 0 24 24">
520
536
  <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/>
521
- </svg>`,ym=`<svg aria-hidden="true" viewBox="0 0 24 24">
537
+ </svg>`,Cm=`<svg aria-hidden="true" viewBox="0 0 24 24">
522
538
  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/>
523
- </svg>`,Yy=`<svg aria-hidden="true" viewBox="0 0 24 24">
539
+ </svg>`,ty=`<svg aria-hidden="true" viewBox="0 0 24 24">
524
540
  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/>
525
- </svg>`,bm=ie.createElement("template");bm.innerHTML=`
541
+ </svg>`,xm=ae.createElement("template");xm.innerHTML=`
526
542
  <style>
527
543
 
528
- :host(:not([${U.MEDIA_VOLUME_LEVEL}])) slot:not([name=high]) > *,
529
- :host(:not([${U.MEDIA_VOLUME_LEVEL}])) ::slotted(:not([slot=high])),
530
- :host([${U.MEDIA_VOLUME_LEVEL}=high]) slot:not([name=high]) > *,
531
- :host([${U.MEDIA_VOLUME_LEVEL}=high]) ::slotted(:not([slot=high])) {
544
+ :host(:not([${Os}])) slot:not([name=high]):not([name=icon]),
545
+ :host([${Os}=high]) slot:not([name=high]):not([name=icon]) {
532
546
  display: none !important;
533
547
  }
534
548
 
535
- :host([${U.MEDIA_VOLUME_LEVEL}=off]) slot:not([name=off]) > *,
536
- :host([${U.MEDIA_VOLUME_LEVEL}=off]) ::slotted(:not([slot=off])) {
549
+ :host([${Os}=off]) slot:not([name=off]):not([name=icon]) {
537
550
  display: none !important;
538
551
  }
539
552
 
540
- :host([${U.MEDIA_VOLUME_LEVEL}=low]) slot:not([name=low]) > *,
541
- :host([${U.MEDIA_VOLUME_LEVEL}=low]) ::slotted(:not([slot=low])) {
553
+ :host([${Os}=low]) slot:not([name=low]):not([name=icon]) {
542
554
  display: none !important;
543
555
  }
544
556
 
545
- :host([${U.MEDIA_VOLUME_LEVEL}=medium]) slot:not([name=medium]) > *,
546
- :host([${U.MEDIA_VOLUME_LEVEL}=medium]) ::slotted(:not([slot=medium])) {
557
+ :host([${Os}=medium]) slot:not([name=medium]):not([name=icon]) {
547
558
  display: none !important;
548
559
  }
549
560
  </style>
550
561
 
551
- <slot name="off">${qy}</slot>
552
- <slot name="low">${ym}</slot>
553
- <slot name="medium">${ym}</slot>
554
- <slot name="high">${Yy}</slot>
555
- `;var Em=n=>{let l=n.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ct.UNMUTE():ct.MUTE();n.setAttribute("aria-label",l)},ju=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_VOLUME_LEVEL]}constructor(a={}){super({slotTemplate:bm,...a})}connectedCallback(){Em(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_VOLUME_LEVEL&&Em(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ve.MEDIA_UNMUTE_REQUEST:ve.MEDIA_MUTE_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-mute-button")||W.customElements.define("media-mute-button",ju);var _m=`<svg aria-hidden="true" viewBox="0 0 28 24">
562
+ <slot name="icon">
563
+ <slot name="off">${ey}</slot>
564
+ <slot name="low">${Cm}</slot>
565
+ <slot name="medium">${Cm}</slot>
566
+ <slot name="high">${ty}</slot>
567
+ </slot>
568
+ `;var Mm=n=>{let l=n.mediaVolumeLevel==="off"?yt.UNMUTE():yt.MUTE();n.setAttribute("aria-label",l)},tc=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME_LEVEL]}constructor(r={}){super({slotTemplate:xm,...r})}connectedCallback(){Mm(this),super.connectedCallback()}attributeChangedCallback(r,l,m){r===F.MEDIA_VOLUME_LEVEL&&Mm(this),super.attributeChangedCallback(r,l,m)}get mediaVolumeLevel(){return Ht(this,F.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(r){Yt(this,F.MEDIA_VOLUME_LEVEL,r)}handleClick(){let r=this.mediaVolumeLevel==="off"?Ie.MEDIA_UNMUTE_REQUEST:Ie.MEDIA_MUTE_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-mute-button")||q.customElements.define("media-mute-button",tc);var Pm=`<svg aria-hidden="true" viewBox="0 0 28 24">
556
569
  <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/>
557
- </svg>`,Am=ie.createElement("template");Am.innerHTML=`
570
+ </svg>`,Nm=ae.createElement("template");Nm.innerHTML=`
558
571
  <style>
559
- :host([${U.MEDIA_IS_PIP}]) slot:not([name=exit]) > *,
560
- :host([${U.MEDIA_IS_PIP}]) ::slotted(:not([slot=exit])) {
572
+ :host([${F.MEDIA_IS_PIP}]) slot:not([name=exit]):not([name=icon]) {
561
573
  display: none !important;
562
574
  }
563
575
 
564
576
 
565
- :host(:not([${U.MEDIA_IS_PIP}])) slot:not([name=enter]) > *,
566
- :host(:not([${U.MEDIA_IS_PIP}])) ::slotted(:not([slot=enter])) {
577
+ :host(:not([${F.MEDIA_IS_PIP}])) slot:not([name=enter]):not([name=icon]) {
567
578
  display: none !important;
568
579
  }
569
580
  </style>
570
581
 
571
- <slot name="enter">${_m}</slot>
572
- <slot name="exit">${_m}</slot>
573
- `;var Tm=n=>{let l=n.getAttribute(U.MEDIA_IS_PIP)!=null?ct.EXIT_PIP():ct.ENTER_PIP();n.setAttribute("aria-label",l)},zu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_PIP,U.MEDIA_PIP_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Am,...a})}connectedCallback(){Tm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_PIP&&Tm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_PIP)!=null?ve.MEDIA_EXIT_PIP_REQUEST:ve.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-pip-button")||W.customElements.define("media-pip-button",zu);var $y=`<svg aria-hidden="true" viewBox="0 0 24 24">
582
+ <slot name="icon">
583
+ <slot name="enter">${Pm}</slot>
584
+ <slot name="exit">${Pm}</slot>
585
+ </slot>
586
+ `;var Om=n=>{let r=n.mediaIsPip?yt.EXIT_PIP():yt.ENTER_PIP();n.setAttribute("aria-label",r)},ic=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_PIP,F.MEDIA_PIP_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Nm,...r})}connectedCallback(){Om(this),super.connectedCallback()}attributeChangedCallback(r,l,m){r===F.MEDIA_IS_PIP&&Om(this),super.attributeChangedCallback(r,l,m)}get mediaPipUnavailable(){return Ht(this,F.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(r){Yt(this,F.MEDIA_PIP_UNAVAILABLE,r)}get mediaIsPip(){return mt(this,F.MEDIA_IS_PIP)}set mediaIsPip(r){bt(this,F.MEDIA_IS_PIP,r)}handleClick(){let r=this.mediaIsPip?Ie.MEDIA_EXIT_PIP_REQUEST:Ie.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-pip-button")||q.customElements.define("media-pip-button",ic);var iy=`<svg aria-hidden="true" viewBox="0 0 24 24">
574
587
  <path d="m6 21 15-9L6 3v18Z"/>
575
- </svg>`,jy=`<svg aria-hidden="true" viewBox="0 0 24 24">
588
+ </svg>`,ry=`<svg aria-hidden="true" viewBox="0 0 24 24">
576
589
  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
577
- </svg>`,km=ie.createElement("template");km.innerHTML=`
590
+ </svg>`,Um=ae.createElement("template");Um.innerHTML=`
578
591
  <style>
579
- :host([${U.MEDIA_PAUSED}]) slot[name=pause] > *,
580
- :host([${U.MEDIA_PAUSED}]) ::slotted([slot=pause]) {
592
+ :host([${F.MEDIA_PAUSED}]) slot[name=pause] {
581
593
  display: none !important;
582
594
  }
583
595
 
584
- :host(:not([${U.MEDIA_PAUSED}])) slot[name=play] > *,
585
- :host(:not([${U.MEDIA_PAUSED}])) ::slotted([slot=play]) {
596
+ :host(:not([${F.MEDIA_PAUSED}])) slot[name=play] {
586
597
  display: none !important;
587
598
  }
588
599
  </style>
589
600
 
590
- <slot name="play">${$y}</slot>
591
- <slot name="pause">${jy}</slot>
592
- `;var Sm=n=>{let l=n.getAttribute(U.MEDIA_PAUSED)!=null?ct.PLAY():ct.PAUSE();n.setAttribute("aria-label",l)},Qu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PAUSED]}constructor(a={}){super({slotTemplate:km,...a})}connectedCallback(){Sm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_PAUSED&&Sm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-play-button")||W.customElements.define("media-play-button",Qu);var wm=[1,1.25,1.5,1.75,2],Sl=1,Lm=ie.createElement("template");Lm.innerHTML=`
601
+ <slot name="icon">
602
+ <slot name="play">${iy}</slot>
603
+ <slot name="pause">${ry}</slot>
604
+ </slot>
605
+ `;var Fm=n=>{let r=n.mediaPaused?yt.PLAY():yt.PAUSE();n.setAttribute("aria-label",r)},rc=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED,F.MEDIA_ENDED]}constructor(r={}){super({slotTemplate:Um,...r})}connectedCallback(){Fm(this),super.connectedCallback()}attributeChangedCallback(r,l,m){r===F.MEDIA_PAUSED&&Fm(this),super.attributeChangedCallback(r,l,m)}get mediaPaused(){return mt(this,F.MEDIA_PAUSED)}set mediaPaused(r){bt(this,F.MEDIA_PAUSED,r)}handleClick(){let r=this.mediaPaused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-play-button")||q.customElements.define("media-play-button",rc);var ay=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Pl=(n,r,l)=>(ay(n,r,"read from private field"),l?l.call(n):r.get(n)),ny=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Cn,ac={RATES:"rates"},sy=[1,1.25,1.5,1.75,2],Ol=1,Bm=ae.createElement("template");Bm.innerHTML=`
593
606
  <span id="container"></span>
594
- `;var Xu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PLAYBACK_RATE,"rates"]}constructor(a={}){super({slotTemplate:Lm,...a}),this._rates=wm,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${Sl}x`}attributeChangedCallback(a,l,m){if(a==="rates"){let v=(m!=null?m:"").trim().split(/\s*,?\s+/).map(E=>Number(E)).filter(E=>!Number.isNaN(E)).sort((E,I)=>E-I);this._rates=v.length?v:wm;return}if(a===U.MEDIA_PLAYBACK_RATE){let v=m?+m:Number.NaN,E=Number.isNaN(v)?Sl:v;this.container.innerHTML=`${E}x`,this.setAttribute("aria-label",Jt.PLAYBACK_RATE({playbackRate:E}));return}super.attributeChangedCallback(a,l,m)}handleClick(){var a,l;let m=+this.getAttribute(U.MEDIA_PLAYBACK_RATE)||Sl,v=(l=(a=this._rates.find(I=>I>m))!=null?a:this._rates[0])!=null?l:Sl,E=new W.CustomEvent(ve.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-playback-rate-button")||W.customElements.define("media-playback-rate-button",Xu);var Im=ie.createElement("template");Im.innerHTML=`
607
+ `;var nc=class extends pt{constructor(r={}){super({slotTemplate:Bm,...r}),ny(this,Cn,new Sn(this,ac.RATES,{defaultValue:sy})),this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${Ol}x`}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PLAYBACK_RATE,ac.RATES]}attributeChangedCallback(r,l,m){if(r===ac.RATES&&(Pl(this,Cn).value=m),r===F.MEDIA_PLAYBACK_RATE){let v=m?+m:Number.NaN,y=Number.isNaN(v)?Ol:v;this.container.innerHTML=`${y}x`,this.setAttribute("aria-label",si.PLAYBACK_RATE({playbackRate:y}));return}super.attributeChangedCallback(r,l,m)}get rates(){return Pl(this,Cn)}set rates(r){r?Array.isArray(r)&&(Pl(this,Cn).value=r.join(" ")):Pl(this,Cn).value=""}get mediaPlaybackRate(){var r;return(r=St(this,F.MEDIA_PLAYBACK_RATE))!=null?r:Ol}set mediaPlaybackRate(r){Lt(this,F.MEDIA_PLAYBACK_RATE,r)}handleClick(){var r,l;let m=Array.from(this.rates.values(),I=>+I).sort(),v=(l=(r=m.find(I=>I>this.mediaPlaybackRate))!=null?r:m[0])!=null?l:Ol,y=new q.CustomEvent(Ie.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(y)}};Cn=new WeakMap;q.customElements.get("media-playback-rate-button")||q.customElements.define("media-playback-rate-button",nc);var hr={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"},Hm=ae.createElement("template");Hm.innerHTML=`
595
608
  <style>
596
609
  :host {
597
610
  pointer-events: none;
@@ -605,17 +618,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
605
618
  min-width: 100%;
606
619
  min-height: 100%;
607
620
  background-repeat: no-repeat;
608
- background-position: var(--media-background-position, var(--media-object-position, center));
609
- background-size: var(--media-background-size, var(--media-object-fit, contain));
621
+ background-position: var(--media-poster-image-background-position, var(--media-object-position, center));
622
+ background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));
610
623
  object-fit: var(--media-object-fit, contain);
611
624
  object-position: var(--media-object-position, center);
612
625
  }
613
626
  </style>
614
627
 
615
628
  <img aria-hidden="true" id="image"/>
616
- `;var zy=n=>{n.style.removeProperty("background-image")},Qy=(n,a)=>{n.style["background-image"]=`url('${a}')`},Zu=class extends W.HTMLElement{static get observedAttributes(){return["placeholder-src","src"]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Im.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(a,l,m){a==="src"&&(m==null?this.image.removeAttribute("src"):this.image.setAttribute("src",m)),a==="placeholder-src"&&(m==null?zy(this.image):Qy(this.image,m))}};W.customElements.get("media-poster-image")||W.customElements.define("media-poster-image",Zu);var Ju="30",Xy=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">${Ju}</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg>`,Cm=ie.createElement("template");Cm.innerHTML=`
617
- <slot name="backward">${Xy}</slot>
618
- `;var Zy=0,Rm=n=>{let a=Math.abs(+n.getAttribute("seek-offset")),l=ct.SEEK_BACK_N_SECS({seekOffset:a});n.setAttribute("aria-label",l)},Dm=n=>{let a=Zo(n,"backward"),l=n.getAttribute("seek-offset");Xo(a,l)},ec=class extends Et{static get observedAttributes(){return[...super.observedAttributes,"seek-offset",U.MEDIA_CURRENT_TIME]}constructor(a={}){super({slotTemplate:Cm,...a})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Ju),Rm(this),Dm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a==="seek-offset"&&(m==null&&this.setAttribute("seek-offset",Ju),Dm(this),Rm(this)),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME),l=+this.getAttribute("seek-offset"),m=a&&!Number.isNaN(+a)?+a:Zy,v=Math.max(m-l,0),E=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-seek-backward-button")||W.customElements.define("media-seek-backward-button",ec);var xm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Mm=(n,a,l)=>(xm(n,a,"read from private field"),l?l.call(n):a.get(n)),Jy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},eE=(n,a,l,m)=>(xm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Ls,tc=class extends Yr{constructor(){super(),Jy(this,Ls,void 0),eE(this,Ls,this.shadowRoot.querySelector("slot")),Mm(this,Ls).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PREVIEW_TIME]}attributeChangedCallback(a,l,m){a===U.MEDIA_PREVIEW_TIME&&m!=null&&(Mm(this,Ls).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};Ls=new WeakMap;W.customElements.get("media-preview-time-display")||W.customElements.define("media-preview-time-display",tc);var Pm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},kl=(n,a,l)=>(Pm(n,a,"read from private field"),l?l.call(n):a.get(n)),tE=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},wl=(n,a,l,m)=>(Pm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),sr,Om=ie.createElement("template");Om.innerHTML=`
629
+ `;var oy=n=>{n.style.removeProperty("background-image")},ly=(n,r)=>{n.style["background-image"]=`url('${r}')`},sc=class extends q.HTMLElement{static get observedAttributes(){return[hr.PLACEHOLDER_SRC,hr.SRC]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Hm.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(r,l,m){r===hr.SRC&&(m==null?this.image.removeAttribute(hr.SRC):this.image.setAttribute(hr.SRC,m)),r===hr.PLACEHOLDER_SRC&&(m==null?oy(this.image):ly(this.image,m))}get placeholderSrc(){return Ht(this,hr.PLACEHOLDER_SRC)}set placeholderSrc(r){Yt(this,hr.SRC,r)}get src(){return Ht(this,hr.SRC)}set src(r){Yt(this,hr.SRC,r)}};q.customElements.get("media-poster-image")||q.customElements.define("media-poster-image",sc);var Nl={SEEK_OFFSET:"seekoffset"},Gm=30,uy=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">${Gm}</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg>`,Vm=ae.createElement("template");Vm.innerHTML=`
630
+ <slot name="backward">${uy}</slot>
631
+ `;var dy=0,oc=class extends pt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,Nl.SEEK_OFFSET]}constructor(r={}){super({slotTemplate:Vm,...r})}connectedCallback(){Rn(this),Dn(this,"backward"),super.connectedCallback()}attributeChangedCallback(r,l,m){r===Nl.SEEK_OFFSET&&(Dn(this,"backward"),Rn(this)),super.attributeChangedCallback(r,l,m)}get seekOffset(){var r;return(r=St(this,Nl.SEEK_OFFSET))!=null?r:Gm}set seekOffset(r){Lt(this,Nl.SEEK_OFFSET,r)}get mediaCurrentTime(){var r;return(r=St(this,F.MEDIA_CURRENT_TIME))!=null?r:dy}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}handleClick(){let r=Math.max(this.mediaCurrentTime-this.seekOffset,0),l=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(l)}};q.customElements.get("media-seek-backward-button")||q.customElements.define("media-seek-backward-button",oc);var Wm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Km=(n,r,l)=>(Wm(n,r,"read from private field"),l?l.call(n):r.get(n)),cy=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},hy=(n,r,l,m)=>(Wm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Ns,lc=class extends xr{constructor(){super(),cy(this,Ns,void 0),hy(this,Ns,this.shadowRoot.querySelector("slot")),Km(this,Ns).textContent=or(0)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PREVIEW_TIME]}attributeChangedCallback(r,l,m){r===F.MEDIA_PREVIEW_TIME&&m!=null&&(Km(this,Ns).textContent=or(m)),super.attributeChangedCallback(r,l,m)}get mediaPreviewTime(){return St(this,F.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(r){Lt(this,F.MEDIA_PREVIEW_TIME,r)}};Ns=new WeakMap;q.customElements.get("media-preview-time-display")||q.customElements.define("media-preview-time-display",lc);var qm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Fl=(n,r,l)=>(qm(n,r,"read from private field"),l?l.call(n):r.get(n)),fy=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Ul=(n,r,l,m)=>(qm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),fr,Ym=ae.createElement("template");Ym.innerHTML=`
619
632
  <style>
620
633
  :host {
621
634
  box-sizing: border-box;
@@ -628,8 +641,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
628
641
  position: relative;
629
642
  }
630
643
  </style>
631
- <img crossorigin loading="eager" decoding="async" />
632
- `;var ic=class extends W.HTMLElement{constructor(){super(),tE(this,sr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Om.content.cloneNode(!0)))}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,"time",U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_COORDS]}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(wl(this,sr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=kl(this,sr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=kl(this,sr))==null?void 0:a.unassociateElement)==null||l.call(a,this),wl(this,sr,null)}attributeChangedCallback(a,l,m){var v,E,I,M,B;["time",U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_COORDS].includes(a)&&this.update(),a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=kl(this,sr))==null?void 0:v.unassociateElement)==null||E.call(v,this),wl(this,sr,null)),m&&(wl(this,sr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=kl(this,sr))==null?void 0:M.associateElement)==null||B.call(M,this)))}update(){let a=this.getAttribute(U.MEDIA_PREVIEW_COORDS),l=this.getAttribute(U.MEDIA_PREVIEW_IMAGE);if(!(a&&l))return;let[m,v,E,I]=a.split(/\s+/).map(oe=>+oe),M=l.split("#")[0],B=getComputedStyle(this),{maxWidth:F,maxHeight:Q,minWidth:re,minHeight:te}=B,se=Math.min(parseInt(F)/E,parseInt(Q)/I),pe=Math.max(parseInt(re)/E,parseInt(te)/I),Ae=se<1,ke=Ae?se:pe>1?pe:1,{style:we}=Ct(this.shadowRoot,":host"),nt=Ct(this.shadowRoot,"img").style,Ue=this.shadowRoot.querySelector("img"),st=Ae?"min":"max";we.setProperty(`${st}-width`,"initial","important"),we.setProperty(`${st}-height`,"initial","important"),we.width=`${E*ke}px`,we.height=`${I*ke}px`;let dt=()=>{nt.width=`${this.imgWidth*ke}px`,nt.height=`${this.imgHeight*ke}px`,nt.display="block"};Ue.src!==M&&(Ue.onload=()=>{this.imgWidth=Ue.naturalWidth,this.imgHeight=Ue.naturalHeight,dt()},Ue.src=M,dt()),dt(),nt.transform=`translate(-${m*ke}px, -${v*ke}px)`}};sr=new WeakMap;W.customElements.get("media-preview-thumbnail")||W.customElements.define("media-preview-thumbnail",ic);var dc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Kt=(n,a,l)=>(dc(n,a,"read from private field"),l?l.call(n):a.get(n)),gi=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},$r=(n,a,l,m)=>(dc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Is=(n,a,l)=>(dc(n,a,"access private method"),l),Rs,Ll,Ds,Cl,Ml,Il,ac,Rl,gn,Cs,nc,xl,Pl,Dl,sc,oc,Nm,iE="video not loaded, unknown time.",rc=n=>{let a=n.range,l=Ia(+a.value),m=Ia(+a.max),v=l&&m?`${l} of ${m}`:iE;a.setAttribute("aria-valuetext",v)},Fm=ie.createElement("template");Fm.innerHTML=`
644
+ <img crossorigin loading="eager" decoding="async">
645
+ `;var uc=class extends q.HTMLElement{constructor(){super(),fy(this,fr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ym.content.cloneNode(!0)))}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS]}connectedCallback(){var r,l,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Ul(this,fr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=Fl(this,fr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var r,l;(l=(r=Fl(this,fr))==null?void 0:r.unassociateElement)==null||l.call(r,this),Ul(this,fr,null)}attributeChangedCallback(r,l,m){var v,y,I,M,B;[F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS].includes(r)&&this.update(),r===Ne.MEDIA_CONTROLLER&&(l&&((y=(v=Fl(this,fr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Ul(this,fr,null)),m&&(Ul(this,fr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Fl(this,fr))==null?void 0:M.associateElement)==null||B.call(M,this)))}get mediaPreviewImage(){return Ht(this,F.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(r){Yt(this,F.MEDIA_PREVIEW_IMAGE,r)}get mediaPreviewCoords(){let r=this.getAttribute(F.MEDIA_PREVIEW_COORDS);if(!!r)return r.split(/\s+/).map(l=>+l)}set mediaPreviewCoords(r){if(!r){this.removeAttribute(F.MEDIA_PREVIEW_COORDS);return}this.setAttribute(F.MEDIA_PREVIEW_COORDS,r.join(" "))}update(){let r=this.mediaPreviewCoords,l=this.mediaPreviewImage;if(!(r&&l))return;let[m,v,y,I]=r,M=l.split("#")[0],B=getComputedStyle(this),{maxWidth:H,maxHeight:z,minWidth:J,minHeight:ee}=B,le=Math.min(parseInt(H)/y,parseInt(z)/I),me=Math.max(parseInt(J)/y,parseInt(ee)/I),_e=le<1,ge=_e?le:me>1?me:1,{style:ye}=ft(this.shadowRoot,":host"),Ee=ft(this.shadowRoot,"img").style,de=this.shadowRoot.querySelector("img"),Be=_e?"min":"max";ye.setProperty(`${Be}-width`,"initial","important"),ye.setProperty(`${Be}-height`,"initial","important"),ye.width=`${y*ge}px`,ye.height=`${I*ge}px`;let Ge=()=>{Ee.width=`${this.imgWidth*ge}px`,Ee.height=`${this.imgHeight*ge}px`,Ee.display="block"};de.src!==M&&(de.onload=()=>{this.imgWidth=de.naturalWidth,this.imgHeight=de.naturalHeight,Ge()},de.src=M,Ge()),Ge(),Ee.transform=`translate(-${m*ge}px, -${v*ge}px)`}};fr=new WeakMap;q.customElements.get("media-preview-thumbnail")||q.customElements.define("media-preview-thumbnail",uc);var Ec=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Dt=(n,r,l)=>(Ec(n,r,"read from private field"),l?l.call(n):r.get(n)),oi=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},aa=(n,r,l,m)=>(Ec(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Fs=(n,r,l)=>(Ec(n,r,"access private method"),l),Us,Bl,Bs,Wl,ql,Hl,cc,hc,$m,Gl,fc,Vl,Mn,Hs,mc,Yl,$l,Kl,pc,vc,jm,my="video not loaded, unknown time.",dc=n=>{let r=n.range,l=Na(+r.value),m=Na(+r.max),v=l&&m?`${l} of ${m}`:my;r.setAttribute("aria-valuetext",v)},zm=ae.createElement("template");zm.innerHTML=`
633
646
  <style>
634
647
  :host {
635
648
  --media-preview-border-radius: 3px;
@@ -665,8 +678,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
665
678
  opacity: 0;
666
679
  }
667
680
 
668
- :host([${U.MEDIA_PREVIEW_IMAGE}]:hover) [part~="preview-box"],
669
- :host([${U.MEDIA_PREVIEW_TIME}]:hover) [part~="preview-box"] {
681
+ :host([${F.MEDIA_PREVIEW_IMAGE}]:hover) [part~="preview-box"],
682
+ :host([${F.MEDIA_PREVIEW_TIME}]:hover) [part~="preview-box"] {
670
683
  transition-duration: var(--media-preview-transition-duration-in, .5s);
671
684
  transition-delay: var(--media-preview-transition-delay-in, .25s);
672
685
  visibility: visible;
@@ -679,7 +692,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
679
692
 
680
693
  transition: visibility 0s .25s;
681
694
  transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
682
- background: var(--media-preview-time-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))));
695
+ background: var(--media-preview-thumbnail-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))));
683
696
  box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
684
697
  max-width: var(--media-preview-thumbnail-max-width, 180px);
685
698
  max-height: var(--media-preview-thumbnail-max-height, 160px);
@@ -690,8 +703,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
690
703
  var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
691
704
  }
692
705
 
693
- :host([${U.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
694
- :host([${U.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) {
706
+ :host([${F.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
707
+ :host([${F.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) {
695
708
  transition-delay: var(--media-preview-transition-delay-in, .25s);
696
709
  visibility: visible;
697
710
  }
@@ -711,15 +724,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
711
724
  text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
712
725
  }
713
726
 
714
- :host([${U.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
715
- :host([${U.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
727
+ :host([${F.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
728
+ :host([${F.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
716
729
  transition-delay: var(--media-preview-transition-delay-in, .25s);
717
730
  min-width: 100%;
718
731
  border-radius: var(--media-preview-time-border-radius,
719
732
  0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
720
733
  }
721
734
 
722
- :host([${U.MEDIA_PREVIEW_TIME}]:hover) {
735
+ :host([${F.MEDIA_PREVIEW_TIME}]:hover) {
723
736
  --media-time-range-hover-display: block;
724
737
  }
725
738
  </style>
@@ -734,7 +747,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
734
747
 
735
748
  </slot>
736
749
  </div>
737
- `;var lc=class extends Ss{constructor(){super(),gi(this,Il),gi(this,Dl),gi(this,oc),gi(this,Rs,void 0),gi(this,Ll,void 0),gi(this,Ds,void 0),gi(this,Cl,void 0),gi(this,Ml,void 0),gi(this,Rl,l=>{if([...Kt(this,Rs)].some(Q=>l.composedPath().includes(Q)))return;this.updatePointerBar(l);let m=+this.getAttribute(U.MEDIA_DURATION);if(!m)return;let v=this.range.getBoundingClientRect(),E=(l.clientX-v.left)/v.width;E=Math.max(0,Math.min(1,E));let I=Is(this,Il,ac).call(this,Kt(this,Ll),E),{style:M}=Ct(this.shadowRoot,"#preview-rail");M.transform=`translateX(${I})`;let B=E*m,F=new W.CustomEvent(ve.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:B});this.dispatchEvent(F)}),gi(this,gn,!1),gi(this,Cs,l=>{(!l.composedPath().includes(this)||[...Kt(this,Rs)].some(m=>l.composedPath().includes(m)))&&(W.removeEventListener("pointermove",Kt(this,Cs)),$r(this,gn,!1),Kt(this,xl).call(this))}),gi(this,nc,()=>{W.addEventListener("pointermove",Kt(this,Rl),!1)}),gi(this,xl,()=>{W.removeEventListener("pointermove",Kt(this,Rl));let l=new W.CustomEvent(ve.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(l)}),gi(this,Pl,()=>{let l=this.getAttribute(U.MEDIA_DURATION);!Kt(this,gn)&&l&&($r(this,gn,!0),Kt(this,nc).call(this),W.addEventListener("pointermove",Kt(this,Cs),!1))}),this.container.appendChild(Fm.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let m=this.range.value,v=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m});this.dispatchEvent(v)}),this._refreshBar=()=>{let l=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+l*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},$r(this,Rs,this.shadowRoot.querySelectorAll('[part~="box"]')),$r(this,Ll,this.shadowRoot.querySelector('[part~="preview-box"]')),$r(this,Ds,this.shadowRoot.querySelector('[part~="current-box"]'));let a=getComputedStyle(this);$r(this,Cl,parseInt(a.getPropertyValue("--media-box-padding-left"))),$r(this,Ml,parseInt(a.getPropertyValue("--media-box-padding-right"))),Is(this,Dl,sc).call(this)}static get observedAttributes(){return[...super.observedAttributes,"thumbnails","disabled",U.MEDIA_PAUSED,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,U.MEDIA_CURRENT_TIME,U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_TIME,U.MEDIA_BUFFERED,U.MEDIA_PLAYBACK_RATE,U.MEDIA_LOADING]}connectedCallback(){this.range.setAttribute("aria-label",Jt.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(a,l,m){var v,E,I,M,B;(a===U.MEDIA_CURRENT_TIME||a===U.MEDIA_PAUSED||a===U.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,rc(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),a===U.MEDIA_DURATION&&(this.range.max=(E=(v=this.mediaSeekableEnd)!=null?v:this.mediaDuration)!=null?E:1e3,rc(this),this.updateBar(),this.updateCurrentBox()),a===U.MEDIA_SEEKABLE&&(this.range.min=(I=this.mediaSeekableStart)!=null?I:0,this.range.max=(B=(M=this.mediaSeekableEnd)!=null?M:this.mediaDuration)!=null?B:1e3,rc(this),this.updateBar()),a===U.MEDIA_BUFFERED&&this.updateBar(),a==="disabled"&&(m==null?Is(this,Dl,sc).call(this):Is(this,oc,Nm).call(this)),super.attributeChangedCallback(a,l,m)}get mediaPaused(){return this.hasAttribute(U.MEDIA_PAUSED)}get mediaLoading(){return this.hasAttribute(U.MEDIA_LOADING)}get mediaDuration(){let a=this.getAttribute(U.MEDIA_DURATION);return a!=null?+a:void 0}get mediaCurrentTime(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME);return a!=null?+a:void 0}get mediaPlaybackRate(){let a=this.getAttribute(U.MEDIA_PLAYBACK_RATE);return a!=null?+a:1}get mediaBuffered(){let a=this.getAttribute(U.MEDIA_BUFFERED);return a?a.split(" ").map(l=>l.split(":").map(m=>+m)):[]}get mediaSeekable(){let a=this.getAttribute(U.MEDIA_SEEKABLE);if(!!a)return a.split(":").map(l=>+l)}get mediaSeekableEnd(){var a;let[,l]=(a=this.mediaSeekable)!=null?a:[];return l}get mediaSeekableStart(){var a;let[l]=(a=this.mediaSeekable)!=null?a:[];return l}getBarColors(){var a;let l=super.getBarColors(),{range:m}=this,v=m.max-m.min,E=this.mediaBuffered;if(!E.length||!Number.isFinite(v)||v<=0)return l;let I=this.mediaCurrentTime,[,M=m.min]=(a=E.find(([Q,re])=>Q<=I&&I<=re))!=null?a:[],F=(M-m.min)/v*100;return l.splice(1,0,["var(--media-time-buffered-color, rgb(255 255 255 / .4))",F]),l}updateCurrentBox(){if(!Kt(this,Ds).assignedElements().length)return;let a=this.range.value/(this.range.max-this.range.min),l=Is(this,Il,ac).call(this,Kt(this,Ds),a),{style:m}=Ct(this.shadowRoot,"#current-rail");m.transform=`translateX(${l})`}};Rs=new WeakMap;Ll=new WeakMap;Ds=new WeakMap;Cl=new WeakMap;Ml=new WeakMap;Il=new WeakSet;ac=function(n,a){var l;let m=`${a*100*100}%`,v=n.offsetWidth;if(!v)return m;let E=(l=this.getAttribute("bounds")?Ra(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?l:this,I=this.range.getBoundingClientRect(),M=E.getBoundingClientRect(),B=(Kt(this,Cl)-(I.left-M.left-v/2))/I.width*100,F=(M.right-I.left-v/2-Kt(this,Ml))/I.width*100;return Number.isNaN(B)||(m=`max(${B*100}%, ${m})`),Number.isNaN(F)||(m=`min(${m}, ${F*100}%)`),m};Rl=new WeakMap;gn=new WeakMap;Cs=new WeakMap;nc=new WeakMap;xl=new WeakMap;Pl=new WeakMap;Dl=new WeakSet;sc=function(){this.addEventListener("pointermove",Kt(this,Pl),!1)};oc=new WeakSet;Nm=function(){W.removeEventListener("pointermove",Kt(this,Cs)),this.removeEventListener("pointermove",Kt(this,Pl)),$r(this,gn,!1),Kt(this,xl).call(this)};W.customElements.get("media-time-range")||W.customElements.define("media-time-range",lc);var Um=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ol=(n,a,l)=>(Um(n,a,"read from private field"),l?l.call(n):a.get(n)),rE=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Nl=(n,a,l,m)=>(Um(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),or,Bm=ie.createElement("template"),aE=`
750
+ `;var gc=class extends Ga{constructor(){super(),oi(this,Hl),oi(this,hc),oi(this,Gl),oi(this,Kl),oi(this,vc),oi(this,Us,void 0),oi(this,Bl,void 0),oi(this,Bs,void 0),oi(this,Wl,void 0),oi(this,ql,void 0),oi(this,Vl,l=>{if([...Dt(this,Us)].some(z=>l.composedPath().includes(z)))return;this.updatePointerBar(l);let m=this.mediaDuration;if(!m)return;let v=this.range.getBoundingClientRect(),y=(l.clientX-v.left)/v.width;y=Math.max(0,Math.min(1,y));let I=Fs(this,Gl,fc).call(this,Dt(this,Bl),y),{style:M}=ft(this.shadowRoot,"#preview-rail");M.transform=`translateX(${I})`;let B=y*m,H=new q.CustomEvent(Ie.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:B});this.dispatchEvent(H)}),oi(this,Mn,!1),oi(this,Hs,l=>{(!l.composedPath().includes(this)||[...Dt(this,Us)].some(m=>l.composedPath().includes(m)))&&(q.removeEventListener("pointermove",Dt(this,Hs)),aa(this,Mn,!1),Dt(this,Yl).call(this))}),oi(this,mc,()=>{q.addEventListener("pointermove",Dt(this,Vl),!1)}),oi(this,Yl,()=>{q.removeEventListener("pointermove",Dt(this,Vl));let l=new q.CustomEvent(Ie.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(l)}),oi(this,$l,()=>{let l=this.getAttribute(F.MEDIA_DURATION);!Dt(this,Mn)&&l&&(aa(this,Mn,!0),Dt(this,mc).call(this),q.addEventListener("pointermove",Dt(this,Hs),!1))}),this.container.appendChild(zm.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let m=this.range.value,v=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m});this.dispatchEvent(v)}),this._refreshBar=()=>{let l=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+l*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},aa(this,Us,this.shadowRoot.querySelectorAll('[part~="box"]')),aa(this,Bl,this.shadowRoot.querySelector('[part~="preview-box"]')),aa(this,Bs,this.shadowRoot.querySelector('[part~="current-box"]'));let r=getComputedStyle(this);aa(this,Wl,parseInt(r.getPropertyValue("--media-box-padding-left"))),aa(this,ql,parseInt(r.getPropertyValue("--media-box-padding-right"))),Fs(this,Kl,pc).call(this)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,F.MEDIA_CURRENT_TIME,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_TIME,F.MEDIA_BUFFERED,F.MEDIA_PLAYBACK_RATE,F.MEDIA_LOADING]}connectedCallback(){this.range.setAttribute("aria-label",si.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(r,l,m){var v,y,I,M,B;(r===F.MEDIA_CURRENT_TIME||r===F.MEDIA_PAUSED||r===F.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,dc(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),r===F.MEDIA_DURATION&&(this.range.max=(y=(v=Dt(this,Hl,cc))!=null?v:this.mediaDuration)!=null?y:1e3,dc(this),this.updateBar(),this.updateCurrentBox()),r===F.MEDIA_SEEKABLE&&(this.range.min=(I=Dt(this,hc,$m))!=null?I:0,this.range.max=(B=(M=Dt(this,Hl,cc))!=null?M:this.mediaDuration)!=null?B:1e3,dc(this),this.updateBar()),r===F.MEDIA_BUFFERED&&this.updateBar(),r==="disabled"&&(m==null?Fs(this,Kl,pc).call(this):Fs(this,vc,jm).call(this)),super.attributeChangedCallback(r,l,m)}get mediaPaused(){return mt(this,F.MEDIA_PAUSED)}set mediaPaused(r){bt(this,F.MEDIA_PAUSED,r)}get mediaLoading(){return mt(this,F.MEDIA_LOADING)}set mediaLoading(r){bt(this,F.MEDIA_LOADING,r)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}get mediaCurrentTime(){return St(this,F.MEDIA_CURRENT_TIME)}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}get mediaPlaybackRate(){var r;return(r=St(this,F.MEDIA_PLAYBACK_RATE))!=null?r:1}set mediaPlaybackrate(r){Lt(this,F.MEDIA_PLAYBACK_RATE,r)}get mediaBuffered(){let r=this.getAttribute(F.MEDIA_BUFFERED);return r?r.split(" ").map(l=>l.split(":").map(m=>+m)):[]}set mediaBuffered(r){if(!r){this.removeAttribute(F.MEDIA_BUFFERED);return}let l=r.map((m,v)=>`${m}:${v}`).join(" ");this.setAttribute(F.MEDIA_BUFFERED,l)}get mediaSeekable(){let r=this.getAttribute(F.MEDIA_SEEKABLE);if(!!r)return r.split(":").map(l=>+l)}set mediaSeekable(r){if(r==null){this.removeAttribute(F.MEDIA_SEEKABLE);return}this.setAttribute(F.MEDIA_SEEKABLE,r.join(":"))}get mediaPreviewImage(){return Ht(this,F.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(r){Yt(this,F.MEDIA_PREVIEW_IMAGE,r)}get mediaPreviewTime(){return St(this,F.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(r){Lt(this,F.MEDIA_PREVIEW_TIME,r)}getBarColors(){var r;let l=super.getBarColors(),{range:m}=this,v=m.max-m.min,y=this.mediaBuffered;if(!y.length||!Number.isFinite(v)||v<=0)return l;let I=this.mediaCurrentTime,[,M=m.min]=(r=y.find(([z,J])=>z<=I&&I<=J))!=null?r:[],H=(M-m.min)/v*100;return l.splice(1,0,["var(--media-time-range-buffered-color, rgb(255 255 255 / .4))",H]),l}updateCurrentBox(){if(!Dt(this,Bs).assignedElements().length)return;let r=this.range.value/(this.range.max-this.range.min),l=Fs(this,Gl,fc).call(this,Dt(this,Bs),r),{style:m}=ft(this.shadowRoot,"#current-rail");m.transform=`translateX(${l})`}};Us=new WeakMap;Bl=new WeakMap;Bs=new WeakMap;Wl=new WeakMap;ql=new WeakMap;Hl=new WeakSet;cc=function(){var n;let[,r]=(n=this.mediaSeekable)!=null?n:[];return r};hc=new WeakSet;$m=function(){var n;let[r]=(n=this.mediaSeekable)!=null?n:[];return r};Gl=new WeakSet;fc=function(n,r){var l;let m=`${r*100*100}%`,v=n.offsetWidth;if(!v)return m;let y=(l=this.getAttribute("bounds")?Fa(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?l:this,I=this.range.getBoundingClientRect(),M=y.getBoundingClientRect(),B=(Dt(this,Wl)-(I.left-M.left-v/2))/I.width*100,H=(M.right-I.left-v/2-Dt(this,ql))/I.width*100;return Number.isNaN(B)||(m=`max(${B*100}%, ${m})`),Number.isNaN(H)||(m=`min(${m}, ${H*100}%)`),m};Vl=new WeakMap;Mn=new WeakMap;Hs=new WeakMap;mc=new WeakMap;Yl=new WeakMap;$l=new WeakMap;Kl=new WeakSet;pc=function(){this.addEventListener("pointermove",Dt(this,$l),!1)};vc=new WeakSet;jm=function(){q.removeEventListener("pointermove",Dt(this,Hs)),this.removeEventListener("pointermove",Dt(this,$l)),aa(this,Mn,!1),Dt(this,Yl).call(this)};q.customElements.get("media-time-range")||q.customElements.define("media-time-range",gc);var Xm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},xn=(n,r,l)=>(Xm(n,r,"read from private field"),l?l.call(n):r.get(n)),yc=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Pn=(n,r,l,m)=>(Xm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),mr,jl,zl,Qm={LOADING_DELAY:"loadingdelay"},Zm=500,Jm=ae.createElement("template"),py=`
738
751
  <svg aria-hidden="true" viewBox="0 0 100 100">
739
752
  <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
740
753
  <animateTransform
@@ -747,12 +760,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
747
760
  repeatCount="indefinite" />
748
761
  </path>
749
762
  </svg>
750
- `;Bm.innerHTML=`
763
+ `;Jm.innerHTML=`
751
764
  <style>
752
765
  :host {
753
766
  display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
754
767
  vertical-align: middle;
755
768
  box-sizing: border-box;
769
+ --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${Zm}ms);
756
770
  }
757
771
 
758
772
  #status {
@@ -763,30 +777,37 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
763
777
 
764
778
  :host slot[name=loading] > *,
765
779
  :host ::slotted([slot=loading]) {
766
- opacity: 1;
780
+ opacity: var(--media-loading-indicator-opacity, 0);
767
781
  transition: opacity 0.15s;
768
782
  }
769
783
 
770
- :host(:not([is-loading])) slot[name=loading] > *,
771
- :host(:not([is-loading])) ::slotted([slot=loading]) {
772
- opacity: 0;
784
+ :host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) slot[name=loading] > *,
785
+ :host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) ::slotted([slot=loading]) {
786
+ opacity: var(--media-loading-indicator-opacity, 1);
787
+ transition: opacity 0.15s var(--_loading-indicator-delay);
773
788
  }
774
789
 
775
- :host(:not([is-loading])) #status {
776
- display: none;
790
+ :host #status {
791
+ visibility: var(--media-loading-indicator-opacity, hidden);
792
+ transition: visibility 0.15s;
793
+ }
794
+
795
+ :host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) #status {
796
+ visibility: var(--media-loading-indicator-opacity, visible);
797
+ transition: visibility 0.15s var(--_loading-indicator-delay);
777
798
  }
778
799
 
779
800
  svg, img, ::slotted(svg), ::slotted(img) {
780
- width: var(--media-loading-icon-width, 100px);
781
- height: var(--media-loading-icon-height);
801
+ width: var(--media-loading-indicator-icon-width);
802
+ height: var(--media-loading-indicator-icon-height, 100px);
782
803
  fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
783
804
  vertical-align: middle;
784
805
  }
785
806
  </style>
786
807
 
787
- <slot name="loading">${aE}</slot>
788
- <div id="status" role="status" aria-live="polite">${Jt.MEDIA_LOADING()}</div>
789
- `;var nE=500,uc=class extends W.HTMLElement{constructor(){if(super(),rE(this,or,void 0),!this.shadowRoot){let a=this.attachShadow({mode:"open"}),l=Bm.content.cloneNode(!0);a.appendChild(l)}}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,U.MEDIA_PAUSED,U.MEDIA_LOADING,"loading-delay"]}attributeChangedCallback(a,l,m){var v,E,I,M,B,F;if(a===U.MEDIA_LOADING||a===U.MEDIA_PAUSED){let Q=this.getAttribute(U.MEDIA_PAUSED)!=null,re=this.getAttribute(U.MEDIA_LOADING)!=null,te=!Q&&re;if(!te)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&te){let se=+((v=this.getAttribute("loading-delay"))!=null?v:nE);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},se)}}else a===Pe.MEDIA_CONTROLLER&&(l&&((I=(E=Ol(this,or))==null?void 0:E.unassociateElement)==null||I.call(E,this),Nl(this,or,null)),m&&(Nl(this,or,(M=this.getRootNode())==null?void 0:M.getElementById(m)),(F=(B=Ol(this,or))==null?void 0:B.associateElement)==null||F.call(B,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(Nl(this,or,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ol(this,or))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),(l=(a=Ol(this,or))==null?void 0:a.unassociateElement)==null||l.call(a,this),Nl(this,or,null)}};or=new WeakMap;W.customElements.get("media-loading-indicator")||W.customElements.define("media-loading-indicator",uc);var sE=100,oE=n=>{var a;if(n.getAttribute(U.MEDIA_MUTED)!=null)return 0;let m=+((a=n.getAttribute(U.MEDIA_VOLUME))!=null?a:1);return Math.round(m*n.range.max)},lE=({value:n,max:a})=>`${Math.round(n/a*100)}%`,cc=class extends Ss{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_VOLUME,U.MEDIA_MUTED,U.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=sE,this.range.addEventListener("input",()=>{let l=this.range.value/this.range.max,m=new W.CustomEvent(ve.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(m)})}connectedCallback(){this.range.setAttribute("aria-label",Jt.VOLUME()),super.connectedCallback()}attributeChangedCallback(a,l,m){if(a===U.MEDIA_VOLUME||a===U.MEDIA_MUTED){let v=oE(this);this.range.value=v,this.range.setAttribute("aria-valuetext",lE(this.range)),this.updateBar()}super.attributeChangedCallback(a,l,m)}};W.customElements.get("media-volume-range")||W.customElements.define("media-volume-range",cc);var hc=class extends Ts{};W.customElements.get("media-chrome")||W.customElements.define("media-chrome",hc);var fc=class extends Ts{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};W.customElements.get("media-container")||W.customElements.define("media-container",fc);var Ec=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},lt=(n,a,l)=>(Ec(n,a,"read from private field"),l?l.call(n):a.get(n)),si=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Fi=(n,a,l,m)=>(Ec(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Sr=(n,a,l)=>(Ec(n,a,"access private method"),l),zr,En,Ms,bn,xs,kr,_n,mc,jr,xa,Fl,Ul,pc,yn,vc,Ps,Bl,Hl,gc,yc,Hm,bc,Gm,Vm=ie.createElement("template");Vm.innerHTML=`
808
+ <slot name="loading">${py}</slot>
809
+ <div id="status" role="status" aria-live="polite">${si.MEDIA_LOADING()}</div>
810
+ `;var bc=class extends q.HTMLElement{constructor(){if(super(),yc(this,mr,void 0),yc(this,jl,Zm),yc(this,zl,void 0),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=Jm.content.cloneNode(!0);l.appendChild(m)}let{style:r}=ft(this.shadowRoot,":host");Pn(this,zl,r)}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PAUSED,F.MEDIA_LOADING,Qm.LOADING_DELAY]}attributeChangedCallback(r,l,m){var v,y,I,M,B;r===Qm.LOADING_DELAY&&l!==m?this.loadingDelay=Number(m):r===Ne.MEDIA_CONTROLLER&&(l&&((y=(v=xn(this,mr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Pn(this,mr,null)),m&&(Pn(this,mr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=xn(this,mr))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var r,l,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Pn(this,mr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(l=xn(this,mr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var r,l;(l=(r=xn(this,mr))==null?void 0:r.unassociateElement)==null||l.call(r,this),Pn(this,mr,null)}get loadingDelay(){return xn(this,jl)}set loadingDelay(r){Pn(this,jl,r),xn(this,zl).setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${r}ms)`)}get mediaPaused(){return mt(this,F.MEDIA_PAUSED)}set mediaPaused(r){bt(this,F.MEDIA_PAUSED,r)}get mediaLoading(){return mt(this,F.MEDIA_LOADING)}set mediaLoading(r){bt(this,F.MEDIA_LOADING,r)}};mr=new WeakMap;jl=new WeakMap;zl=new WeakMap;q.customElements.get("media-loading-indicator")||q.customElements.define("media-loading-indicator",bc);var vy=100,gy=1,Ey=n=>n.mediaMuted?0:Math.round(n.mediaVolume*n.range.max),yy=({value:n,max:r})=>`${Math.round(n/r*100)}%`,_c=class extends Ga{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME,F.MEDIA_MUTED,F.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=vy,this.range.addEventListener("input",()=>{let l=this.range.value/this.range.max,m=new q.CustomEvent(Ie.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(m)})}connectedCallback(){this.range.setAttribute("aria-label",si.VOLUME()),super.connectedCallback()}attributeChangedCallback(r,l,m){if(r===F.MEDIA_VOLUME||r===F.MEDIA_MUTED){let v=Ey(this);this.range.value=v,this.range.setAttribute("aria-valuetext",yy(this.range)),this.updateBar()}super.attributeChangedCallback(r,l,m)}get mediaVolume(){var r;return(r=St(this,F.MEDIA_VOLUME))!=null?r:gy}set mediaVolume(r){Lt(this,F.MEDIA_VOLUME,r)}get mediaMuted(){return mt(this,F.MEDIA_MUTED)}set mediaMuted(r){bt(this,F.MEDIA_MUTED,r)}get mediaVolumeUnavailable(){return Ht(this,F.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(r){Yt(this,F.MEDIA_VOLUME_UNAVAILABLE,r)}};q.customElements.get("media-volume-range")||q.customElements.define("media-volume-range",_c);var Lc=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},dt=(n,r,l)=>(Lc(n,r,"read from private field"),l?l.call(n):r.get(n)),fi=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Ki=(n,r,l,m)=>(Lc(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Or=(n,r,l)=>(Lc(n,r,"access private method"),l),sa,Nn,Gs,Fn,Vs,Nr,Un,Tc,na,Va,Ql,Xl,Ac,On,Sc,Ks,Zl,Jl,kc,wc,ep,Ic,tp,ip=ae.createElement("template");ip.innerHTML=`
790
811
  <style>
791
812
  :host ul {
792
813
  font: var(--media-font,
@@ -824,7 +845,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
824
845
  <ul tabindex="0">
825
846
  <slot></slot>
826
847
  </ul>
827
- `;var Gl=class extends W.HTMLElement{constructor(a={}){if(super(),si(this,kr),si(this,jr),si(this,Ul),si(this,Ps),si(this,Hl),si(this,yc),si(this,bc),si(this,zr,""),si(this,En,null),si(this,Ms,void 0),si(this,bn,void 0),si(this,xs,!1),si(this,Fl,l=>{this.handleClick(l)}),si(this,yn,l=>{let{key:m}=l;if(m==="Escape"){this.removeEventListener("keyup",lt(this,yn));return}if(m==="Meta"){Fi(this,xs,!1);return}Sr(this,Ul,pc).call(this,l)}),si(this,vc,l=>{let{key:m,altKey:v}=l;if(v){this.removeEventListener("keyup",lt(this,yn));return}if(m==="Meta"){Fi(this,xs,!0);return}if(this.keysUsed.includes(m)&&l.preventDefault(),lt(this,xs)&&this.keysUsed.includes(m)){Sr(this,Ul,pc).call(this,l);return}this.addEventListener("keyup",lt(this,yn),{once:!0})}),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=Vm.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}Fi(this,Ms,this.shadowRoot.querySelector("slot")),lt(this,Ms).addEventListener("slotchange",()=>{Fi(this,kr,lt(this,Ms).assignedElements({flatten:!0}),mc),lt(this,kr,_n).length===1&&lt(this,kr,_n)[0].nodeName.toLowerCase()==="slot"&&Fi(this,kr,lt(this,kr,_n)[0].assignedElements({flatten:!0}),mc);let l=lt(this,jr,xa);if(l.some(E=>E.getAttribute("tabindex")==="0"))return;let v=l.filter(E=>E.getAttribute("aria-selected")==="true")[0];v||(v=l[0]),v&&(v.setAttribute("tabindex",0),v.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}get selectedOptions(){return lt(this,jr,xa).filter(a=>a.getAttribute("aria-selected")==="true")}get value(){return this.selectedOptions[0].value||this.selectedOptions[0].textContent}set value(a){let l=lt(this,jr,xa).find(m=>m.value===a||m.textContent===a);!l||Sr(this,Hl,gc).call(this,l)}focus(){var a;(a=this.selectedOptions[0])==null||a.focus()}enable(){this.addEventListener("click",lt(this,Fl)),this.addEventListener("keydown",lt(this,vc))}disable(){this.removeEventListener("click",lt(this,Fl)),this.removeEventListener("keyup",lt(this,yn))}attributeChangedCallback(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this)}}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(a,l){let m=Sr(this,Ps,Bl).call(this,a);!m||Sr(this,Hl,gc).call(this,m,l)}handleMovement(a){let{key:l}=a,m=lt(this,jr,xa),v=Sr(this,Ps,Bl).call(this,a);v||(v=m.filter(I=>I.getAttribute("tabindex")==="0")[0]);let E;switch(l){case"ArrowDown":E=v.nextElementSibling,E!=null&&E.hasAttribute("disabled")&&(E=E.nextElementSibling);break;case"ArrowUp":E=v.previousElementSibling,E!=null&&E.hasAttribute("disabled")&&(E=E.previousElementSibling);break;case"Home":E=m[0];break;case"End":E=m[m.length-1];break;default:E=Sr(this,yc,Hm).call(this,l);break}E&&(m.forEach(I=>I.setAttribute("tabindex","-1")),E.setAttribute("tabindex","0"),E.focus())}handleClick(a){let l=Sr(this,Ps,Bl).call(this,a);!l||l.hasAttribute("disabled")||(lt(this,jr,xa).forEach(m=>m.setAttribute("tabindex","-1")),l.setAttribute("tabindex","0"),this.handleSelection(a,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"))}};zr=new WeakMap;En=new WeakMap;Ms=new WeakMap;bn=new WeakMap;xs=new WeakMap;kr=new WeakSet;_n=function(){return lt(this,bn)||Fi(this,bn,Array.from(this.shadowRoot.querySelectorAll("media-chrome-listitem"))),lt(this,bn)};mc=function(n){Fi(this,bn,n)};jr=new WeakSet;xa=function(){return lt(this,kr,_n).filter(n=>!n.hasAttribute("disabled"))};Fl=new WeakMap;Ul=new WeakSet;pc=function(n){let{key:a}=n;a==="Enter"||a===" "?this.handleSelection(n,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"):this.handleMovement(n)};yn=new WeakMap;vc=new WeakMap;Ps=new WeakSet;Bl=function(n){let a=n.composedPath(),l=a.findIndex(m=>m.nodeName==="MEDIA-CHROME-LISTITEM");return a[l]};Hl=new WeakSet;gc=function(n,a){(!this.hasAttribute("aria-multiselectable")||this.getAttribute("aria-multiselectable")!=="true")&&lt(this,kr,_n).forEach(l=>l.setAttribute("aria-selected","false")),a&&n.getAttribute("aria-selected")==="true"?n.setAttribute("aria-selected","false"):n.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))};yc=new WeakSet;Hm=function(n){Sr(this,bc,Gm).call(this);let a=lt(this,jr,xa),l=a.findIndex(F=>F.getAttribute("tabindex")==="0");Fi(this,zr,lt(this,zr)+n);let m=lt(this,zr).split("").every(F=>F===n),v=a.slice(l+(m?1:0)).filter(F=>F.textContent.toLowerCase().startsWith(lt(this,zr))),E=a.slice(0,l-(m?1:0)).filter(F=>F.textContent.toLowerCase().startsWith(lt(this,zr))),I=[],M=[];return m&&(I=a.slice(l+(m?1:0)).filter(F=>F.textContent.startsWith(n)),M=a.slice(0,l-(m?1:0)).filter(F=>F.textContent.startsWith(n))),[...v,...E,...I,...M][0]};bc=new WeakSet;Gm=function(){W.clearTimeout(lt(this,En)),Fi(this,En,null),Fi(this,En,W.setTimeout(()=>{Fi(this,zr,""),Fi(this,En,null)},500))};W.customElements.get("media-chrome-listbox")||W.customElements.define("media-chrome-listbox",Gl);var Km=Gl;var Ac=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},ge=(n,a,l)=>(Ac(n,a,"read from private field"),l?l.call(n):a.get(n)),ti=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Ui=(n,a,l,m)=>(Ac(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),wr=(n,a,l)=>(Ac(n,a,"access private method"),l),Tn,Os,An,Ut,Ns,mt,lr,Fs,Pa,Sn,Vl,_c,Wm,Tc,qm,kn,Us,Sc,Ym,Kl,kc,$m=ie.createElement("template");$m.innerHTML=`
848
+ `;var eu=class extends q.HTMLElement{constructor(r={}){if(super(),fi(this,Nr),fi(this,na),fi(this,Xl),fi(this,Ks),fi(this,Jl),fi(this,wc),fi(this,Ic),fi(this,sa,""),fi(this,Nn,null),fi(this,Gs,void 0),fi(this,Fn,void 0),fi(this,Vs,!1),fi(this,Ql,l=>{this.handleClick(l)}),fi(this,On,l=>{let{key:m}=l;if(m==="Escape"){this.removeEventListener("keyup",dt(this,On));return}if(m==="Meta"){Ki(this,Vs,!1);return}Or(this,Xl,Ac).call(this,l)}),fi(this,Sc,l=>{let{key:m,altKey:v}=l;if(v){this.removeEventListener("keyup",dt(this,On));return}if(m==="Meta"){Ki(this,Vs,!0);return}if(this.keysUsed.includes(m)&&l.preventDefault(),dt(this,Vs)&&this.keysUsed.includes(m)){Or(this,Xl,Ac).call(this,l);return}this.addEventListener("keyup",dt(this,On),{once:!0})}),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=ip.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}Ki(this,Gs,this.shadowRoot.querySelector("slot")),dt(this,Gs).addEventListener("slotchange",()=>{Ki(this,Nr,dt(this,Gs).assignedElements({flatten:!0}),Tc),dt(this,Nr,Un).length===1&&dt(this,Nr,Un)[0].nodeName.toLowerCase()==="slot"&&Ki(this,Nr,dt(this,Nr,Un)[0].assignedElements({flatten:!0}),Tc);let l=dt(this,na,Va);if(l.some(y=>y.getAttribute("tabindex")==="0"))return;let v=l.filter(y=>y.getAttribute("aria-selected")==="true")[0];v||(v=l[0]),v&&(v.setAttribute("tabindex",0),v.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}get selectedOptions(){return dt(this,na,Va).filter(r=>r.getAttribute("aria-selected")==="true")}get value(){return this.selectedOptions[0].value||this.selectedOptions[0].textContent}set value(r){let l=dt(this,na,Va).find(m=>m.value===r||m.textContent===r);!l||Or(this,Jl,kc).call(this,l)}focus(){var r;(r=this.selectedOptions[0])==null||r.focus()}enable(){this.addEventListener("click",dt(this,Ql)),this.addEventListener("keydown",dt(this,Sc))}disable(){this.removeEventListener("click",dt(this,Ql)),this.removeEventListener("keyup",dt(this,On))}attributeChangedCallback(r,l,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(l){let I=ae.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this)}}else r==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.associateElement)==null||r.call(m,this)}}disconnectedCallback(){var r;this.disable();let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(r,l){let m=Or(this,Ks,Zl).call(this,r);!m||Or(this,Jl,kc).call(this,m,l)}handleMovement(r){let{key:l}=r,m=dt(this,na,Va),v=Or(this,Ks,Zl).call(this,r);v||(v=m.filter(I=>I.getAttribute("tabindex")==="0")[0]);let y;switch(l){case"ArrowDown":y=v.nextElementSibling,y!=null&&y.hasAttribute("disabled")&&(y=y.nextElementSibling);break;case"ArrowUp":y=v.previousElementSibling,y!=null&&y.hasAttribute("disabled")&&(y=y.previousElementSibling);break;case"Home":y=m[0];break;case"End":y=m[m.length-1];break;default:y=Or(this,wc,ep).call(this,l);break}y&&(m.forEach(I=>I.setAttribute("tabindex","-1")),y.setAttribute("tabindex","0"),y.focus())}handleClick(r){let l=Or(this,Ks,Zl).call(this,r);!l||l.hasAttribute("disabled")||(dt(this,na,Va).forEach(m=>m.setAttribute("tabindex","-1")),l.setAttribute("tabindex","0"),this.handleSelection(r,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"))}};sa=new WeakMap;Nn=new WeakMap;Gs=new WeakMap;Fn=new WeakMap;Vs=new WeakMap;Nr=new WeakSet;Un=function(){return dt(this,Fn)||Ki(this,Fn,Array.from(this.shadowRoot.querySelectorAll("media-chrome-listitem"))),dt(this,Fn)};Tc=function(n){Ki(this,Fn,n)};na=new WeakSet;Va=function(){return dt(this,Nr,Un).filter(n=>!n.hasAttribute("disabled"))};Ql=new WeakMap;Xl=new WeakSet;Ac=function(n){let{key:r}=n;r==="Enter"||r===" "?this.handleSelection(n,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"):this.handleMovement(n)};On=new WeakMap;Sc=new WeakMap;Ks=new WeakSet;Zl=function(n){let r=n.composedPath(),l=r.findIndex(m=>m.nodeName==="MEDIA-CHROME-LISTITEM");return r[l]};Jl=new WeakSet;kc=function(n,r){(!this.hasAttribute("aria-multiselectable")||this.getAttribute("aria-multiselectable")!=="true")&&dt(this,Nr,Un).forEach(l=>l.setAttribute("aria-selected","false")),r&&n.getAttribute("aria-selected")==="true"?n.setAttribute("aria-selected","false"):n.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))};wc=new WeakSet;ep=function(n){Or(this,Ic,tp).call(this);let r=dt(this,na,Va),l=r.findIndex(H=>H.getAttribute("tabindex")==="0");Ki(this,sa,dt(this,sa)+n);let m=dt(this,sa).split("").every(H=>H===n),v=r.slice(l+(m?1:0)).filter(H=>H.textContent.toLowerCase().startsWith(dt(this,sa))),y=r.slice(0,l-(m?1:0)).filter(H=>H.textContent.toLowerCase().startsWith(dt(this,sa))),I=[],M=[];return m&&(I=r.slice(l+(m?1:0)).filter(H=>H.textContent.startsWith(n)),M=r.slice(0,l-(m?1:0)).filter(H=>H.textContent.startsWith(n))),[...v,...y,...I,...M][0]};Ic=new WeakSet;tp=function(){q.clearTimeout(dt(this,Nn)),Ki(this,Nn,null),Ki(this,Nn,q.setTimeout(()=>{Ki(this,sa,""),Ki(this,Nn,null)},500))};q.customElements.get("media-chrome-listbox")||q.customElements.define("media-chrome-listbox",eu);var rp=eu;var Cc=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},be=(n,r,l)=>(Cc(n,r,"read from private field"),l?l.call(n):r.get(n)),li=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Wi=(n,r,l,m)=>(Cc(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Fr=(n,r,l)=>(Cc(n,r,"access private method"),l),Bn,Ws,Hn,$t,qs,_t,pr,Ys,Ka,Gn,tu,Rc,ap,Dc,np,Vn,$s,Mc,sp,iu,xc,op=ae.createElement("template");op.innerHTML=`
828
849
  <style>
829
850
  :host {
830
851
  display: inline-flex;
@@ -852,7 +873,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
852
873
  <slot></slot>
853
874
  </media-chrome-listbox>
854
875
  </slot>
855
- `;var Wl=class extends W.HTMLElement{constructor(){var a;if(super(),ti(this,_c),ti(this,Tc),ti(this,kn),ti(this,Sc),ti(this,Kl),ti(this,Tn,void 0),ti(this,Os,void 0),ti(this,An,!0),ti(this,Ut,void 0),ti(this,Ns,void 0),ti(this,mt,void 0),ti(this,lr,void 0),ti(this,Fs,!1),ti(this,Pa,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",ge(this,Pa));return}m.composedPath().includes(ge(this,Ut))&&(v==="Enter"||v===" ")?ge(this,Tn).call(this):v==="Escape"&&!ge(this,lr).hidden&&wr(this,kn,Us).call(this)}),ti(this,Sn,m=>{let{metaKey:v,altKey:E,key:I}=m;if(v||E||!this.keysUsed.includes(I)){this.removeEventListener("keyup",ge(this,Pa));return}m.preventDefault(),this.addEventListener("keyup",ge(this,Pa),{once:!0})}),ti(this,Vl,m=>{m.composedPath().includes(this)||ge(this,lr).hidden||wr(this,kn,Us).call(this)}),!this.shadowRoot){let m=this.attachShadow({mode:"open"}),v=$m.content.cloneNode(!0);this.nativeEl=v,m.appendChild(v)}let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Ui(this,Tn,wr(this,_c,Wm).bind(this)),Ui(this,Os,wr(this,Tc,qm).bind(this)),(a=this.init)==null||a.call(this),Ui(this,Ut,this.shadowRoot.querySelector("[part=button]")),Ui(this,mt,this.shadowRoot.querySelector("[part=listbox]")),Ui(this,Ns,this.shadowRoot.querySelector("slot[name=button]")),ge(this,Ns).addEventListener("slotchange",()=>{let m=ge(this,Ns).assignedElements()[0];!m||(this.disable(),Ui(this,Ut,m),ge(this,Ut).preventClick=!0,ge(this,Ut).hasAttribute("disabled")&&Ui(this,An,!1),ge(this,An)?(this.enable(),ge(this,Ut).setAttribute("aria-haspopup","listbox")):this.disable())}),Ui(this,lr,this.shadowRoot.querySelector("slot[name=listbox]")),ge(this,lr).addEventListener("slotchange",()=>{this.disable(),Ui(this,mt,ge(this,lr).assignedElements()[0]||ge(this,mt)),this.enable()})}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}enable(){ge(this,Ut).removeAttribute("disabled"),ge(this,Ut).addEventListener("click",ge(this,Tn)),ge(this,Ut).addEventListener("keydown",ge(this,Sn)),ge(this,mt).addEventListener("keydown",ge(this,Sn)),wr(this,Kl,kc).call(this),ge(this,mt).addEventListener("change",ge(this,Os)),ie.addEventListener("click",ge(this,Vl))}disable(){ge(this,Ut).setAttribute("disabled",""),ge(this,Ut).removeEventListener("click",ge(this,Tn)),ge(this,Ut).removeEventListener("keydown",ge(this,Sn)),ge(this,Ut).removeEventListener("keyup",ge(this,Pa)),ge(this,mt).removeEventListener("keydown",ge(this,Sn)),ge(this,mt).removeEventListener("keyup",ge(this,Pa)),ge(this,mt).addEventListener("change",ge(this,Os)),ie.removeEventListener("click",ge(this,Vl))}attributeChangedCallback(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this),ge(this,mt).removeAttribute(Pe.MEDIA_CONTROLLER)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this),ge(this,mt).setAttribute(Pe.MEDIA_CONTROLLER,m)}}else a==="disabled"&&m!==l&&(m==null?(Ui(this,An,!0),this.enable()):(Ui(this,An,!1),this.disable()))}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this),ge(this,mt).setAttribute(Pe.MEDIA_CONTROLLER,l)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this),ge(this,mt).removeAttribute(Pe.MEDIA_CONTROLLER)}}get keysUsed(){return["Enter","Escape"," ","ArrowUp","ArrowDown","f","c","k","m"]}};Tn=new WeakMap;Os=new WeakMap;An=new WeakMap;Ut=new WeakMap;Ns=new WeakMap;mt=new WeakMap;lr=new WeakMap;Fs=new WeakMap;Pa=new WeakMap;Sn=new WeakMap;Vl=new WeakMap;_c=new WeakSet;Wm=function(){wr(this,kn,Us).call(this)};Tc=new WeakSet;qm=function(){wr(this,kn,Us).call(this,!0)};kn=new WeakSet;Us=function(n){ge(this,lr).hidden=!ge(this,lr).hidden||n,wr(this,Kl,kc).call(this,n),ge(this,lr).hidden?(this.shadowRoot.activeElement===ge(this,mt)||ge(this,mt).contains(this.shadowRoot.activeElement))&&ge(this,Ut).focus():(ge(this,mt).focus(),wr(this,Sc,Ym).call(this))};Sc=new WeakSet;Ym=function(){var n;if(ge(this,mt).offsetWidth===0)return;let a=ge(this,Ut).getBoundingClientRect();if(this.hasAttribute("media-controller")||ge(this,Ut).hasAttribute("media-controller")||ge(this,mt).hasAttribute("media-controller")){ge(this,mt).style.zIndex="1",ge(this,mt).style.bottom="unset",ge(this,mt).style.top=a.height+"px";return}let m=((n=this.getAttribute("bounds")?Ra(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?n:this).getBoundingClientRect(),v=ge(this,mt).getBoundingClientRect(),E=-Math.max(a.x+v.width-m.right,0);ge(this,mt).style.transform=`translateX(${E}px)`};Kl=new WeakSet;kc=function(n=!1){Ui(this,Fs,!ge(this,Fs)||n),ge(this,Ut).setAttribute("aria-expanded",ge(this,Fs))};W.customElements.get("media-chrome-selectmenu")||W.customElements.define("media-chrome-selectmenu",Wl);var jm=Wl;var zm=ie.createElement("template");zm.innerHTML=`
876
+ `;var ru=class extends q.HTMLElement{constructor(){var r;if(super(),li(this,Rc),li(this,Dc),li(this,Vn),li(this,Mc),li(this,iu),li(this,Bn,void 0),li(this,Ws,void 0),li(this,Hn,!0),li(this,$t,void 0),li(this,qs,void 0),li(this,_t,void 0),li(this,pr,void 0),li(this,Ys,!1),li(this,Ka,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",be(this,Ka));return}m.composedPath().includes(be(this,$t))&&(v==="Enter"||v===" ")?be(this,Bn).call(this):v==="Escape"&&!be(this,pr).hidden&&Fr(this,Vn,$s).call(this)}),li(this,Gn,m=>{let{metaKey:v,altKey:y,key:I}=m;if(v||y||!this.keysUsed.includes(I)){this.removeEventListener("keyup",be(this,Ka));return}m.preventDefault(),this.addEventListener("keyup",be(this,Ka),{once:!0})}),li(this,tu,m=>{m.composedPath().includes(this)||be(this,pr).hidden||Fr(this,Vn,$s).call(this)}),!this.shadowRoot){let m=this.attachShadow({mode:"open"}),v=op.content.cloneNode(!0);this.nativeEl=v,m.appendChild(v)}let{style:l}=ft(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Wi(this,Bn,Fr(this,Rc,ap).bind(this)),Wi(this,Ws,Fr(this,Dc,np).bind(this)),(r=this.init)==null||r.call(this),Wi(this,$t,this.shadowRoot.querySelector("[part=button]")),Wi(this,_t,this.shadowRoot.querySelector("[part=listbox]")),Wi(this,qs,this.shadowRoot.querySelector("slot[name=button]")),be(this,qs).addEventListener("slotchange",()=>{let m=be(this,qs).assignedElements()[0];!m||(this.disable(),Wi(this,$t,m),be(this,$t).preventClick=!0,be(this,$t).hasAttribute("disabled")&&Wi(this,Hn,!1),be(this,Hn)?(this.enable(),be(this,$t).setAttribute("aria-haspopup","listbox")):this.disable())}),Wi(this,pr,this.shadowRoot.querySelector("slot[name=listbox]")),be(this,pr).addEventListener("slotchange",()=>{this.disable(),Wi(this,_t,be(this,pr).assignedElements()[0]||be(this,_t)),this.enable()})}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}enable(){be(this,$t).removeAttribute("disabled"),be(this,$t).addEventListener("click",be(this,Bn)),be(this,$t).addEventListener("keydown",be(this,Gn)),be(this,_t).addEventListener("keydown",be(this,Gn)),Fr(this,iu,xc).call(this),be(this,_t).addEventListener("change",be(this,Ws)),ae.addEventListener("click",be(this,tu))}disable(){be(this,$t).setAttribute("disabled",""),be(this,$t).removeEventListener("click",be(this,Bn)),be(this,$t).removeEventListener("keydown",be(this,Gn)),be(this,$t).removeEventListener("keyup",be(this,Ka)),be(this,_t).removeEventListener("keydown",be(this,Gn)),be(this,_t).removeEventListener("keyup",be(this,Ka)),be(this,_t).addEventListener("change",be(this,Ws)),ae.removeEventListener("click",be(this,tu))}attributeChangedCallback(r,l,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(l){let I=ae.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this),be(this,_t).removeAttribute(Ne.MEDIA_CONTROLLER)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this),be(this,_t).setAttribute(Ne.MEDIA_CONTROLLER,m)}}else r==="disabled"&&m!==l&&(m==null?(Wi(this,Hn,!0),this.enable()):(Wi(this,Hn,!1),this.disable()))}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable();let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.associateElement)==null||r.call(m,this),be(this,_t).setAttribute(Ne.MEDIA_CONTROLLER,l)}}disconnectedCallback(){var r;this.disable();let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this),be(this,_t).removeAttribute(Ne.MEDIA_CONTROLLER)}}get keysUsed(){return["Enter","Escape"," ","ArrowUp","ArrowDown","f","c","k","m"]}};Bn=new WeakMap;Ws=new WeakMap;Hn=new WeakMap;$t=new WeakMap;qs=new WeakMap;_t=new WeakMap;pr=new WeakMap;Ys=new WeakMap;Ka=new WeakMap;Gn=new WeakMap;tu=new WeakMap;Rc=new WeakSet;ap=function(){Fr(this,Vn,$s).call(this)};Dc=new WeakSet;np=function(){Fr(this,Vn,$s).call(this,!0)};Vn=new WeakSet;$s=function(n){be(this,pr).hidden=!be(this,pr).hidden||n,Fr(this,iu,xc).call(this,n),be(this,pr).hidden?(this.shadowRoot.activeElement===be(this,_t)||be(this,_t).contains(this.shadowRoot.activeElement))&&be(this,$t).focus():(be(this,_t).focus(),Fr(this,Mc,sp).call(this))};Mc=new WeakSet;sp=function(){var n;if(be(this,_t).offsetWidth===0)return;let r=be(this,$t).getBoundingClientRect();if(this.hasAttribute("mediacontroller")||be(this,$t).hasAttribute("mediacontroller")||be(this,_t).hasAttribute("mediacontroller")){be(this,_t).style.zIndex="1",be(this,_t).style.bottom="unset",be(this,_t).style.top=r.height+"px";return}let m=((n=this.getAttribute("bounds")?Fa(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?n:this).getBoundingClientRect(),v=be(this,_t).getBoundingClientRect(),y=-Math.max(r.x+v.width-m.right,0);be(this,_t).style.transform=`translateX(${y}px)`};iu=new WeakSet;xc=function(n=!1){Wi(this,Ys,!be(this,Ys)||n),be(this,$t).setAttribute("aria-expanded",be(this,Ys))};q.customElements.get("media-chrome-selectmenu")||q.customElements.define("media-chrome-selectmenu",ru);var lp=ru;var up=ae.createElement("template");up.innerHTML=`
856
877
  <style>
857
878
  :host {
858
879
  display: list-item;
@@ -869,51 +890,62 @@ svg, img, ::slotted(svg), ::slotted(img) {
869
890
  <li>
870
891
  <slot></slot>
871
892
  </li>
872
- `;var wc=class extends W.HTMLElement{static get observedAttributes(){return["disabled","aria-selected","value",Pe.MEDIA_CONTROLLER]}constructor(){if(super(),!this.shadowRoot){let a=this.attachShadow({mode:"open"}),l=zm.content.cloneNode(!0);this.nativeEl=l,a.appendChild(l)}}set value(a){this.setAttribute("value",a)}get value(){return this.getAttribute("value")}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this)}}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this)}}handleClick(){}};W.customElements.get("media-chrome-listitem")||W.customElements.define("media-chrome-listitem",wc);var Cc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},jt=(n,a,l)=>(Cc(n,a,"read from private field"),l?l.call(n):a.get(n)),Qr=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Xr=(n,a,l,m)=>(Cc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),$i=(n,a,l)=>(Cc(n,a,"access private method"),l),Ln,In,Lr,Bi,ql,Lc,$l,Ic,Oa,wn,Yl,Rc,Xm=`
893
+ `;var Pc={VALUE:"value"},Oc=class extends q.HTMLElement{static get observedAttributes(){return["disabled","aria-selected",Pc.VALUE,Ne.MEDIA_CONTROLLER]}constructor(){if(super(),!this.shadowRoot){let r=this.attachShadow({mode:"open"}),l=up.content.cloneNode(!0);this.nativeEl=l,r.appendChild(l)}}set value(r){this.setAttribute(Pc.VALUE,r)}get value(){return this.getAttribute(Pc.VALUE)}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(r,l,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(l){let I=ae.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this)}}else r==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.associateElement)==null||r.call(m,this)}}disconnectedCallback(){var r;this.disable();let l=this.getAttribute(Ne.MEDIA_CONTROLLER);if(l){let m=ae.getElementById(l);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this)}}handleClick(){}};q.customElements.get("media-chrome-listitem")||q.customElements.define("media-chrome-listitem",Oc);var Bc=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},ki=(n,r,l)=>(Bc(n,r,"read from private field"),l?l.call(n):r.get(n)),Wa=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},qa=(n,r,l,m)=>(Bc(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Ya=(n,r,l)=>(Bc(n,r,"access private method"),l),Kn,Ur,qi,Nc,cp,Hc,hp,js,au,nu,Fc,fp=`
873
894
  fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
874
895
  height: var(--media-captions-indicator-height, 1em);
875
896
  vertical-align: var(--media-captions-indicator-vertical-align, bottom);
876
897
  margin-inline-start: 1ch;
877
- `,dE=`
878
- <svg style="${Xm}" aria-hidden="true" viewBox="0 0 26 24">
898
+ `,by=`
899
+ <svg style="${fp}" aria-hidden="true" viewBox="0 0 26 24">
879
900
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
880
- </svg>`,Zm=ie.createElement("template");Zm.innerHTML=`
901
+ </svg>`,mp=ae.createElement("template");mp.innerHTML=`
881
902
  <style>
882
903
  media-chrome-listitem {
883
904
  white-space: var(--media-captions-listbox-white-space, nowrap);
884
905
  }
885
-
886
906
  </style>
887
- <slot hidden name="captions-indicator">${dE}</slot>
888
- `;var Qm=(n,a)=>n.label===a.label&&n.language===a.language,Dc=class extends Km{constructor(){super({slotTemplate:Zm}),Qr(this,ql),Qr(this,$l),Qr(this,Oa),Qr(this,Yl),Qr(this,Ln,[]),Qr(this,In,[]),Qr(this,Lr,void 0),Qr(this,Bi,void 0);let a=ie.createElement("media-chrome-listitem");a.part.add("listitem"),a.value="off",a.textContent="Off",Xr(this,Lr,a);let l=this.shadowRoot.querySelector('[name="captions-indicator"]');Xr(this,Bi,l.firstElementChild),l.addEventListener("slotchange",()=>{let m=l.assignedElements();if(m.length===1&&m[0].nodeName.toLowerCase()==="slot"){let v=m[0].assignedElements();v.length===0?Xr(this,Bi,m[0].firstElementChild):v.length===1&&Xr(this,Bi,v[0])}jt(this,Bi)||Xr(this,Bi,l.firstElementChild),Xr(this,Bi,jt(this,Bi).cloneNode(!0)),jt(this,Bi).removeAttribute("slot"),jt(this,Bi).setAttribute("style",Xm)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",U.MEDIA_CAPTIONS_LIST,U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_LIST,U.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(a,l,m){if(a===U.MEDIA_SUBTITLES_LIST&&l!==m)Xr(this,Ln,$i(this,ql,Lc).call(this,m,jt(this,Ln))),$i(this,Oa,wn).call(this);else if(a===U.MEDIA_CAPTIONS_LIST&&l!==m)Xr(this,In,$i(this,ql,Lc).call(this,m,jt(this,In))),$i(this,Oa,wn).call(this);else if(a===U.MEDIA_SUBTITLES_SHOWING&&l!==m){let v=vs(m!=null?m:"")[0];jt(this,Ln).forEach(E=>{E.selected=E.language===v.language&&E.label===v.label}),$i(this,Oa,wn).call(this)}else if(a===U.MEDIA_CAPTIONS_SHOWING&&l!==m){let v=vs(m!=null?m:"")[0];jt(this,In).forEach(E=>{E.selected=E.language===v.language&&E.label===v.label}),$i(this,Oa,wn).call(this)}else a==="aria-multiselectable"&&(this.removeAttribute("aria-multiselectable"),console.warn("Captions List doesn't currently support multiple selections. You can enable multiple items via the media.textTrack API."));super.attributeChangedCallback(a,l,m)}connectedCallback(){$i(this,Oa,wn).call(this),this.addEventListener("change",$i(this,Yl,Rc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",$i(this,Yl,Rc)),super.disconnectedCallback()}};Ln=new WeakMap;In=new WeakMap;Lr=new WeakMap;Bi=new WeakMap;ql=new WeakSet;Lc=function(n,a){let l=n?vs(n!=null?n:""):[],m=[],v=[];return a.forEach(E=>{l.some(I=>Qm(I,E))||m.push(E)}),l.forEach(E=>{a.some(I=>Qm(I,E))||v.push(E)}),m.forEach(E=>E.el.remove()),a.filter(E=>!m.includes(E)).concat(v)};$l=new WeakSet;Ic=function(n,a){let l=this.shadowRoot.querySelector("ul slot");n.forEach(m=>{let v=m.el,E=!0;if(!v){v=ie.createElement("media-chrome-listitem"),E=!1,v.part.add("listitem"),v.value=a+"!"+Iu(m);let I=ie.createElement("span");I.textContent=m.label,v.append(I),a==="cc"&&v.append(jt(this,Bi).cloneNode(!0))}m.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),E||(l.append(v),m.el=v)})};Oa=new WeakSet;wn=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(jt(this,Lr))||n.append(jt(this,Lr)),!this.hasAttribute(U.MEDIA_CAPTIONS_SHOWING)&&!this.hasAttribute(U.MEDIA_SUBTITLES_SHOWING)?(jt(this,Lr).setAttribute("aria-selected","true"),jt(this,Lr).setAttribute("tabindex","0")):(jt(this,Lr).setAttribute("aria-selected","false"),jt(this,Lr).setAttribute("tabindex","-1")),$i(this,$l,Ic).call(this,jt(this,In),"cc"),$i(this,$l,Ic).call(this,jt(this,Ln),"subs")};Yl=new WeakSet;Rc=function(){var n,a,l;let[m,v]=(l=(a=(n=this.selectedOptions[0])==null?void 0:n.value)==null?void 0:a.split("!"))!=null?l:[];if(Da(this,!0),!v)return;let E=new W.CustomEvent(m==="cc"?ve.MEDIA_SHOW_CAPTIONS_REQUEST:ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)};W.customElements.get("media-captions-listbox")||W.customElements.define("media-captions-listbox",Dc);var Mc=class extends jm{constructor(){super()}init(){let a=ie.createElement("media-captions-button");a.part.add("button"),a.preventClick=!0,this.hasAttribute("default-showing")&&a.setAttribute("default-showing","");let l=ie.createElement("media-captions-listbox");l.part.add("listbox"),l.setAttribute("exportparts","listitem");let m=this.shadowRoot.querySelector("slot[name=button]"),v=this.shadowRoot.querySelector("slot[name=listbox]");m.textContent="",v.textContent="",m.append(a),v.append(l)}};W.customElements.get("media-captions-selectmenu")||W.customElements.define("media-captions-selectmenu",Mc);var zl=yf(Jm(),1),lp=yf(tp(),1),uE=lp.default,yi=uE,Bs=class extends Error{constructor(n,a=Bs.MEDIA_ERR_CUSTOM,l,m){var v;super(n),this.name="MediaError",this.code=a,this.context=m,this.fatal=l!=null?l:a>=Bs.MEDIA_ERR_NETWORK&&a<=Bs.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=Bs.defaultMessages[this.code])!=null?v:"")}},pt=Bs;pt.MEDIA_ERR_ABORTED=1,pt.MEDIA_ERR_NETWORK=2,pt.MEDIA_ERR_DECODE=3,pt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,pt.MEDIA_ERR_ENCRYPTED=5,pt.MEDIA_ERR_CUSTOM=100,pt.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 cE=n=>n==null,dp=(n,a)=>cE(a)?!1:n in a,Nc={ANY:"any",MUTED:"muted"},vt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Hi={MSE:"mse",NATIVE:"native"},Fc={HEADER:"header",QUERY:"query",NONE:"none"},Dn=Object.values(Fc),Rn={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Uc={HLS:Rn.M3U8},nS=Object.keys(Uc),sS=[...Object.values(Rn),"hls","HLS"],Zr=(n,a,l,m,v=n)=>{v.addEventListener(a,l,m),n.addEventListener("teardown",()=>{v.removeEventListener(a,l)},{once:!0})};function hE(n,a,l){a&&l>a&&(l=a);for(let m=0;m<n.length;m++)if(n.start(m)<=l&&n.end(m)>=l)return!0;return!1}var fE=n=>{let a=n.indexOf("?");if(a<0)return[n];let l=n.slice(0,a),m=n.slice(a);return[l,m]},up=n=>{let a=n.type;if(a){let m=a.toUpperCase();return dp(m,Uc)?Uc[m]:a}let{src:l}=n;return l?mE(l):""},cp=n=>n==="VOD"?vt.ON_DEMAND:vt.LIVE,hp=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,mE=n=>{let a="";try{a=new URL(n).pathname}catch{console.error("invalid url")}let l=a.lastIndexOf(".");if(l<0)return"";let m=a.slice(l+1).toUpperCase();return dp(m,Rn)?Rn[m]:""},pE=Object.values(Nc),ip=n=>typeof n=="boolean"||typeof n=="string"&&pE.includes(n),vE=({autoplay:n},a,l)=>{let m=!1,v=!1,E=ip(n)?n:!!n,I=()=>{m||Zr(a,"playing",()=>{m=!0},{once:!0})};if(I(),Zr(a,"loadstart",()=>{m=!1,I(),Oc(a,E)},{once:!0}),Zr(a,"loadstart",()=>{l||(v=!Number.isFinite(a.duration)),Oc(a,E)},{once:!0}),l&&l.once(yi.Events.LEVEL_LOADED,(M,B)=>{var F;v=(F=B.details.live)!=null?F:!1}),!E){let M=()=>{!v||(l!=null&&l.liveSyncPosition?a.currentTime=l.liveSyncPosition:Number.isFinite(a.seekable.end(0))&&(a.currentTime=a.seekable.end(0)))};l&&Zr(a,"play",()=>{a.preload==="metadata"?l.once(yi.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(E=ip(M)?M:!!M,Oc(a,E))}},Oc=(n,a)=>{if(!a)return;let l=n.muted,m=()=>n.muted=l;switch(a){case Nc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case Nc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},gE=({preload:n,src:a},l,m)=>{let v=re=>{re!=null&&["","none","metadata","auto"].includes(re)?l.setAttribute("preload",re):l.removeAttribute("preload")};if(!m)return v(n),v;let E=!1,I=!1,M=m.config.maxBufferLength,B=m.config.maxBufferSize,F=re=>{v(re);let te=re!=null?re:l.preload;I||te==="none"||(te==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=B),Q())},Q=()=>{!E&&a&&(E=!0,m.loadSource(a))};return Zr(l,"play",()=>{I=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=B,Q()},{once:!0}),F(n),F};function yE(n,a){a.on(yi.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:E})=>{E.forEach(I=>{var M;let B=(M=I.subtitleTrack)!=null?M:I.closedCaptions,F=a.subtitleTracks.findIndex(({lang:Q,name:re,type:te})=>Q==(B==null?void 0:B.lang)&&re===I.label&&te.toLowerCase()===I.kind);Ql(n,I.kind,I.label,B==null?void 0:B.lang,`${I.kind}${F}`)})});let l=()=>{var v;if(!a.subtitleTracks.length)return;let E=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),I=`${(v=a.subtitleTracks[a.subtitleTrack])==null?void 0:v.type.toLowerCase()}${a.subtitleTrack}`;if(E&&(a.subtitleTrack<0||(E==null?void 0:E.id)!==I)){let M=a.subtitleTracks.findIndex(({lang:B,name:F,type:Q})=>B==E.language&&F===E.label&&Q.toLowerCase()===E.kind);a.subtitleTrack=M}E&&(E==null?void 0:E.id)===I&&E.cues&&Array.from(E.cues).forEach(M=>{E.addCue(M)})};n.textTracks.addEventListener("change",l),a.on(yi.Events.CUES_PARSED,(v,{track:E,cues:I})=>{let M=n.textTracks.getTrackById(E);if(!M)return;let B=M.mode==="disabled";B&&(M.mode="hidden"),I.forEach(F=>{var Q;(Q=M.cues)!=null&&Q.getCueById(F.id)||M.addCue(F)}),B&&(M.mode="disabled")}),a.once(yi.Events.DESTROYING,()=>{n.textTracks.removeEventListener("change",l),n.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let m=()=>{Array.from(n.textTracks).forEach(v=>{var E,I;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((E=v.cues)!=null&&E.length)){let M=n.querySelector('track[label="thumbnails"]'),B=(I=M==null?void 0:M.getAttribute("src"))!=null?I:"";M==null||M.removeAttribute("src"),setTimeout(()=>{M==null||M.setAttribute("src",B)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};a.once(yi.Events.MANIFEST_LOADED,m),a.once(yi.Events.MEDIA_ATTACHED,m)}function Ql(n,a,l,m,v){let E=document.createElement("track");return E.kind=a,E.label=l,m&&(E.srclang=m),v&&(E.id=v),E.track.mode=["subtitles","captions"].includes(a)?"disabled":"hidden",E.setAttribute("data-removeondestroy",""),n.append(E),E.track}function fp(n,a){let l=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===a);l==null||l.remove()}var Hs="cuepoints",Hc=Object.freeze({label:Hs}),Gc=(n,{label:a=Hs}=Hc)=>{var l;return(l=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===a&&m.track.kind==="metadata"))==null?void 0:l.track};async function Vc(n,a,l=Hc){let m=Gc(n,l);if(!m){let{label:v=Hs}=l;m=Ql(n,"metadata",v),m.mode="hidden",await new Promise(E=>setTimeout(()=>E(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...a].sort(({time:v},{time:E})=>E-v).forEach(({time:v,value:E})=>{var I,M;let B=Array.prototype.findIndex.call(m==null?void 0:m.cues,se=>se.startTime>=v),F=(I=m==null?void 0:m.cues)==null?void 0:I[B],Q=F?F.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,re=(M=m==null?void 0:m.cues)==null?void 0:M[B-1];re&&(re.endTime=v);let te=new VTTCue(v,Q,JSON.stringify(E!=null?E:null));m.addCue(te)}),m}var mp=n=>({time:n.startTime,value:JSON.parse(n.text)});function pp(n,a={label:Hs}){let l=Gc(n,a);return l!=null&&l.cues?Array.from(l.cues,m=>mp(m)):[]}function Kc(n,a={label:Hs}){var l,m;let v=Gc(n,a);if(!((l=v==null?void 0:v.activeCues)!=null&&l.length))return;let{currentTime:E}=n,I=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:B})=>M<=E&&B>E);return mp(I)}async function EE(n,a=Hc){return new Promise(l=>{Zr(n,"loadstart",async()=>{let m=await Vc(n,[],a);Zr(n,"cuechange",()=>{let v=Kc(n);if(v){let E=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(E)}},{},m),l(m)})})}function vp(n,a){if(a){let l=a.playingDate;if(l!=null)return new Date(l.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function gp(n,a){if(a&&a.playingDate)return a.playingDate;if(typeof n.getStartDate=="function"){let l=n.getStartDate();return new Date(l.getTime()+n.currentTime*1e3)}return new Date(NaN)}var bE=async n=>fetch(n).then(a=>a.text()).then(a=>{let l=a.split(`
889
- `).find((m,v,E)=>v&&E[v-1].startsWith("#EXT-X-STREAM-INF"));return fetch(l).then(m=>m.text()).then(m=>m.split(`
890
- `))}),_E=n=>{var a,l;let m=(l=((a=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?a:"").split(":")[1])==null?void 0:l.trim(),v=cp(m),E=hp(m),I;if(v===vt.LIVE){let M=n.find(B=>B.startsWith("#EXT-X-PART-INF"));M?I=+M.split(":")[1].split("=")[1]*2:I=+n.find(B=>B.startsWith("#EXT-X-TARGETDURATION")).split(":")[1]*3}return{streamType:v,targetLiveWindow:E,liveEdgeStartOffset:I}},rp=async(n,a)=>{var l,m,v;let E=await bE(n),{streamType:I,targetLiveWindow:M,liveEdgeStartOffset:B}=_E(E);((l=zt.get(a))!=null?l:{}).liveEdgeStartOffset=B,((m=zt.get(a))!=null?m:{}).targetLiveWindow=M,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((v=zt.get(a))!=null?v:{}).streamType=I,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},TE=n=>{var a;let l=n.type,m=cp(l),v=hp(l),E,I=!!((a=n.partList)!=null&&a.length);return m===vt.LIVE&&(E=I?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:E,lowLatency:I}},AE=(n,a,l)=>{var m,v,E,I,M,B,F,Q;let{streamType:re,targetLiveWindow:te,liveEdgeStartOffset:se,lowLatency:pe}=TE(n);if(re===vt.LIVE){pe?(l.config.backBufferLength=(m=l.userConfig.backBufferLength)!=null?m:4,l.config.maxFragLookUpTolerance=(v=l.userConfig.maxFragLookUpTolerance)!=null?v:.001,l.config.abrBandWidthUpFactor=(E=l.userConfig.abrBandWidthUpFactor)!=null?E:l.config.abrBandWidthFactor):l.config.backBufferLength=(I=l.userConfig.backBufferLength)!=null?I:8;let Ae=Object.freeze({get length(){return a.seekable.length},start(ke){return a.seekable.start(ke)},end(ke){var we;return ke>this.length?a.seekable.end(ke):(we=l.liveSyncPosition)!=null?we:a.seekable.end(ke)}});((M=zt.get(a))!=null?M:{}).seekable=Ae}((B=zt.get(a))!=null?B:{}).liveEdgeStartOffset=se,((F=zt.get(a))!=null?F:{}).targetLiveWindow=te,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((Q=zt.get(a))!=null?Q:{}).streamType=re,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},ap,np,SE=(np=(ap=globalThis==null?void 0:globalThis.navigator)==null?void 0:ap.userAgent)!=null?np:"",kE=SE.toLowerCase().indexOf("android")!==-1,zt=new WeakMap,yp="mux.com",sp,op,Ep=(op=(sp=yi).isSupported)==null?void 0:op.call(sp),wE=kE,bp=()=>zl.default.utils.now(),LE=zl.default.utils.generateUUID,_p=(n,{domain:a=yp,maxResolution:l=""}={})=>{if(!n)return;let[m,v=""]=fE(n),E=new URL(`https://stream.${a}/${m}.m3u8${v}`);return l&&E.searchParams.set("max_resolution",l),E.toString()},IE=n=>{if(!n)return;let[a]=n.split("?");return a||void 0},RE=n=>{if(!n||!n.startsWith("https://stream."))return;let[a]=new URL(n).pathname.slice(1).split(".m3u8");return a||void 0},DE=n=>{var a,l,m;return(a=n==null?void 0:n.metadata)!=null&&a.video_id?n.metadata.video_id:Ip(n)&&(m=(l=IE(n.playbackId))!=null?l:RE(n.src))!=null?m:n.src},Tp=n=>{var a;return(a=zt.get(n))==null?void 0:a.error},Ap=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.streamType)!=null?l:vt.UNKNOWN},Sp=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.targetLiveWindow)!=null?l:Number.NaN},Wc=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.seekable)!=null?l:n.seekable},kp=n=>{var a;let l=(a=zt.get(n))==null?void 0:a.liveEdgeStartOffset;if(typeof l!="number")return Number.NaN;let m=Wc(n);return m.length?m.end(m.length-1)-l:Number.NaN},wp=(n,a,l)=>{qc(a,l);let{metadata:m={}}=n,{view_session_id:v=LE()}=m,E=DE(n);m.view_session_id=v,m.video_id=E,n.metadata=m,zt.set(a,{});let I=CE(n,a);xE(n,a,I),PE(n,a,I),EE(a);let M=vE(n,a,I),B=gE(n,a,I);return{engine:I,setAutoplay:M,setPreload:B}},qc=(n,a)=>{let l=a==null?void 0:a.engine;l&&(l.detachMedia(),l.destroy()),(n==null?void 0:n.mux)&&!n.mux.deleted&&(n.mux.destroy(),delete n.mux),n&&(n.removeAttribute("src"),n.load(),n.removeEventListener("error",Dp),n.removeEventListener("error",Bc),n.removeEventListener("durationchange",Rp),zt.delete(n),n.dispatchEvent(new Event("teardown")))};function Lp(n,a){var l;let m=up(n);if(m!==Rn.M3U8)return!0;let v=!m||((l=a.canPlayType(m))!=null?l:!0),{preferPlayback:E}=n,I=E===Hi.MSE,M=E===Hi.NATIVE;return v&&(M||!(Ep&&(I||wE)))}var CE=(n,a)=>{let{debug:l,streamType:m,startTime:v=-1,metadata:E,preferCmcd:I}=n,M=up(n)===Rn.M3U8,B=Lp(n,a);if(M&&!B&&Ep){let F={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},Q=ME(m),re=I!==Fc.NONE?{useHeaders:I===Fc.HEADER,sessionId:E==null?void 0:E.view_session_id,contentId:E==null?void 0:E.video_id}:void 0;return new yi({debug:l,startPosition:v,cmcd:re,...F,...Q})}},ME=n=>n===vt.LIVE?{backBufferLength:8}:{},Ip=({playbackId:n,src:a,customDomain:l})=>{if(n)return!0;if(typeof a!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(a,m).hostname.toLocaleLowerCase();return v.includes(yp)||!!l&&v.includes(l.toLocaleLowerCase())},xE=(n,a,l)=>{var m;let{envKey:v}=n,E=Ip(n);if(v||E){let{playerInitTime:I,playerSoftwareName:M,playerSoftwareVersion:B,beaconCollectionDomain:F,debug:Q,disableCookies:re}=n,te={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},se=pe=>typeof pe.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(pe):pe;zl.default.monitor(a,{debug:Q,beaconCollectionDomain:F,hlsjs:l,Hls:l?yi:void 0,automaticErrorTracking:!1,errorTranslator:se,disableCookies:re,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:B,player_init_time:I,...te}})}},PE=(n,a,l)=>{var m;let v=Lp(n,a),{src:E}=n;a&&v?(typeof E=="string"?(a.preload==="none"?Zr(a,"loadstart",()=>rp(E,a)):rp(E,a),a.setAttribute("src",E),n.startTime&&(((m=zt.get(a))!=null?m:{}).startTime=n.startTime,a.addEventListener("durationchange",Rp,{once:!0}))):a.removeAttribute("src"),a.addEventListener("error",Dp),a.addEventListener("error",Bc),a.addEventListener("emptied",()=>{a.querySelectorAll("track[data-removeondestroy]").forEach(I=>{I.remove()})},{once:!0})):l&&E?(l.once(yi.Events.LEVEL_LOADED,(I,M)=>{AE(M.details,a,l)}),l.on(yi.Events.ERROR,(I,M)=>{let B={[yi.ErrorTypes.NETWORK_ERROR]:pt.MEDIA_ERR_NETWORK,[yi.ErrorTypes.MEDIA_ERROR]:pt.MEDIA_ERR_DECODE},F=new pt("",B[M.type]);F.fatal=M.fatal,F.data=M,a.dispatchEvent(new CustomEvent("error",{detail:F}))}),a.addEventListener("error",Bc),yE(a,l),l.attachMedia(a)):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 Rp(n){var a;let l=n.target,m=(a=zt.get(l))==null?void 0:a.startTime;if(!!m&&hE(l.seekable,l.duration,m)){let v=l.preload==="auto";v&&(l.preload="none"),l.currentTime=m,v&&(l.preload="auto")}}async function Dp(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let a=n.target;if(!(a!=null&&a.error))return;let{message:l,code:m}=a.error,v=new pt(l,m);if(a.src&&(m!==pt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:E}=await fetch(a.src);v.data={response:{code:E}}}catch{}a.dispatchEvent(new CustomEvent("error",{detail:v}))}function Bc(n){var a,l;if(!(n instanceof CustomEvent)||!(n.detail instanceof pt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((a=zt.get(m))!=null?a:{}).error=v,(l=m.mux)==null||l.emit("error",{player_error_code:v.code,player_error_message:v.message,player_error_context:v.context}))}var OE=Object.defineProperty,NE=(n,a,l)=>a in n?OE(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,Xl=(n,a,l)=>(NE(n,typeof a!="symbol"?a+"":a,l),l),Qc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},fe=(n,a,l)=>(Qc(n,a,"read from private field"),l?l.call(n):a.get(n)),Xe=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},gt=(n,a,l,m)=>(Qc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Mt=(n,a,l)=>(Qc(n,a,"access private method"),l),od=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends od{}globalThis.DocumentFragment=n}var Xc=class extends od{},FE=class extends od{},UE={get(n){},define(n,a,l){},upgrade(n){},whenDefined(n){return Promise.resolve(Xc)}},Zl,BE=class{constructor(n,a={}){Xe(this,Zl,void 0),gt(this,Zl,a==null?void 0:a.detail)}get detail(){return fe(this,Zl)}initCustomEvent(){}};Zl=new WeakMap;function HE(n,a){return new Xc}var xp={document:{createElement:HE},DocumentFragment,customElements:UE,CustomEvent:BE,EventTarget:od,HTMLElement:Xc,HTMLVideoElement:FE},Pp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Jr=Pp?xp:globalThis,Op=Pp?xp.document:globalThis.document,GE=()=>{try{return"0.15.2"}catch{}return"UNKNOWN"},VE=GE(),KE=()=>VE,Cp=n=>{var a,l,m,v,E,I,M,B,F,Q,re,te,se,pe,Ae,ke,we,nt,Ue,st,dt,oe,w,le,$,Ie,$e,tt,Bt,Je,H,ri,Ht,it,Qt,Ke,xt,ht,Tt,Qi;return a=class extends n{constructor(){super(),Xe(this,$e),Xe(this,Bt),Xe(this,H),Xe(this,Ht),Xe(this,Qt),Xe(this,xt),Xe(this,Tt),Xl(this,"castEnabled",!1),Xe(this,dt,{paused:!1}),Xe(this,oe,void 0),Xe(this,w,{}),Xe(this,le,void 0),Xe(this,$,void 0),Xe(this,Ie,void 0),a.instances.add(this),Mt(this,Qt,Ke).call(this)}static get castElement(){return fe(a,l)}static get castEnabled(){return fe(a,m)}static get castState(){var J;return(J=fe(a,F,Q))==null?void 0:J.getCastState()}static async exitCast(){try{await fe(a,F,Q).endCurrentSession(!0)}catch(J){console.error(J);return}}get castPlayer(){if(a.castElement===this)return fe(this,oe)}attributeChangedCallback(J){if(this.castPlayer)switch(J){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(J={}){var Ee;Mt(Ee=a,Ue,st).call(Ee,J),gt(a,l,this),Object.entries(fe(this,w)).forEach(([rt,bt])=>{fe(this,oe).controller.addEventListener(rt,bt)});try{await fe(a,F,Q).requestSession()}catch{gt(a,l,void 0);return}fe(this,dt).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(rt){console.error(rt)}}async load(){var J,Ee;if(!this.castPlayer)return super.load();let rt=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),bt=[...this.querySelectorAll("track")].filter(({kind:je,src:di})=>di&&(je==="subtitles"||je==="captions")),_t=[],ai=0;bt.length&&(rt.tracks=bt.map(je=>{let di=++ai;_t.length===0&&je.track.mode==="showing"&&_t.push(di);let ui=new chrome.cast.media.Track(di,chrome.cast.media.TrackType.TEXT);return ui.trackContentId=je.src,ui.trackContentType="text/vtt",ui.subtype=je.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,ui.name=je.label,ui.language=je.srclang,ui})),this.castStreamType==="live"?rt.streamType=chrome.cast.media.StreamType.LIVE:rt.streamType=chrome.cast.media.StreamType.BUFFERED,rt.metadata=new chrome.cast.media.GenericMediaMetadata,rt.metadata.title=this.title,rt.metadata.images=[{url:this.poster}];let Gi=new chrome.cast.media.LoadRequest(rt);Gi.currentTime=(J=super.currentTime)!=null?J:0,Gi.autoplay=!fe(this,dt).paused,Gi.activeTrackIds=_t,await((Ee=fe(a,re,te))==null?void 0:Ee.loadMedia(Gi)),this.dispatchEvent(new Event("volumechange"))}play(){var J;if(this.castPlayer){this.castPlayer.isPaused&&((J=this.castPlayer.controller)==null||J.playOrPause());return}return super.play()}pause(){var J;if(this.castPlayer){this.castPlayer.isPaused||(J=this.castPlayer.controller)==null||J.playOrPause();return}super.pause()}get castSrc(){var J,Ee,rt;return(rt=(Ee=this.getAttribute("cast-src"))!=null?Ee:(J=this.querySelector("source"))==null?void 0:J.src)!=null?rt:this.currentSrc}set castSrc(J){this.castSrc!=J&&this.setAttribute("cast-src",`${J}`)}get castContentType(){var J;return(J=this.getAttribute("cast-content-type"))!=null?J:void 0}set castContentType(J){this.setAttribute("cast-content-type",`${J}`)}get castStreamType(){var J,Ee;return(Ee=(J=this.getAttribute("cast-stream-type"))!=null?J:this.streamType)!=null?Ee:void 0}set castStreamType(J){this.setAttribute("cast-stream-type",`${J}`)}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 J;return this.castPlayer?(J=this.castPlayer)==null?void 0:J.isMuted:super.muted}set muted(J){var Ee;if(this.castPlayer){(J&&!this.castPlayer.isMuted||!J&&this.castPlayer.isMuted)&&((Ee=this.castPlayer.controller)==null||Ee.muteOrUnmute());return}super.muted=J}get volume(){var J,Ee;return this.castPlayer?(Ee=(J=this.castPlayer)==null?void 0:J.volumeLevel)!=null?Ee:1:super.volume}set volume(J){var Ee;if(this.castPlayer){this.castPlayer.volumeLevel=J,(Ee=this.castPlayer.controller)==null||Ee.setVolumeLevel();return}super.volume=J}get duration(){var J,Ee;return this.castPlayer&&fe(this,$e,tt)?(Ee=(J=this.castPlayer)==null?void 0:J.duration)!=null?Ee:NaN:super.duration}get currentTime(){var J,Ee;return this.castPlayer&&fe(this,$e,tt)?(Ee=(J=this.castPlayer)==null?void 0:J.currentTime)!=null?Ee:0:super.currentTime}set currentTime(J){var Ee;if(this.castPlayer){this.castPlayer.currentTime=J,(Ee=this.castPlayer.controller)==null||Ee.seek();return}super.currentTime=J}get onentercast(){return fe(this,le)}set onentercast(J){fe(this,le)&&(this.removeEventListener("entercast",fe(this,le)),gt(this,le,null)),typeof J=="function"&&(gt(this,le,J),this.addEventListener("entercast",J))}get onleavecast(){return fe(this,$)}set onleavecast(J){fe(this,$)&&(this.removeEventListener("leavecast",fe(this,$)),gt(this,$,null)),typeof J=="function"&&(gt(this,$,J),this.addEventListener("leavecast",J))}get oncastchange(){return fe(this,Ie)}set oncastchange(J){fe(this,Ie)&&(this.removeEventListener("castchange",fe(this,Ie)),gt(this,Ie,null)),typeof J=="function"&&(gt(this,Ie,J),this.addEventListener("castchange",J))}},l=new WeakMap,m=new WeakMap,v=new WeakMap,E=new WeakSet,I=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,B=function(){return typeof cast!="undefined"&&cast.framework},F=new WeakSet,Q=function(){if(fe(a,M,B))return cast.framework.CastContext.getInstance()},re=new WeakSet,te=function(){var J;return(J=fe(a,F,Q))==null?void 0:J.getCurrentSession()},se=new WeakSet,pe=function(){var J;return(J=fe(a,re,te))==null?void 0:J.getSessionObj().media[0]},Ae=new WeakSet,ke=function(J){return new Promise((Ee,rt)=>{fe(a,se,pe).editTracksInfo(J,Ee,rt)})},we=new WeakSet,nt=function(J){return new Promise((Ee,rt)=>{fe(a,se,pe).getStatus(J,Ee,rt)})},Ue=new WeakSet,st=function(J){return fe(a,F,Q).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...J})},dt=new WeakMap,oe=new WeakMap,w=new WeakMap,le=new WeakMap,$=new WeakMap,Ie=new WeakMap,$e=new WeakSet,tt=function(){var J;return(J=this.castPlayer)==null?void 0:J.isMediaLoaded},Bt=new WeakSet,Je=function(){fe(a,l)===this&&(Object.entries(fe(this,w)).forEach(([J,Ee])=>{fe(this,oe).controller.removeEventListener(J,Ee)}),gt(a,l,void 0),this.muted=fe(this,oe).isMuted,this.currentTime=fe(this,oe).savedPlayerState.currentTime,fe(this,oe).savedPlayerState.isPaused===!1&&this.play())},H=new WeakSet,ri=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:fe(a,F,Q).getCastState()}))},Ht=new WeakSet,it=async function(){var J,Ee;let{SESSION_RESUMED:rt}=cast.framework.SessionState;if(fe(a,F,Q).getSessionState()===rt&&this.castSrc===((J=fe(a,se,pe))==null?void 0:J.media.contentId)){gt(a,l,this),Object.entries(fe(this,w)).forEach(([bt,_t])=>{fe(this,oe).controller.addEventListener(bt,_t)});try{await Mt(Ee=a,we,nt).call(Ee,new chrome.cast.media.GetStatusRequest)}catch(bt){console.error(bt)}fe(this,w)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),fe(this,w)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Qt=new WeakSet,Ke=function(){var J;!fe(a,M,B)||this.castEnabled||(this.castEnabled=!0,Mt(J=a,Ue,st).call(J),this.textTracks.addEventListener("change",Mt(this,Tt,Qi).bind(this)),Mt(this,H,ri).call(this),gt(this,oe,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(fe(this,oe)),gt(this,w,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:Ee})=>{Ee===!1&&Mt(this,Bt,Je).call(this),this.dispatchEvent(new Event(Ee?"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]:()=>{!fe(this,$e,tt)||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 Ee,rt;((Ee=this.castPlayer)==null?void 0:Ee.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"}[(rt=this.castPlayer)==null?void 0:rt.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!fe(this,$e,tt)||(await Promise.resolve(),Mt(this,xt,ht).call(this))}}))},xt=new WeakSet,ht=function(){Mt(this,Tt,Qi).call(this)},Tt=new WeakSet,Qi=async function(){var J,Ee,rt,bt,_t,ai;if(!this.castPlayer)return;let Gi=((Ee=(J=fe(this,oe).mediaInfo)==null?void 0:J.tracks)!=null?Ee:[]).filter(({type:ut})=>ut===chrome.cast.media.TrackType.TEXT),je=[...this.textTracks].filter(({kind:ut})=>ut==="subtitles"||ut==="captions"),di=Gi.map(({language:ut,name:Zi,trackId:ur})=>{var Nr;let{mode:Li}=(Nr=je.find(cr=>cr.language===ut&&cr.label===Zi))!=null?Nr:{};return Li?{mode:Li,trackId:ur}:!1}).filter(Boolean),ui=di.filter(({mode:ut})=>ut!=="showing").map(({trackId:ut})=>ut),Vi=di.find(({mode:ut})=>ut==="showing"),Xi=(_t=(bt=(rt=fe(a,re,te))==null?void 0:rt.getSessionObj().media[0])==null?void 0:bt.activeTrackIds)!=null?_t:[],ci=Xi;if(Xi.length&&(ci=ci.filter(ut=>!ui.includes(ut))),Vi!=null&&Vi.trackId&&(ci=[...ci,Vi.trackId]),ci=[...new Set(ci)],!((ut,Zi)=>ut.length===Zi.length&&ut.every(ur=>Zi.includes(ur)))(Xi,ci))try{let ut=new chrome.cast.media.EditTracksInfoRequest(ci);await Mt(ai=a,Ae,ke).call(ai,ut)}catch(ut){console.error(ut)}},Xe(a,E),Xe(a,M),Xe(a,F),Xe(a,re),Xe(a,se),Xe(a,Ae),Xe(a,we),Xe(a,Ue),Xl(a,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Xl(a,"instances",new Set),Xe(a,l,void 0),Xe(a,m,!1),Xl(a,"initCast",()=>{var J;fe(a,E,I)?fe(a,M,B)?fe(J=a,v).call(J,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var Ee;return fe(Ee=a,v).call(Ee,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var Ee;return fe(Ee=a,v).call(Ee,chrome.cast.isAvailable)})}}),Xe(a,v,J=>{if(J){gt(a,m,!0);let{CAST_STATE_CHANGED:Ee}=cast.framework.CastContextEventType;fe(a,F,Q).addEventListener(Ee,bt=>{a.instances.forEach(_t=>{var ai;return Mt(ai=_t,H,ri).call(ai,bt)})});let{SESSION_STATE_CHANGED:rt}=cast.framework.CastContextEventType;fe(a,F,Q).addEventListener(rt,bt=>{a.instances.forEach(_t=>{var ai;return Mt(ai=_t,Ht,it).call(ai,bt)})}),a.instances.forEach(bt=>{var _t;return Mt(_t=bt,Qt,Ke).call(_t)})}}),a},Yc=globalThis.HTMLVideoElement?Cp(HTMLVideoElement):Cp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",Yc,{extends:"video"}),globalThis.CastableVideoElement=Yc);Yc.initCast();var Zc=["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"],Np=Op.createElement("template");Np.innerHTML=`
891
- <style>
892
- :host {
893
- display: inline-block;
894
- line-height: 0;
895
- width: auto;
896
- height: auto;
897
- }
898
-
899
- video {
900
- max-width: 100%;
901
- max-height: 100%;
902
- min-width: 100%;
903
- min-height: 100%;
904
- object-fit: var(--media-object-fit, contain);
905
- object-position: var(--media-object-position, 50% 50%);
906
- }
907
-
908
- video::-webkit-media-text-track-container {
909
- transform: var(--media-webkit-text-track-transform);
910
- transition: var(--media-webkit-text-track-transition);
911
- }
912
- </style>
913
- <video is="castable-video" part="video" crossorigin></video>
914
- <slot></slot>
915
- `;var Jl,Gs,ed,sd,$c,Cn=class extends Jr.HTMLElement{constructor(){super(),Xe(this,Gs),Xe(this,sd),Xe(this,Jl,void 0),this.attachShadow({mode:"open"}),this.isConnected&&Mt(this,Gs,ed).call(this)}static get observedAttributes(){let n=[],a=m=>m.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(m=>{let v=!1;try{typeof this.prototype[m]=="function"&&(v=!0)}catch{}!v&&m!==m.toUpperCase()&&n.push(m.toLowerCase(),a(m))});let l=Object.getPrototypeOf(this).observedAttributes;return l&&(n=n.concat(l)),n}attributeChangedCallback(n,a,l){Mt(this,Gs,ed).call(this),Mt(this,sd,$c).call(this,n,a,l)}connectedCallback(){Mt(this,Gs,ed).call(this)}};Jl=new WeakMap,Gs=new WeakSet,ed=function(){if(fe(this,Jl))return;gt(this,Jl,!0),this.shadowRoot.append(Np.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Zc.forEach(a=>{this.nativeEl.addEventListener(a,l=>{this.dispatchEvent(new CustomEvent(l.type,{detail:l.detail}))})});let n=this.shadowRoot.querySelector("slot");n.addEventListener("slotchange",()=>{n.assignedElements().forEach(a=>{!["track","source"].includes(a.localName)||this.nativeEl.append(a)})}),Array.prototype.forEach.call(this.attributes,a=>{Mt(this,sd,$c).call(this,a.name,null,a.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},sd=new WeakSet,$c=function(n,a,l){let m=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),v=qE(m,n),E=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;v&&!E?typeof this[v]=="boolean"?l===null?this[v]=!1:this[v]=!0:this[v]=l:l===null?this.nativeEl.removeAttribute(n):["id","class"].indexOf(n)===-1&&this.nativeEl.setAttribute(n,l)};var Fp=[],Up=Op.createElement("video",{is:"castable-video"}),WE=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let n=Object.getPrototypeOf(Up);n&&n!==Jr.HTMLElement.prototype;n=Object.getPrototypeOf(n))Object.getOwnPropertyNames(n).forEach(a=>{WE.indexOf(a)===-1&&Fp.push(a)});Fp.forEach(n=>{if(!(n in Cn.prototype))if(typeof Up[n]=="function")Cn.prototype[n]=function(){return this.nativeEl[n].apply(this.nativeEl,arguments)};else{let a={get(){return this.nativeEl[n]}};n!==n.toUpperCase()&&(a.set=function(l){this.nativeEl[n]=l}),Object.defineProperty(Cn.prototype,n,a)}});function qE(n,a){let l=null;return n.forEach(m=>{m.toLowerCase()==a.toLowerCase()&&(l=m)}),l}Jr.customElements.get("custom-video")||(Jr.customElements.define("custom-video",Cn),Jr.CustomVideoElement=Cn);var Mp=Cn,ae={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",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},YE=Object.values(ae),$E=KE(),jE="mux-video",Ir,Vs,td,Ks,id,rd,ad,nd,jc,zc=class extends Mp{constructor(){super(),Xe(this,nd),Xe(this,Ir,void 0),Xe(this,Vs,void 0),Xe(this,td,void 0),Xe(this,Ks,{}),Xe(this,id,void 0),Xe(this,rd,void 0),Xe(this,ad,void 0),gt(this,td,bp())}static get observedAttributes(){var n;return[...YE,...(n=Mp.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ae.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Dn.includes(n)?this.setAttribute(ae.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Dn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get playerInitTime(){return fe(this,td)}get playerSoftwareName(){var n;return(n=fe(this,rd))!=null?n:jE}set playerSoftwareName(n){gt(this,rd,n)}get playerSoftwareVersion(){var n;return(n=fe(this,id))!=null?n:$E}set playerSoftwareVersion(n){gt(this,id,n)}get _hls(){var n;return(n=fe(this,Ir))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=Tp(this.nativeEl))!=null?n:null}get errorTranslator(){return fe(this,ad)}set errorTranslator(n){gt(this,ad,n)}get src(){return this.getAttribute("src")}set src(n){n!==this.src&&(n==null?this.removeAttribute("src"):this.setAttribute("src",n))}get type(){var n;return(n=this.getAttribute(ae.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ae.TYPE,n):this.removeAttribute(ae.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let a=this.autoplay;n!==a&&(n?this.setAttribute("autoplay",typeof n=="string"?n:""):this.removeAttribute("autoplay"))}get preload(){let n=this.getAttribute("preload");return n===""?"auto":["none","metadata","auto"].includes(n)?n:super.preload}set preload(n){n!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(n)?this.setAttribute("preload",n):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get disableCookies(){return this.hasAttribute(ae.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ae.START_TIME);if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ae.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ae.PLAYBACK_ID,n):this.removeAttribute(ae.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ae.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ae.MAX_RESOLUTION,n):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ae.CUSTOM_DOMAIN,n):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var n;return(n=this.getAttribute(ae.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ae.ENV_KEY,n):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ae.STREAM_TYPE))!=null?n:Ap(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ae.STREAM_TYPE,n):this.removeAttribute(ae.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ae.TARGET_LIVE_WINDOW)?+this.getAttribute(ae.TARGET_LIVE_WINDOW):Sp(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.TARGET_LIVE_WINDOW):this.setAttribute(ae.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,a;if(this.hasAttribute(ae.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:l}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(a=this.nativeEl.seekable.start(0))!=null?a:0;return Math.max(v,m-l)}return kp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ae.LIVE_EDGE_OFFSET))return+this.getAttribute(ae.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.LIVE_EDGE_OFFSET):this.setAttribute(ae.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Wc(this.nativeEl)}async addCuePoints(n){return Vc(this.nativeEl,n)}get activeCuePoint(){return Kc(this.nativeEl)}get cuePoints(){return pp(this.nativeEl)}getStartDate(){return vp(this.nativeEl,this._hls)}get currentPdt(){return gp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ae.PREFER_PLAYBACK);if(n===Hi.MSE||n===Hi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Hi.MSE||n===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,n):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ae.METADATA_URL].includes(n)).reduce((n,a)=>{let l=this.getAttribute(a);return l!=null&&(n[a.replace(/^metadata-/,"").replace(/-/g,"_")]=l),n},{}),...fe(this,Ks)}}set metadata(n){gt(this,Ks,n!=null?n:{}),this.mux&&this.mux.emit("hb",fe(this,Ks))}load(){gt(this,Ir,wp(this,this.nativeEl,fe(this,Ir)))}unload(){qc(this.nativeEl,fe(this,Ir)),gt(this,Ir,void 0)}attributeChangedCallback(n,a,l){var m,v;switch(super.attributeChangedCallback(n,a,l),n){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=l!=null?l:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=l!=null?l:void 0;break;case"src":{let E=!!a,I=!!l;!E&&I?Mt(this,nd,jc).call(this):E&&!I?this.unload():E&&I&&(this.unload(),Mt(this,nd,jc).call(this));break}case"autoplay":if(l===a)break;(m=fe(this,Ir))==null||m.setAutoplay(this.autoplay);break;case"preload":if(l===a)break;(v=fe(this,Ir))==null||v.setPreload(l);break;case ae.PLAYBACK_ID:this.src=_p(l!=null?l:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ae.DEBUG:{let E=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=E);break}case ae.METADATA_URL:l&&fetch(l).then(E=>E.json()).then(E=>this.metadata=E).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${l}!`));break;case ae.STREAM_TYPE:(l==null||l!==a)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ae.TARGET_LIVE_WINDOW:(l==null||l!==a)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Ir=new WeakMap,Vs=new WeakMap,td=new WeakMap,Ks=new WeakMap,id=new WeakMap,rd=new WeakMap,ad=new WeakMap,nd=new WeakSet,jc=async function(){fe(this,Vs)||(await gt(this,Vs,Promise.resolve()),gt(this,Vs,null),this.load())};Jr.customElements.get("mux-video")||(Jr.customElements.define("mux-video",zc),Jr.MuxVideoElement=zc);var Bp=zc;var zE="en",Na={code:zE};var Hp="en";function Ye(n,a=!0){var v,E;let l=a&&(E=(v=Na)==null?void 0:v[n])!=null?E:n,m=a?Na.code:Hp;return new Jc(l,m)}var Jc=class{constructor(a,l=(m=>(m=Na.code)!=null?m:Hp)()){this.message=a,this.locale=l}format(a){return this.message.replace(/\{(\w+)\}/g,(l,m)=>{var v;return(v=a[m])!=null?v:""})}toString(){return this.message}};function Gp(n){let a="";return Object.entries(n).forEach(([l,m])=>{m!=null&&(a+=`${ld(l)}: ${m}; `)}),a?a.trim():void 0}function ld(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function dd(n){return n.replace(/[-_]([a-z])/g,(a,l)=>l.toUpperCase())}function Rr(n){if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}function ud(n){let a=QE(n).toString();return a?"?"+a:""}function QE(n){let a={};for(let l in n)n[l]!=null&&(a[l]=n[l]);return new URLSearchParams(a)}function ea(n){let a=(n!=null?n:"").split(".")[1];if(!a)return{};let l=a.replace(/-/g,"+").replace(/_/g,"/"),m=decodeURIComponent(atob(l).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(m)}var eh=(n,a)=>!n||!a?!1:n.contains(a)?!0:eh(n,a.getRootNode().host);var th="mux.com",XE=()=>{try{return"1.11.0"}catch{}return"UNKNOWN"},ZE=XE(),hd=()=>ZE,ih=(n,{maxResolution:a,token:l,domain:m=th}={})=>{let I=!!l?{token:l}:{redundant_streams:!0,...a?{max_resolution:a}:{}};return`https://stream.${m}/${n}.m3u8${ud(I)}`},Vp=(n,{token:a,thumbnailTime:l,domain:m=th}={})=>{let v=a==null?l:void 0,{aud:E}=ea(a);if(!(a&&E!=="t"))return`https://image.${m}/${n}/thumbnail.webp${ud({token:a,time:v})}`},Kp=(n,{token:a,domain:l=th}={})=>{let{aud:m}=ea(a);if(!(a&&m!=="s"))return`https://image.${l}/${n}/storyboard.vtt${ud({token:a,format:"webp"})}`},Ws=n=>{if(!!n){if([vt.LIVE,vt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return vt.LIVE}};var JE={crossorigin:"crossOrigin",playsinline:"playsInline"};function Wp(n){var a;return(a=JE[n])!=null?a:dd(n)}var Fa,Ua,oi,cd=class{constructor(a,l){Dt(this,Fa,void 0);Dt(this,Ua,void 0);Dt(this,oi,[]);Oi(this,Fa,a),Oi(this,Ua,l)}[Symbol.iterator](){return at(this,oi).values()}get length(){return at(this,oi).length}get value(){var a;return(a=at(this,oi).join(" "))!=null?a:""}set value(a){var l;a!==this.value&&(Oi(this,oi,[]),this.add(...(l=a==null?void 0:a.split(" "))!=null?l:[]))}toString(){return this.value}item(a){return at(this,oi)[a]}values(){return at(this,oi).values()}keys(){return at(this,oi).keys()}forEach(a){at(this,oi).forEach(a)}add(...a){var l,m;a.forEach(v=>{this.contains(v)||at(this,oi).push(v)}),!(this.value===""&&!((l=at(this,Fa))!=null&&l.hasAttribute(`${at(this,Ua)}`)))&&((m=at(this,Fa))==null||m.setAttribute(`${at(this,Ua)}`,`${this.value}`))}remove(...a){var l;a.forEach(m=>{at(this,oi).splice(at(this,oi).indexOf(m),1)}),(l=at(this,Fa))==null||l.setAttribute(`${at(this,Ua)}`,`${this.value}`)}contains(a){return at(this,oi).includes(a)}toggle(a,l){return typeof l!="undefined"?l?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,l){this.remove(a),this.add(l)}};Fa=new WeakMap,Ua=new WeakMap,oi=new WeakMap;var qp=`[mux-player ${hd()}]`;function ta(...n){console.warn(qp,...n)}function ji(...n){console.error(qp,...n)}function rh(n){var l;let a=(l=n.message)!=null?l:"";if(n.context&&(a+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${Ye("Read more: ")}
916
- ${m}${n.file}`}ta(a)}var ii={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ba={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},$p=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),e0=Zc.filter(n=>n!=="error"),t0=Object.values(ii).filter(n=>![ii.PLAYSINLINE].includes(n)),i0=Object.values(Ba);function jp(n){n.querySelectorAll(":scope > track").forEach(a=>{var l;(l=n.media)==null||l.append(a.cloneNode())}),e0.forEach(a=>{var l;(l=n.media)==null||l.addEventListener(a,m=>{n.dispatchEvent(new Event(m.type))})})}var ah=class extends Ft.HTMLElement{static get observedAttributes(){return[...t0,...i0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let a=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(E=>{var M,B;let I=(M=this.media)==null?void 0:M.querySelector(`track[src="${E.src}"]`);I&&((B=this.media)==null||B.removeChild(I))}),v.addedNodes.forEach(E=>{var I;(I=this.media)==null||I.append(E.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,l,m){var v,E;switch(a){case Ba.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Ba.VOLUME:{let I=(v=Rr(m))!=null?v:1;this.media&&(this.media.volume=I);return}case Ba.PLAYBACKRATE:{let I=(E=Rr(m))!=null?E:1;this.media&&(this.media.playbackRate=I,this.media.defaultPlaybackRate=I);return}}}play(){var a,l;return(l=(a=this.media)==null?void 0:a.play())!=null?l:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var l;return(l=this.media)==null?void 0:l.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,l;return(l=(a=this.media)==null?void 0:a.paused)!=null?l:!0}get duration(){var a,l;return(l=(a=this.media)==null?void 0:a.duration)!=null?l:NaN}get ended(){var a,l;return(l=(a=this.media)==null?void 0:a.ended)!=null?l:!1}get buffered(){var a,l;return(l=(a=this.media)==null?void 0:a.buffered)!=null?l:$p}get seekable(){var a,l;return(l=(a=this.media)==null?void 0:a.seekable)!=null?l:$p}get readyState(){var a,l;return(l=(a=this.media)==null?void 0:a.readyState)!=null?l:0}get videoWidth(){var a,l;return(l=(a=this.media)==null?void 0:a.videoWidth)!=null?l:0}get videoHeight(){var a,l;return(l=(a=this.media)==null?void 0:a.videoHeight)!=null?l:0}get currentTime(){var a,l;return(l=(a=this.media)==null?void 0:a.currentTime)!=null?l:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,l;return(l=(a=this.media)==null?void 0:a.volume)!=null?l:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,l;return(l=(a=this.media)==null?void 0:a.playbackRate)!=null?l:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=Rr(this.getAttribute(Ba.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(Ba.PLAYBACKRATE,`${a}`):this.removeAttribute(Ba.PLAYBACKRATE)}get crossOrigin(){return qs(this,ii.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(ii.CROSSORIGIN,`${a}`)}get autoplay(){return qs(this,ii.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(ii.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(ii.AUTOPLAY)}get loop(){return qs(this,ii.LOOP)!=null}set loop(a){a?this.setAttribute(ii.LOOP,""):this.removeAttribute(ii.LOOP)}get muted(){var a,l;return(l=(a=this.media)==null?void 0:a.muted)!=null?l:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return qs(this,ii.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(ii.MUTED,""):this.removeAttribute(ii.MUTED)}get playsInline(){return qs(this,ii.PLAYSINLINE)!=null}set playsInline(a){ji("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(ii.PRELOAD,a):this.removeAttribute(ii.PRELOAD)}};function qs(n,a){return n.media?n.media.getAttribute(a):n.getAttribute(a)}var nh=ah;var r0=Object.defineProperty,a0=(n,a,l)=>a in n?r0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,n0=(n,a,l)=>(a0(n,typeof a!="symbol"?a+"":a,l),l),Jp=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},qe=(n,a,l)=>(Jp(n,a,"read from private field"),l?l.call(n):a.get(n)),dr=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Dr=(n,a,l,m)=>(Jp(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Mn,fd,Ha,Ys,ia,ra,aa,Ga,xn,md,zi,zp=1,Qp=0,s0=1,o0={processCallback(n,a,l){if(!!l){for(let[m,v]of a)if(m in l){let E=l[m];typeof E=="boolean"&&v instanceof li&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=E:typeof E=="function"&&v instanceof li?v.element[v.attributeName]=E:v.value=E}}}},Cr=class extends W.DocumentFragment{constructor(a,l,m=o0){var v;super(),dr(this,Mn,void 0),dr(this,fd,void 0),this.append(a.content.cloneNode(!0)),Dr(this,Mn,ev(this)),Dr(this,fd,m),(v=m.createCallback)==null||v.call(m,this,qe(this,Mn),l),m.processCallback(this,qe(this,Mn),l)}update(a){qe(this,fd).processCallback(this,qe(this,Mn),a)}};Mn=new WeakMap;fd=new WeakMap;var ev=(n,a=[])=>{let l,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let E=new sh;for([l,m]of Zp(v.value))if(!l)E.append(m);else{let I=new li(n,v.name,v.namespaceURI);E.append(I),a.push([m,I])}v.value=E.toString()}for(let v of n.childNodes)if(v.nodeType===zp&&!(v instanceof HTMLTemplateElement))ev(v,a);else if(v.nodeType===zp||v.data.includes("{{")){let E=[];if(v.data)for([l,m]of Zp(v.data))if(!l)E.push(new Text(m));else{let I=new Mr(n);E.push(I),a.push([m,I])}else if(v instanceof HTMLTemplateElement){let I=new $s(n,v);E.push(I),a.push([I.expression,I])}v.replaceWith(...E.flatMap(I=>I.replacementNodes||[I]))}return a},Xp={},Zp=n=>{let a="",l=0,m=Xp[n],v=0,E;if(m)return m;for(m=[];E=n[v];v++)E==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++l==1?(a&&m.push([Qp,a]),a="",v++):E==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--l?(m.push([s0,a.trim()]),a="",v++):a+=E||"";return a&&m.push([Qp,(l>0?"{{":"")+a]),Xp[n]=m},l0=11,pd=class{get value(){return""}set value(a){}toString(){return this.value}},tv=new WeakMap,sh=class{constructor(){dr(this,Ha,[])}[Symbol.iterator](){return qe(this,Ha).values()}get length(){return qe(this,Ha).length}item(a){return qe(this,Ha)[a]}append(...a){for(let l of a)l instanceof li&&tv.set(l,this),qe(this,Ha).push(l)}toString(){return qe(this,Ha).join("")}};Ha=new WeakMap;var li=class extends pd{constructor(a,l,m){super(),dr(this,Ga),dr(this,Ys,""),dr(this,ia,void 0),dr(this,ra,void 0),dr(this,aa,void 0),Dr(this,ia,a),Dr(this,ra,l),Dr(this,aa,m)}get attributeName(){return qe(this,ra)}get attributeNamespace(){return qe(this,aa)}get element(){return qe(this,ia)}get value(){return qe(this,Ys)}set value(a){qe(this,Ys)!==a&&(Dr(this,Ys,a),!qe(this,Ga,xn)||qe(this,Ga,xn).length===1?a==null?qe(this,ia).removeAttributeNS(qe(this,aa),qe(this,ra)):qe(this,ia).setAttributeNS(qe(this,aa),qe(this,ra),a):qe(this,ia).setAttributeNS(qe(this,aa),qe(this,ra),qe(this,Ga,xn)))}get booleanValue(){return qe(this,ia).hasAttributeNS(qe(this,aa),qe(this,ra))}set booleanValue(a){if(!qe(this,Ga,xn)||qe(this,Ga,xn).length===1)this.value=a?"":null;else throw new DOMException("Value is not fully templatized")}};Ys=new WeakMap;ia=new WeakMap;ra=new WeakMap;aa=new WeakMap;Ga=new WeakSet;xn=function(){return tv.get(this)};var Mr=class extends pd{constructor(a,l){super(),dr(this,md,void 0),dr(this,zi,void 0),Dr(this,md,a),Dr(this,zi,l?[...l]:[new Text])}get replacementNodes(){return qe(this,zi)}get parentNode(){return qe(this,md)}get nextSibling(){return qe(this,zi)[qe(this,zi).length-1].nextSibling}get previousSibling(){return qe(this,zi)[0].previousSibling}get value(){return qe(this,zi).map(a=>a.textContent).join("")}set value(a){this.replace(a)}replace(...a){let l=a.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===l0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);l.length||l.push(new Text),Dr(this,zi,d0(qe(this,zi)[0].parentNode,qe(this,zi),l,this.nextSibling))}};md=new WeakMap;zi=new WeakMap;var $s=class extends Mr{constructor(a,l){let m=l.getAttribute("directive")||l.getAttribute("type"),v=l.getAttribute("expression")||l.getAttribute(m)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(a),n0(this,"directive"),this.expression=v,this.template=l,this.directive=m}};function d0(n,a,l,m=null){let v=0,E,I,M,B=l.length,F=a.length;for(;v<B&&v<F&&a[v]==l[v];)v++;for(;v<B&&v<F&&l[B-1]==a[F-1];)m=l[--F,--B];if(v==F)for(;v<B;)n.insertBefore(l[v++],m);if(v==B)for(;v<F;)n.removeChild(a[v++]);else{for(E=a[v];v<B;)M=l[v++],I=E?E.nextSibling:m,E==M?E=I:v<B&&l[v]==I?(n.replaceChild(M,E),E=I):n.insertBefore(M,E);for(;E!=m;)I=E.nextSibling,n.removeChild(E),E=I}return l}var iv={string:n=>String(n)},gd=class{constructor(a){this.template=a,this.state=void 0}},Va=new WeakMap,Ka=new WeakMap,oh={partial:(n,a)=>{a[n.expression]=new gd(n.template)},if:(n,a)=>{var l;if(av(n.expression,a))if(Va.get(n)!==n.template){Va.set(n,n.template);let m=new Cr(n.template,a,yd);n.replace(m),Ka.set(n,m)}else(l=Ka.get(n))==null||l.update(a);else n.replace(""),Va.delete(n),Ka.delete(n)}},u0=Object.keys(oh),yd={processCallback(n,a,l){var m,v;if(!!l)for(let[E,I]of a){if(I instanceof $s){if(!I.directive){let B=u0.find(F=>I.template.hasAttribute(F));B&&(I.directive=B,I.expression=I.template.getAttribute(B))}(m=oh[I.directive])==null||m.call(oh,I,l);continue}let M=av(E,l);if(M instanceof gd){Va.get(I)!==M.template?(Va.set(I,M.template),M=new Cr(M.template,M.state,yd),I.value=M,Ka.set(I,M)):(v=Ka.get(I))==null||v.update(M.state);continue}M?(I instanceof li&&I.attributeName.startsWith("aria-")&&(M=String(M)),I instanceof li?typeof M=="boolean"?I.booleanValue=M:typeof M=="function"?I.element[I.attributeName]=M:I.value=M:(I.value=M,Va.delete(I),Ka.delete(I))):I instanceof li?I.value=void 0:(I.value=void 0,Va.delete(I),Ka.delete(I))}}},rv={"!":n=>!n,"!!":n=>!!n,"==":(n,a)=>n==a,"!=":(n,a)=>n!=a,">":(n,a)=>n>a,">=":(n,a)=>n>=a,"<":(n,a)=>n<a,"<=":(n,a)=>n<=a,"??":(n,a)=>n!=null?n:a,"|":(n,a)=>{var l;return(l=iv[a])==null?void 0:l.call(iv,n)}};function c0(n){return h0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:a})=>a!=="ws")}function av(n,a={}){var l,m,v,E,I,M,B;let F=c0(n);if(F.length===0||F.some(({type:Q})=>!Q))return js(n);if(((l=F[0])==null?void 0:l.token)===">"){let Q=a[(m=F[1])==null?void 0:m.token];if(!Q)return js(n);let re={...a};Q.state=re;let te=F.slice(2);for(let se=0;se<te.length;se+=3){let pe=(v=te[se])==null?void 0:v.token,Ae=(E=te[se+1])==null?void 0:E.token,ke=(I=te[se+2])==null?void 0:I.token;pe&&Ae==="="&&(re[pe]=zs(ke,a))}return Q}if(F.length===1)return vd(F[0])?zs(F[0].token,a):js(n);if(F.length===2){let Q=(M=F[0])==null?void 0:M.token,re=rv[Q];if(!re||!vd(F[1]))return js(n);let te=zs(F[1].token,a);return re(te)}if(F.length===3){let Q=(B=F[1])==null?void 0:B.token,re=rv[Q];if(!re||!vd(F[0])||!vd(F[2]))return js(n);let te=zs(F[0].token,a);if(Q==="|")return re(te,F[2].token);let se=zs(F[2].token,a);return re(te,se)}}function js(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function vd({type:n}){return["number","boolean","string","param"].includes(n)}function zs(n,a){let l=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":l===m&&["'",'"'].includes(l)?n.slice(1,-1):zo(n)?parseFloat(n):a[n]}function h0(n,a){let l,m,v,E=[];for(;n;){v=null,l=n.length;for(let I in a)m=a[I].exec(n),m&&m.index<l&&(v={token:m[0],type:I,matches:m.slice(1)},l=m.index);l&&E.push({token:n.substr(0,l),type:void 0}),v&&E.push(v),n=n.substr(l+(v?v.token.length:0))}return E}var f0=Object.defineProperty,m0=(n,a,l)=>a in n?f0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,Xs=(n,a,l)=>(m0(n,typeof a!="symbol"?a+"":a,l),l),fh=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},uh=(n,a,l)=>(fh(n,a,"read from private field"),l?l.call(n):a.get(n)),Qs=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Wa=(n,a,l,m)=>(fh(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),lh=(n,a,l)=>(fh(n,a,"access private method"),l),Pn,Ed,On,ch,nv,bd,hh,dh={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},sv=ie.createElement("template");sv.innerHTML=`
907
+ <slot hidden name="captions-indicator">${by}</slot>
908
+ `;var dp=(n,r)=>n.label===r.label&&n.language===r.language,Uc=class extends rp{constructor(){super({slotTemplate:mp}),Wa(this,Nc),Wa(this,Hc),Wa(this,js),Wa(this,nu),Wa(this,Kn,[]),Wa(this,Ur,void 0),Wa(this,qi,void 0);let r=ae.createElement("media-chrome-listitem");r.part.add("listitem"),r.value="off",r.textContent="Off",qa(this,Ur,r);let l=this.shadowRoot.querySelector('[name="captions-indicator"]');qa(this,qi,l.firstElementChild),l.addEventListener("slotchange",()=>{let m=l.assignedElements();if(m.length===1&&m[0].nodeName.toLowerCase()==="slot"){let v=m[0].assignedElements();v.length===0?qa(this,qi,m[0].firstElementChild):v.length===1&&qa(this,qi,v[0])}ki(this,qi)||qa(this,qi,l.firstElementChild),qa(this,qi,ki(this,qi).cloneNode(!0)),ki(this,qi).removeAttribute("slot"),ki(this,qi).setAttribute("style",fp)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(r,l,m){if(r===F.MEDIA_SUBTITLES_LIST&&l!==m)qa(this,Kn,Ya(this,Nc,cp).call(this,m,ki(this,Kn))),Ya(this,js,au).call(this);else if(r===F.MEDIA_SUBTITLES_SHOWING&&l!==m){let v=kn(m!=null?m:"")[0];ki(this,Kn).forEach(y=>{y.selected=y.language===v.language&&y.label===v.label}),Ya(this,js,au).call(this)}else r==="aria-multiselectable"&&(this.removeAttribute("aria-multiselectable"),console.warn("Captions List doesn't currently support multiple selections. You can enable multiple items via the media.textTrack API."));super.attributeChangedCallback(r,l,m)}connectedCallback(){Ya(this,js,au).call(this),this.addEventListener("change",Ya(this,nu,Fc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",Ya(this,nu,Fc)),super.disconnectedCallback()}};Kn=new WeakMap;Ur=new WeakMap;qi=new WeakMap;Nc=new WeakSet;cp=function(n,r){let l=n?kn(n!=null?n:""):[],m=[],v=[];return r.forEach(y=>{l.some(I=>dp(I,y))||m.push(y)}),l.forEach(y=>{r.some(I=>dp(I,y))||v.push(y)}),m.forEach(y=>y.el.remove()),r.filter(y=>!m.includes(y)).concat(v)};Hc=new WeakSet;hp=function(n){let r=this.shadowRoot.querySelector("ul slot");n.forEach(l=>{var m;let v=l.el,y=!0,I=(m=l.kind)!=null?m:"subs";if(!v){v=ae.createElement("media-chrome-listitem"),y=!1,v.part.add("listitem"),v.value=Nd(l);let M=ae.createElement("span");M.textContent=l.label,v.append(M),I==="captions"&&v.append(ki(this,qi).cloneNode(!0))}l.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),y||(r.append(v),l.el=v)})};js=new WeakSet;au=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(ki(this,Ur))||n.append(ki(this,Ur)),this.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)?(ki(this,Ur).setAttribute("aria-selected","false"),ki(this,Ur).setAttribute("tabindex","-1")):(ki(this,Ur).setAttribute("aria-selected","true"),ki(this,Ur).setAttribute("tabindex","0")),Ya(this,Hc,hp).call(this,ki(this,Kn))};nu=new WeakSet;Fc=function(){var n;let r=(n=this.selectedOptions[0])==null?void 0:n.value;if(Cr(this,!1),!r)return;let l=new q.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(l)};q.customElements.get("media-captions-listbox")||q.customElements.define("media-captions-listbox",Uc);var Gc=class extends lp{constructor(){super()}init(){let r=ae.createElement("media-captions-button");r.part.add("button"),r.preventClick=!0;let l=ae.createElement("media-captions-listbox");l.part.add("listbox"),l.setAttribute("exportparts","listitem");let m=this.shadowRoot.querySelector("slot[name=button]"),v=this.shadowRoot.querySelector("slot[name=listbox]");m.textContent="",v.textContent="",m.append(r),v.append(l)}};q.customElements.get("media-captions-selectmenu")||q.customElements.define("media-captions-selectmenu",Gc);var ou=Rf(pp(),1),Sp=Rf(gp(),1),_y=Sp.default,wi=_y,zs=class extends Error{constructor(n,r=zs.MEDIA_ERR_CUSTOM,l,m){var v;super(n),this.name="MediaError",this.code=r,this.context=m,this.fatal=l!=null?l:r>=zs.MEDIA_ERR_NETWORK&&r<=zs.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=zs.defaultMessages[this.code])!=null?v:"")}},Tt=zs;Tt.MEDIA_ERR_ABORTED=1,Tt.MEDIA_ERR_NETWORK=2,Tt.MEDIA_ERR_DECODE=3,Tt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Tt.MEDIA_ERR_ENCRYPTED=5,Tt.MEDIA_ERR_CUSTOM=100,Tt.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 Ty=n=>n==null,kp=(n,r)=>Ty(r)?!1:n in r,qc={ANY:"any",MUTED:"muted"},vt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Yi={MSE:"mse",NATIVE:"native"},Yc={HEADER:"header",QUERY:"query",NONE:"none"},Wn=Object.values(Yc),la={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},$c={HLS:la.M3U8},IS=Object.keys($c),RS=[...Object.values(la),"hls","HLS"],oa=(n,r,l,m,v=n)=>{v.addEventListener(r,l,m),n.addEventListener("teardown",()=>{v.removeEventListener(r,l)},{once:!0})};function Ay(n,r,l){r&&l>r&&(l=r);for(let m=0;m<n.length;m++)if(n.start(m)<=l&&n.end(m)>=l)return!0;return!1}var Sy=n=>{let r=n.indexOf("?");if(r<0)return[n];let l=n.slice(0,r),m=n.slice(r);return[l,m]},lu=n=>{let r=n.type;if(r){let m=r.toUpperCase();return kp(m,$c)?$c[m]:r}let{src:l}=n;return l?ky(l):""},wp=n=>n==="VOD"?vt.ON_DEMAND:vt.LIVE,Lp=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,ky=n=>{let r="";try{r=new URL(n).pathname}catch{console.error("invalid url")}let l=r.lastIndexOf(".");if(l<0)return"";let m=r.slice(l+1).toUpperCase();return kp(m,la)?la[m]:""},wy=Object.values(qc),Ep=n=>typeof n=="boolean"||typeof n=="string"&&wy.includes(n),Ly=({autoplay:n},r,l)=>{let m=!1,v=!1,y=Ep(n)?n:!!n,I=()=>{m||oa(r,"playing",()=>{m=!0},{once:!0})};if(I(),oa(r,"loadstart",()=>{m=!1,I(),Wc(r,y)},{once:!0}),oa(r,"loadstart",()=>{l||(v=!Number.isFinite(r.duration)),Wc(r,y)},{once:!0}),l&&l.once(wi.Events.LEVEL_LOADED,(M,B)=>{var H;v=(H=B.details.live)!=null?H:!1}),!y){let M=()=>{!v||(l!=null&&l.liveSyncPosition?r.currentTime=l.liveSyncPosition:Number.isFinite(r.seekable.end(0))&&(r.currentTime=r.seekable.end(0)))};l&&oa(r,"play",()=>{r.preload==="metadata"?l.once(wi.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(y=Ep(M)?M:!!M,Wc(r,y))}},Wc=(n,r)=>{if(!r)return;let l=n.muted,m=()=>n.muted=l;switch(r){case qc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case qc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},Iy=({preload:n,src:r},l,m)=>{let v=J=>{J!=null&&["","none","metadata","auto"].includes(J)?l.setAttribute("preload",J):l.removeAttribute("preload")};if(!m)return v(n),v;let y=!1,I=!1,M=m.config.maxBufferLength,B=m.config.maxBufferSize,H=J=>{v(J);let ee=J!=null?J:l.preload;I||ee==="none"||(ee==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=B),z())},z=()=>{!y&&r&&(y=!0,m.loadSource(r))};return oa(l,"play",()=>{I=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=B,z()},{once:!0}),H(n),H};function Ry(n,r){r.on(wi.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:y})=>{y.forEach(I=>{var M;let B=(M=I.subtitleTrack)!=null?M:I.closedCaptions,H=r.subtitleTracks.findIndex(({lang:z,name:J,type:ee})=>z==(B==null?void 0:B.lang)&&J===I.label&&ee.toLowerCase()===I.kind);uu(n,I.kind,I.label,B==null?void 0:B.lang,`${I.kind}${H}`)})});let l=()=>{var v;if(!r.subtitleTracks.length)return;let y=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),I=`${(v=r.subtitleTracks[r.subtitleTrack])==null?void 0:v.type.toLowerCase()}${r.subtitleTrack}`;if(y&&(r.subtitleTrack<0||(y==null?void 0:y.id)!==I)){let M=r.subtitleTracks.findIndex(({lang:B,name:H,type:z})=>B==y.language&&H===y.label&&z.toLowerCase()===y.kind);r.subtitleTrack=M}y&&(y==null?void 0:y.id)===I&&y.cues&&Array.from(y.cues).forEach(M=>{y.addCue(M)})};n.textTracks.addEventListener("change",l),r.on(wi.Events.CUES_PARSED,(v,{track:y,cues:I})=>{let M=n.textTracks.getTrackById(y);if(!M)return;let B=M.mode==="disabled";B&&(M.mode="hidden"),I.forEach(H=>{var z;(z=M.cues)!=null&&z.getCueById(H.id)||M.addCue(H)}),B&&(M.mode="disabled")}),r.once(wi.Events.DESTROYING,()=>{n.textTracks.removeEventListener("change",l),n.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let m=()=>{Array.from(n.textTracks).forEach(v=>{var y,I;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((y=v.cues)!=null&&y.length)){let M=n.querySelector('track[label="thumbnails"]'),B=(I=M==null?void 0:M.getAttribute("src"))!=null?I:"";M==null||M.removeAttribute("src"),setTimeout(()=>{M==null||M.setAttribute("src",B)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};r.once(wi.Events.MANIFEST_LOADED,m),r.once(wi.Events.MEDIA_ATTACHED,m)}function uu(n,r,l,m,v){let y=document.createElement("track");return y.kind=r,y.label=l,m&&(y.srclang=m),v&&(y.id=v),y.track.mode=["subtitles","captions"].includes(r)?"disabled":"hidden",y.setAttribute("data-removeondestroy",""),n.append(y),y.track}function Ip(n,r){let l=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===r);l==null||l.remove()}var Qs="cuepoints",zc=Object.freeze({label:Qs}),Qc=(n,{label:r=Qs}=zc)=>{var l;return(l=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===r&&m.track.kind==="metadata"))==null?void 0:l.track};async function Xc(n,r,l=zc){let m=Qc(n,l);if(!m){let{label:v=Qs}=l;m=uu(n,"metadata",v),m.mode="hidden",await new Promise(y=>setTimeout(()=>y(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...r].sort(({time:v},{time:y})=>y-v).forEach(({time:v,value:y})=>{var I,M;let B=Array.prototype.findIndex.call(m==null?void 0:m.cues,le=>le.startTime>=v),H=(I=m==null?void 0:m.cues)==null?void 0:I[B],z=H?H.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,J=(M=m==null?void 0:m.cues)==null?void 0:M[B-1];J&&(J.endTime=v);let ee=new VTTCue(v,z,JSON.stringify(y!=null?y:null));m.addCue(ee)}),m}var Rp=n=>({time:n.startTime,value:JSON.parse(n.text)});function Dp(n,r={label:Qs}){let l=Qc(n,r);return l!=null&&l.cues?Array.from(l.cues,m=>Rp(m)):[]}function Zc(n,r={label:Qs}){var l,m;let v=Qc(n,r);if(!((l=v==null?void 0:v.activeCues)!=null&&l.length))return;let{currentTime:y}=n,I=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:B})=>M<=y&&B>y);return Rp(I)}async function Dy(n,r=zc){return new Promise(l=>{oa(n,"loadstart",async()=>{let m=await Xc(n,[],r);oa(n,"cuechange",()=>{let v=Zc(n);if(v){let y=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(y)}},{},m),l(m)})})}function Cp(n,r){if(r){let l=r.playingDate;if(l!=null)return new Date(l.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function Mp(n,r){if(r&&r.playingDate)return r.playingDate;if(typeof n.getStartDate=="function"){let l=n.getStartDate();return new Date(l.getTime()+n.currentTime*1e3)}return new Date(NaN)}var Cy=async n=>fetch(n).then(r=>r.text()).then(r=>{let l=r.split(`
909
+ `).find((m,v,y)=>v&&y[v-1].startsWith("#EXT-X-STREAM-INF"));return fetch(l).then(m=>m.text()).then(m=>m.split(`
910
+ `))}),My=n=>{var r,l;let m=(l=((r=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?r:"").split(":")[1])==null?void 0:l.trim(),v=wp(m),y=Lp(m),I;if(v===vt.LIVE){let M=n.find(B=>B.startsWith("#EXT-X-PART-INF"));M?I=+M.split(":")[1].split("=")[1]*2:I=+n.find(B=>B.startsWith("#EXT-X-TARGETDURATION")).split(":")[1]*3}return{streamType:v,targetLiveWindow:y,liveEdgeStartOffset:I}},xy=async(n,r)=>{if(r===la.MP4)return{streamType:vt.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(r===la.M3U8){let l=await Cy(n);return My(l)}return console.error(`Media type ${r} is an unrecognized or unsupported type for src ${n}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},yp=async(n,r,l=lu({src:n}))=>{var m,v,y;let{streamType:I,targetLiveWindow:M,liveEdgeStartOffset:B}=await xy(n,l);((m=ii.get(r))!=null?m:{}).liveEdgeStartOffset=B,((v=ii.get(r))!=null?v:{}).targetLiveWindow=M,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((y=ii.get(r))!=null?y:{}).streamType=I,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Py=n=>{var r;let l=n.type,m=wp(l),v=Lp(l),y,I=!!((r=n.partList)!=null&&r.length);return m===vt.LIVE&&(y=I?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:y,lowLatency:I}},Oy=(n,r,l)=>{var m,v,y,I,M,B,H,z;let{streamType:J,targetLiveWindow:ee,liveEdgeStartOffset:le,lowLatency:me}=Py(n);if(J===vt.LIVE){me?(l.config.backBufferLength=(m=l.userConfig.backBufferLength)!=null?m:4,l.config.maxFragLookUpTolerance=(v=l.userConfig.maxFragLookUpTolerance)!=null?v:.001,l.config.abrBandWidthUpFactor=(y=l.userConfig.abrBandWidthUpFactor)!=null?y:l.config.abrBandWidthFactor):l.config.backBufferLength=(I=l.userConfig.backBufferLength)!=null?I:8;let _e=Object.freeze({get length(){return r.seekable.length},start(ge){return r.seekable.start(ge)},end(ge){var ye;return ge>this.length?r.seekable.end(ge):(ye=l.liveSyncPosition)!=null?ye:r.seekable.end(ge)}});((M=ii.get(r))!=null?M:{}).seekable=_e}((B=ii.get(r))!=null?B:{}).liveEdgeStartOffset=le,((H=ii.get(r))!=null?H:{}).targetLiveWindow=ee,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((z=ii.get(r))!=null?z:{}).streamType=J,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},bp,_p,Ny=(_p=(bp=globalThis==null?void 0:globalThis.navigator)==null?void 0:bp.userAgent)!=null?_p:"",Fy=Ny.toLowerCase().indexOf("android")!==-1,ii=new WeakMap,xp="mux.com",Tp,Ap,Pp=(Ap=(Tp=wi).isSupported)==null?void 0:Ap.call(Tp),Uy=Fy,Op=()=>ou.default.utils.now(),By=ou.default.utils.generateUUID,Np=(n,{domain:r=xp,maxResolution:l=""}={})=>{if(!n)return;let[m,v=""]=Sy(n),y=new URL(`https://stream.${r}/${m}.m3u8${v}`);return l&&y.searchParams.set("max_resolution",l),y.toString()},Hy=n=>{if(!n)return;let[r]=n.split("?");return r||void 0},Gy=n=>{if(!n||!n.startsWith("https://stream."))return;let[r]=new URL(n).pathname.slice(1).split(".m3u8");return r||void 0},Vy=n=>{var r,l,m;return(r=n==null?void 0:n.metadata)!=null&&r.video_id?n.metadata.video_id:Kp(n)&&(m=(l=Hy(n.playbackId))!=null?l:Gy(n.src))!=null?m:n.src},Fp=n=>{var r;return(r=ii.get(n))==null?void 0:r.error},Up=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.streamType)!=null?l:vt.UNKNOWN},Bp=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.targetLiveWindow)!=null?l:Number.NaN},Jc=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.seekable)!=null?l:n.seekable},Hp=n=>{var r;let l=(r=ii.get(n))==null?void 0:r.liveEdgeStartOffset;if(typeof l!="number")return Number.NaN;let m=Jc(n);return m.length?m.end(m.length-1)-l:Number.NaN},Gp=(n,r,l)=>{eh(r,l);let{metadata:m={}}=n,{view_session_id:v=By()}=m,y=Vy(n);m.view_session_id=v,m.video_id=y,n.metadata=m,ii.set(r,{});let I=Ky(n,r);qy(n,r,I),Yy(n,r,I),Dy(r);let M=Ly(n,r,I),B=Iy(n,r,I);return{engine:I,setAutoplay:M,setPreload:B}},eh=(n,r)=>{let l=r==null?void 0:r.engine;l&&(l.detachMedia(),l.destroy()),(n==null?void 0:n.mux)&&!n.mux.deleted&&(n.mux.destroy(),delete n.mux),n&&(n.removeAttribute("src"),n.load(),n.removeEventListener("error",qp),n.removeEventListener("error",jc),n.removeEventListener("durationchange",Wp),ii.delete(n),n.dispatchEvent(new Event("teardown")))};function Vp(n,r){var l;let m=lu(n);if(m!==la.M3U8)return!0;let v=!m||((l=r.canPlayType(m))!=null?l:!0),{preferPlayback:y}=n,I=y===Yi.MSE,M=y===Yi.NATIVE;return v&&(M||!(Pp&&(I||Uy)))}var Ky=(n,r)=>{let{debug:l,streamType:m,startTime:v=-1,metadata:y,preferCmcd:I}=n,M=lu(n)===la.M3U8,B=Vp(n,r);if(M&&!B&&Pp){let H={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},z=Wy(m),J=I!==Yc.NONE?{useHeaders:I===Yc.HEADER,sessionId:y==null?void 0:y.view_session_id,contentId:y==null?void 0:y.video_id}:void 0;return new wi({debug:l,startPosition:v,cmcd:J,...H,...z})}},Wy=n=>n===vt.LIVE?{backBufferLength:8}:{},Kp=({playbackId:n,src:r,customDomain:l})=>{if(n)return!0;if(typeof r!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(r,m).hostname.toLocaleLowerCase();return v.includes(xp)||!!l&&v.includes(l.toLocaleLowerCase())},qy=(n,r,l)=>{var m;let{envKey:v}=n,y=Kp(n);if(v||y){let{playerInitTime:I,playerSoftwareName:M,playerSoftwareVersion:B,beaconCollectionDomain:H,debug:z,disableCookies:J}=n,ee={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},le=me=>typeof me.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(me):me;ou.default.monitor(r,{debug:z,beaconCollectionDomain:H,hlsjs:l,Hls:l?wi:void 0,automaticErrorTracking:!1,errorTranslator:le,disableCookies:J,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:B,player_init_time:I,...ee}})}},Yy=(n,r,l)=>{var m;let v=Vp(n,r),{src:y}=n;if(r&&v){let I=lu(n);typeof y=="string"?(r.preload==="none"?oa(r,"loadstart",()=>yp(y,r,I)):yp(y,r,I),r.setAttribute("src",y),n.startTime&&(((m=ii.get(r))!=null?m:{}).startTime=n.startTime,r.addEventListener("durationchange",Wp,{once:!0}))):r.removeAttribute("src"),r.addEventListener("error",qp),r.addEventListener("error",jc),r.addEventListener("emptied",()=>{r.querySelectorAll("track[data-removeondestroy]").forEach(M=>{M.remove()})},{once:!0})}else l&&y?(l.once(wi.Events.LEVEL_LOADED,(I,M)=>{Oy(M.details,r,l)}),l.on(wi.Events.ERROR,(I,M)=>{let B={[wi.ErrorTypes.NETWORK_ERROR]:Tt.MEDIA_ERR_NETWORK,[wi.ErrorTypes.MEDIA_ERROR]:Tt.MEDIA_ERR_DECODE},H=new Tt("",B[M.type]);H.fatal=M.fatal,H.data=M,r.dispatchEvent(new CustomEvent("error",{detail:H}))}),r.addEventListener("error",jc),Ry(r,l),l.attachMedia(r)):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 Wp(n){var r;let l=n.target,m=(r=ii.get(l))==null?void 0:r.startTime;if(!!m&&Ay(l.seekable,l.duration,m)){let v=l.preload==="auto";v&&(l.preload="none"),l.currentTime=m,v&&(l.preload="auto")}}async function qp(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let r=n.target;if(!(r!=null&&r.error))return;let{message:l,code:m}=r.error,v=new Tt(l,m);if(r.src&&(m!==Tt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:y}=await fetch(r.src);v.data={response:{code:y}}}catch{}r.dispatchEvent(new CustomEvent("error",{detail:v}))}function jc(n){var r,l;if(!(n instanceof CustomEvent)||!(n.detail instanceof Tt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((r=ii.get(m))!=null?r:{}).error=v,(l=m.mux)==null||l.emit("error",{player_error_code:v.code,player_error_message:v.message,player_error_context:v.context}))}var $y=Object.defineProperty,jy=(n,r,l)=>r in n?$y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,qn=(n,r,l)=>(jy(n,typeof r!="symbol"?r+"":r,l),l),oh=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},pe=(n,r,l)=>(oh(n,r,"read from private field"),l?l.call(n):r.get(n)),Ye=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},ht=(n,r,l,m)=>(oh(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),kt=(n,r,l)=>(oh(n,r,"access private method"),l),gu=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends gu{}globalThis.DocumentFragment=n}var lh=class extends gu{},zy=class extends gu{},Qy={get(n){},define(n,r,l){},upgrade(n){},whenDefined(n){return Promise.resolve(lh)}},du,Xy=class{constructor(n,r={}){Ye(this,du,void 0),ht(this,du,r==null?void 0:r.detail)}get detail(){return pe(this,du)}initCustomEvent(){}};du=new WeakMap;function Zy(n,r){return new lh}var zp={document:{createElement:Zy},DocumentFragment,customElements:Qy,CustomEvent:Xy,EventTarget:gu,HTMLElement:lh,HTMLVideoElement:zy},Qp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",cu=Qp?zp:globalThis,MS=Qp?zp.document:globalThis.document,Jy=()=>{try{return"0.15.3"}catch{}return"UNKNOWN"},e0=Jy(),t0=()=>e0,Yp=n=>{var r,l,m,v,y,I,M,B,H,z,J,ee,le,me,_e,ge,ye,Ee,de,Be,Ge,re,k,se,W,Se,Xe,at,jt,it,U,di,zt,nt,ri,$e,Gt,gt,Ct,tr;return r=class extends n{constructor(){super(),Ye(this,Xe),Ye(this,jt),Ye(this,U),Ye(this,zt),Ye(this,ri),Ye(this,Gt),Ye(this,Ct),qn(this,"castEnabled",!1),Ye(this,Ge,{paused:!1}),Ye(this,re,void 0),Ye(this,k,{}),Ye(this,se,void 0),Ye(this,W,void 0),Ye(this,Se,void 0),r.instances.add(this),kt(this,ri,$e).call(this)}static get castElement(){return pe(r,l)}static get castEnabled(){return pe(r,m)}static get castState(){var te;return(te=pe(r,H,z))==null?void 0:te.getCastState()}static async exitCast(){try{await pe(r,H,z).endCurrentSession(!0)}catch(te){console.error(te);return}}get castPlayer(){if(r.castElement===this)return pe(this,re)}attributeChangedCallback(te){if(this.castPlayer)switch(te){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(te={}){var ke;kt(ke=r,de,Be).call(ke,te),ht(r,l,this),Object.entries(pe(this,k)).forEach(([st,wt])=>{pe(this,re).controller.addEventListener(st,wt)});try{await pe(r,H,z).requestSession()}catch{ht(r,l,void 0);return}pe(this,Ge).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(st){console.error(st)}}async load(){var te,ke;if(!this.castPlayer)return super.load();let st=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),wt=[...this.querySelectorAll("track")].filter(({kind:Ze,src:vi})=>vi&&(Ze==="subtitles"||Ze==="captions")),Rt=[],ci=0;wt.length&&(st.tracks=wt.map(Ze=>{let vi=++ci;Rt.length===0&&Ze.track.mode==="showing"&&Rt.push(vi);let gi=new chrome.cast.media.Track(vi,chrome.cast.media.TrackType.TEXT);return gi.trackContentId=Ze.src,gi.trackContentType="text/vtt",gi.subtype=Ze.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,gi.name=Ze.label,gi.language=Ze.srclang,gi})),this.castStreamType==="live"?st.streamType=chrome.cast.media.StreamType.LIVE:st.streamType=chrome.cast.media.StreamType.BUFFERED,st.metadata=new chrome.cast.media.GenericMediaMetadata,st.metadata.title=this.title,st.metadata.images=[{url:this.poster}];let $i=new chrome.cast.media.LoadRequest(st);$i.currentTime=(te=super.currentTime)!=null?te:0,$i.autoplay=!pe(this,Ge).paused,$i.activeTrackIds=Rt,await((ke=pe(r,J,ee))==null?void 0:ke.loadMedia($i)),this.dispatchEvent(new Event("volumechange"))}play(){var te;if(this.castPlayer){this.castPlayer.isPaused&&((te=this.castPlayer.controller)==null||te.playOrPause());return}return super.play()}pause(){var te;if(this.castPlayer){this.castPlayer.isPaused||(te=this.castPlayer.controller)==null||te.playOrPause();return}super.pause()}get castSrc(){var te,ke,st;return(st=(ke=this.getAttribute("cast-src"))!=null?ke:(te=this.querySelector("source"))==null?void 0:te.src)!=null?st:this.currentSrc}set castSrc(te){this.castSrc!=te&&this.setAttribute("cast-src",`${te}`)}get castContentType(){var te;return(te=this.getAttribute("cast-content-type"))!=null?te:void 0}set castContentType(te){this.setAttribute("cast-content-type",`${te}`)}get castStreamType(){var te,ke;return(ke=(te=this.getAttribute("cast-stream-type"))!=null?te:this.streamType)!=null?ke:void 0}set castStreamType(te){this.setAttribute("cast-stream-type",`${te}`)}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 te;return this.castPlayer?(te=this.castPlayer)==null?void 0:te.isMuted:super.muted}set muted(te){var ke;if(this.castPlayer){(te&&!this.castPlayer.isMuted||!te&&this.castPlayer.isMuted)&&((ke=this.castPlayer.controller)==null||ke.muteOrUnmute());return}super.muted=te}get volume(){var te,ke;return this.castPlayer?(ke=(te=this.castPlayer)==null?void 0:te.volumeLevel)!=null?ke:1:super.volume}set volume(te){var ke;if(this.castPlayer){this.castPlayer.volumeLevel=te,(ke=this.castPlayer.controller)==null||ke.setVolumeLevel();return}super.volume=te}get duration(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.duration)!=null?ke:NaN:super.duration}get currentTime(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.currentTime)!=null?ke:0:super.currentTime}set currentTime(te){var ke;if(this.castPlayer){this.castPlayer.currentTime=te,(ke=this.castPlayer.controller)==null||ke.seek();return}super.currentTime=te}get onentercast(){return pe(this,se)}set onentercast(te){pe(this,se)&&(this.removeEventListener("entercast",pe(this,se)),ht(this,se,null)),typeof te=="function"&&(ht(this,se,te),this.addEventListener("entercast",te))}get onleavecast(){return pe(this,W)}set onleavecast(te){pe(this,W)&&(this.removeEventListener("leavecast",pe(this,W)),ht(this,W,null)),typeof te=="function"&&(ht(this,W,te),this.addEventListener("leavecast",te))}get oncastchange(){return pe(this,Se)}set oncastchange(te){pe(this,Se)&&(this.removeEventListener("castchange",pe(this,Se)),ht(this,Se,null)),typeof te=="function"&&(ht(this,Se,te),this.addEventListener("castchange",te))}},l=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakSet,I=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,B=function(){return typeof cast!="undefined"&&cast.framework},H=new WeakSet,z=function(){if(pe(r,M,B))return cast.framework.CastContext.getInstance()},J=new WeakSet,ee=function(){var te;return(te=pe(r,H,z))==null?void 0:te.getCurrentSession()},le=new WeakSet,me=function(){var te;return(te=pe(r,J,ee))==null?void 0:te.getSessionObj().media[0]},_e=new WeakSet,ge=function(te){return new Promise((ke,st)=>{pe(r,le,me).editTracksInfo(te,ke,st)})},ye=new WeakSet,Ee=function(te){return new Promise((ke,st)=>{pe(r,le,me).getStatus(te,ke,st)})},de=new WeakSet,Be=function(te){return pe(r,H,z).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...te})},Ge=new WeakMap,re=new WeakMap,k=new WeakMap,se=new WeakMap,W=new WeakMap,Se=new WeakMap,Xe=new WeakSet,at=function(){var te;return(te=this.castPlayer)==null?void 0:te.isMediaLoaded},jt=new WeakSet,it=function(){pe(r,l)===this&&(Object.entries(pe(this,k)).forEach(([te,ke])=>{pe(this,re).controller.removeEventListener(te,ke)}),ht(r,l,void 0),this.muted=pe(this,re).isMuted,this.currentTime=pe(this,re).savedPlayerState.currentTime,pe(this,re).savedPlayerState.isPaused===!1&&this.play())},U=new WeakSet,di=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:pe(r,H,z).getCastState()}))},zt=new WeakSet,nt=async function(){var te,ke;let{SESSION_RESUMED:st}=cast.framework.SessionState;if(pe(r,H,z).getSessionState()===st&&this.castSrc===((te=pe(r,le,me))==null?void 0:te.media.contentId)){ht(r,l,this),Object.entries(pe(this,k)).forEach(([wt,Rt])=>{pe(this,re).controller.addEventListener(wt,Rt)});try{await kt(ke=r,ye,Ee).call(ke,new chrome.cast.media.GetStatusRequest)}catch(wt){console.error(wt)}pe(this,k)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),pe(this,k)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},ri=new WeakSet,$e=function(){var te;!pe(r,M,B)||this.castEnabled||(this.castEnabled=!0,kt(te=r,de,Be).call(te),this.textTracks.addEventListener("change",kt(this,Ct,tr).bind(this)),kt(this,U,di).call(this),ht(this,re,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(pe(this,re)),ht(this,k,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ke})=>{ke===!1&&kt(this,jt,it).call(this),this.dispatchEvent(new Event(ke?"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]:()=>{!pe(this,Xe,at)||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 ke,st;((ke=this.castPlayer)==null?void 0:ke.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"}[(st=this.castPlayer)==null?void 0:st.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!pe(this,Xe,at)||(await Promise.resolve(),kt(this,Gt,gt).call(this))}}))},Gt=new WeakSet,gt=function(){kt(this,Ct,tr).call(this)},Ct=new WeakSet,tr=async function(){var te,ke,st,wt,Rt,ci;if(!this.castPlayer)return;let $i=((ke=(te=pe(this,re).mediaInfo)==null?void 0:te.tracks)!=null?ke:[]).filter(({type:ct})=>ct===chrome.cast.media.TrackType.TEXT),Ze=[...this.textTracks].filter(({kind:ct})=>ct==="subtitles"||ct==="captions"),vi=$i.map(({language:ct,name:rr,trackId:gr})=>{var $r;let{mode:xi}=($r=Ze.find(Er=>Er.language===ct&&Er.label===rr))!=null?$r:{};return xi?{mode:xi,trackId:gr}:!1}).filter(Boolean),gi=vi.filter(({mode:ct})=>ct!=="showing").map(({trackId:ct})=>ct),ji=vi.find(({mode:ct})=>ct==="showing"),ir=(Rt=(wt=(st=pe(r,J,ee))==null?void 0:st.getSessionObj().media[0])==null?void 0:wt.activeTrackIds)!=null?Rt:[],Ei=ir;if(ir.length&&(Ei=Ei.filter(ct=>!gi.includes(ct))),ji!=null&&ji.trackId&&(Ei=[...Ei,ji.trackId]),Ei=[...new Set(Ei)],!((ct,rr)=>ct.length===rr.length&&ct.every(gr=>rr.includes(gr)))(ir,Ei))try{let ct=new chrome.cast.media.EditTracksInfoRequest(Ei);await kt(ci=r,_e,ge).call(ci,ct)}catch(ct){console.error(ct)}},Ye(r,y),Ye(r,M),Ye(r,H),Ye(r,J),Ye(r,le),Ye(r,_e),Ye(r,ye),Ye(r,de),qn(r,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),qn(r,"instances",new Set),Ye(r,l,void 0),Ye(r,m,!1),qn(r,"initCast",()=>{var te;pe(r,y,I)?pe(r,M,B)?pe(te=r,v).call(te,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)})}}),Ye(r,v,te=>{if(te){ht(r,m,!0);let{CAST_STATE_CHANGED:ke}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(ke,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,U,di).call(ci,wt)})});let{SESSION_STATE_CHANGED:st}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(st,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,zt,nt).call(ci,wt)})}),r.instances.forEach(wt=>{var Rt;return kt(Rt=wt,ri,$e).call(Rt)})}}),r},ih=globalThis.HTMLVideoElement?Yp(HTMLVideoElement):Yp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",ih,{extends:"video"}),globalThis.CastableVideoElement=ih);ih.initCast();var Eu=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],$p,rh=($p=globalThis.document)==null?void 0:$p.createElement("template");rh&&(rh.innerHTML=`
911
+ <style>
912
+ :host {
913
+ display: inline-block;
914
+ line-height: 0;
915
+ }
916
+
917
+ audio {
918
+ max-width: 100%;
919
+ max-height: 100%;
920
+ min-width: 100%;
921
+ min-height: 100%;
922
+ }
923
+ </style>
924
+ <slot></slot>
925
+ `);var jp,ah=(jp=globalThis.document)==null?void 0:jp.createElement("template");ah&&(ah.innerHTML=`
926
+ <style>
927
+ :host {
928
+ display: inline-block;
929
+ line-height: 0;
930
+ }
931
+
932
+ video {
933
+ max-width: 100%;
934
+ max-height: 100%;
935
+ min-width: 100%;
936
+ min-height: 100%;
937
+ object-fit: var(--media-object-fit, contain);
938
+ object-position: var(--media-object-position, 50% 50%);
939
+ }
940
+
941
+ video::-webkit-media-text-track-container {
942
+ transform: var(--media-webkit-text-track-transform);
943
+ transition: var(--media-webkit-text-track-transition);
944
+ }
945
+ </style>
946
+ <slot></slot>
947
+ `);var uh=(n,{tag:r,is:l})=>{var m,v,y,I,M,B,H,z,J,ee,le,me,_e;let ge=(m=globalThis.document)==null?void 0:m.createElement(r,{is:l}),ye=ge?i0(ge):[];return v=class extends n{constructor(){super(),Ye(this,z),Ye(this,ee),Ye(this,me),Ye(this,B,void 0),Ye(this,H,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var Ee,de,Be;return kt(Ee=v,I,M).call(Ee),[...(Be=(de=ge==null?void 0:ge.constructor)==null?void 0:de.observedAttributes)!=null?Be:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var Ee,de;return(de=(Ee=pe(this,H))!=null?Ee:this.shadowRoot.querySelector(r))!=null?de:this.querySelector(r)}set nativeEl(Ee){ht(this,H,Ee)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(Ee){this.toggleAttribute("muted",Boolean(Ee))}get src(){return this.getAttribute("src")}set src(Ee){this.setAttribute("src",`${Ee}`)}get preload(){var Ee,de;return(de=this.getAttribute("preload"))!=null?de:(Ee=this.nativeEl)==null?void 0:Ee.preload}set preload(Ee){this.setAttribute("preload",`${Ee}`)}attributeChangedCallback(Ee,de,Be){kt(this,z,J).call(this),kt(this,me,_e).call(this,Ee,de,Be)}connectedCallback(){kt(this,z,J).call(this)}},y=new WeakMap,I=new WeakSet,M=function(){if(pe(this,y))return;ht(this,y,!0);let Ee=new Set(this.observedAttributes);Ee.delete("muted");for(let de of ye)if(!(de in this.prototype))if(typeof ge[de]=="function")this.prototype[de]=function(...Be){return kt(this,z,J).call(this),(()=>this.call?this.call(de,...Be):this.nativeEl[de].apply(this.nativeEl,Be))()};else{let Be={get(){var Ge,re,k;kt(this,z,J).call(this);let se=de.toLowerCase();if(Ee.has(se)){let W=this.getAttribute(se);return W===null?!1:W===""?!0:W}return(k=(Ge=this.get)==null?void 0:Ge.call(this,de))!=null?k:(re=this.nativeEl)==null?void 0:re[de]}};de!==de.toUpperCase()&&(Be.set=function(Ge){kt(this,z,J).call(this);let re=de.toLowerCase();if(Ee.has(re)){Ge===!0||Ge===!1||Ge==null?this.toggleAttribute(re,Boolean(Ge)):this.setAttribute(re,Ge);return}if(this.set){this.set(de,Ge);return}this.nativeEl[de]=Ge}),Object.defineProperty(this.prototype,de,Be)}},B=new WeakMap,H=new WeakMap,z=new WeakSet,J=function(){var Ee,de;if(pe(this,B))return;if(ht(this,B,!0),!this.nativeEl){let re=document.createElement(r,{is:l});re.part=r,this.shadowRoot.append(re)}this.nativeEl.muted=this.hasAttribute("muted");for(let re of ye)kt(this,ee,le).call(this,re);let Be=new Map,Ge=this.shadowRoot.querySelector("slot:not([name])");Ge==null||Ge.addEventListener("slotchange",()=>{let re=new Map(Be);Ge.assignedElements().filter(k=>["track","source"].includes(k.localName)).forEach(k=>{var se,W;re.delete(k);let Se=Be.get(k);Se||(Se=k.cloneNode(),Be.set(k,Se)),(W=(se=this.nativeEl).append)==null||W.call(se,Se)}),re.forEach(k=>k.remove())});for(let re of this.constructor.Events)(de=(Ee=this.shadowRoot).addEventListener)==null||de.call(Ee,re,k=>{k.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(k.type,{detail:k.detail}))},!0)},ee=new WeakSet,le=function(Ee){if(Object.prototype.hasOwnProperty.call(this,Ee)){let de=this[Ee];delete this[Ee],this[Ee]=de}},me=new WeakSet,_e=function(Ee,de,Be){var Ge,re,k,se;["id","class"].includes(Ee)||(Be===null?(re=(Ge=this.nativeEl).removeAttribute)==null||re.call(Ge,Ee):(se=(k=this.nativeEl).setAttribute)==null||se.call(k,Ee,Be))},Ye(v,I),qn(v,"Events",Eu),qn(v,"template",r.endsWith("audio")?rh:ah),Ye(v,y,void 0),v};function i0(n){let r=[];for(let l=Object.getPrototypeOf(n);l&&l!==HTMLElement.prototype;l=Object.getPrototypeOf(l))r.push(...Object.getOwnPropertyNames(l));return r}var PS=globalThis.document?uh(HTMLElement,{tag:"video"}):class{},OS=globalThis.document?uh(HTMLElement,{tag:"audio"}):class{};Eu.push("castchange","entercast","leavecast");var th=uh(cu.HTMLElement,{tag:"video",is:"castable-video"}),ne={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",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},r0=Object.values(ne),a0=t0(),n0="mux-video",Br,Xs,hu,Zs,fu,mu,pu,vu,nh,sh=class extends th{constructor(){super(),Ye(this,vu),Ye(this,Br,void 0),Ye(this,Xs,void 0),Ye(this,hu,void 0),Ye(this,Zs,{}),Ye(this,fu,void 0),Ye(this,mu,void 0),Ye(this,pu,void 0),ht(this,hu,Op())}static get observedAttributes(){var n;return[...r0,...(n=th.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ne.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Wn.includes(n)?this.setAttribute(ne.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.PREFER_CMCD))}get playerInitTime(){return pe(this,hu)}get playerSoftwareName(){var n;return(n=pe(this,mu))!=null?n:n0}set playerSoftwareName(n){ht(this,mu,n)}get playerSoftwareVersion(){var n;return(n=pe(this,fu))!=null?n:a0}set playerSoftwareVersion(n){ht(this,fu,n)}get _hls(){var n;return(n=pe(this,Br))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=Fp(this.nativeEl))!=null?n:null}get errorTranslator(){return pe(this,pu)}set errorTranslator(n){ht(this,pu,n)}get src(){return this.getAttribute("src")}set src(n){n!==this.src&&(n==null?this.removeAttribute("src"):this.setAttribute("src",n))}get type(){var n;return(n=this.getAttribute(ne.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ne.TYPE,n):this.removeAttribute(ne.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let r=this.autoplay;n!==r&&(n?this.setAttribute("autoplay",typeof n=="string"?n:""):this.removeAttribute("autoplay"))}get preload(){let n=this.getAttribute("preload");return n===""?"auto":["none","metadata","auto"].includes(n)?n:super.preload}set preload(n){n!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(n)?this.setAttribute("preload",n):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ne.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG))}get disableCookies(){return this.hasAttribute(ne.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ne.START_TIME);if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ne.START_TIME):this.setAttribute(ne.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ne.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ne.PLAYBACK_ID,n):this.removeAttribute(ne.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ne.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ne.MAX_RESOLUTION,n):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ne.CUSTOM_DOMAIN,n):this.removeAttribute(ne.CUSTOM_DOMAIN))}get envKey(){var n;return(n=this.getAttribute(ne.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ne.ENV_KEY,n):this.removeAttribute(ne.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ne.STREAM_TYPE))!=null?n:Up(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ne.STREAM_TYPE,n):this.removeAttribute(ne.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ne.TARGET_LIVE_WINDOW)?+this.getAttribute(ne.TARGET_LIVE_WINDOW):Bp(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.TARGET_LIVE_WINDOW):this.setAttribute(ne.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,r;if(this.hasAttribute(ne.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:l}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(r=this.nativeEl.seekable.start(0))!=null?r:0;return Math.max(v,m-l)}return Hp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ne.LIVE_EDGE_OFFSET))return+this.getAttribute(ne.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.LIVE_EDGE_OFFSET):this.setAttribute(ne.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Jc(this.nativeEl)}async addCuePoints(n){return Xc(this.nativeEl,n)}get activeCuePoint(){return Zc(this.nativeEl)}get cuePoints(){return Dp(this.nativeEl)}getStartDate(){return Cp(this.nativeEl,this._hls)}get currentPdt(){return Mp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ne.PREFER_PLAYBACK);if(n===Yi.MSE||n===Yi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Yi.MSE||n===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,n):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ne.METADATA_URL].includes(n)).reduce((n,r)=>{let l=this.getAttribute(r);return l!=null&&(n[r.replace(/^metadata-/,"").replace(/-/g,"_")]=l),n},{}),...pe(this,Zs)}}set metadata(n){ht(this,Zs,n!=null?n:{}),this.mux&&this.mux.emit("hb",pe(this,Zs))}load(){ht(this,Br,Gp(this,this.nativeEl,pe(this,Br)))}unload(){eh(this.nativeEl,pe(this,Br)),ht(this,Br,void 0)}attributeChangedCallback(n,r,l){var m,v;switch(th.observedAttributes.includes(n)&&!["src","autoplay","preload"].includes(n)&&super.attributeChangedCallback(n,r,l),n){case ne.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=l!=null?l:void 0;break;case ne.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=l!=null?l:void 0;break;case"src":{let y=!!r,I=!!l;!y&&I?kt(this,vu,nh).call(this):y&&!I?this.unload():y&&I&&(this.unload(),kt(this,vu,nh).call(this));break}case"autoplay":if(l===r)break;(m=pe(this,Br))==null||m.setAutoplay(this.autoplay);break;case"preload":if(l===r)break;(v=pe(this,Br))==null||v.setPreload(l);break;case ne.PLAYBACK_ID:this.src=Np(l!=null?l:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ne.DEBUG:{let y=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=y);break}case ne.METADATA_URL:l&&fetch(l).then(y=>y.json()).then(y=>this.metadata=y).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${l}!`));break;case ne.STREAM_TYPE:(l==null||l!==r)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ne.TARGET_LIVE_WINDOW:(l==null||l!==r)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Br=new WeakMap,Xs=new WeakMap,hu=new WeakMap,Zs=new WeakMap,fu=new WeakMap,mu=new WeakMap,pu=new WeakMap,vu=new WeakSet,nh=async function(){pe(this,Xs)||(await ht(this,Xs,Promise.resolve()),ht(this,Xs,null),this.load())};cu.customElements.get("mux-video")||(cu.customElements.define("mux-video",sh),cu.MuxVideoElement=sh);var Xp=sh;var s0="en",$a={code:s0};var Zp="en";function Qe(n,r=!0){var v,y;let l=r&&(y=(v=$a)==null?void 0:v[n])!=null?y:n,m=r?$a.code:Zp;return new dh(l,m)}var dh=class{constructor(r,l=(m=>(m=$a.code)!=null?m:Zp)()){this.message=r,this.locale=l}format(r){return this.message.replace(/\{(\w+)\}/g,(l,m)=>{var v;return(v=r[m])!=null?v:""})}toString(){return this.message}};function Jp(n){let r="";return Object.entries(n).forEach(([l,m])=>{m!=null&&(r+=`${yu(l)}: ${m}; `)}),r?r.trim():void 0}function yu(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function bu(n){return n.replace(/[-_]([a-z])/g,(r,l)=>l.toUpperCase())}function Hr(n){if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}function _u(n){let r=o0(n).toString();return r?"?"+r:""}function o0(n){let r={};for(let l in n)n[l]!=null&&(r[l]=n[l]);return new URLSearchParams(r)}function ua(n){let r=(n!=null?n:"").split(".")[1];if(!r)return{};let l=r.replace(/-/g,"+").replace(/_/g,"/"),m=decodeURIComponent(atob(l).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(m)}var ch=(n,r)=>!n||!r?!1:n.contains(r)?!0:ch(n,r.getRootNode().host);var hh="mux.com",l0=()=>{try{return"1.11.1"}catch{}return"UNKNOWN"},u0=l0(),Au=()=>u0,fh=(n,{maxResolution:r,token:l,domain:m=hh}={})=>{let I=!!l?{token:l}:{redundant_streams:!0,...r?{max_resolution:r}:{}};return`https://stream.${m}/${n}.m3u8${_u(I)}`},ev=(n,{token:r,thumbnailTime:l,domain:m=hh}={})=>{let v=r==null?l:void 0,{aud:y}=ua(r);if(!(r&&y!=="t"))return`https://image.${m}/${n}/thumbnail.webp${_u({token:r,time:v})}`},tv=(n,{token:r,domain:l=hh}={})=>{let{aud:m}=ua(r);if(!(r&&m!=="s"))return`https://image.${l}/${n}/storyboard.vtt${_u({token:r,format:"webp"})}`},Js=n=>{if(!!n){if([vt.LIVE,vt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return vt.LIVE}};var d0={crossorigin:"crossOrigin",playsinline:"playsInline"};function iv(n){var r;return(r=d0[n])!=null?r:bu(n)}var ja,za,mi,Tu=class{constructor(r,l){Bt(this,ja,void 0);Bt(this,za,void 0);Bt(this,mi,[]);Gi(this,ja,r),Gi(this,za,l)}[Symbol.iterator](){return ot(this,mi).values()}get length(){return ot(this,mi).length}get value(){var r;return(r=ot(this,mi).join(" "))!=null?r:""}set value(r){var l;r!==this.value&&(Gi(this,mi,[]),this.add(...(l=r==null?void 0:r.split(" "))!=null?l:[]))}toString(){return this.value}item(r){return ot(this,mi)[r]}values(){return ot(this,mi).values()}keys(){return ot(this,mi).keys()}forEach(r){ot(this,mi).forEach(r)}add(...r){var l,m;r.forEach(v=>{this.contains(v)||ot(this,mi).push(v)}),!(this.value===""&&!((l=ot(this,ja))!=null&&l.hasAttribute(`${ot(this,za)}`)))&&((m=ot(this,ja))==null||m.setAttribute(`${ot(this,za)}`,`${this.value}`))}remove(...r){var l;r.forEach(m=>{ot(this,mi).splice(ot(this,mi).indexOf(m),1)}),(l=ot(this,ja))==null||l.setAttribute(`${ot(this,za)}`,`${this.value}`)}contains(r){return ot(this,mi).includes(r)}toggle(r,l){return typeof l!="undefined"?l?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,l){this.remove(r),this.add(l)}};ja=new WeakMap,za=new WeakMap,mi=new WeakMap;var rv=`[mux-player ${Au()}]`;function da(...n){console.warn(rv,...n)}function Ji(...n){console.error(rv,...n)}function mh(n){var l;let r=(l=n.message)!=null?l:"";if(n.context&&(r+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";r+=` ${Qe("Read more: ")}
948
+ ${m}${n.file}`}da(r)}var ui={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Qa={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},nv=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),c0=Eu.filter(n=>n!=="error"),h0=Object.values(ui).filter(n=>![ui.PLAYSINLINE].includes(n)),f0=Object.values(Qa);function sv(n){n.querySelectorAll(":scope > track").forEach(r=>{var l;(l=n.media)==null||l.append(r.cloneNode())}),c0.forEach(r=>{var l;(l=n.media)==null||l.addEventListener(r,m=>{n.dispatchEvent(new Event(m.type))})})}var ph=class extends qt.HTMLElement{static get observedAttributes(){return[...h0,...f0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let r=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(y=>{var M,B;let I=(M=this.media)==null?void 0:M.querySelector(`track[src="${y.src}"]`);I&&((B=this.media)==null||B.removeChild(I))}),v.addedNodes.forEach(y=>{var I;(I=this.media)==null||I.append(y.cloneNode())}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(r,l,m){var v,y;switch(r){case Qa.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Qa.VOLUME:{let I=(v=Hr(m))!=null?v:1;this.media&&(this.media.volume=I);return}case Qa.PLAYBACKRATE:{let I=(y=Hr(m))!=null?y:1;this.media&&(this.media.playbackRate=I,this.media.defaultPlaybackRate=I);return}}}play(){var r,l;return(l=(r=this.media)==null?void 0:r.play())!=null?l:Promise.reject()}pause(){var r;(r=this.media)==null||r.pause()}requestCast(r){var l;return(l=this.media)==null?void 0:l.requestCast(r)}get media(){var r;return(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video")}get paused(){var r,l;return(l=(r=this.media)==null?void 0:r.paused)!=null?l:!0}get duration(){var r,l;return(l=(r=this.media)==null?void 0:r.duration)!=null?l:NaN}get ended(){var r,l;return(l=(r=this.media)==null?void 0:r.ended)!=null?l:!1}get buffered(){var r,l;return(l=(r=this.media)==null?void 0:r.buffered)!=null?l:nv}get seekable(){var r,l;return(l=(r=this.media)==null?void 0:r.seekable)!=null?l:nv}get readyState(){var r,l;return(l=(r=this.media)==null?void 0:r.readyState)!=null?l:0}get videoWidth(){var r,l;return(l=(r=this.media)==null?void 0:r.videoWidth)!=null?l:0}get videoHeight(){var r,l;return(l=(r=this.media)==null?void 0:r.videoHeight)!=null?l:0}get currentTime(){var r,l;return(l=(r=this.media)==null?void 0:r.currentTime)!=null?l:0}set currentTime(r){this.media&&(this.media.currentTime=Number(r))}get volume(){var r,l;return(l=(r=this.media)==null?void 0:r.volume)!=null?l:1}set volume(r){this.media&&(this.media.volume=Number(r))}get playbackRate(){var r,l;return(l=(r=this.media)==null?void 0:r.playbackRate)!=null?l:1}set playbackRate(r){this.media&&(this.media.playbackRate=Number(r))}get defaultPlaybackRate(){var r;return(r=Hr(this.getAttribute(Qa.PLAYBACKRATE)))!=null?r:1}set defaultPlaybackRate(r){r!=null?this.setAttribute(Qa.PLAYBACKRATE,`${r}`):this.removeAttribute(Qa.PLAYBACKRATE)}get crossOrigin(){return eo(this,ui.CROSSORIGIN)}set crossOrigin(r){this.setAttribute(ui.CROSSORIGIN,`${r}`)}get autoplay(){return eo(this,ui.AUTOPLAY)!=null}set autoplay(r){r?this.setAttribute(ui.AUTOPLAY,typeof r=="string"?r:""):this.removeAttribute(ui.AUTOPLAY)}get loop(){return eo(this,ui.LOOP)!=null}set loop(r){r?this.setAttribute(ui.LOOP,""):this.removeAttribute(ui.LOOP)}get muted(){var r,l;return(l=(r=this.media)==null?void 0:r.muted)!=null?l:!1}set muted(r){this.media&&(this.media.muted=Boolean(r))}get defaultMuted(){return eo(this,ui.MUTED)!=null}set defaultMuted(r){r?this.setAttribute(ui.MUTED,""):this.removeAttribute(ui.MUTED)}get playsInline(){return eo(this,ui.PLAYSINLINE)!=null}set playsInline(r){Ji("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(r){["","none","metadata","auto"].includes(r)?this.setAttribute(ui.PRELOAD,r):this.removeAttribute(ui.PRELOAD)}};function eo(n,r){return n.media?n.media.getAttribute(r):n.getAttribute(r)}var vh=ph;var m0=Object.defineProperty,p0=(n,r,l)=>r in n?m0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,v0=(n,r,l)=>(p0(n,typeof r!="symbol"?r+"":r,l),l),cv=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},ze=(n,r,l)=>(cv(n,r,"read from private field"),l?l.call(n):r.get(n)),vr=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Gr=(n,r,l,m)=>(cv(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Yn,Su,Xa,to,ca,ha,fa,Za,$n,ku,er,ov=1,lv=0,g0=1,E0={processCallback(n,r,l){if(!!l){for(let[m,v]of r)if(m in l){let y=l[m];typeof y=="boolean"&&v instanceof pi&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=y:typeof y=="function"&&v instanceof pi?v.element[v.attributeName]=y:v.value=y}}}},Vr=class extends q.DocumentFragment{constructor(r,l,m=E0){var v;super(),vr(this,Yn,void 0),vr(this,Su,void 0),this.append(r.content.cloneNode(!0)),Gr(this,Yn,hv(this)),Gr(this,Su,m),(v=m.createCallback)==null||v.call(m,this,ze(this,Yn),l),m.processCallback(this,ze(this,Yn),l)}update(r){ze(this,Su).processCallback(this,ze(this,Yn),r)}};Yn=new WeakMap;Su=new WeakMap;var hv=(n,r=[])=>{let l,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let y=new gh;for([l,m]of dv(v.value))if(!l)y.append(m);else{let I=new pi(n,v.name,v.namespaceURI);y.append(I),r.push([m,I])}v.value=y.toString()}for(let v of n.childNodes)if(v.nodeType===ov&&!(v instanceof HTMLTemplateElement))hv(v,r);else if(v.nodeType===ov||v.data.includes("{{")){let y=[];if(v.data)for([l,m]of dv(v.data))if(!l)y.push(new Text(m));else{let I=new Kr(n);y.push(I),r.push([m,I])}else if(v instanceof HTMLTemplateElement){let I=new io(n,v);y.push(I),r.push([I.expression,I])}v.replaceWith(...y.flatMap(I=>I.replacementNodes||[I]))}return r},uv={},dv=n=>{let r="",l=0,m=uv[n],v=0,y;if(m)return m;for(m=[];y=n[v];v++)y==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++l==1?(r&&m.push([lv,r]),r="",v++):y==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--l?(m.push([g0,r.trim()]),r="",v++):r+=y||"";return r&&m.push([lv,(l>0?"{{":"")+r]),uv[n]=m},y0=11,wu=class{get value(){return""}set value(r){}toString(){return this.value}},fv=new WeakMap,gh=class{constructor(){vr(this,Xa,[])}[Symbol.iterator](){return ze(this,Xa).values()}get length(){return ze(this,Xa).length}item(r){return ze(this,Xa)[r]}append(...r){for(let l of r)l instanceof pi&&fv.set(l,this),ze(this,Xa).push(l)}toString(){return ze(this,Xa).join("")}};Xa=new WeakMap;var pi=class extends wu{constructor(r,l,m){super(),vr(this,Za),vr(this,to,""),vr(this,ca,void 0),vr(this,ha,void 0),vr(this,fa,void 0),Gr(this,ca,r),Gr(this,ha,l),Gr(this,fa,m)}get attributeName(){return ze(this,ha)}get attributeNamespace(){return ze(this,fa)}get element(){return ze(this,ca)}get value(){return ze(this,to)}set value(r){ze(this,to)!==r&&(Gr(this,to,r),!ze(this,Za,$n)||ze(this,Za,$n).length===1?r==null?ze(this,ca).removeAttributeNS(ze(this,fa),ze(this,ha)):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),r):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),ze(this,Za,$n)))}get booleanValue(){return ze(this,ca).hasAttributeNS(ze(this,fa),ze(this,ha))}set booleanValue(r){if(!ze(this,Za,$n)||ze(this,Za,$n).length===1)this.value=r?"":null;else throw new DOMException("Value is not fully templatized")}};to=new WeakMap;ca=new WeakMap;ha=new WeakMap;fa=new WeakMap;Za=new WeakSet;$n=function(){return fv.get(this)};var Kr=class extends wu{constructor(r,l){super(),vr(this,ku,void 0),vr(this,er,void 0),Gr(this,ku,r),Gr(this,er,l?[...l]:[new Text])}get replacementNodes(){return ze(this,er)}get parentNode(){return ze(this,ku)}get nextSibling(){return ze(this,er)[ze(this,er).length-1].nextSibling}get previousSibling(){return ze(this,er)[0].previousSibling}get value(){return ze(this,er).map(r=>r.textContent).join("")}set value(r){this.replace(r)}replace(...r){let l=r.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===y0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);l.length||l.push(new Text),Gr(this,er,b0(ze(this,er)[0].parentNode,ze(this,er),l,this.nextSibling))}};ku=new WeakMap;er=new WeakMap;var io=class extends Kr{constructor(r,l){let m=l.getAttribute("directive")||l.getAttribute("type"),v=l.getAttribute("expression")||l.getAttribute(m)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(r),v0(this,"directive"),this.expression=v,this.template=l,this.directive=m}};function b0(n,r,l,m=null){let v=0,y,I,M,B=l.length,H=r.length;for(;v<B&&v<H&&r[v]==l[v];)v++;for(;v<B&&v<H&&l[B-1]==r[H-1];)m=l[--H,--B];if(v==H)for(;v<B;)n.insertBefore(l[v++],m);if(v==B)for(;v<H;)n.removeChild(r[v++]);else{for(y=r[v];v<B;)M=l[v++],I=y?y.nextSibling:m,y==M?y=I:v<B&&l[v]==I?(n.replaceChild(M,y),y=I):n.insertBefore(M,y);for(;y!=m;)I=y.nextSibling,n.removeChild(y),y=I}return l}var mv={string:n=>String(n)},Iu=class{constructor(r){this.template=r,this.state=void 0}},Ja=new WeakMap,en=new WeakMap,Eh={partial:(n,r)=>{r[n.expression]=new Iu(n.template)},if:(n,r)=>{var l;if(vv(n.expression,r))if(Ja.get(n)!==n.template){Ja.set(n,n.template);let m=new Vr(n.template,r,Ru);n.replace(m),en.set(n,m)}else(l=en.get(n))==null||l.update(r);else n.replace(""),Ja.delete(n),en.delete(n)}},_0=Object.keys(Eh),Ru={processCallback(n,r,l){var m,v;if(!!l)for(let[y,I]of r){if(I instanceof io){if(!I.directive){let B=_0.find(H=>I.template.hasAttribute(H));B&&(I.directive=B,I.expression=I.template.getAttribute(B))}(m=Eh[I.directive])==null||m.call(Eh,I,l);continue}let M=vv(y,l);if(M instanceof Iu){Ja.get(I)!==M.template?(Ja.set(I,M.template),M=new Vr(M.template,M.state,Ru),I.value=M,en.set(I,M)):(v=en.get(I))==null||v.update(M.state);continue}M?(I instanceof pi&&I.attributeName.startsWith("aria-")&&(M=String(M)),I instanceof pi?typeof M=="boolean"?I.booleanValue=M:typeof M=="function"?I.element[I.attributeName]=M:I.value=M:(I.value=M,Ja.delete(I),en.delete(I))):I instanceof pi?I.value=void 0:(I.value=void 0,Ja.delete(I),en.delete(I))}}},pv={"!":n=>!n,"!!":n=>!!n,"==":(n,r)=>n==r,"!=":(n,r)=>n!=r,">":(n,r)=>n>r,">=":(n,r)=>n>=r,"<":(n,r)=>n<r,"<=":(n,r)=>n<=r,"??":(n,r)=>n!=null?n:r,"|":(n,r)=>{var l;return(l=mv[r])==null?void 0:l.call(mv,n)}};function T0(n){return A0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:r})=>r!=="ws")}function vv(n,r={}){var l,m,v,y,I,M,B;let H=T0(n);if(H.length===0||H.some(({type:z})=>!z))return ro(n);if(((l=H[0])==null?void 0:l.token)===">"){let z=r[(m=H[1])==null?void 0:m.token];if(!z)return ro(n);let J={...r};z.state=J;let ee=H.slice(2);for(let le=0;le<ee.length;le+=3){let me=(v=ee[le])==null?void 0:v.token,_e=(y=ee[le+1])==null?void 0:y.token,ge=(I=ee[le+2])==null?void 0:I.token;me&&_e==="="&&(J[me]=ao(ge,r))}return z}if(H.length===1)return Lu(H[0])?ao(H[0].token,r):ro(n);if(H.length===2){let z=(M=H[0])==null?void 0:M.token,J=pv[z];if(!J||!Lu(H[1]))return ro(n);let ee=ao(H[1].token,r);return J(ee)}if(H.length===3){let z=(B=H[1])==null?void 0:B.token,J=pv[z];if(!J||!Lu(H[0])||!Lu(H[2]))return ro(n);let ee=ao(H[0].token,r);if(z==="|")return J(ee,H[2].token);let le=ao(H[2].token,r);return J(ee,le)}}function ro(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function Lu({type:n}){return["number","boolean","string","param"].includes(n)}function ao(n,r){let l=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":l===m&&["'",'"'].includes(l)?n.slice(1,-1):sl(n)?parseFloat(n):r[n]}function A0(n,r){let l,m,v,y=[];for(;n;){v=null,l=n.length;for(let I in r)m=r[I].exec(n),m&&m.index<l&&(v={token:m[0],type:I,matches:m.slice(1)},l=m.index);l&&y.push({token:n.substr(0,l),type:void 0}),v&&y.push(v),n=n.substr(l+(v?v.token.length:0))}return y}var S0=Object.defineProperty,k0=(n,r,l)=>r in n?S0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,so=(n,r,l)=>(k0(n,typeof r!="symbol"?r+"":r,l),l),Sh=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},_h=(n,r,l)=>(Sh(n,r,"read from private field"),l?l.call(n):r.get(n)),no=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},tn=(n,r,l,m)=>(Sh(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),yh=(n,r,l)=>(Sh(n,r,"access private method"),l),jn,Du,zn,Th,gv,Cu,Ah,bh={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Ev=ae.createElement("template");Ev.innerHTML=`
917
949
  <style>
918
950
  :host {
919
951
  display: inline-block;
@@ -924,8 +956,18 @@ ${m}${n.file}`}ta(a)}var ii={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:
924
956
  width: 100%;
925
957
  height: 100%;
926
958
  }
959
+
960
+ media-controller:not([mediasubtitleslist]) media-captions-selectmenu,
961
+ media-captions-button:not([mediasubtitleslist]),
962
+ media-volume-range[mediavolumeunavailable],
963
+ media-airplay-button[mediaairplayunavailable],
964
+ media-fullscreen-button[mediafullscreenunavailable],
965
+ media-cast-button[mediacastunavailable],
966
+ media-pip-button[mediapipunavailable] {
967
+ display: none;
968
+ }
927
969
  </style>
928
- `;var Nn=class extends W.HTMLElement{constructor(){super(),Qs(this,ch),Qs(this,bd),Xs(this,"renderRoot"),Xs(this,"renderer"),Qs(this,Pn,void 0),Qs(this,Ed,void 0),Qs(this,On,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let a=new MutationObserver(l=>{l.some(m=>{let v=m.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(dh[m.attributeName]||m.attributeName.startsWith("breakpoint-"))})&&this.render()});a.observe(this,{attributes:!0}),a.observe(this.renderRoot,{attributes:!0,subtree:!0}),lh(this,ch,nv).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var a;return(a=uh(this,Pn))!=null?a:this.constructor.template}set template(a){Wa(this,On,null),Wa(this,Pn,a),this.createRenderer()}get props(){var a,l,m;let v=[...Array.from((l=(a=this.mediaController)==null?void 0:a.attributes)!=null?l:[]).filter(({name:I})=>dh[I]||I.startsWith("breakpoint-")),...Array.from(this.attributes)],E={};for(let I of v){let M=(m=dh[I.name])!=null?m:Tf(I.name),{value:B}=I;B!=null?(zo(B)&&(B=parseFloat(B)),E[M]=B===""?!0:B):E[M]=!1}return E}attributeChangedCallback(a,l,m){a==="template"&&l!=m&&lh(this,bd,hh).call(this)}connectedCallback(){lh(this,bd,hh).call(this)}createRenderer(){this.template&&this.template!==uh(this,Ed)&&(Wa(this,Ed,this.template),this.renderer=new Cr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(sv.content.cloneNode(!0),this.renderer))}render(){var a;(a=this.renderer)==null||a.update(this.props)}};Pn=new WeakMap;Ed=new WeakMap;On=new WeakMap;ch=new WeakSet;nv=function(n){if(Object.prototype.hasOwnProperty.call(this,n)){let a=this[n];delete this[n],this[n]=a}};bd=new WeakSet;hh=function(){var n;let a=this.getAttribute("template");if(!a||a===uh(this,On))return;let l=this.getRootNode(),m=(n=l==null?void 0:l.getElementById)==null?void 0:n.call(l,a);if(m){Wa(this,On,a),Wa(this,Pn,m),this.createRenderer();return}p0(a)&&(Wa(this,On,a),v0(a).then(v=>{let E=ie.createElement("template");E.innerHTML=v,Wa(this,Pn,E),this.createRenderer()}).catch(console.error))};Xs(Nn,"template");Xs(Nn,"observedAttributes",["template"]);Xs(Nn,"processor",yd);function p0(n){if(!/^(\/|\.\/|https?:\/\/)/.test(n))return!1;let a=/^https?:\/\//.test(n)?void 0:location.origin;try{new URL(n,a)}catch{return!1}return!0}async function v0(n){let a=await fetch(n);if(a.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${a.status}`);return a.text()}W.customElements.get("media-theme")||W.customElements.define("media-theme",Nn);var ov=`:host {
970
+ `;var Qn=class extends q.HTMLElement{constructor(){super(),no(this,Th),no(this,Cu),so(this,"renderRoot"),so(this,"renderer"),no(this,jn,void 0),no(this,Du,void 0),no(this,zn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let r=new MutationObserver(l=>{l.some(m=>{let v=m.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(bh[m.attributeName]||m.attributeName.startsWith("breakpoint"))})&&this.render()});r.observe(this,{attributes:!0}),r.observe(this.renderRoot,{attributes:!0,subtree:!0}),yh(this,Th,gv).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var r;return(r=_h(this,jn))!=null?r:this.constructor.template}set template(r){tn(this,zn,null),tn(this,jn,r),this.createRenderer()}get props(){var r,l,m;let v=[...Array.from((l=(r=this.mediaController)==null?void 0:r.attributes)!=null?l:[]).filter(({name:I})=>bh[I]||I.startsWith("breakpoint")),...Array.from(this.attributes)],y={};for(let I of v){let M=(m=bh[I.name])!=null?m:xf(I.name),{value:B}=I;B!=null?(sl(B)&&(B=parseFloat(B)),y[M]=B===""?!0:B):y[M]=!1}return y}attributeChangedCallback(r,l,m){r==="template"&&l!=m&&yh(this,Cu,Ah).call(this)}connectedCallback(){yh(this,Cu,Ah).call(this)}createRenderer(){this.template&&this.template!==_h(this,Du)&&(tn(this,Du,this.template),this.renderer=new Vr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(Ev.content.cloneNode(!0),this.renderer))}render(){var r;(r=this.renderer)==null||r.update(this.props)}};jn=new WeakMap;Du=new WeakMap;zn=new WeakMap;Th=new WeakSet;gv=function(n){if(Object.prototype.hasOwnProperty.call(this,n)){let r=this[n];delete this[n],this[n]=r}};Cu=new WeakSet;Ah=function(){var n;let r=this.getAttribute("template");if(!r||r===_h(this,zn))return;let l=this.getRootNode(),m=(n=l==null?void 0:l.getElementById)==null?void 0:n.call(l,r);if(m){tn(this,zn,r),tn(this,jn,m),this.createRenderer();return}w0(r)&&(tn(this,zn,r),L0(r).then(v=>{let y=ae.createElement("template");y.innerHTML=v,tn(this,jn,y),this.createRenderer()}).catch(console.error))};so(Qn,"template");so(Qn,"observedAttributes",["template"]);so(Qn,"processor",Ru);function w0(n){if(!/^(\/|\.\/|https?:\/\/)/.test(n))return!1;let r=/^https?:\/\//.test(n)?void 0:location.origin;try{new URL(n,r)}catch{return!1}return!0}async function L0(n){let r=await fetch(n);if(r.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${r.status}`);return r.text()}q.customElements.get("media-theme")||q.customElements.define("media-theme",Qn);var yv=`:host {
929
971
  --media-control-display: var(--controls);
930
972
  --media-loading-indicator-display: var(--loading-indicator);
931
973
  --media-dialog-display: var(--dialog);
@@ -1041,7 +1083,7 @@ media-theme {
1041
1083
  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
1042
1084
  --media-title-display-display: var(--title-display, var(--bottom-title-display));
1043
1085
  }
1044
- `;var lv=`<!-- prettier-ignore -->
1086
+ `;var bv=`<!-- prettier-ignore -->
1045
1087
  <template id="media-theme-mux">
1046
1088
  <style>
1047
1089
  :host {
@@ -1053,7 +1095,7 @@ media-theme {
1053
1095
  --media-range-bar-color: var(--_primary-color);
1054
1096
  --media-control-background: var(--_secondary-color);
1055
1097
  --media-control-hover-background: var(--_secondary-color);
1056
- --media-time-buffered-color: rgba(255, 255, 255, 0.4);
1098
+ --media-time-range-buffered-color: rgba(255, 255, 255, 0.4);
1057
1099
  --media-range-track-background:
1058
1100
  linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
1059
1101
  linear-gradient(rgba(20, 20, 30, 0.7), rgba(20, 20, 30, 0.7));
@@ -1096,8 +1138,8 @@ media-theme {
1096
1138
  width: 100%;
1097
1139
  }
1098
1140
 
1099
- [disabled],
1100
- [aria-disabled='true'] {
1141
+ [disabled]:not(media-live-button),
1142
+ [aria-disabled='true']:not(media-live-button) {
1101
1143
  opacity: 60%;
1102
1144
  cursor: not-allowed;
1103
1145
  }
@@ -1106,7 +1148,7 @@ media-theme {
1106
1148
  z-index: 10;
1107
1149
  }
1108
1150
 
1109
- media-controller:not(:is([media-captions-list], [media-subtitles-list])) media-captions-selectmenu {
1151
+ media-controller:not([mediasubtitleslist]) media-captions-selectmenu {
1110
1152
  --captions-selectmenu: none;
1111
1153
  }
1112
1154
 
@@ -1116,7 +1158,7 @@ media-theme {
1116
1158
  media-controller ::slotted([slot='media']) {
1117
1159
  --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
1118
1160
  }
1119
- media-controller:is([media-paused],:not([user-inactive])) ::slotted([slot='media']) {
1161
+ media-controller:is([mediapaused],:not([userinactive])) ::slotted([slot='media']) {
1120
1162
  /* 42px is the height of the control bar and progress bar
1121
1163
  * with an additional 5px as a buffer, to get 47px */
1122
1164
  --media-webkit-text-track-transform: translateY(-47px);
@@ -1131,23 +1173,23 @@ media-theme {
1131
1173
  --media-text-color: white;
1132
1174
  }
1133
1175
 
1134
- media-volume-range[media-volume-unavailable] {
1176
+ media-volume-range[mediavolumeunavailable] {
1135
1177
  --volume-range: none;
1136
1178
  }
1137
1179
 
1138
- media-airplay-button[media-airplay-unavailable] {
1180
+ media-airplay-button[mediaairplayunavailable] {
1139
1181
  --airplay-button: none;
1140
1182
  }
1141
1183
 
1142
- media-fullscreen-button[media-fullscreen-unavailable] {
1184
+ media-fullscreen-button[mediafullscreenunavailable] {
1143
1185
  --fullscreen-button: none;
1144
1186
  }
1145
1187
 
1146
- media-cast-button[media-cast-unavailable] {
1188
+ media-cast-button[mediacastunavailable] {
1147
1189
  --cast-button: none;
1148
1190
  }
1149
1191
 
1150
- media-pip-button[media-pip-unavailable] {
1192
+ media-pip-button[mediapipunavailable] {
1151
1193
  --pip-button: none;
1152
1194
  }
1153
1195
 
@@ -1169,11 +1211,11 @@ media-theme {
1169
1211
  --media-control-padding: 4px 3px;
1170
1212
  }
1171
1213
 
1172
- [breakpoint-sm] media-control-bar {
1214
+ [breakpointsm] media-control-bar {
1173
1215
  --media-control-padding: 9px 5px;
1174
1216
  }
1175
1217
 
1176
- [breakpoint-md] media-control-bar {
1218
+ [breakpointmd] media-control-bar {
1177
1219
  --media-control-padding: 9px 7px;
1178
1220
  }
1179
1221
 
@@ -1222,7 +1264,7 @@ media-theme {
1222
1264
  transition: background-color 1s;
1223
1265
  }
1224
1266
 
1225
- media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
1267
+ media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
1226
1268
  background-color: var(--controls-backdrop-color, var(--controls, transparent));
1227
1269
  transition: background-color 0.25s;
1228
1270
  }
@@ -1286,7 +1328,7 @@ media-theme {
1286
1328
  opacity: 1;
1287
1329
  }
1288
1330
 
1289
- media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
1331
+ media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
1290
1332
  opacity: 0;
1291
1333
  transition-delay: 400ms;
1292
1334
  }
@@ -1343,7 +1385,7 @@ media-theme {
1343
1385
 
1344
1386
  <template partial="SeekBackwardButton">
1345
1387
  <media-seek-backward-button
1346
- seek-offset="{{backwardSeekOffset}}"
1388
+ seekoffset="{{backwardseekoffset}}"
1347
1389
  part="{{section ?? 'bottom'}} seek-backward button"
1348
1390
  disabled="{{disabled}}"
1349
1391
  aria-disabled="{{disabled}}"
@@ -1351,7 +1393,7 @@ media-theme {
1351
1393
  <svg aria-hidden="true" viewBox="0 0 22 24" slot="backward">
1352
1394
  <path d="M11 6V3L5.37 7 11 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 11 6Z" />
1353
1395
  <text class="value" transform="translate(2.5 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
1354
- {{backwardSeekOffset}}
1396
+ {{backwardseekoffset}}
1355
1397
  </text>
1356
1398
  </svg>
1357
1399
  </media-seek-backward-button>
@@ -1359,7 +1401,7 @@ media-theme {
1359
1401
 
1360
1402
  <template partial="SeekForwardButton">
1361
1403
  <media-seek-forward-button
1362
- seek-offset="{{forwardSeekOffset}}"
1404
+ seekoffset="{{forwardseekoffset}}"
1363
1405
  part="{{section ?? 'bottom'}} seek-forward button"
1364
1406
  disabled="{{disabled}}"
1365
1407
  aria-disabled="{{disabled}}"
@@ -1367,7 +1409,7 @@ media-theme {
1367
1409
  <svg aria-hidden="true" viewBox="0 0 22 24" slot="forward">
1368
1410
  <path d="M11 6V3l5.61 4L11 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 11 6Z" />
1369
1411
  <text class="value" transform="translate(10 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
1370
- {{forwardSeekOffset}}
1412
+ {{forwardseekoffset}}
1371
1413
  </text>
1372
1414
  </svg>
1373
1415
  </media-seek-forward-button>
@@ -1415,7 +1457,6 @@ media-theme {
1415
1457
 
1416
1458
  <template partial="CaptionsMenuButton">
1417
1459
  <media-captions-selectmenu
1418
- default-showing="{{defaultShowingCaptions}}"
1419
1460
  part="bottom captions selectmenu"
1420
1461
  disabled="{{disabled}}"
1421
1462
  aria-disabled="{{disabled}}"
@@ -1491,7 +1532,7 @@ media-theme {
1491
1532
 
1492
1533
  <template partial="PlaybackRateButton">
1493
1534
  <media-playback-rate-button
1494
- rates="{{playbackRates}}"
1535
+ rates="{{playbackrates}}"
1495
1536
  part="bottom playback-rate button"
1496
1537
  disabled="{{disabled}}"
1497
1538
  aria-disabled="{{disabled}}"
@@ -1508,8 +1549,8 @@ media-theme {
1508
1549
 
1509
1550
  <template partial="TimeDisplay">
1510
1551
  <media-time-display
1511
- remaining="{{defaultShowRemainingTime}}"
1512
- show-duration="{{!hideDuration}}"
1552
+ remaining="{{defaultshowremainingtime}}"
1553
+ showduration="{{!hideduration}}"
1513
1554
  part="bottom time display"
1514
1555
  disabled="{{disabled}}"
1515
1556
  aria-disabled="{{disabled}}"
@@ -1525,23 +1566,24 @@ media-theme {
1525
1566
  </template>
1526
1567
 
1527
1568
  <media-controller
1528
- default-stream-type="{{defaultStreamType ?? 'on-demand'}}"
1569
+ defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
1529
1570
  breakpoints="sm:300 md:700"
1530
- gestures-disabled="{{disabled}}"
1571
+ gesturesdisabled="{{disabled}}"
1531
1572
  hotkeys="{{hotkeys}}"
1532
1573
  nohotkeys="{{nohotkeys}}"
1533
1574
  novolumepref="{{novolumepref}}"
1534
1575
  audio="{{audio}}"
1535
1576
  noautoseektolive="{{noautoseektolive}}"
1577
+ defaultsubtitles="{{defaultsubtitles}}"
1536
1578
  exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
1537
1579
  >
1538
1580
  <slot name="media" slot="media"></slot>
1539
1581
  <slot name="poster" slot="poster"></slot>
1540
- <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
1582
+ <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
1541
1583
 
1542
1584
  <template if="audio">
1543
1585
 
1544
- <template if="streamType == 'on-demand'">
1586
+ <template if="streamtype == 'on-demand'">
1545
1587
  <template if="title">
1546
1588
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
1547
1589
  </template>
@@ -1559,9 +1601,9 @@ media-theme {
1559
1601
  </media-control-bar>
1560
1602
  </template>
1561
1603
 
1562
- <template if="streamType == 'live'">
1604
+ <template if="streamtype == 'live'">
1563
1605
 
1564
- <template if="targetLiveWindow > 0">
1606
+ <template if="targetlivewindow > 0">
1565
1607
  <template if="title">
1566
1608
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
1567
1609
  </template>
@@ -1580,7 +1622,7 @@ media-theme {
1580
1622
  </media-control-bar>
1581
1623
  </template>
1582
1624
 
1583
- <template if="!targetLiveWindow">
1625
+ <template if="!targetlivewindow">
1584
1626
  <template if="title">
1585
1627
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
1586
1628
  </template>
@@ -1600,9 +1642,9 @@ media-theme {
1600
1642
 
1601
1643
  <template if="!audio">
1602
1644
 
1603
- <template if="streamType == 'on-demand'">
1645
+ <template if="streamtype == 'on-demand'">
1604
1646
 
1605
- <template if="!breakpointSm">
1647
+ <template if="!breakpointsm">
1606
1648
  {{>TimeRange}}
1607
1649
  <media-control-bar>
1608
1650
  {{>PlayButton}}
@@ -1613,8 +1655,8 @@ media-theme {
1613
1655
  </media-control-bar>
1614
1656
  </template>
1615
1657
 
1616
- <template if="breakpointSm">
1617
- <template if="!breakpointMd">
1658
+ <template if="breakpointsm">
1659
+ <template if="!breakpointmd">
1618
1660
  <media-control-bar slot="top-chrome">
1619
1661
  {{>TitleDisplay}}
1620
1662
  </media-control-bar>
@@ -1640,7 +1682,7 @@ media-theme {
1640
1682
  </template>
1641
1683
  </template>
1642
1684
 
1643
- <template if="breakpointMd">
1685
+ <template if="breakpointmd">
1644
1686
  <media-control-bar slot="top-chrome">
1645
1687
  {{>TitleDisplay}}
1646
1688
  </media-control-bar>
@@ -1667,11 +1709,11 @@ media-theme {
1667
1709
 
1668
1710
  </template>
1669
1711
 
1670
- <template if="streamType == 'live'">
1712
+ <template if="streamtype == 'live'">
1671
1713
 
1672
- <template if="!targetLiveWindow">
1714
+ <template if="!targetlivewindow">
1673
1715
 
1674
- <template if="!breakpointSm">
1716
+ <template if="!breakpointsm">
1675
1717
  <media-control-bar slot="top-chrome">
1676
1718
  {{>LiveButton}}
1677
1719
  </media-control-bar>
@@ -1684,8 +1726,8 @@ media-theme {
1684
1726
  </media-control-bar>
1685
1727
  </template>
1686
1728
 
1687
- <template if="breakpointSm">
1688
- <template if="!breakpointMd">
1729
+ <template if="breakpointsm">
1730
+ <template if="!breakpointmd">
1689
1731
  <media-control-bar slot="top-chrome">
1690
1732
  {{>LiveButton}}
1691
1733
  {{>TitleDisplay}}
@@ -1707,7 +1749,7 @@ media-theme {
1707
1749
  </template>
1708
1750
  </template>
1709
1751
 
1710
- <template if="breakpointMd">
1752
+ <template if="breakpointmd">
1711
1753
  <media-control-bar slot="top-chrome">
1712
1754
  {{>LiveButton}}
1713
1755
  {{>TitleDisplay}}
@@ -1729,9 +1771,9 @@ media-theme {
1729
1771
  </template>
1730
1772
  </template>
1731
1773
 
1732
- <template if="targetLiveWindow > 0">
1774
+ <template if="targetlivewindow > 0">
1733
1775
 
1734
- <template if="!breakpointSm">
1776
+ <template if="!breakpointsm">
1735
1777
  <media-control-bar slot="top-chrome">
1736
1778
  {{>LiveButton}}
1737
1779
  </media-control-bar>
@@ -1745,8 +1787,8 @@ media-theme {
1745
1787
  </media-control-bar>
1746
1788
  </template>
1747
1789
 
1748
- <template if="breakpointSm">
1749
- <template if="!breakpointMd">
1790
+ <template if="breakpointsm">
1791
+ <template if="!breakpointmd">
1750
1792
  <media-control-bar slot="top-chrome">
1751
1793
  {{>LiveButton}}
1752
1794
  {{>TitleDisplay}}
@@ -1771,7 +1813,7 @@ media-theme {
1771
1813
  </template>
1772
1814
  </template>
1773
1815
 
1774
- <template if="breakpointMd">
1816
+ <template if="breakpointmd">
1775
1817
  <media-control-bar slot="top-chrome">
1776
1818
  {{>LiveButton}}
1777
1819
  {{>TitleDisplay}}
@@ -1805,7 +1847,7 @@ media-theme {
1805
1847
 
1806
1848
  </media-controller>
1807
1849
  </template>
1808
- `;var uv=`
1850
+ `;var Tv=`
1809
1851
  :host {
1810
1852
  z-index: 100;
1811
1853
  display: var(--media-dialog-display, flex);
@@ -1857,17 +1899,17 @@ media-theme {
1857
1899
  text-align: center;
1858
1900
  line-height: 1.4;
1859
1901
  }
1860
- `,cv=Si.createElement("template");cv.innerHTML=`
1902
+ `,Av=Mi.createElement("template");Av.innerHTML=`
1861
1903
  <style>
1862
- ${uv}
1904
+ ${Tv}
1863
1905
  </style>
1864
1906
 
1865
1907
  <div class="dialog">
1866
1908
  <slot></slot>
1867
1909
  </div>
1868
- `;var na=class extends Ft.HTMLElement{constructor(){var l;super();this.attachShadow({mode:"open"}),(l=this.shadowRoot)==null||l.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),dv(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),E0(this))}attributeChangedCallback(l,m,v){l==="open"&&m!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&dv(this)}};na.styles=uv,na.template=cv,na.observedAttributes=["open"];function dv(n){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(n.dispatchEvent(a),a.defaultPrevented)return;let l=n.querySelector("[autofocus]:not([disabled])");!l&&n.tabIndex>=0&&(l=n),l||(l=hv(n.shadowRoot)),n._previouslyFocusedElement=Si.activeElement,Si.activeElement instanceof HTMLElement&&Si.activeElement.blur(),n.addEventListener("transitionend",()=>{l instanceof HTMLElement&&l.focus({preventScroll:!0})},{once:!0})}function hv(n){let l=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});l.push('[tabindex]:not([disabled]):not([tabindex=""])');let m=n==null?void 0:n.querySelector(l.join(", "));if(!m&&"attachShadow"in Element.prototype){let v=(n==null?void 0:n.querySelectorAll("*"))||[];for(let E=0;E<v.length&&!(v[E].tagName&&v[E].shadowRoot&&(m=hv(v[E].shadowRoot),m));E++);}return m}function E0(n){n._previouslyFocusedElement instanceof HTMLElement&&n._previouslyFocusedElement.focus()}Ft.customElements.get("media-dialog")||(Ft.customElements.define("media-dialog",na),Ft.MediaDialog=na);var mh=na;var fv=Si.createElement("template");fv.innerHTML=`
1910
+ `;var ma=class extends qt.HTMLElement{constructor(){var l;super();this.attachShadow({mode:"open"}),(l=this.shadowRoot)==null||l.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),_v(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),D0(this))}attributeChangedCallback(l,m,v){l==="open"&&m!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&_v(this)}};ma.styles=Tv,ma.template=Av,ma.observedAttributes=["open"];function _v(n){let r=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(n.dispatchEvent(r),r.defaultPrevented)return;let l=n.querySelector("[autofocus]:not([disabled])");!l&&n.tabIndex>=0&&(l=n),l||(l=Sv(n.shadowRoot)),n._previouslyFocusedElement=Mi.activeElement,Mi.activeElement instanceof HTMLElement&&Mi.activeElement.blur(),n.addEventListener("transitionend",()=>{l instanceof HTMLElement&&l.focus({preventScroll:!0})},{once:!0})}function Sv(n){let l=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});l.push('[tabindex]:not([disabled]):not([tabindex=""])');let m=n==null?void 0:n.querySelector(l.join(", "));if(!m&&"attachShadow"in Element.prototype){let v=(n==null?void 0:n.querySelectorAll("*"))||[];for(let y=0;y<v.length&&!(v[y].tagName&&v[y].shadowRoot&&(m=Sv(v[y].shadowRoot),m));y++);}return m}function D0(n){n._previouslyFocusedElement instanceof HTMLElement&&n._previouslyFocusedElement.focus()}qt.customElements.get("media-dialog")||(qt.customElements.define("media-dialog",ma),qt.MediaDialog=ma);var kh=ma;var kv=Mi.createElement("template");kv.innerHTML=`
1869
1911
  <style>
1870
- ${mh.styles}
1912
+ ${kh.styles}
1871
1913
 
1872
1914
  .close {
1873
1915
  background: none;
@@ -1896,84 +1938,84 @@ media-theme {
1896
1938
  </svg>
1897
1939
  </button>
1898
1940
  </slot>
1899
- `;var Zs=class extends mh{constructor(){var a,l;super(),(l=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||l.addEventListener("click",()=>{this.close()})}};Zs.template=fv;Ft.customElements.get("mxp-dialog")||(Ft.customElements.define("mxp-dialog",Zs),Ft.MxpDialog=Zs);var Js=new WeakMap,eo=class{constructor(a,l){this.element=a;this.type=l;this.element.addEventListener(this.type,this);let m=Js.get(this.element);m&&m.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let l=Js.get(this.element);l&&l.delete(this.type)}}static for(a){Js.has(a.element)||Js.set(a.element,new Map);let l=a.attributeName.slice(2),m=Js.get(a.element);return m&&m.has(l)?m.get(l):new eo(a.element,l)}};function b0(n,a){return n instanceof li&&n.attributeName.startsWith("on")?(eo.for(n).set(a),n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),!0):!1}function _0(n,a){return a instanceof _d&&n instanceof Mr?(a.renderInto(n),!0):!1}function T0(n,a){return a instanceof DocumentFragment&&n instanceof Mr?(a.childNodes.length&&n.replace(...a.childNodes),!0):!1}function A0(n,a){if(n instanceof li){let l=n.attributeNamespace,m=n.element.getAttributeNS(l,n.attributeName);return String(a)!==m&&(n.value=String(a)),!0}return n.value=String(a),!0}function S0(n,a){if(n instanceof li&&a instanceof Element){let l=n.element;return l[n.attributeName]!==a&&(n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),l[n.attributeName]=a),!0}return!1}function k0(n,a){if(typeof a=="boolean"&&n instanceof li){let l=n.attributeNamespace,m=n.element.hasAttributeNS(l,n.attributeName);return a!==m&&(n.booleanValue=a),!0}return!1}function w0(n,a){return a===!1&&n instanceof Mr?(n.replace(""),!0):!1}function L0(n,a){S0(n,a)||k0(n,a)||b0(n,a)||w0(n,a)||_0(n,a)||T0(n,a)||A0(n,a)}var ph=new Map,mv=new WeakMap,pv=new WeakMap,_d=class{constructor(a,l,m){this.strings=a;this.values=l;this.processor=m;this.stringsKey=this.strings.join("")}get template(){if(ph.has(this.stringsKey))return ph.get(this.stringsKey);{let a=Si.createElement("template"),l=this.strings.length-1;return a.innerHTML=this.strings.reduce((m,v,E)=>m+v+(E<l?`{{ ${E} }}`:""),""),ph.set(this.stringsKey,a),a}}renderInto(a){var v;let l=this.template;if(mv.get(a)!==l){mv.set(a,l);let E=new Cr(l,this.values,this.processor);pv.set(a,E),a instanceof Mr?a.replace(...E.children):a.appendChild(E);return}let m=pv.get(a);(v=m==null?void 0:m.update)==null||v.call(m,this.values)}},I0={processCallback(n,a,l){var m;if(!!l){for(let[v,E]of a)if(v in l){let I=(m=l[v])!=null?m:"";L0(E,I)}}}};function xr(n,...a){return new _d(n,a,I0)}function vv(n,a){n.renderInto(a)}var vh=Si.createElement("template");"innerHTML"in vh&&(vh.innerHTML=lv);var gv=n=>xr`
1941
+ `;var oo=class extends kh{constructor(){var r,l;super(),(l=(r=this.shadowRoot)==null?void 0:r.querySelector(".close"))==null||l.addEventListener("click",()=>{this.close()})}};oo.template=kv;qt.customElements.get("mxp-dialog")||(qt.customElements.define("mxp-dialog",oo),qt.MxpDialog=oo);var lo=new WeakMap,uo=class{constructor(r,l){this.element=r;this.type=l;this.element.addEventListener(this.type,this);let m=lo.get(this.element);m&&m.set(this.type,this)}set(r){if(typeof r=="function")this.handleEvent=r.bind(this.element);else if(typeof r=="object"&&typeof r.handleEvent=="function")this.handleEvent=r.handleEvent.bind(r);else{this.element.removeEventListener(this.type,this);let l=lo.get(this.element);l&&l.delete(this.type)}}static for(r){lo.has(r.element)||lo.set(r.element,new Map);let l=r.attributeName.slice(2),m=lo.get(r.element);return m&&m.has(l)?m.get(l):new uo(r.element,l)}};function C0(n,r){return n instanceof pi&&n.attributeName.startsWith("on")?(uo.for(n).set(r),n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),!0):!1}function M0(n,r){return r instanceof Mu&&n instanceof Kr?(r.renderInto(n),!0):!1}function x0(n,r){return r instanceof DocumentFragment&&n instanceof Kr?(r.childNodes.length&&n.replace(...r.childNodes),!0):!1}function P0(n,r){if(n instanceof pi){let l=n.attributeNamespace,m=n.element.getAttributeNS(l,n.attributeName);return String(r)!==m&&(n.value=String(r)),!0}return n.value=String(r),!0}function O0(n,r){if(n instanceof pi&&r instanceof Element){let l=n.element;return l[n.attributeName]!==r&&(n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),l[n.attributeName]=r),!0}return!1}function N0(n,r){if(typeof r=="boolean"&&n instanceof pi){let l=n.attributeNamespace,m=n.element.hasAttributeNS(l,n.attributeName);return r!==m&&(n.booleanValue=r),!0}return!1}function F0(n,r){return r===!1&&n instanceof Kr?(n.replace(""),!0):!1}function U0(n,r){O0(n,r)||N0(n,r)||C0(n,r)||F0(n,r)||M0(n,r)||x0(n,r)||P0(n,r)}var wh=new Map,wv=new WeakMap,Lv=new WeakMap,Mu=class{constructor(r,l,m){this.strings=r;this.values=l;this.processor=m;this.stringsKey=this.strings.join("")}get template(){if(wh.has(this.stringsKey))return wh.get(this.stringsKey);{let r=Mi.createElement("template"),l=this.strings.length-1;return r.innerHTML=this.strings.reduce((m,v,y)=>m+v+(y<l?`{{ ${y} }}`:""),""),wh.set(this.stringsKey,r),r}}renderInto(r){var v;let l=this.template;if(wv.get(r)!==l){wv.set(r,l);let y=new Vr(l,this.values,this.processor);Lv.set(r,y),r instanceof Kr?r.replace(...y.children):r.appendChild(y);return}let m=Lv.get(r);(v=m==null?void 0:m.update)==null||v.call(m,this.values)}},B0={processCallback(n,r,l){var m;if(!!l){for(let[v,y]of r)if(v in l){let I=(m=l[v])!=null?m:"";U0(y,I)}}}};function Wr(n,...r){return new Mu(n,r,B0)}function Iv(n,r){n.renderInto(r)}var Lh=Mi.createElement("template");"innerHTML"in Lh&&(Lh.innerHTML=bv);var Rv=n=>Wr`
1900
1942
  <style>
1901
- ${ov}
1943
+ ${yv}
1902
1944
  </style>
1903
- ${D0(n)}
1904
- `,R0=n=>{let a=n.hotKeys?`${n.hotKeys}`:"";return Ws(n.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},D0=n=>{var a,l,m,v,E,I,M,B,F,Q,re,te,se,pe,Ae,ke,we,nt,Ue,st,dt,oe,w,le,$,Ie,$e,tt,Bt,Je,H,ri,Ht,it,Qt;return xr`
1945
+ ${G0(n)}
1946
+ `,H0=n=>{let r=n.hotKeys?`${n.hotKeys}`:"";return Js(n.streamType)==="live"&&(r+=" noarrowleft noarrowright"),r},G0=n=>{var r,l,m,v,y,I,M,B,H,z,J,ee,le,me,_e,ge,ye,Ee,de,Be,Ge,re,k,se,W,Se,Xe,at,jt,it,U,di,zt,nt,ri;return Wr`
1905
1947
  <media-theme
1906
- template="${(a=n.themeTemplate)!=null?a:vh.content.children[0]}"
1907
- default-stream-type="${(l=n.defaultStreamType)!=null?l:!1}"
1908
- hotkeys="${R0(n)||!1}"
1948
+ template="${(r=n.themeTemplate)!=null?r:Lh.content.children[0]}"
1949
+ defaultstreamtype="${(l=n.defaultStreamType)!=null?l:!1}"
1950
+ hotkeys="${H0(n)||!1}"
1909
1951
  nohotkeys="${n.noHotKeys||!n.hasSrc||n.isDialogOpen||!1}"
1910
1952
  noautoseektolive="${!!((m=n.streamType)!=null&&m.includes(vt.LIVE))&&n.targetLiveWindow!==0}"
1911
1953
  novolumepref="${n.novolumepref||!1}"
1912
1954
  disabled="${!n.hasSrc||n.isDialogOpen}"
1913
1955
  audio="${(v=n.audio)!=null?v:!1}"
1914
- style="${(E=Gp({"--media-primary-color":n.primaryColor,"--media-secondary-color":n.secondaryColor}))!=null?E:!1}"
1915
- default-showing-captions="${!n.defaultHiddenCaptions}"
1916
- forward-seek-offset="${(I=n.forwardSeekOffset)!=null?I:!1}"
1917
- backward-seek-offset="${(M=n.backwardSeekOffset)!=null?M:!1}"
1918
- playback-rates="${(B=n.playbackRates)!=null?B:!1}"
1919
- default-show-remaining-time="${(F=n.defaultShowRemainingTime)!=null?F:!1}"
1920
- hide-duration="${(Q=n.hideDuration)!=null?Q:!1}"
1921
- title="${(re=n.title)!=null?re:!1}"
1956
+ style="${(y=Jp({"--media-primary-color":n.primaryColor,"--media-secondary-color":n.secondaryColor}))!=null?y:!1}"
1957
+ defaultsubtitles="${!n.defaultHiddenCaptions}"
1958
+ forwardseekoffset="${(I=n.forwardSeekOffset)!=null?I:!1}"
1959
+ backwardseekoffset="${(M=n.backwardSeekOffset)!=null?M:!1}"
1960
+ playbackrates="${(B=n.playbackRates)!=null?B:!1}"
1961
+ defaultshowremainingtime="${(H=n.defaultShowRemainingTime)!=null?H:!1}"
1962
+ hideduration="${(z=n.hideDuration)!=null?z:!1}"
1963
+ title="${(J=n.title)!=null?J:!1}"
1922
1964
  exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
1923
1965
  >
1924
1966
  <mux-video
1925
1967
  slot="media"
1926
- target-live-window="${(te=n.targetLiveWindow)!=null?te:!1}"
1927
- stream-type="${(se=Ws(n.streamType))!=null?se:!1}"
1928
- crossorigin="${(pe=n.crossOrigin)!=null?pe:""}"
1968
+ target-live-window="${(ee=n.targetLiveWindow)!=null?ee:!1}"
1969
+ stream-type="${(le=Js(n.streamType))!=null?le:!1}"
1970
+ crossorigin="${(me=n.crossOrigin)!=null?me:""}"
1929
1971
  playsinline
1930
- autoplay="${(Ae=n.autoplay)!=null?Ae:!1}"
1931
- muted="${(ke=n.muted)!=null?ke:!1}"
1932
- loop="${(we=n.loop)!=null?we:!1}"
1933
- preload="${(nt=n.preload)!=null?nt:!1}"
1934
- debug="${(Ue=n.debug)!=null?Ue:!1}"
1935
- prefer-cmcd="${(st=n.preferCmcd)!=null?st:!1}"
1936
- disable-cookies="${(dt=n.disableCookies)!=null?dt:!1}"
1937
- prefer-playback="${(oe=n.preferPlayback)!=null?oe:!1}"
1972
+ autoplay="${(_e=n.autoplay)!=null?_e:!1}"
1973
+ muted="${(ge=n.muted)!=null?ge:!1}"
1974
+ loop="${(ye=n.loop)!=null?ye:!1}"
1975
+ preload="${(Ee=n.preload)!=null?Ee:!1}"
1976
+ debug="${(de=n.debug)!=null?de:!1}"
1977
+ prefer-cmcd="${(Be=n.preferCmcd)!=null?Be:!1}"
1978
+ disable-cookies="${(Ge=n.disableCookies)!=null?Ge:!1}"
1979
+ prefer-playback="${(re=n.preferPlayback)!=null?re:!1}"
1938
1980
  start-time="${n.startTime!=null?n.startTime:!1}"
1939
- beacon-collection-domain="${(w=n.beaconCollectionDomain)!=null?w:!1}"
1940
- player-software-name="${(le=n.playerSoftwareName)!=null?le:!1}"
1941
- player-software-version="${($=n.playerSoftwareVersion)!=null?$:!1}"
1942
- env-key="${(Ie=n.envKey)!=null?Ie:!1}"
1943
- custom-domain="${($e=n.customDomain)!=null?$e:!1}"
1944
- src="${n.src?n.src:n.playbackId?ih(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
1945
- cast-src="${n.src?n.src:n.playbackId?ih(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
1981
+ beacon-collection-domain="${(k=n.beaconCollectionDomain)!=null?k:!1}"
1982
+ player-software-name="${(se=n.playerSoftwareName)!=null?se:!1}"
1983
+ player-software-version="${(W=n.playerSoftwareVersion)!=null?W:!1}"
1984
+ env-key="${(Se=n.envKey)!=null?Se:!1}"
1985
+ custom-domain="${(Xe=n.customDomain)!=null?Xe:!1}"
1986
+ src="${n.src?n.src:n.playbackId?fh(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
1987
+ cast-src="${n.src?n.src:n.playbackId?fh(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
1946
1988
  exportparts="video"
1947
1989
  >
1948
- ${n.storyboard?xr`<track label="thumbnails" default kind="metadata" src="${n.storyboard}" />`:xr``}
1990
+ ${n.storyboard?Wr`<track label="thumbnails" default kind="metadata" src="${n.storyboard}" />`:Wr``}
1949
1991
  </mux-video>
1950
1992
  <media-poster-image
1951
1993
  slot="poster"
1952
1994
  part="poster"
1953
- src="${n.poster===""?!1:(tt=n.poster)!=null?tt:!1}"
1954
- placeholder-src="${(Bt=n.placeholder)!=null?Bt:!1}"
1995
+ src="${n.poster===""?!1:(at=n.poster)!=null?at:!1}"
1996
+ placeholder-src="${(jt=n.placeholder)!=null?jt:!1}"
1955
1997
  ></media-poster-image>
1956
1998
  <mxp-dialog
1957
1999
  no-auto-hide
1958
- open="${(Je=n.isDialogOpen)!=null?Je:!1}"
2000
+ open="${(it=n.isDialogOpen)!=null?it:!1}"
1959
2001
  onclose="${n.onCloseErrorDialog}"
1960
2002
  oninitfocus="${n.onInitFocusDialog}"
1961
2003
  >
1962
- ${(H=n.dialog)!=null&&H.title?xr`<h3>${n.dialog.title}</h3>`:xr``}
2004
+ ${(U=n.dialog)!=null&&U.title?Wr`<h3>${n.dialog.title}</h3>`:Wr``}
1963
2005
  <p>
1964
- ${(ri=n.dialog)==null?void 0:ri.message}
1965
- ${(Ht=n.dialog)!=null&&Ht.linkUrl?xr`<a
2006
+ ${(di=n.dialog)==null?void 0:di.message}
2007
+ ${(zt=n.dialog)!=null&&zt.linkUrl?Wr`<a
1966
2008
  href="${n.dialog.linkUrl}"
1967
2009
  target="_blank"
1968
2010
  rel="external noopener"
1969
- aria-label="${(it=n.dialog.linkText)!=null?it:""} ${Ye("(opens in a new window)")}"
1970
- >${(Qt=n.dialog.linkText)!=null?Qt:n.dialog.linkUrl}</a
1971
- >`:xr``}
2011
+ aria-label="${(nt=n.dialog.linkText)!=null?nt:""} ${Qe("(opens in a new window)")}"
2012
+ >${(ri=n.dialog.linkText)!=null?ri:n.dialog.linkUrl}</a
2013
+ >`:Wr``}
1972
2014
  </p>
1973
2015
  </mxp-dialog>
1974
2016
  </media-theme>
1975
- `};function Td(n,a,l,m,v){var M,B,F;let E={},I={};switch(n.code){case pt.MEDIA_ERR_NETWORK:{switch(E.title=Ye("Network Error",v),E.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{E.title=Ye("Video is not currently available",v),E.message=Ye("The live stream or video file are not yet ready.",v),I.message=Ye("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),I.file="412-not-playable.md";break}case 404:{E.title=Ye("Video does not exist",v),E.message="",I.message=Ye("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),I.file="404-not-found.md";break}case 403:{if(E.title=Ye("Invalid playback URL",v),E.message=Ye("The video URL or playback-token are formatted with incorrect or incomplete information.",v),I.message=Ye("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),I.file="missing-signed-tokens.md",!m)break;let{exp:Q,aud:re,sub:te}=ea(m),se=Date.now()>Q*1e3,pe=te!==l,Ae=re!=="v",ke={timeStyle:"medium",dateStyle:"medium"};if(se){E.title=Ye("Video URL has expired",v),E.message=Ye("The video\u2019s secured playback-token has expired.",v),I.message=Ye("The video\u2019s secured playback-token has expired.",v),I.context=Ye("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat(Na.code,ke).format(Q*1e3),currentDate:new Intl.DateTimeFormat(Na.code,ke).format(Date.now())}),I.file="403-expired-token.md";break}if(pe){E.title=Ye("Video URL is formatted incorrectly",v),E.message=Ye("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.message=Ye("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.context=Ye("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:l,tokenPlaybackId:te}),I.file="403-playback-id-mismatch.md";break}if(Ae){E.title=Ye("Video URL is formatted incorrectly",v),E.message=Ye("The playback-token is formatted with incorrect information.",v),I.message=Ye("The playback-token is formatted with incorrect information.",v),I.context=Ye("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:re}),I.file="403-incorrect-aud-value.md";break}I.message=Ye("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),I.file="403-malformatted-token.md";break}}break}case pt.MEDIA_ERR_DECODE:{let{message:Q}=n;E={title:Ye("Media Error",v),message:Q},I.file="media-decode-error.md";break}case pt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let Q=(F=(B=n.data)==null?void 0:B.response)==null?void 0:F.code;if(Q>=400&&Q<500){n.code=pt.MEDIA_ERR_NETWORK,n.data={response:{code:Q}},{dialog:E,devlog:I}=Td(n,a,l,m);break}E={title:Ye("Source Not Supported",v),message:n.message},I.file="media-src-not-supported.md";break}default:E={title:Ye("Error",v),message:n.message};break}return a&&(E={title:Ye("Your device appears to be offline",v),message:Ye("Check your internet connection and try reloading this video.",v)}),{dialog:E,devlog:I}}var Pr={SRC:"src",POSTER:"poster"},me={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},gh=["audio","backward-seek-offset","default-show-remaining-time","default-showing-captions","noautoseektolive","disabled","exportparts","forward-seek-offset","hide-duration","hotkeys","nohotkeys","playbackrates","default-stream-type","stream-type","style","target-live-window","template","title","no-volume-pref"];function C0(n,a){var m;return{src:!n.playbackId&&n.src,playbackId:n.playbackId,hasSrc:!!n.playbackId||!!n.src,poster:n.poster,storyboard:n.storyboard,storyboardSrc:n.getAttribute(me.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:M0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(me.NOHOTKEYS),hotKeys:n.getAttribute(me.HOTKEYS),muted:n.muted,paused:n.paused,preload:n.preload,envKey:n.envKey,preferCmcd:n.preferCmcd,debug:n.debug,disableCookies:n.disableCookies,tokens:n.tokens,beaconCollectionDomain:n.beaconCollectionDomain,maxResolution:n.maxResolution,metadata:n.metadata,playerSoftwareName:n.playerSoftwareName,playerSoftwareVersion:n.playerSoftwareVersion,startTime:n.startTime,preferPlayback:n.preferPlayback,audio:n.audio,defaultStreamType:n.defaultStreamType,targetLiveWindow:n.getAttribute(ae.TARGET_LIVE_WINDOW),streamType:Ws(n.getAttribute(ae.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:x0(n),playbackRates:n.getAttribute(me.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ae.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(me.TITLE),novolumepref:n.hasAttribute(me.NO_VOLUME_PREF),...a}}function M0(n){var l,m;let a=n.getAttribute(me.THEME);if(a){let v=(m=(l=n.getRootNode())==null?void 0:l.getElementById)==null?void 0:m.call(l,a);if(v)return v;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let E=Ft.customElements.get(a);if(E!=null&&E.template)return E.template}}function x0(n){var l;let a=(l=n.mediaController)==null?void 0:l.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function yv(n){return n.getAttributeNames().filter(a=>a.startsWith("metadata-")).reduce((a,l)=>{let m=n.getAttribute(l);return m!==null&&(a[l.replace(/^metadata-/,"").replace(/-/g,"_")]=m),a},{})}var P0=Object.values(ae),O0=Object.values(Pr),N0=Object.values(me),F0=hd(),U0="mux-player",Ev={dialog:void 0,isDialogOpen:!1},io,ro,Or,ao,qa,sa,Un,Ad,bv,no,yh,oa,Bn,Sd,_v,kd,Tv,wd,Av,Ld,Sv,to=class extends nh{constructor(){super();Dt(this,sa);Dt(this,Ad);Dt(this,no);Dt(this,oa);Dt(this,Sd);Dt(this,kd);Dt(this,wd);Dt(this,Ld);Dt(this,io,!1);Dt(this,ro,{});Dt(this,Or,!0);Dt(this,ao,new cd(this,"hotkeys"));Dt(this,qa,{...Ev,onCloseErrorDialog:()=>Gt(this,no,yh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:l=>{eh(this,Si.activeElement)||l.preventDefault()}});this.attachShadow({mode:"open"}),Gt(this,Ad,bv).call(this),this.isConnected&&Gt(this,sa,Un).call(this)}static get observedAttributes(){var l;return[...(l=nh.observedAttributes)!=null?l:[],...O0,...P0,...N0]}get mediaTheme(){var l;return(l=this.shadowRoot)==null?void 0:l.querySelector("media-theme")}get mediaController(){var l,m;return(m=(l=this.mediaTheme)==null?void 0:l.shadowRoot)==null?void 0:m.querySelector("media-controller")}connectedCallback(){var m;let l=(m=this.shadowRoot)==null?void 0:m.querySelector("mux-video");l&&(l.metadata=yv(this))}attributeChangedCallback(l,m,v){switch(Gt(this,sa,Un).call(this),super.attributeChangedCallback(l,m,v),l){case me.HOTKEYS:at(this,ao).value=v;break;case me.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ta(Ye("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case me.THUMBNAIL_TOKEN:{let{aud:I}=ea(v);v&&I!=="t"&&ta(Ye("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:I}));break}case me.STORYBOARD_TOKEN:{let{aud:I}=ea(v);v&&I!=="s"&&ta(Ye("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:I}));break}case ae.PLAYBACK_ID:{v!=null&&v.includes("?token")&&ji(Ye("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ae.STREAM_TYPE:v&&![vt.LIVE,vt.ON_DEMAND,vt.UNKNOWN].includes(v)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=v.includes("dvr")?Number.POSITIVE_INFINITY:0:rh({file:"invalid-stream-type.md",message:Ye("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=v===vt.LIVE?0:Number.NaN}[ae.PLAYBACK_ID,Pr.SRC,me.PLAYBACK_TOKEN].includes(l)&&m!==v&&Oi(this,qa,{...at(this,qa),...Ev}),Gt(this,oa,Bn).call(this,{[Wp(l)]:v})}get preferCmcd(){var l;return(l=this.getAttribute(ae.PREFER_CMCD))!=null?l:void 0}set preferCmcd(l){l!==this.preferCmcd&&(l?Dn.includes(l)?this.setAttribute(ae.PREFER_CMCD,l):ta(`Invalid value for preferCmcd. Must be one of ${Dn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get hasPlayed(){var l,m;return(m=(l=this.mediaController)==null?void 0:l.hasAttribute("media-has-played"))!=null?m:!1}get inLiveWindow(){var l;return(l=this.mediaController)==null?void 0:l.hasAttribute("media-time-is-live")}get _hls(){var l;return(l=this.media)==null?void 0:l._hls}get mux(){var l;return(l=this.media)==null?void 0:l.mux}get theme(){var l;return(l=this.getAttribute(me.THEME))!=null?l:""}set theme(l){this.setAttribute(me.THEME,`${l}`)}get themeProps(){let l=this.mediaTheme;if(!l)return;let m={};for(let v of l.getAttributeNames()){if(gh.includes(v))continue;let E=l.getAttribute(v);m[dd(v)]=E===""?!0:E}return m}set themeProps(l){var v,E;Gt(this,sa,Un).call(this);let m={...this.themeProps,...l};for(let I in m){if(gh.includes(I))continue;let M=l==null?void 0:l[I];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(ld(I),Boolean(M)):(E=this.mediaTheme)==null||E.setAttribute(ld(I),M)}}get playbackId(){var l;return(l=this.getAttribute(ae.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l?this.setAttribute(ae.PLAYBACK_ID,l):this.removeAttribute(ae.PLAYBACK_ID)}get src(){var l,m;return this.playbackId?(l=Fn(this,Pr.SRC))!=null?l:void 0:(m=this.getAttribute(Pr.SRC))!=null?m:void 0}set src(l){l?this.setAttribute(Pr.SRC,l):this.removeAttribute(Pr.SRC)}get poster(){var m;let l=this.getAttribute(Pr.POSTER);if(l!=null)return l;if(this.playbackId&&!this.audio)return Vp(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(l){l||l===""?this.setAttribute(Pr.POSTER,l):this.removeAttribute(Pr.POSTER)}get storyboardSrc(){var l;return(l=this.getAttribute(me.STORYBOARD_SRC))!=null?l:void 0}set storyboardSrc(l){l?this.setAttribute(me.STORYBOARD_SRC,l):this.removeAttribute(me.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[vt.LIVE,vt.UNKNOWN].includes(this.streamType)))return Kp(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(me.AUDIO)}set audio(l){if(!l){this.removeAttribute(me.AUDIO);return}this.setAttribute(me.AUDIO,"")}get hotkeys(){return at(this,ao)}get nohotkeys(){return this.hasAttribute(me.NOHOTKEYS)}set nohotkeys(l){if(!l){this.removeAttribute(me.NOHOTKEYS);return}this.setAttribute(me.NOHOTKEYS,"")}get thumbnailTime(){return Rr(this.getAttribute(me.THUMBNAIL_TIME))}set thumbnailTime(l){this.setAttribute(me.THUMBNAIL_TIME,`${l}`)}get title(){var l;return(l=this.getAttribute(me.TITLE))!=null?l:""}set title(l){l!==this.title&&(l?this.setAttribute(me.TITLE,l):this.removeAttribute("title"),super.title=l)}get placeholder(){var l;return(l=Fn(this,me.PLACEHOLDER))!=null?l:""}set placeholder(l){this.setAttribute(me.PLACEHOLDER,`${l}`)}get primaryColor(){var m,v;let l=this.getAttribute(me.PRIMARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),l))return l}set primaryColor(l){this.setAttribute(me.PRIMARY_COLOR,`${l}`)}get secondaryColor(){var m,v;let l=this.getAttribute(me.SECONDARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),l))return l}set secondaryColor(l){this.setAttribute(me.SECONDARY_COLOR,`${l}`)}get defaultShowRemainingTime(){return this.hasAttribute(me.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(l){l?this.setAttribute(me.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(me.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(me.PLAYBACK_RATES))return this.getAttribute(me.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(l=>Number(l)).filter(l=>!Number.isNaN(l)).sort((l,m)=>l-m)}set playbackRates(l){if(!l){this.removeAttribute(me.PLAYBACK_RATES);return}this.setAttribute(me.PLAYBACK_RATES,l.join(" "))}get forwardSeekOffset(){var l;return(l=Rr(this.getAttribute(me.FORWARD_SEEK_OFFSET)))!=null?l:10}set forwardSeekOffset(l){this.setAttribute(me.FORWARD_SEEK_OFFSET,`${l}`)}get backwardSeekOffset(){var l;return(l=Rr(this.getAttribute(me.BACKWARD_SEEK_OFFSET)))!=null?l:10}set backwardSeekOffset(l){this.setAttribute(me.BACKWARD_SEEK_OFFSET,`${l}`)}get defaultHiddenCaptions(){return this.hasAttribute(me.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(l){l?this.setAttribute(me.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(me.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var l;return(l=this.getAttribute(ae.PLAYER_SOFTWARE_NAME))!=null?l:U0}get playerSoftwareVersion(){var l;return(l=this.getAttribute(ae.PLAYER_SOFTWARE_VERSION))!=null?l:F0}get beaconCollectionDomain(){var l;return(l=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var l;return(l=this.getAttribute(ae.MAX_RESOLUTION))!=null?l:void 0}set maxResolution(l){l!==this.maxResolution&&(l?this.setAttribute(ae.MAX_RESOLUTION,l):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var l;return(l=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?l:void 0}set customDomain(l){l!==this.customDomain&&(l?this.setAttribute(ae.CUSTOM_DOMAIN,l):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var l;return(l=Fn(this,ae.ENV_KEY))!=null?l:void 0}set envKey(l){this.setAttribute(ae.ENV_KEY,`${l}`)}get noVolumePref(){return this.hasAttribute(me.NO_VOLUME_PREF)}set noVolumePref(l){l?this.setAttribute(me.NO_VOLUME_PREF,""):this.removeAttribute(me.NO_VOLUME_PREF)}get debug(){return Fn(this,ae.DEBUG)!=null}set debug(l){l?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG)}get disableCookies(){return Fn(this,ae.DISABLE_COOKIES)!=null}set disableCookies(l){l?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES)}get streamType(){var l,m,v;return(v=(m=this.getAttribute(ae.STREAM_TYPE))!=null?m:(l=this.media)==null?void 0:l.streamType)!=null?v:vt.UNKNOWN}set streamType(l){this.setAttribute(ae.STREAM_TYPE,`${l}`)}get defaultStreamType(){var l,m,v;return(v=(m=this.getAttribute(me.DEFAULT_STREAM_TYPE))!=null?m:(l=this.mediaController)==null?void 0:l.getAttribute(me.DEFAULT_STREAM_TYPE))!=null?v:vt.ON_DEMAND}set defaultStreamType(l){l?this.setAttribute(me.DEFAULT_STREAM_TYPE,l):this.removeAttribute(me.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var l,m;return this.hasAttribute(me.TARGET_LIVE_WINDOW)?+this.getAttribute(me.TARGET_LIVE_WINDOW):(m=(l=this.media)==null?void 0:l.targetLiveWindow)!=null?m:Number.NaN}set targetLiveWindow(l){l!=this.targetLiveWindow&&(l==null?this.removeAttribute(me.TARGET_LIVE_WINDOW):this.setAttribute(me.TARGET_LIVE_WINDOW,`${+l}`))}get liveEdgeStart(){var l;return(l=this.media)==null?void 0:l.liveEdgeStart}get startTime(){return Rr(Fn(this,ae.START_TIME))}set startTime(l){this.setAttribute(ae.START_TIME,`${l}`)}get preferPlayback(){let l=this.getAttribute(ae.PREFER_PLAYBACK);if(l===Hi.MSE||l===Hi.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===Hi.MSE||l===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,l):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){var l;return(l=this.media)==null?void 0:l.metadata}set metadata(l){if(Gt(this,sa,Un).call(this),!this.media){ji("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...yv(this),...l}}async addCuePoints(l){var m;if(Gt(this,sa,Un).call(this),!this.media){ji("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(m=this.media)==null?void 0:m.addCuePoints(l)}get activeCuePoint(){var l;return(l=this.media)==null?void 0:l.activeCuePoint}get cuePoints(){var l,m;return(m=(l=this.media)==null?void 0:l.cuePoints)!=null?m:[]}getStartDate(){var l;return(l=this.media)==null?void 0:l.getStartDate()}get currentPdt(){var l;return(l=this.media)==null?void 0:l.currentPdt}get tokens(){let l=this.getAttribute(me.PLAYBACK_TOKEN),m=this.getAttribute(me.THUMBNAIL_TOKEN),v=this.getAttribute(me.STORYBOARD_TOKEN);return{...at(this,ro),...l!=null?{playback:l}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(l){Oi(this,ro,l!=null?l:{})}get playbackToken(){var l;return(l=this.getAttribute(me.PLAYBACK_TOKEN))!=null?l:void 0}set playbackToken(l){this.setAttribute(me.PLAYBACK_TOKEN,`${l}`)}get thumbnailToken(){var l;return(l=this.getAttribute(me.THUMBNAIL_TOKEN))!=null?l:void 0}set thumbnailToken(l){this.setAttribute(me.THUMBNAIL_TOKEN,`${l}`)}get storyboardToken(){var l;return(l=this.getAttribute(me.STORYBOARD_TOKEN))!=null?l:void 0}set storyboardToken(l){this.setAttribute(me.STORYBOARD_TOKEN,`${l}`)}addTextTrack(l,m,v,E){var M;let I=(M=this.media)==null?void 0:M.nativeEl;if(!!I)return Ql(I,l,m,v,E)}removeTextTrack(l){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return fp(m,l)}get textTracks(){var l;return(l=this.media)==null?void 0:l.textTracks}};io=new WeakMap,ro=new WeakMap,Or=new WeakMap,ao=new WeakMap,qa=new WeakMap,sa=new WeakSet,Un=function(){var l,m,v;if(!at(this,io)){Oi(this,io,!0),Gt(this,oa,Bn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Ft.HTMLElement))throw""}catch{ji("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Bp))throw""}catch{ji("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ts))throw""}catch{ji("<media-controller> failed to upgrade!")}jp(this),Gt(this,Sd,_v).call(this),Gt(this,kd,Tv).call(this),Gt(this,wd,Av).call(this),Oi(this,Or,(m=(l=this.mediaController)==null?void 0:l.hasAttribute("user-inactive"))!=null?m:!0),Gt(this,Ld,Sv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Gt(this,oa,Bn).call(this)})}},Ad=new WeakSet,bv=function(){var l,m;try{(l=window==null?void 0:window.CSS)==null||l.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(m=window==null?void 0:window.CSS)==null||m.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},no=new WeakSet,yh=function(l){Object.assign(at(this,qa),l),Gt(this,oa,Bn).call(this)},oa=new WeakSet,Bn=function(l={}){vv(gv(C0(this,{...at(this,qa),...l})),this.shadowRoot)},Sd=new WeakSet,_v=function(){let l=v=>{var M,B;if(!(v!=null&&v.startsWith("theme-")))return;let E=v.replace(/^theme-/,"");if(gh.includes(E))return;let I=this.getAttribute(v);I!=null?(M=this.mediaTheme)==null||M.setAttribute(E,I):(B=this.mediaTheme)==null||B.removeAttribute(E)};new MutationObserver(v=>{for(let{attributeName:E}of v)l(E)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(l)},kd=new WeakSet,Tv=function(){var m;let l=v=>{let{detail:E}=v;if(E instanceof pt||(E=new pt(E.message,E.code,E.fatal)),!(E!=null&&E.fatal)){ta(E),E.data&&ta(`${E.name} data:`,E.data);return}let{dialog:I,devlog:M}=Td(E,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&rh(M),ji(E),E.data&&ji(`${E.name} data:`,E.data),Gt(this,no,yh).call(this,{isDialogOpen:!0,dialog:I})};this.addEventListener("error",l),this.media&&(this.media.errorTranslator=(v={})=>{var I,M,B;if(!(((I=this.media)==null?void 0:I.error)instanceof pt))return v;let{devlog:E}=Td((M=this.media)==null?void 0:M.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(B=this.media)==null?void 0:B.error.code,player_error_message:E.message?String(E.message):v.player_error_message,player_error_context:E.context?String(E.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var I,M;let{detail:E}=v;if(!E){let{message:B,code:F}=(M=(I=this.media)==null?void 0:I.error)!=null?M:{};E=new pt(B,F)}!(E!=null&&E.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:E}))})},wd=new WeakSet,Av=function(){var m,v,E,I;let l=()=>Gt(this,oa,Bn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",l),(I=(E=this.media)==null?void 0:E.textTracks)==null||I.addEventListener("removetrack",l)},Ld=new WeakSet,Sv=function(){var Q,re;let l=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,E=new WeakMap,I=()=>this.streamType===vt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(te,se,pe=!1)=>{if(I())return;Array.from(te&&te.activeCues||[]).forEach(ke=>{if(!(!ke.snapToLines||ke.line<-5||ke.line>=0&&ke.line<10))if(!se||this.paused){let we=ke.text.split(`
1976
- `).length,nt=l?-2:-3;this.streamType===vt.LIVE&&(nt=l?-1:-2);let Ue=nt-we;if(ke.line===Ue&&!pe)return;E.has(ke)||E.set(ke,ke.line),ke.line=Ue-1,ke.line=Ue}else setTimeout(()=>{ke.line=E.get(ke)||"auto"},500)})},B=()=>{var te,se;M(v,(se=(te=this.mediaController)==null?void 0:te.hasAttribute("user-inactive"))!=null?se:!1)},F=()=>{var pe,Ae;let se=Array.from(((Ae=(pe=this.mediaController)==null?void 0:pe.media)==null?void 0:Ae.textTracks)||[]).filter(ke=>["subtitles","captions"].includes(ke.kind)&&ke.mode==="showing")[0];se!==v&&(v==null||v.removeEventListener("cuechange",B)),v=se,v==null||v.addEventListener("cuechange",B),M(v,at(this,Or))};if(F(),(Q=this.textTracks)==null||Q.addEventListener("change",F),(re=this.textTracks)==null||re.addEventListener("addtrack",F),navigator.userAgent.includes("Chrome/")){let te=()=>{M(v,at(this,Or),!0),this.paused||window.requestAnimationFrame(te)};this.addEventListener("playing",()=>{te()})}this.addEventListener("userinactivechange",()=>{var se,pe;let te=(pe=(se=this.mediaController)==null?void 0:se.hasAttribute("user-inactive"))!=null?pe:!0;at(this,Or)!==te&&(Oi(this,Or,te),M(v,at(this,Or)))})};function Fn(n,a){return n.media?n.media.getAttribute(a):n.getAttribute(a)}Ft.customElements.get("mux-player")||(Ft.customElements.define("mux-player",to),Ft.MuxPlayerElement=to);var I1=to;export{pt as MediaError,I1 as default,Fn as getVideoAttribute};
2017
+ `};function xu(n,r,l,m,v){var M,B,H;let y={},I={};switch(n.code){case Tt.MEDIA_ERR_NETWORK:{switch(y.title=Qe("Network Error",v),y.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{y.title=Qe("Video is not currently available",v),y.message=Qe("The live stream or video file are not yet ready.",v),I.message=Qe("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),I.file="412-not-playable.md";break}case 404:{y.title=Qe("Video does not exist",v),y.message="",I.message=Qe("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),I.file="404-not-found.md";break}case 403:{if(y.title=Qe("Invalid playback URL",v),y.message=Qe("The video URL or playback-token are formatted with incorrect or incomplete information.",v),I.message=Qe("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),I.file="missing-signed-tokens.md",!m)break;let{exp:z,aud:J,sub:ee}=ua(m),le=Date.now()>z*1e3,me=ee!==l,_e=J!=="v",ge={timeStyle:"medium",dateStyle:"medium"};if(le){y.title=Qe("Video URL has expired",v),y.message=Qe("The video\u2019s secured playback-token has expired.",v),I.message=Qe("The video\u2019s secured playback-token has expired.",v),I.context=Qe("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat($a.code,ge).format(z*1e3),currentDate:new Intl.DateTimeFormat($a.code,ge).format(Date.now())}),I.file="403-expired-token.md";break}if(me){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.context=Qe("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:l,tokenPlaybackId:ee}),I.file="403-playback-id-mismatch.md";break}if(_e){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The playback-token is formatted with incorrect information.",v),I.message=Qe("The playback-token is formatted with incorrect information.",v),I.context=Qe("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:J}),I.file="403-incorrect-aud-value.md";break}I.message=Qe("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),I.file="403-malformatted-token.md";break}}break}case Tt.MEDIA_ERR_DECODE:{let{message:z}=n;y={title:Qe("Media Error",v),message:z},I.file="media-decode-error.md";break}case Tt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let z=(H=(B=n.data)==null?void 0:B.response)==null?void 0:H.code;if(z>=400&&z<500){n.code=Tt.MEDIA_ERR_NETWORK,n.data={response:{code:z}},{dialog:y,devlog:I}=xu(n,r,l,m);break}y={title:Qe("Source Not Supported",v),message:n.message},I.file="media-src-not-supported.md";break}default:y={title:Qe("Error",v),message:n.message};break}return r&&(y={title:Qe("Your device appears to be offline",v),message:Qe("Check your internet connection and try reloading this video.",v)}),{dialog:y,devlog:I}}var qr={SRC:"src",POSTER:"poster"},ve={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},Ih=["audio","backwardseekoffset","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function V0(n,r){var m;return{src:!n.playbackId&&n.src,playbackId:n.playbackId,hasSrc:!!n.playbackId||!!n.src,poster:n.poster,storyboard:n.storyboard,storyboardSrc:n.getAttribute(ve.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:K0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(ve.NOHOTKEYS),hotKeys:n.getAttribute(ve.HOTKEYS),muted:n.muted,paused:n.paused,preload:n.preload,envKey:n.envKey,preferCmcd:n.preferCmcd,debug:n.debug,disableCookies:n.disableCookies,tokens:n.tokens,beaconCollectionDomain:n.beaconCollectionDomain,maxResolution:n.maxResolution,metadata:n.metadata,playerSoftwareName:n.playerSoftwareName,playerSoftwareVersion:n.playerSoftwareVersion,startTime:n.startTime,preferPlayback:n.preferPlayback,audio:n.audio,defaultStreamType:n.defaultStreamType,targetLiveWindow:n.getAttribute(ne.TARGET_LIVE_WINDOW),streamType:Js(n.getAttribute(ne.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:W0(n),playbackRates:n.getAttribute(ve.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ne.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(ve.TITLE),novolumepref:n.hasAttribute(ve.NO_VOLUME_PREF),...r}}function K0(n){var l,m;let r=n.getAttribute(ve.THEME);if(r){let v=(m=(l=n.getRootNode())==null?void 0:l.getElementById)==null?void 0:m.call(l,r);if(v)return v;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let y=qt.customElements.get(r);if(y!=null&&y.template)return y.template}}function W0(n){var l;let r=(l=n.mediaController)==null?void 0:l.querySelector("media-time-display");return r&&getComputedStyle(r).getPropertyValue("--media-duration-display-display").trim()==="none"}function Dv(n){return n.getAttributeNames().filter(r=>r.startsWith("metadata-")).reduce((r,l)=>{let m=n.getAttribute(l);return m!==null&&(r[l.replace(/^metadata-/,"").replace(/-/g,"_")]=m),r},{})}var q0=Object.values(ne),Y0=Object.values(qr),$0=Object.values(ve),j0=Au(),z0="mux-player",Cv={dialog:void 0,isDialogOpen:!1},ho,fo,Yr,mo,rn,pa,Zn,Pu,Mv,po,Rh,va,Jn,Ou,xv,Nu,Pv,Fu,Ov,Uu,Nv,co=class extends vh{constructor(){super();Bt(this,pa);Bt(this,Pu);Bt(this,po);Bt(this,va);Bt(this,Ou);Bt(this,Nu);Bt(this,Fu);Bt(this,Uu);Bt(this,ho,!1);Bt(this,fo,{});Bt(this,Yr,!0);Bt(this,mo,new Tu(this,"hotkeys"));Bt(this,rn,{...Cv,onCloseErrorDialog:()=>Qt(this,po,Rh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:l=>{ch(this,Mi.activeElement)||l.preventDefault()}});this.attachShadow({mode:"open"}),Qt(this,Pu,Mv).call(this),this.isConnected&&Qt(this,pa,Zn).call(this)}static get observedAttributes(){var l;return[...(l=vh.observedAttributes)!=null?l:[],...Y0,...q0,...$0]}get mediaTheme(){var l;return(l=this.shadowRoot)==null?void 0:l.querySelector("media-theme")}get mediaController(){var l,m;return(m=(l=this.mediaTheme)==null?void 0:l.shadowRoot)==null?void 0:m.querySelector("media-controller")}connectedCallback(){var m;let l=(m=this.shadowRoot)==null?void 0:m.querySelector("mux-video");l&&(l.metadata=Dv(this))}attributeChangedCallback(l,m,v){switch(Qt(this,pa,Zn).call(this),super.attributeChangedCallback(l,m,v),l){case ve.HOTKEYS:ot(this,mo).value=v;break;case ve.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&da(Qe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case ve.THUMBNAIL_TOKEN:{let{aud:I}=ua(v);v&&I!=="t"&&da(Qe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:I}));break}case ve.STORYBOARD_TOKEN:{let{aud:I}=ua(v);v&&I!=="s"&&da(Qe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:I}));break}case ne.PLAYBACK_ID:{v!=null&&v.includes("?token")&&Ji(Qe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ne.STREAM_TYPE:v&&![vt.LIVE,vt.ON_DEMAND,vt.UNKNOWN].includes(v)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=v.includes("dvr")?Number.POSITIVE_INFINITY:0:mh({file:"invalid-stream-type.md",message:Qe("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=v===vt.LIVE?0:Number.NaN}[ne.PLAYBACK_ID,qr.SRC,ve.PLAYBACK_TOKEN].includes(l)&&m!==v&&Gi(this,rn,{...ot(this,rn),...Cv}),Qt(this,va,Jn).call(this,{[iv(l)]:v})}get preferCmcd(){var l;return(l=this.getAttribute(ne.PREFER_CMCD))!=null?l:void 0}set preferCmcd(l){l!==this.preferCmcd&&(l?Wn.includes(l)?this.setAttribute(ne.PREFER_CMCD,l):da(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.PREFER_CMCD))}get hasPlayed(){var l,m;return(m=(l=this.mediaController)==null?void 0:l.hasAttribute("media-has-played"))!=null?m:!1}get inLiveWindow(){var l;return(l=this.mediaController)==null?void 0:l.hasAttribute("media-time-is-live")}get _hls(){var l;return(l=this.media)==null?void 0:l._hls}get mux(){var l;return(l=this.media)==null?void 0:l.mux}get theme(){var l;return(l=this.getAttribute(ve.THEME))!=null?l:""}set theme(l){this.setAttribute(ve.THEME,`${l}`)}get themeProps(){let l=this.mediaTheme;if(!l)return;let m={};for(let v of l.getAttributeNames()){if(Ih.includes(v))continue;let y=l.getAttribute(v);m[bu(v)]=y===""?!0:y}return m}set themeProps(l){var v,y;Qt(this,pa,Zn).call(this);let m={...this.themeProps,...l};for(let I in m){if(Ih.includes(I))continue;let M=l==null?void 0:l[I];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(yu(I),Boolean(M)):(y=this.mediaTheme)==null||y.setAttribute(yu(I),M)}}get playbackId(){var l;return(l=this.getAttribute(ne.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l?this.setAttribute(ne.PLAYBACK_ID,l):this.removeAttribute(ne.PLAYBACK_ID)}get src(){var l,m;return this.playbackId?(l=Xn(this,qr.SRC))!=null?l:void 0:(m=this.getAttribute(qr.SRC))!=null?m:void 0}set src(l){l?this.setAttribute(qr.SRC,l):this.removeAttribute(qr.SRC)}get poster(){var m;let l=this.getAttribute(qr.POSTER);if(l!=null)return l;if(this.playbackId&&!this.audio)return ev(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(l){l||l===""?this.setAttribute(qr.POSTER,l):this.removeAttribute(qr.POSTER)}get storyboardSrc(){var l;return(l=this.getAttribute(ve.STORYBOARD_SRC))!=null?l:void 0}set storyboardSrc(l){l?this.setAttribute(ve.STORYBOARD_SRC,l):this.removeAttribute(ve.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[vt.LIVE,vt.UNKNOWN].includes(this.streamType)))return tv(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(ve.AUDIO)}set audio(l){if(!l){this.removeAttribute(ve.AUDIO);return}this.setAttribute(ve.AUDIO,"")}get hotkeys(){return ot(this,mo)}get nohotkeys(){return this.hasAttribute(ve.NOHOTKEYS)}set nohotkeys(l){if(!l){this.removeAttribute(ve.NOHOTKEYS);return}this.setAttribute(ve.NOHOTKEYS,"")}get thumbnailTime(){return Hr(this.getAttribute(ve.THUMBNAIL_TIME))}set thumbnailTime(l){this.setAttribute(ve.THUMBNAIL_TIME,`${l}`)}get title(){var l;return(l=this.getAttribute(ve.TITLE))!=null?l:""}set title(l){l!==this.title&&(l?this.setAttribute(ve.TITLE,l):this.removeAttribute("title"),super.title=l)}get placeholder(){var l;return(l=Xn(this,ve.PLACEHOLDER))!=null?l:""}set placeholder(l){this.setAttribute(ve.PLACEHOLDER,`${l}`)}get primaryColor(){var m,v;let l=this.getAttribute(ve.PRIMARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),l))return l}set primaryColor(l){this.setAttribute(ve.PRIMARY_COLOR,`${l}`)}get secondaryColor(){var m,v;let l=this.getAttribute(ve.SECONDARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),l))return l}set secondaryColor(l){this.setAttribute(ve.SECONDARY_COLOR,`${l}`)}get defaultShowRemainingTime(){return this.hasAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(l){l?this.setAttribute(ve.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(ve.PLAYBACK_RATES))return this.getAttribute(ve.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(l=>Number(l)).filter(l=>!Number.isNaN(l)).sort((l,m)=>l-m)}set playbackRates(l){if(!l){this.removeAttribute(ve.PLAYBACK_RATES);return}this.setAttribute(ve.PLAYBACK_RATES,l.join(" "))}get forwardSeekOffset(){var l;return(l=Hr(this.getAttribute(ve.FORWARD_SEEK_OFFSET)))!=null?l:10}set forwardSeekOffset(l){this.setAttribute(ve.FORWARD_SEEK_OFFSET,`${l}`)}get backwardSeekOffset(){var l;return(l=Hr(this.getAttribute(ve.BACKWARD_SEEK_OFFSET)))!=null?l:10}set backwardSeekOffset(l){this.setAttribute(ve.BACKWARD_SEEK_OFFSET,`${l}`)}get defaultHiddenCaptions(){return this.hasAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(l){l?this.setAttribute(ve.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var l;return(l=this.getAttribute(ne.PLAYER_SOFTWARE_NAME))!=null?l:z0}get playerSoftwareVersion(){var l;return(l=this.getAttribute(ne.PLAYER_SOFTWARE_VERSION))!=null?l:j0}get beaconCollectionDomain(){var l;return(l=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var l;return(l=this.getAttribute(ne.MAX_RESOLUTION))!=null?l:void 0}set maxResolution(l){l!==this.maxResolution&&(l?this.setAttribute(ne.MAX_RESOLUTION,l):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var l;return(l=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?l:void 0}set customDomain(l){l!==this.customDomain&&(l?this.setAttribute(ne.CUSTOM_DOMAIN,l):this.removeAttribute(ne.CUSTOM_DOMAIN))}get envKey(){var l;return(l=Xn(this,ne.ENV_KEY))!=null?l:void 0}set envKey(l){this.setAttribute(ne.ENV_KEY,`${l}`)}get noVolumePref(){return this.hasAttribute(ve.NO_VOLUME_PREF)}set noVolumePref(l){l?this.setAttribute(ve.NO_VOLUME_PREF,""):this.removeAttribute(ve.NO_VOLUME_PREF)}get debug(){return Xn(this,ne.DEBUG)!=null}set debug(l){l?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG)}get disableCookies(){return Xn(this,ne.DISABLE_COOKIES)!=null}set disableCookies(l){l?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES)}get streamType(){var l,m,v;return(v=(m=this.getAttribute(ne.STREAM_TYPE))!=null?m:(l=this.media)==null?void 0:l.streamType)!=null?v:vt.UNKNOWN}set streamType(l){this.setAttribute(ne.STREAM_TYPE,`${l}`)}get defaultStreamType(){var l,m,v;return(v=(m=this.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?m:(l=this.mediaController)==null?void 0:l.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?v:vt.ON_DEMAND}set defaultStreamType(l){l?this.setAttribute(ve.DEFAULT_STREAM_TYPE,l):this.removeAttribute(ve.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var l,m;return this.hasAttribute(ve.TARGET_LIVE_WINDOW)?+this.getAttribute(ve.TARGET_LIVE_WINDOW):(m=(l=this.media)==null?void 0:l.targetLiveWindow)!=null?m:Number.NaN}set targetLiveWindow(l){l!=this.targetLiveWindow&&(l==null?this.removeAttribute(ve.TARGET_LIVE_WINDOW):this.setAttribute(ve.TARGET_LIVE_WINDOW,`${+l}`))}get liveEdgeStart(){var l;return(l=this.media)==null?void 0:l.liveEdgeStart}get startTime(){return Hr(Xn(this,ne.START_TIME))}set startTime(l){this.setAttribute(ne.START_TIME,`${l}`)}get preferPlayback(){let l=this.getAttribute(ne.PREFER_PLAYBACK);if(l===Yi.MSE||l===Yi.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===Yi.MSE||l===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,l):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){var l;return(l=this.media)==null?void 0:l.metadata}set metadata(l){if(Qt(this,pa,Zn).call(this),!this.media){Ji("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Dv(this),...l}}async addCuePoints(l){var m;if(Qt(this,pa,Zn).call(this),!this.media){Ji("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(m=this.media)==null?void 0:m.addCuePoints(l)}get activeCuePoint(){var l;return(l=this.media)==null?void 0:l.activeCuePoint}get cuePoints(){var l,m;return(m=(l=this.media)==null?void 0:l.cuePoints)!=null?m:[]}getStartDate(){var l;return(l=this.media)==null?void 0:l.getStartDate()}get currentPdt(){var l;return(l=this.media)==null?void 0:l.currentPdt}get tokens(){let l=this.getAttribute(ve.PLAYBACK_TOKEN),m=this.getAttribute(ve.THUMBNAIL_TOKEN),v=this.getAttribute(ve.STORYBOARD_TOKEN);return{...ot(this,fo),...l!=null?{playback:l}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(l){Gi(this,fo,l!=null?l:{})}get playbackToken(){var l;return(l=this.getAttribute(ve.PLAYBACK_TOKEN))!=null?l:void 0}set playbackToken(l){this.setAttribute(ve.PLAYBACK_TOKEN,`${l}`)}get thumbnailToken(){var l;return(l=this.getAttribute(ve.THUMBNAIL_TOKEN))!=null?l:void 0}set thumbnailToken(l){this.setAttribute(ve.THUMBNAIL_TOKEN,`${l}`)}get storyboardToken(){var l;return(l=this.getAttribute(ve.STORYBOARD_TOKEN))!=null?l:void 0}set storyboardToken(l){this.setAttribute(ve.STORYBOARD_TOKEN,`${l}`)}addTextTrack(l,m,v,y){var M;let I=(M=this.media)==null?void 0:M.nativeEl;if(!!I)return uu(I,l,m,v,y)}removeTextTrack(l){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return Ip(m,l)}get textTracks(){var l;return(l=this.media)==null?void 0:l.textTracks}};ho=new WeakMap,fo=new WeakMap,Yr=new WeakMap,mo=new WeakMap,rn=new WeakMap,pa=new WeakSet,Zn=function(){var l,m,v;if(!ot(this,ho)){Gi(this,ho,!0),Qt(this,va,Jn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof qt.HTMLElement))throw""}catch{Ji("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Xp))throw""}catch{Ji("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof qd))throw""}catch{Ji("<media-controller> failed to upgrade!")}sv(this),Qt(this,Ou,xv).call(this),Qt(this,Nu,Pv).call(this),Qt(this,Fu,Ov).call(this),Gi(this,Yr,(m=(l=this.mediaController)==null?void 0:l.hasAttribute("userinactive"))!=null?m:!0),Qt(this,Uu,Nv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Qt(this,va,Jn).call(this)})}},Pu=new WeakSet,Mv=function(){var l,m;try{(l=window==null?void 0:window.CSS)==null||l.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(m=window==null?void 0:window.CSS)==null||m.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},po=new WeakSet,Rh=function(l){Object.assign(ot(this,rn),l),Qt(this,va,Jn).call(this)},va=new WeakSet,Jn=function(l={}){Iv(Rv(V0(this,{...ot(this,rn),...l})),this.shadowRoot)},Ou=new WeakSet,xv=function(){let l=v=>{var M,B;if(!(v!=null&&v.startsWith("theme-")))return;let y=v.replace(/^theme-/,"");if(Ih.includes(y))return;let I=this.getAttribute(v);I!=null?(M=this.mediaTheme)==null||M.setAttribute(y,I):(B=this.mediaTheme)==null||B.removeAttribute(y)};new MutationObserver(v=>{for(let{attributeName:y}of v)l(y)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(l)},Nu=new WeakSet,Pv=function(){var m;let l=v=>{let{detail:y}=v;if(y instanceof Tt||(y=new Tt(y.message,y.code,y.fatal)),!(y!=null&&y.fatal)){da(y),y.data&&da(`${y.name} data:`,y.data);return}let{dialog:I,devlog:M}=xu(y,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&mh(M),Ji(y),y.data&&Ji(`${y.name} data:`,y.data),Qt(this,po,Rh).call(this,{isDialogOpen:!0,dialog:I})};this.addEventListener("error",l),this.media&&(this.media.errorTranslator=(v={})=>{var I,M,B;if(!(((I=this.media)==null?void 0:I.error)instanceof Tt))return v;let{devlog:y}=xu((M=this.media)==null?void 0:M.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(B=this.media)==null?void 0:B.error.code,player_error_message:y.message?String(y.message):v.player_error_message,player_error_context:y.context?String(y.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var I,M;let{detail:y}=v;if(!y){let{message:B,code:H}=(M=(I=this.media)==null?void 0:I.error)!=null?M:{};y=new Tt(B,H)}!(y!=null&&y.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:y}))})},Fu=new WeakSet,Ov=function(){var m,v,y,I;let l=()=>Qt(this,va,Jn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",l),(I=(y=this.media)==null?void 0:y.textTracks)==null||I.addEventListener("removetrack",l)},Uu=new WeakSet,Nv=function(){var z,J;let l=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,y=new WeakMap,I=()=>this.streamType===vt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(ee,le,me=!1)=>{if(I())return;Array.from(ee&&ee.activeCues||[]).forEach(ge=>{if(!(!ge.snapToLines||ge.line<-5||ge.line>=0&&ge.line<10))if(!le||this.paused){let ye=ge.text.split(`
2018
+ `).length,Ee=l?-2:-3;this.streamType===vt.LIVE&&(Ee=l?-1:-2);let de=Ee-ye;if(ge.line===de&&!me)return;y.has(ge)||y.set(ge,ge.line),ge.line=de-1,ge.line=de}else setTimeout(()=>{ge.line=y.get(ge)||"auto"},500)})},B=()=>{var ee,le;M(v,(le=(ee=this.mediaController)==null?void 0:ee.hasAttribute("userinactive"))!=null?le:!1)},H=()=>{var me,_e;let le=Array.from(((_e=(me=this.mediaController)==null?void 0:me.media)==null?void 0:_e.textTracks)||[]).filter(ge=>["subtitles","captions"].includes(ge.kind)&&ge.mode==="showing")[0];le!==v&&(v==null||v.removeEventListener("cuechange",B)),v=le,v==null||v.addEventListener("cuechange",B),M(v,ot(this,Yr))};if(H(),(z=this.textTracks)==null||z.addEventListener("change",H),(J=this.textTracks)==null||J.addEventListener("addtrack",H),navigator.userAgent.includes("Chrome/")){let ee=()=>{M(v,ot(this,Yr),!0),this.paused||window.requestAnimationFrame(ee)};this.addEventListener("playing",()=>{ee()})}this.addEventListener("userinactivechange",()=>{var le,me;let ee=(me=(le=this.mediaController)==null?void 0:le.hasAttribute("userinactive"))!=null?me:!0;ot(this,Yr)!==ee&&(Gi(this,Yr,ee),M(v,ot(this,Yr)))})};function Xn(n,r){return n.media?n.media.getAttribute(r):n.getAttribute(r)}qt.customElements.get("mux-player")||(qt.customElements.define("mux-player",co),qt.MuxPlayerElement=co);var ik=co;export{Tt as MediaError,ik as default,Xn as getVideoAttribute};
1977
2019
  /*!
1978
2020
  * JavaScript Cookie v2.1.3
1979
2021
  * https://github.com/js-cookie/js-cookie