mira-app-server
Version:
Mira Server - standalone server application using mira-app-core
11 lines • 547 kB
JavaScript
import{aJ as bs,a1 as Rs,ax as Se,as as k,x as Ii,cb as Li,bL as to,cr as W,av as Mt,bZ as xe,cR as so,c8 as we,al as as,dl as io,bV as vn,bX as Sn,b1 as ro,bJ as no,aG as ii,d1 as ao,d0 as oo,cW as lo,a_ as co,aH as Yt,dq as tr}from"./index-OOzZz4T6.js";import{P as uo}from"./plyr-BSkcSigr.js";import{P as ho}from"./PreviewHeader-QH_5UTLt.js";const fo=bs({__name:"VideoThumbnailListComponent",props:{videos:{type:Array,required:!0},currentVideoId:{type:String,required:!0}},emits:["video-select"],setup(a,{expose:e}){e();const i={getFileFormat:r=>r.split(".").pop()?.toUpperCase()||"VIDEO",formatDuration:r=>{const n=Math.floor(r/60),o=r%60;return`${n}:${o.toString().padStart(2,"0")}`}};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}}),go={class:"w-28 flex-shrink-0 bg-white dark:bg-muted p-2 flex flex-col items-center border-r border-border dark:border-border"},mo={class:"flex-grow space-y-3 overflow-y-auto pr-1"},po=["onClick"],yo=["alt","src"],Eo={class:"absolute top-1 right-1 inline-flex items-center rounded-sm bg-black/60 px-1.5 py-0.5 text-xs font-medium text-white"},To={key:0,class:"absolute bottom-1 right-1 inline-flex items-center rounded-sm bg-black/60 px-1.5 py-0.5 text-xs font-medium text-white"};function vo(a,e,t,s,i,r){return xe(),Se("div",go,[k("div",mo,[(xe(!0),Se(Ii,null,Li(t.videos,n=>(xe(),Se("div",{key:n.id,class:to(["relative cursor-pointer rounded-lg",n.id===t.currentVideoId?"border-2 border-primary":"border-2 border-transparent hover:border-border dark:hover:border-border"]),onClick:o=>a.$emit("video-select",n.id)},[k("img",{alt:n.name,src:n.thumbnailPath||n.url,class:"h-24 w-24 rounded-lg object-cover",loading:"lazy"},null,8,yo),e[0]||(e[0]=k("div",{class:"absolute inset-0 bg-black/30 flex items-center justify-center rounded-lg"},[k("span",{class:"material-icons text-white"},"play_arrow")],-1)),k("span",Eo,W(s.getFileFormat(n.name)),1),n.metadata?.duration?(xe(),Se("span",To,W(s.formatDuration(n.metadata.duration)),1)):Mt("",!0)],10,po))),128))])])}const So=Rs(fo,[["render",vo],["__scopeId","data-v-e124886b"],["__file","D:/mira_typescript/packages/mira-client/src/renderer/components/business/VideoThumbnailListComponent.vue"]]),N=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},xo=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Ao},Ao=Number.MAX_SAFE_INTEGER||9007199254740991;let Y=(function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a})({}),R=(function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a})({}),m=(function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a})({});var J={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},$={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class mt{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Io{constructor(e,t,s,i=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new mt(e),this.fast_=new mt(t),this.defaultTTFB_=i,this.ttfb_=new mt(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new mt(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new mt(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new mt(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,r=s/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function Lo(a,e,t){return(e=Ro(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ne(){return ne=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(a[s]=t[s])}return a},ne.apply(null,arguments)}function sr(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,s)}return t}function ie(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sr(Object(t),!0).forEach(function(s){Lo(a,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):sr(Object(t)).forEach(function(s){Object.defineProperty(a,s,Object.getOwnPropertyDescriptor(t,s))})}return a}function bo(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var s=t.call(a,e);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function Ro(a){var e=bo(a,"string");return typeof e=="symbol"?e:e+""}class Fe{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${e}]:`;this.trace=tt,this.debug=t.debug.bind(null,s),this.log=t.log.bind(null,s),this.warn=t.warn.bind(null,s),this.info=t.info.bind(null,s),this.error=t.error.bind(null,s)}}const tt=function(){},_o={trace:tt,debug:tt,log:tt,warn:tt,info:tt,error:tt};function ri(){return ne({},_o)}function Do(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):tt}function ir(a,e,t){return e[a]?e[a].bind(e):Do(a,t)}const ni=ri();function Co(a,e,t){const s=ri();if(typeof console=="object"&&a===!0||typeof a=="object"){const i=["debug","log","info","warn","error"];i.forEach(r=>{s[r]=ir(r,a,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.17`)}catch{return ri()}i.forEach(r=>{ni[r]=ir(r,a)})}else ne(ni,s);return s}const re=ni;function rt(a=!0){return typeof self>"u"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Po(a){return typeof self<"u"&&a===self.ManagedMediaSource}function xn(a,e){const t=Object.keys(a),s=Object.keys(e),i=t.length,r=s.length;return!i||!r||i===r&&!t.some(n=>s.indexOf(n)===-1)}function Ce(a,e=!1){if(typeof TextDecoder<"u"){const l=new TextDecoder("utf-8").decode(a);if(e){const d=l.indexOf("\0");return d!==-1?l.substring(0,d):l}return l.replace(/\0/g,"")}const t=a.length;let s,i,r,n="",o=0;for(;o<t;){if(s=a[o++],s===0&&e)return n;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(s);break;case 12:case 13:i=a[o++],n+=String.fromCharCode((s&31)<<6|i&63);break;case 14:i=a[o++],r=a[o++],n+=String.fromCharCode((s&15)<<12|(i&63)<<6|(r&63)<<0);break}}return n}function ye(a){let e="";for(let t=0;t<a.length;t++){let s=a[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}function An(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function ko(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ws={exports:{}},rr;function wo(){return rr||(rr=1,(function(a,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,l,d){if(d=d||{},c=c.trim(),l=l.trim(),!l){if(!d.alwaysNormalize)return c;var u=o.parseURL(c);if(!u)throw new Error("Error trying to parse base URL.");return u.path=o.normalizePath(u.path),o.buildURLFromParts(u)}var h=o.parseURL(l);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return d.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):l;var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var g=i.exec(f.path);f.netLoc=g[1],f.path=g[2]}f.netLoc&&!f.path&&(f.path="/");var y={scheme:f.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(y.netLoc=f.netLoc,h.path[0]!=="/"))if(!h.path)y.path=f.path,h.params||(y.params=f.params,h.query||(y.query=f.query));else{var p=f.path,E=p.substring(0,p.lastIndexOf("/")+1)+h.path;y.path=o.normalizePath(E)}return y.path===null&&(y.path=d.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(y)},parseURL:function(c){var l=s.exec(c);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(r,"");c.length!==(c=c.replace(n,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()})(ws)),ws.exports}var bi=wo();class Ri{constructor(){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}}}var ae={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class In{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Fo(this,"stats")}setByteRange(e,t){const s=e.split("@",2);let i;s.length===1?i=t?.byteRangeEndOffset||0:i=parseInt(s[1]),this._byteRange=[i,parseInt(s[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[ae.AUDIO]:null,[ae.VIDEO]:null,[ae.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Ri),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=bi.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ae.AUDIO]=null,e[ae.VIDEO]=null,e[ae.AUDIOVIDEO]=null}}function ue(a){return a.sn!=="initSegment"}class Os extends In{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(N(e)&&N(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const s=Object.keys(t);if(s.length===1){const i=this._decryptdata=t[s[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=N(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const s=Object.keys(this.levelkeys),i=s.length;if(i>1||i===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!N(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ue(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var s;const i=t[e];i&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,r,n=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:r,partial:n};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,s),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,r)}}class Oo extends In{constructor(e,t,s,i,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Ln(a,e){const t=Object.getPrototypeOf(a);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||Ln(t,e)}}function Fo(a,e){const t=Ln(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const nr=Math.pow(2,32)-1,Mo=[].push,bn={video:1,audio:2,id3:3,text:4};function he(a){return String.fromCharCode.apply(null,a)}function Rn(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function q(a,e){const t=_n(a,e);return t<0?4294967296+t:t}function ar(a,e){let t=q(a,e);return t*=Math.pow(2,32),t+=q(a,e+4),t}function _n(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function No(a){const e=a.byteLength;for(let t=0;t<e;){const s=q(a,t);if(s>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=s>1?t+s:e}return!1}function Z(a,e){const t=[];if(!e.length)return t;const s=a.byteLength;for(let i=0;i<s;){const r=q(a,i),n=he(a.subarray(i+4,i+8)),o=r>1?i+r:s;if(n===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const c=Z(a.subarray(i+8,o),e.slice(1));c.length&&Mo.apply(t,c)}i=o}return t}function Bo(a){const e=[],t=a[0];let s=8;const i=q(a,s);s+=4;let r=0,n=0;t===0?(r=q(a,s),n=q(a,s+4),s+=8):(r=ar(a,s),n=ar(a,s+8),s+=16),s+=2;let o=a.length+n;const c=Rn(a,s);s+=2;for(let l=0;l<c;l++){let d=s;const u=q(a,d);d+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return re.warn("SIDX has hierarchical references (not supported)"),null;const g=q(a,d);d+=4,e.push({referenceSize:h,subsegmentDuration:g,info:{duration:g/i,start:o,end:o+h-1}}),o+=h,d+=4,s=d}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:c,references:e}}function Dn(a){const e=[],t=Z(a,["moov","trak"]);for(let i=0;i<t.length;i++){const r=t[i],n=Z(r,["tkhd"])[0];if(n){let o=n[0];const c=q(n,o===0?12:20),l=Z(r,["mdia","mdhd"])[0];if(l){o=l[0];const d=q(l,o===0?12:20),u=Z(r,["mdia","hdlr"])[0];if(u){const h=he(u.subarray(8,12)),f={soun:ae.AUDIO,vide:ae.VIDEO}[h],g=Z(r,["mdia","minf","stbl","stsd"])[0],y=Uo(g);f?(e[c]={timescale:d,type:f,stsd:y},e[f]=ie({timescale:d,id:c},y)):e[c]={timescale:d,type:h,stsd:y}}}}}return Z(a,["moov","mvex","trex"]).forEach(i=>{const r=q(i,4),n=e[r];n&&(n.default={duration:q(i,12),flags:q(i,20)})}),e}function Uo(a){const e=a.subarray(8),t=e.subarray(86),s=he(e.subarray(4,8));let i=s,r;const n=s==="enca"||s==="encv";if(n){const l=Z(e,[s])[0].subarray(s==="enca"?28:78);Z(l,["sinf"]).forEach(u=>{const h=Z(u,["schm"])[0];if(h){const f=he(h.subarray(4,8));if(f==="cbcs"||f==="cenc"){const g=Z(u,["frma"])[0];g&&(i=he(g))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Z(t,["avcC"])[0];c&&c.length>3&&(i+="."+jt(c[1])+jt(c[2])+jt(c[3]),r=Wt(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Z(e,[s])[0],l=Z(c.subarray(28),["esds"])[0];if(l&&l.length>7){let d=4;if(l[d++]!==3)break;d=Fs(l,d),d+=2;const u=l[d++];if(u&128&&(d+=2),u&64&&(d+=l[d++]),l[d++]!==4)break;d=Fs(l,d);const h=l[d++];if(h===64)i+="."+jt(h);else break;if(d+=12,l[d++]!==5)break;d=Fs(l,d);const f=l[d++];let g=(f&248)>>3;g===31&&(g+=1+((f&7)<<3)+((l[d]&224)>>5)),i+="."+g}break}case"hvc1":case"hev1":{const c=Z(t,["hvcC"])[0];if(c&&c.length>12){const l=c[1],d=["","A","B","C"][l>>6],u=l&31,h=q(c,2),f=(l&32)>>5?"H":"L",g=c[12],y=c.subarray(6,12);i+="."+d+u,i+="."+$o(h).toString(16).toUpperCase(),i+="."+f+g;let p="";for(let E=y.length;E--;){const T=y[E];(T||p)&&(p="."+T.toString(16).toUpperCase()+p)}i+=p}r=Wt(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=Wt(i,t)||i;break}case"vp09":{const c=Z(t,["vpcC"])[0];if(c&&c.length>6){const l=c[4],d=c[5],u=c[6]>>4&15;i+="."+Ve(l)+"."+Ve(d)+"."+Ve(u)}break}case"av01":{const c=Z(t,["av1C"])[0];if(c&&c.length>2){const l=c[1]>>>5,d=c[1]&31,u=c[2]>>>7?"H":"M",h=(c[2]&64)>>6,f=(c[2]&32)>>5,g=l===2&&h?f?12:10:h?10:8,y=(c[2]&16)>>4,p=(c[2]&8)>>3,E=(c[2]&4)>>2,T=c[2]&3;i+="."+l+"."+Ve(d)+u+"."+Ve(g)+"."+y+"."+p+E+T+"."+Ve(1)+"."+Ve(1)+"."+Ve(1)+"."+0,r=Wt("dav1",t)}break}}return{codec:i,encrypted:n,supplemental:r}}function Wt(a,e){const t=Z(e,["dvvC"]),s=t.length?t[0]:Z(e,["dvcC"])[0];if(s){const i=s[2]>>1&127,r=s[2]<<5&32|s[3]>>3&31;return a+"."+Ve(i)+"."+Ve(r)}}function $o(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function Fs(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function jt(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Ve(a){return(a<10?"0":"")+a}function Go(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Cn(a,(s,i)=>{const r=s.subarray(8,24);r.some(n=>n!==0)||(re.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${ye(r)} -> ${ye(t)}`),s.set(t,8))})}function Vo(a){const e=[];return Cn(a,t=>e.push(t.subarray(8,24))),e}function Cn(a,e){Z(a,["moov","trak"]).forEach(s=>{const i=Z(s,["mdia","minf","stbl","stsd"])[0];if(!i)return;const r=i.subarray(8);let n=Z(r,["enca"]);const o=n.length>0;o||(n=Z(r,["encv"])),n.forEach(c=>{const l=o?c.subarray(28):c.subarray(78);Z(l,["sinf"]).forEach(u=>{const h=Pn(u);h&&e(h,o)})})})}function Pn(a){const e=Z(a,["schm"])[0];if(e){const t=he(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=Z(a,["schi","tenc"])[0];if(s)return s}}}function Ko(a,e,t){const s={},i=Z(a,["moof","traf"]);for(let r=0;r<i.length;r++){const n=i[r],o=Z(n,["tfhd"])[0],c=q(o,4),l=e[c];if(!l)continue;s[c]||(s[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});const d=s[c],u=Z(n,["tfdt"])[0];if(u){const v=u[0];let S=q(u,4);v===1&&(S===nr?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(S*=nr+1,S+=q(u,8))),N(S)&&(!N(d.start)||S<d.start)&&(d.start=S)}const h=l.default,f=q(o,0)|h?.flags;let g=h?.duration||0;f&8&&(f&2?g=q(o,12):g=q(o,8));const y=Z(n,["trun"]);let p=d.start||0,E=0,T=g;for(let v=0;v<y.length;v++){const S=y[v],x=q(S,4),D=d.sampleCount;d.sampleCount+=x;const I=S[3]&1,_=S[3]&4,A=S[2]&1,L=S[2]&2,C=S[2]&4,w=S[2]&8;let U=8,K=x;for(I&&(U+=4),_&&x&&(!(S[U+1]&1)&&d.keyFrameIndex===void 0&&(d.keyFrameIndex=D),U+=4,A?(T=q(S,U),U+=4):T=g,L&&(U+=4),w&&(U+=4),p+=T,E+=T,K--);K--;)A?(T=q(S,U),U+=4):T=g,L&&(U+=4),C&&(S[U+1]&1||d.keyFrameIndex===void 0&&(d.keyFrameIndex=d.sampleCount-(K+1),d.keyFrameStart=p),U+=4),w&&(U+=4),p+=T,E+=T;!E&&g&&(E+=g*x)}d.duration+=E}if(!Object.keys(s).some(r=>s[r].duration)){let r=1/0,n=0;const o=Z(a,["sidx"]);for(let c=0;c<o.length;c++){const l=Bo(o[c]);if(l!=null&&l.references){r=Math.min(r,l.earliestPresentationTime/l.timescale);const d=l.references.reduce((u,h)=>u+h.info.duration||0,0);n=Math.max(n,d+l.earliestPresentationTime/l.timescale)}}n&&N(n)&&Object.keys(s).forEach(c=>{s[c].duration||(s[c].duration=n*s[c].timescale-s[c].start)})}return s}function Ho(a){const e={valid:null,remainder:null},t=Z(a,["moof"]);if(t.length<2)return e.remainder=a,e;const s=t[t.length-1];return e.valid=a.slice(0,s.byteOffset-8),e.remainder=a.slice(s.byteOffset-8),e}function Oe(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function or(a,e){const t=[],s=e.samples,i=e.timescale,r=e.id;let n=!1;return Z(s,["moof"]).map(c=>{const l=c.byteOffset-8;Z(c,["traf"]).map(u=>{const h=Z(u,["tfdt"]).map(f=>{const g=f[0];let y=q(f,4);return g===1&&(y*=Math.pow(2,32),y+=q(f,8)),y/i})[0];return h!==void 0&&(a=h),Z(u,["tfhd"]).map(f=>{const g=q(f,4),y=q(f,0)&16777215,p=(y&1)!==0,E=(y&2)!==0,T=(y&8)!==0;let v=0;const S=(y&16)!==0;let x=0;const D=(y&32)!==0;let I=8;g===r&&(p&&(I+=8),E&&(I+=4),T&&(v=q(f,I),I+=4),S&&(x=q(f,I),I+=4),D&&(I+=4),e.type==="video"&&(n=_s(e.codec)),Z(u,["trun"]).map(_=>{const A=_[0],L=q(_,0)&16777215,C=(L&1)!==0;let w=0;const U=(L&4)!==0,K=(L&256)!==0;let G=0;const O=(L&512)!==0;let V=0;const B=(L&1024)!==0,H=(L&2048)!==0;let j=0;const F=q(_,4);let M=8;C&&(w=q(_,M),M+=4),U&&(M+=4);let X=w+l;for(let se=0;se<F;se++){if(K?(G=q(_,M),M+=4):G=v,O?(V=q(_,M),M+=4):V=x,B&&(M+=4),H&&(A===0?j=q(_,M):j=_n(_,M),M+=4),e.type===ae.VIDEO){let Q=0;for(;Q<V;){const ee=q(s,X);if(X+=4,Yo(n,s[X])){const Te=s.subarray(X,X+ee);_i(Te,n?2:1,a+j/i,t)}X+=ee,Q+=ee+4}}a+=G/i}}))})})}),t}function _s(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Yo(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function _i(a,e,t,s){const i=kn(a);let r=0;r+=e;let n=0,o=0,c=0;for(;r<i.length;){n=0;do{if(r>=i.length)break;c=i[r++],n+=c}while(c===255);o=0;do{if(r>=i.length)break;c=i[r++],o+=c}while(c===255);const l=i.length-r;let d=r;if(o<l)r+=o;else if(o>l){re.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(n===4){if(i[d++]===181){const h=Rn(i,d);if(d+=2,h===49){const f=q(i,d);if(d+=4,f===1195456820){const g=i[d++];if(g===3){const y=i[d++],p=31&y,E=64&y,T=E?2+p*3:0,v=new Uint8Array(T);if(E){v[0]=y;for(let S=1;S<T;S++)v[S]=i[d++]}s.push({type:g,payloadType:n,pts:t,bytes:v})}}}}}else if(n===5&&o>16){const u=[];for(let g=0;g<16;g++){const y=i[d++].toString(16);u.push(y.length==1?"0"+y:y),(g===3||g===5||g===7||g===9)&&u.push("-")}const h=o-16,f=new Uint8Array(h);for(let g=0;g<h;g++)f[g]=i[d++];s.push({payloadType:n,pts:t,uuid:u.join(""),userData:Ce(f),userDataBytes:f})}}}function kn(a){const e=a.byteLength,t=[];let s=1;for(;s<e-2;)a[s]===0&&a[s+1]===0&&a[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return a;const i=e-t.length,r=new Uint8Array(i);let n=0;for(s=0;s<i;n++,s++)n===t[0]&&(n++,t.shift()),r[s]=a[n];return r}function Wo(a){const e=a[0];let t="",s="",i=0,r=0,n=0,o=0,c=0,l=0;if(e===0){for(;he(a.subarray(l,l+1))!=="\0";)t+=he(a.subarray(l,l+1)),l+=1;for(t+=he(a.subarray(l,l+1)),l+=1;he(a.subarray(l,l+1))!=="\0";)s+=he(a.subarray(l,l+1)),l+=1;s+=he(a.subarray(l,l+1)),l+=1,i=q(a,12),r=q(a,16),o=q(a,20),c=q(a,24),l=28}else if(e===1){l+=4,i=q(a,l),l+=4;const u=q(a,l);l+=4;const h=q(a,l);for(l+=4,n=2**32*u+h,xo(n)||(n=Number.MAX_SAFE_INTEGER,re.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=q(a,l),l+=4,c=q(a,l),l+=4;he(a.subarray(l,l+1))!=="\0";)t+=he(a.subarray(l,l+1)),l+=1;for(t+=he(a.subarray(l,l+1)),l+=1;he(a.subarray(l,l+1))!=="\0";)s+=he(a.subarray(l,l+1)),l+=1;s+=he(a.subarray(l,l+1)),l+=1}const d=a.subarray(l,a.byteLength);return{schemeIdUri:t,value:s,timeScale:i,presentationTime:n,presentationTimeDelta:r,eventDuration:o,id:c,payload:d}}function jo(a,...e){const t=e.length;let s=8,i=t;for(;i--;)s+=e[i].byteLength;const r=new Uint8Array(s);for(r[0]=s>>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(a,4),i=0,s=8;i<t;i++)r.set(e[i],s),s+=e[i].byteLength;return r}function qo(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let s,i;s=0,i=new Uint8Array;let r;s>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const n=new Uint8Array(4);return t.byteLength>0&&new DataView(n.buffer).setUint32(0,t.byteLength,!1),jo([112,115,115,104],new Uint8Array([s,0,0,0]),a,r,i,n,t)}function zo(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let s=0;for(;s+32<t;){const i=new DataView(a,s),r=Xo(i);e.push(r),s+=r.size}}return e}function Xo(a){const e=a.getUint32(0),t=a.byteOffset,s=a.byteLength;if(s<e)return{offset:t,size:s};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const r=a.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};const n=a.buffer,o=ye(new Uint8Array(n,t+12,16));let c=null,l=null,d=0;if(r===0)d=28;else{const h=a.getUint32(28);if(!h||s<32+h*16)return{offset:t,size:e};c=[];for(let f=0;f<h;f++)c.push(new Uint8Array(n,t+32+f*16,16));d=32+h*16}if(!d)return{offset:t,size:e};const u=a.getUint32(d);return e-32<u?{offset:t,size:e}:(l=new Uint8Array(n,t+d+4,u),{version:r,systemId:o,kids:c,data:l,offset:t,size:e})}const wn=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Rt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Di(a,e){const t=Rt[e];return!!t&&!!t[a.slice(0,4)]}function Nt(a,e,t=!0){return!a.split(",").some(s=>!Ci(s,e,t))}function Ci(a,e,t=!0){var s;const i=rt(t);return(s=i?.isTypeSupported(Bt(a,e)))!=null?s:!1}function Bt(a,e){return`${e}/mp4;codecs=${a}`}function lr(a){if(a){const e=a.substring(0,4);return Rt.video[e]}return 2}function ms(a){const e=wn();return a.split(",").reduce((t,s)=>{const r=e&&_s(s)?9:Rt.video[s];return r?(r*2+t)/(t?3:2):(Rt.audio[s]+t)/(t?2:1)},0)}const Ms={};function Qo(a,e=!0){if(Ms[a])return Ms[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let i=0;i<t.length;i++){var s;if(Ci(t[i],"audio",e))return Ms[a]=t[i],t[i];if(t[i]==="mp3"&&(s=rt(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return a}const Zo=/flac|opus|mp4a\.40\.34/i;function ps(a,e=!0){return a.replace(Zo,t=>Qo(t.toLowerCase(),e))}function Jo(a,e){const t=[];if(a){const s=a.split(",");for(let i=0;i<s.length;i++)Di(s[i],"video")||t.push(s[i])}return e&&t.push(e),t.join(",")}function os(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(cr(a,"audio")||cr(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let s=t.length;s--;)if(t[s].substring(0,4)===a.substring(0,4))return t[s]}return t[0]}}return e||a}function cr(a,e){return Di(a,e)&&Ci(a,e)}function el(a){const e=a.split(",");for(let t=0;t<e.length;t++){const s=e[t].split(".");s.length>2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function tl(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return a}function dr(a){const e=rt(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ai(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const sl={supported:!0,powerEfficient:!0,smooth:!0},il={supported:!1,smooth:!1,powerEfficient:!1},On={supported:!0,configurations:[],decodingInfoResults:[sl]};function Fn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[il],error:a}}function rl(a,e,t,s,i,r){const n=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=r?.audioCodec,l=r?.channels,d=l?parseInt(l):c?1/0:2;let u=null;if(o!=null&&o.length)try{o.length===1&&o[0]?u=e.groups[o[0]].channels:u=o.reduce((h,f)=>{if(f){const g=e.groups[f];if(!g)throw new Error(`Audio track group ${f} not found`);Object.keys(g.channels).forEach(y=>{h[y]=(h[y]||0)+g.channels[y]})}return h},{2:0})}catch{return!0}return n!==void 0&&(n.split(",").some(h=>_s(h))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(s,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!u&&N(d)&&Object.keys(u).some(h=>parseInt(h)>d)}function Mn(a,e,t,s={}){const i=a.videoCodec;if(!i&&!a.audioCodec||!t)return Promise.resolve(On);const r=[],n=nl(a),o=n.length,c=al(a,e,o>0),l=c.length;for(let d=o||1*l||1;d--;){const u={type:"media-source"};if(o&&(u.video=n[d%o]),l){u.audio=c[d%l];const h=u.audio.bitrate;u.video&&h&&(u.video.bitrate-=h)}r.push(u)}if(i){const d=navigator.userAgent;if(i.split(",").some(u=>_s(u))&&wn())return Promise.resolve(Fn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${d})`),r))}return Promise.all(r.map(d=>{const u=ll(d);return s[u]||(s[u]=t.decodingInfo(d))})).then(d=>({supported:!d.some(u=>!u.supported),configurations:r,decodingInfoResults:d})).catch(d=>({supported:!1,configurations:r,decodingInfoResults:[],error:d}))}function nl(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),s=Nn(a),i=a.width||640,r=a.height||480,n=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const l={contentType:Bt(tl(c),"video"),width:i,height:r,bitrate:s,framerate:n};return o!=="sdr"&&(l.transferFunction=o),l}):[]}function al(a,e,t){var s;const i=(s=a.audioCodec)==null?void 0:s.split(","),r=Nn(a);return i&&a.audioGroups?a.audioGroups.reduce((n,o)=>{var c;const l=o?(c=e.groups[o])==null?void 0:c.tracks:null;return l?l.reduce((d,u)=>{if(u.groupId===o){const h=parseFloat(u.channels||"");i.forEach(f=>{const g={contentType:Bt(f,"audio"),bitrate:t?ol(f,r):r};h&&(g.channels=""+h),d.push(g)})}return d},n):n},[]):[]}function ol(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Nn(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function ll(a){let e="";const{audio:t,video:s}=a;if(s){const i=ai(s.contentType);e+=`${i}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const i=ai(t.contentType);e+=`${s?"_":""}${i}_c${t.channels}`}return e}const oi=["NONE","TYPE-0","TYPE-1",null];function cl(a){return oi.indexOf(a)>-1}const ys=["SDR","PQ","HLG"];function dl(a){return!!a&&ys.indexOf(a)>-1}var ls={No:"",Yes:"YES",v2:"v2"};function ur(a){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=a,i=s<e/2;return e&&i?t?ls.v2:ls.Yes:ls.No}class hr{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Ut{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return fr(this._audioGroups,e)}hasSubtitleGroup(e){return fr(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function fr(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function ul(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function hl(a,e){let t=!1,s=[];if(a&&(t=a!=="SDR",s=[a]),e){s=e.allowedVideoRanges||ys.slice(0);const i=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&ul(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const fl=a=>{const e=new WeakSet;return(t,s)=>{if(a&&(s=a(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},oe=(a,e)=>JSON.stringify(a,fl(e));function gl(a,e,t,s,i){const r=Object.keys(a),n=s?.channels,o=s?.audioCodec,c=i?.videoCodec,l=n&&parseInt(n)===2;let d=!1,u=!1,h=1/0,f=1/0,g=1/0,y=1/0,p=0,E=[];const{preferHDR:T,allowedVideoRanges:v}=hl(e,i);for(let _=r.length;_--;){const A=a[r[_]];d||(d=A.channels[2]>0),h=Math.min(h,A.minHeight),f=Math.min(f,A.minFramerate),g=Math.min(g,A.minBitrate),v.filter(C=>A.videoRanges[C]>0).length>0&&(u=!0)}h=N(h)?h:0,f=N(f)?f:0;const S=Math.max(1080,h),x=Math.max(30,f);g=N(g)?g:t,t=Math.max(g,t),u||(e=void 0);const D=r.length>1;return{codecSet:r.reduce((_,A)=>{const L=a[A];if(A===_)return _;if(E=u?v.filter(C=>L.videoRanges[C]>0):[],D){if(L.minBitrate>t)return $e(A,`min bitrate of ${L.minBitrate} > current estimate of ${t}`),_;if(!L.hasDefaultAudio)return $e(A,"no renditions with default or auto-select sound found"),_;if(o&&A.indexOf(o.substring(0,4))%5!==0)return $e(A,`audio codec preference "${o}" not found`),_;if(n&&!l){if(!L.channels[n])return $e(A,`no renditions with ${n} channel sound found (channels options: ${Object.keys(L.channels)})`),_}else if((!o||l)&&d&&L.channels[2]===0)return $e(A,"no renditions with stereo sound found"),_;if(L.minHeight>S)return $e(A,`min resolution of ${L.minHeight} > maximum of ${S}`),_;if(L.minFramerate>x)return $e(A,`min framerate of ${L.minFramerate} > maximum of ${x}`),_;if(!E.some(C=>L.videoRanges[C]>0))return $e(A,`no variants with VIDEO-RANGE of ${oe(E)} found`),_;if(c&&A.indexOf(c.substring(0,4))%5!==0)return $e(A,`video codec preference "${c}" not found`),_;if(L.maxScore<p)return $e(A,`max score of ${L.maxScore} < selected max of ${p}`),_}return _&&(ms(A)>=ms(_)||L.fragmentError>a[_].fragmentError)?_:(y=L.minIndex,p=L.maxScore,A)},void 0),videoRanges:E,preferHDR:T,minFramerate:f,minBitrate:g,minIndex:y}}function $e(a,e){re.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Bn(a){return a.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const i=t.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ml(a,e,t,s){return a.slice(t,s+1).reduce((i,r,n)=>{if(!r.codecSet)return i;const o=r.audioGroups;let c=i[r.codecSet];c||(i[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,l),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,n),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,o&&o.forEach(d=>{if(!d)return;const u=e.groups[d];u&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?u.hasDefault:u.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(u.channels).forEach(h=>{c.channels[h]=(c.channels[h]||0)+u.channels[h]}))}),i},{})}function gr(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}=a;return{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}}function Ye(a,e,t){if("attrs"in a){const s=e.indexOf(a);if(s!==-1)return s}for(let s=0;s<e.length;s++){const i=e[s];if(ht(a,i,t))return s}return-1}function ht(a,e,t){const{groupId:s,name:i,lang:r,assocLang:n,default:o}=a,c=a.forced;return(s===void 0||e.groupId===s)&&(i===void 0||e.name===i)&&(r===void 0||pl(r,e.lang))&&(r===void 0||e.assocLang===n)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||yl(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function pl(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function yl(a,e=""){const t=a.split(","),s=e.split(",");return t.length===s.length&&!t.some(i=>s.indexOf(i)===-1)}function ut(a,e){const{audioCodec:t,channels:s}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function El(a,e,t,s,i){const r=e[s],o=e.reduce((h,f,g)=>{const y=f.uri;return(h[y]||(h[y]=[])).push(g),h},{})[r.uri];o.length>1&&(s=Math.max.apply(Math,o));const c=r.videoRange,l=r.frameRate,d=r.codecSet.substring(0,4),u=mr(e,s,h=>{if(h.videoRange!==c||h.frameRate!==l||h.codecSet.substring(0,4)!==d)return!1;const f=h.audioGroups,g=t.filter(y=>!f||f.indexOf(y.groupId)!==-1);return Ye(a,g,i)>-1});return u>-1?u:mr(e,s,h=>{const f=h.audioGroups,g=t.filter(y=>!f||f.indexOf(y.groupId)!==-1);return Ye(a,g,i)>-1})}function mr(a,e,t){for(let s=e;s>-1;s--)if(t(a[s]))return s;for(let s=e+1;s<a.length;s++)if(t(a[s]))return s;return-1}function Es(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Tl extends Fe{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var s;const{fragCurrent:i,partCurrent:r,hls:n}=this,{autoLevelEnabled:o,media:c}=n;if(!i||!c)return;const l=performance.now(),d=r?r.stats:i.stats,u=r?r.duration:i.duration,h=l-d.loading.start,f=n.minAutoLevel,g=i.level,y=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||g<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const p=y>-1&&y!==g,E=!!t||p;if(!E&&(c.paused||!c.playbackRate||!c.readyState))return;const T=n.mainForwardBufferInfo;if(!E&&T===null)return;const v=this.bwEstimator.getEstimateTTFB(),S=Math.abs(c.playbackRate);if(h<=Math.max(v,1e3*(u/(S*2))))return;const x=T?T.len/S:0,D=d.loading.first?d.loading.first-d.loading.start:-1,I=d.loaded&&D>-1,_=this.getBwEstimate(),A=n.levels,L=A[g],C=Math.max(d.loaded,Math.round(u*(i.bitrate||L.averageBitrate)/8));let w=I?h-D:h;w<1&&I&&(w=Math.min(h,d.loaded*8/_));const U=I?d.loaded*1e3/w:0,K=v/1e3,G=U?(C-d.loaded)/U:C*8/_+K;if(G<=x)return;const O=U?U*8:_,V=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let H=Number.POSITIVE_INFINITY,j;for(j=g-1;j>f;j--){const se=A[j].maxBitrate,Q=!A[j].details||V;if(H=this.getTimeToLoadFrag(K,O,u*se,Q),H<Math.min(x,u+K))break}if(H>=G||H>u*10)return;I?this.bwEstimator.sample(h-Math.min(v,D),d.loaded):this.bwEstimator.sampleTTFB(h);const F=A[j].maxBitrate;this.getBwEstimate()*B>F&&this.resetEstimator(F);const M=this.findBestLevel(F,f,j,0,x,1,1);M>-1&&(j=M),this.warn(`Fragment ${i.sn}${r?" part "+r.index:""} of level ${g} is loading too slowly;
Fragment duration: ${i.duration.toFixed(3)}
Time to underbuffer: ${x.toFixed(3)} s
Estimated load time for current fragment: ${G.toFixed(3)} s
Estimated load time for down switch fragment: ${H.toFixed(3)} s
TTFB estimate: ${D|0} ms
Current BW estimate: ${N(_)?_|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${j} @ ${F|0} bps`),n.nextLoadLevel=n.nextAutoLevel=j,this.clearTimer();const X=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===j&&j>0){const se=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${j>0?"and switching down":""}
Fragment duration: ${i.duration.toFixed(3)} s
Time to underbuffer: ${se.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,j>f){let Q=this.findBestLevel(this.hls.levels[f].bitrate,f,j,0,se,1,1);Q===-1&&(Q=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Q,this.resetEstimator(this.hls.levels[Q].bitrate)}}};p||G>H*2?X():this.timer=self.setInterval(X,H*1e3),n.trigger(m.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Io(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_LOADING,this.onFragLoadin