53 lines
652 KiB
JavaScript
53 lines
652 KiB
JavaScript
|
/**
|
||
|
* @license
|
||
|
* Video.js 8.19.1 <http://videojs.com/>
|
||
|
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
||
|
* Available under Apache License Version 2.0
|
||
|
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
||
|
*
|
||
|
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
||
|
* Available under Apache License Version 2.0
|
||
|
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
||
|
*/
|
||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){var M="8.19.1";let U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}let q={prefixed:!0};var j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=j[0];let V;for(let e=0;e<j.length;e++)if(j[e][1]in document){V=j[e];break}if(V){for(let e=0;e<V.length;e++)q[H[e]]=V[e];q.prefixed=V[0]!==H[0]}let z=[];function $(e){return Y(e)?Object.keys(e):[]}let o=function s(r,n=":",a=""){let t="info",i;function o(...e){i("log",t,e)}var l,d,h;return i=(l=r,h=a,(t,i,s)=>{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),z&&(z.push([].concat(s)),e=z.length-1e3,z.splice(0,0<e?e:0)),window.console){let e=window.console[t];(e=e||"debug"!==t?e:window.console.info||window.console.log)&&i&&r.test(t)&&e[Array.isArray(s)?"apply":"call"](window.console,s)}}),(d=o).createLogger=(e,t,i)=>s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},(o.history=()=>z?[].concat(z):[]).filter=t=>(z||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{z&&(z.length=0)},o.history.disable=()=>{null!==z&&(z.length=0,z=null)},o.history.enable=()=>{null===z&&(z=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),W=o.createLogger,G=Object.prototype.toString;function X(t,i){$(t).forEach(e=>i(t[e],e))}function K(i,s,e=0){return $(i).reduce((e,t)=>s(e,i[t],t),e)}function Y(e){return!!e&&"object"==typeof e}function Q(e){return Y(e)&&"[object Object]"===G.call(e)&&e.constructor===Object}function d(...e){let i={};return e.forEach(e=>{e&&X(e,(e,t)=>{Q(e)?(Q(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function J(e={}){var t,i,s=[];for(t in e)e.hasOwnProperty(t)&&(i=e[t],s.push(i));return s}function Z(t,i,s,e=!0){let r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}let ee=Object.freeze({__proto__:null,each:X,reduce:K,isObject:Y,isPlain:Q,merge:d,values:J,defineLazyProperty:Z}),te=!1,ie=null,se=!1,re,ne=!1,ae=!1,oe=!1,le=!1,de=null,he=null;var e=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let ue=null,ce=!1,pe=!1,me=!1,ge=!1,fe=!1,ye=!1,_e=!1,ve=Boolean(Ee()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var be,t=window.navigator&&window.navigator.userAgentData;if(t&&t.platform&&t.brands&&(se="Android"===t.platform,ae=Boolean(t.brands.find(e=>"Microsoft Edge"===e.brand)),oe=Boolean(t.brands.find(e=>"Chromium"===e.brand)),le=!ae&&oe,de=he=(t.brands.find(e=>"Chromium"===e.brand)||{}).version||null,pe="Windows"===t.platform),!oe){let i=window.navigator&&window.navigator.userAgent||"";te=/iPod/i.test(i),ie=(t=i.match(/OS (\d+)_/i))&&t[1]?t[1]:null,se=/Android/i.test(i),re=(t=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(vi=t[1]&&parseFloat(t[1]),be=t[2]&&parseFloat(t[2]),vi&&be?parseFloat(t[1]+"."+t[2]):vi||null):null,ne=/Firefox/i.test(i),ae=/Edg/i.test(i),oe=/Chrome/i.test(i)||/CriOS/i.test(i),le=!ae&&oe,de=he=(be=i.match(/(Chrome|CriOS)\/(\d+)/))&&be[2]?parseFloat(be[2]):null,ue=fun
|
||
|
.${s} {
|
||
|
width: ${e}px;
|
||
|
height: ${t}px;
|
||
|
}
|
||
|
|
||
|
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
|
padding-top: ${100*r}%;
|
||
|
}
|
||
|
`)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=m(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(v.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay(),n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};a.names.forEach(e=>{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(n.startTime=this.cache_.currentTime);s=v.getTech(e);if(!s)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new s(n),this.tech_.ready(p(this,this.handleTechReady_),!0),Zt(this.textTracksJson_||[],this.tech_),vn.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${m(t)}_`](e))}),Object.keys(bn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${bn[t]}_`].bind(this),event:e}):this[`handleTech${bn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ae(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Jt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&o.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}version(){return{"video.js":M}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_
|
||
|
.video-js {
|
||
|
width: 300px;
|
||
|
height: 150px;
|
||
|
}
|
||
|
|
||
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
|
padding-top: 56.25%
|
||
|
}
|
||
|
`)),rt(1,E),E.VERSION=M,E.options=T.prototype.options_,E.getPlayers=()=>T.players,E.getPlayer=e=>{var t=T.players;let i;if("string"==typeof e){var s=Nn(e),r=t[s];if(r)return r;i=Ye("#"+s)}else i=e;if(Ce(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},E.getAllPlayers=()=>Object.keys(T.players).map(e=>T.players[e]).filter(Boolean),E.players=T.players,E.getComponent=g.getComponent,E.registerComponent=(e,t)=>(v.isTech(t)&&o.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),g.registerComponent.call(g,e,t)),E.getTech=v.getTech,E.registerTech=v.registerTech,E.use=function(e,t){vs[e]=vs[e]||[],vs[e].push(t)},Object.defineProperty(E,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(E.middleware,"TERMINATOR",{value:Ts,writeable:!1,enumerable:!0}),E.browser=Se,E.obj=ee,E.mergeOptions=Rn(9,"videojs.mergeOptions","videojs.obj.merge",d),E.defineLazyProperty=Rn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Z),E.bind=Rn(9,"videojs.bind","native Function.prototype.bind",p),E.registerPlugin=On.registerPlugin,E.deregisterPlugin=On.deregisterPlugin,E.plugin=(e,t)=>(o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),On.registerPlugin(e,t)),E.getPlugins=On.getPlugins,E.getPlugin=On.getPlugin,E.getPluginVersion=On.getPluginVersion,E.addLanguage=function(e,t){return e=(""+e).toLowerCase(),E.options.languages=d(E.options.languages,{[e]:t}),E.options.languages[e]},E.log=o,E.createLogger=W,E.time=t,E.createTimeRange=Rn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",jt),E.createTimeRanges=Rn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",jt),E.formatTime=Rn(9,"videojs.formatTime","videojs.time.formatTime",Wt),E.setFormatTime=Rn(9,"videojs.setFormatTime","videojs.time.setFormatTime",zt),E.resetFormatTime=Rn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",$t),E.parseUrl=Rn(9,"videojs.parseUrl","videojs.url.parseUrl",mi),E.isCrossOrigin=Rn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",fi),E.EventTarget=wt,E.any=yt,E.on=mt,E.one=ft,E.off=c,E.trigger=gt,E.xhr=Di,E.TextTrack=Bi,E.AudioTrack=Fi,E.VideoTrack=qi,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{E[e]=function(){return o.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),et[e].apply(null,arguments)}}),E.computedStyle=Rn(9,"videojs.computedStyle","videojs.dom.computedStyle",Je),E.dom=et,E.fn=Tt,E.num=zi,E.str=Bt,E.url=_i,E.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},bi(function(e,t){
|
||
|
/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
|
||
|
e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=t(e);class s{constructor(e){let t=this;t.id=e.id;t.label=t.id;t.width=e.width;t.height=e.height;t.bitrate=e.bandwidth;t.frameRate=e.frameRate;t.enabled_=e.enabled;Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(e){t.enabled_(e)}});return t}}class n extends i["default"].EventTarget{constructor(){super();let e=this;e.levels_=[];e.selectedIndex_=-1;Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}});Object.defineProperty(e,"length",{get(){return e.levels_.length}});e[Symbol.iterator]=()=>e.levels_.values();return e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;t=new s(e);if(!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});this.levels_.push(t);this.trigger({qualityLevel:t,type:"addqualitylevel"});return t}removeQualityLevel(i){let s=null;for(let e=0,t=this.length;e<t;e++)if(this[e]===i){s=this.levels_.splice(e,1)[0];if(this.selectedIndex_===e)this.selectedIndex_=-1;else if(this.selectedIndex_>e)this.selectedIndex_--;break}if(s)this.trigger({qualityLevel:i,type:"removequalitylevel"});return s}getQualityLevelById(i){for(let e=0,t=this.length;e<t;e++){const s=this[e];if(s.id===i)return s}return null}dispose(){this.selectedIndex_=-1;this.levels_.length=0}}n.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const l in n.prototype.allowedEvents_)n.prototype["on"+l]=null;var a="4.1.0";const r=function(e,t){const i=e.qualityLevels;const s=new n;const r=function(){s.dispose();e.qualityLevels=i;e.off("dispose",r)};e.on("dispose",r);e.qualityLevels=()=>s;e.qualityLevels.VERSION=a;return s},o=function(e){return r(this,i["default"].obj.merge({},e))};return i["default"].registerPlugin("qualityLevels",o),o.VERSION=a,o}(E)});function Mn(e){return window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")}var Un="https://example.com",Bn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i=/^\/\//.test(e),s=!window.location&&!/\/\//i.test(e),t=(e=new window.URL(e,window.location||Un),new URL(t,e));return s?t.href.slice(Un.length):i?t.href.slice(t.protocol.length):t.href},Yr=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}();function Fn(e){for(var t=Mn(e),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}
|
||
|
/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class qn extends Yr{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}function jn(e){var e=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t}function S(t){var i={};if(t){var s,r=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let e=r.length;for(;e--;)""!==r[e]&&((s=/([^=]*)=(.*)/.exec(r[e]).slice(1))[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),i[s[0]]=s[1])}return i}let Hn=String.fromCharCode(9),Vn=e=>{var e=e.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class zn extends Yr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let a,o;0!==(i=i.trim()).length&&("#"!==i[0]?this.trigger("data",{type:"uri",uri:i}):this.tagMappers.reduce((e,t)=>{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;e<this.customParsers.length;e++)if(this.customParsers[e].call(this,t))return;var e;if(0!==t.indexOf("#EXT"))this.trigger("data",{type:"comment",text:t.slice(1)});else if(t=t.replace("\r",""),a=/^#EXTM3U/.exec(t))this.trigger("data",{type:"tag",tagType:"m3u"});else if(a=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(t))o={type:"tag",tagType:"inf"},a[1]&&(o.duration=parseFloat(a[1])),a[2]&&(o.title=a[2]),this.trigger("data",o);else if(a=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(t))o={type:"tag",tagType:"targetduration"},a[1]&&(o.duration=parseInt(a[1],10)),this.trigger("data",o);else if(a=/^#EXT-X-VERSION:([0-9.]*)?/.exec(t))o={type:"tag",tagType:"version"},a[1]&&(o.version=parseInt(a[1],10)),this.trigger("data",o);else if(a=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(t))o={type:"tag",tagType:"media-sequence"},a[1]&&(o.number=parseInt(a[1],10)),this.trigger("data",o);else if(a=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(t))o={type:"tag",tagType:"discontinuity-sequence"},a[1]&&(o.number=parseInt(a[1],10)),this.trigger("data",o);else if(a=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(t))o={type:"tag",tagType:"playlist-type"},a[1]&&(o.playlistType=a[1]),this.trigger("data",o);else if(a=/^#EXT-X-BYTERANGE:(.*)?$/.exec(t))o=f(jn(a[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",o);else if(a=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(t))o={type:"tag",tagType:"allow-cache"},a[1]&&(o.allowed=!/NO/.test(a[1])),this.trigger("data",o);else if(a=/^#EXT-X-MAP:(.*)$/.exec(t))o={type:"tag",tagType:"map"},a[1]&&((e=S(a[1])).URI&&(o.uri=e.URI),e.BYTERANGE)&&(o.byterange=jn(e.BYTERANGE)),this.trigger("data",o);else if(a=/^#EXT-X-STREAM-INF:(.*)$/.exec(t))o={type:"tag",tagType:"stream-inf"},a[1]&&(o.attributes=S(a[1]),o.attributes.RESOLUTION&&(o.attributes.RESOLUTION=Vn(o.attributes.RESOLUTION)),o.attributes.BANDWIDTH&&(o.attributes.BANDWIDTH=parseInt(o.attributes.BANDWIDTH,10)),o.attributes["FRAME-RATE"]&&(o.attributes["FRAME-RATE"]=parseFloat(o.attributes["FRAME-RATE"])),o.attributes["PROGRAM-ID"])&&(o.attributes["PROGRAM-ID"]=parseInt(o.attributes["PROGRAM-ID"],10)),this.trigger("data",o);else if(a=/^#EXT-X-MEDIA:(.*)$/.exec(t))o={type:"tag",tagType:"media"},a[1]&&(o.attributes=S(a[1])),this.trigger("data",o);else if(a=/^#EXT-X-ENDLIST/.exec(t))this.trigger("data",{type:"tag",tagType:"endlist"});else if(a=/^#EXT-X-DISCONTINUITY/.exec(t))this.trigger("data",{type:"tag",tagType:"discontinuity"});else if(a=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(t))o={type:"tag",tagType:"program-date-time"},a[1]&&(o.dateTimeString=a[1],o.dateTimeObject=new Date(a[1])),this.trigger("data",o);else if(a=/^#EXT-X-KEY:(.*)$/.exec(t))o={type:"tag",tagType:"key"},a[1]&&(o.attributes=S(a[1]),o.attributes.IV)&&("0x"===o.attributes.IV.substring(0,2).toLowerCase()&&(o.attributes.IV=o.attributes.IV.substring(2)),o.attributes.IV=o.attributes.IV.match(/.{8}/g),o.attributes.IV[0]=parseInt(o.attributes.IV[0],16),o.attributes.IV[1]=parseInt(o.attri
|
||
|
/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */
|
||
|
let Go=e=>!!e&&"object"==typeof e,D=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):Go(t[e])&&Go(i[e])?t[e]=D(t[e],i[e]):t[e]=i[e]}),t),{}),Xo=t=>Object.keys(t).map(e=>t[e]),Ko=(t,i)=>{var s=[];for(let e=t;e<i;e++)s.push(e);return s},Yo=e=>e.reduce((e,t)=>e.concat(t),[]),Qo=t=>{if(!t.length)return[];var i=[];for(let e=0;e<t.length;e++)i.push(t[e]);return i},Jo=(e,s)=>e.reduce((e,t,i)=>(t[s]&&e.push(i),e),[]),Zo=(e,i)=>Xo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{}));var el={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};let tl=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:Bn(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e<Number.MAX_SAFE_INTEGER&&"bigint"==typeof e&&(e=Number(e)),t<Number.MAX_SAFE_INTEGER&&"bigint"==typeof t&&(t=Number(t));let i;"bigint"==typeof(i="bigint"==typeof t||"bigint"==typeof e?window.BigInt(t)-window.BigInt(e)+window.BigInt(1):t-e+1)&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),s.byterange={length:i,offset:e}}return s},il=e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t},sl=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),rl={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=sl(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=sl(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},nl=n=>e=>{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}},al=e=>{var{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=rl[t](e),a=Ko(a,o).map(nl(e));return"static"===t&&(a[o=a.length-1].duration=("number"==typeof r?r:n)-i/s*o),a},ol=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=tl({baseUrl:t,source:i.sourceURL,range:i.range}),(t=tl({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=al(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(el.NO_BASE_URL)},ll=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;t<l.length;t++){var g=i.references[t],f=g.referencedSize,g=g.subsegmentDuration;let e;e="bigint"==typeof m?m+window.BigInt(f)-window.BigInt(1):m+f-1;var y=m+"-"+e,y={baseUrl:s,timescale:o,timeline:a,periodStart:u,presentationTime:c,number:p,duration:g,sourceDuration:n,indexRange:y,type:h},y=ol(y)[0];r&&(y.map=r),d.push(y),"bigint"==typeof m?m+=window.BigInt(f):m+=f,c+=g/o,p++}return e.segments=d,e},dl=["AUDIO","SUBTITLES"],hl=1/60,ul=e=>Zo(e,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),cl=(t,i)=>{for(let e=0;e<t.length;e++)if(t[e].attributes.NAME===i)return t[e];return null},pl=e=>{let r=[];return fa(e,dl,(e,t,i,s)=>{r=r.concat(e.playlists||[])}),r},ml=({pla
|
||
|
/*! @name @videojs/http-streaming @version 3.15.0 @license Apache-2.0 */
|
||
|
let Rd=Bn,Nd=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Md=e=>E.log.debug?E.log.debug.bind(E,"VHS:",e+" >"):function(){};function O(...e){var t=E.obj||E;return(t.merge||t.mergeOptions).apply(t,e)}function Ud(...e){var t=E.time||E;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function Bd(e,i){return Wd(e,function(e,t){return e-$d<=i&&t+$d>=i})}function Fd(e,t){return Wd(e,function(e){return e-zd>=t})}function qd(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function jd(t,i){let s=0;if(t&&t.length)for(let e=0;e<t.length;e++){var r=t.start(e),n=t.end(e);n<i||(s+=r<i&&i<=n?n-i:n-r)}return s}function Hd({defaultDuration:t,durationList:i,startIndex:s,endIndex:r}){let n=0;if(r<s&&([s,r]=[r,s]),s<0){for(let e=s;e<Math.min(0,r);e++)n+=t;s=0}for(let e=s;e<r;e++)n+=i[e].duration;return n}function Vd(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return sh(e);if(null===t)return null;t=t||0;let r=ih(e,e.mediaSequence+e.segments.length,t);return i&&(s="number"==typeof s?s:Zd(null,e),r-=s),Math.max(0,r)}let zd=1/30,$d=3*zd,Wd=function(e,t){var i=[];let s;if(e&&e.length)for(s=0;s<e.length;s++)t(e.start(s),e.end(s))&&i.push([e.start(s),e.end(s)]);return Ud(i)},Gd=t=>{var i=[];if(!t||!t.length)return"";for(let e=0;e<t.length;e++)i.push(t.start(e)+" => "+t.end(e));return i.join(", ")},Xd=t=>{var i=[];for(let e=0;e<t.length;e++)i.push({start:t.start(e),end:t.end(e)});return i},Kd=(t,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Yd=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Qd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},Jd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},Zd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<Qd(t).length)&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:e&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},eh=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if("undefined"!=typeof r.start)return{result:r.start,precise:!0};if("undefined"!=typeof r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if("undefined"!=typeof(r=e.segments[s]).end)return{result:i+r.end,precise:!0};if(i+=Kd(e,r),"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},th=function(e,t){let i=0;var s;let r=t-e.mediaSequence;for(;r<e.segments.length;r++){if("undefined"!=typeof(s=e.segments[r]).start)return{result:s.start-i,precise:!0};if(i+=Kd(e,s),"undefined"!=typeof s.end)return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},ih=function(e,t,i){var s;return(t="undefined"==typeof t?e.mediaSequence+e.segments.length:t)<e.mediaSequence?0:(s=eh(e,t)).precise?s.result:(e=th(e,t)).precise?e.result:s.result+i},sh=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),"undefined"==typeof t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return window.Infinity}return ih(e,t,i)};function rh(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function nh(e){return e.excludeUntil&&e.excludeUntil===1/0}function ah(e){var t=rh(e);return!e.disabled&&!t}function oh(e,t){return t.attributes&&t.attributes[e]}function lh(e,t){var i,s=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let r=!1;for(i in s){for(var n in s[i])if(r=t(s[i][n]))break;if(r)break}return!!r}let dh=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!ah(e)&&(e.attributes.BANDWIDTH||0)<i).length},hh=(e,t)=>!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e
|
||
|
`+"browserWorkerPolyFill(self);\n"+e}function tu(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var iu=Zh(eu(tu(function(){function e(){this.init=function(){var n={};this.on=function(e,t){n[e]||(n[e]=[]),n[e]=n[e].concat(t)},this.off=function(e,t){return!!n[e]&&(t=n[e].indexOf(t),n[e]=n[e].slice(),n[e].splice(t,1),-1<t)},this.trigger=function(e){var t,i,s,r=n[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else{for(s=[],t=arguments.length,t=1;t<arguments.length;++t)s.push(arguments[t]);for(i=r.length,t=0;t<i;++t)r[t].apply(this,s)}},this.dispose=function(){n={}}}}var l,M,U,B,F,q,j,H,V,z,$,W,G,X,K,Y,Q,J,Z,ee,d,te,ie,se,re,ne,ae,oe,le,de,he,ue,ce,pe,me,ge,fe,ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(e.prototype.pipe=function(t){return this.on("data",function(e){t.push(e)}),this.on("done",function(e){t.flush(e)}),this.on("partialdone",function(e){t.partialFlush(e)}),this.on("endedtimeline",function(e){t.endTimeline(e)}),this.on("reset",function(e){t.reset(e)}),t},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)},e),_e=Math.pow(2,32),ve={getUint64:function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*_e+e.getUint32(4)},MAX_UINT32:_e},be=ve.MAX_UINT32;if(d={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(var i in d)d.hasOwnProperty(i)&&(d[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]);te=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),se=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),ie=new Uint8Array([0,0,0,1]),xe=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),De=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),re={video:xe,audio:De},oe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ae=new Uint8Array([0,0,0,0,0,0,0,0]),le=new Uint8Array([0,0,0,0,0,0,0,0]),de=le,he=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ue=le,ne=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}l=function(e){for(var t,i=[],s=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)s+=i[r].byteLength;for(t=new Uint8Array(s+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,s=8;r<i.length;r++)t.set(i[r],s),s+=i[r].byteLength;return t},M=function(){return l(d.dinf,l(d.dref,oe))},U=function(e){return l(d.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),q(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},q=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))}
|
||
|
currentTime: ${this.currentTime_()}
|
||
|
bufferedEnd: ${qd(this.buffered_())}
|
||
|
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&uu(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"!==this.sourceType_||e||(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n,a=()=>{0===--e&&s()};for(n in!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,a)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Od),n=Math.ceil((e-s)*Od),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,a)),this.inbandTextTracks_)Fu(t,i,this.inbandTextTracks_[n]);Fu(t,i,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e,t;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&(t={segmentInfo:Qu({type:this.loaderType_,segment:e})},this.trigger({type:"segmentselected",metadata:t}),"number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),s=qd(e)||0,e=jd(e,this.currentTime_()),r=!this.hasPlayed_()&&1<=e,n=e>=this.goalBufferLength_(),t=this.playlist_.
|
||
|
For TargetTime: ${n}.
|
||
|
CurrentTime: ${this.currentTime_()}
|
||
|
BufferedEnd: ${s}
|
||
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
||
|
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){a=this.getSyncInfoFromMediaSequenceSync_(n);if(!a)return this.error({message:s="No sync info found while using media sequence sync",metadata:{errorType:E.Error.StreamingFailedToSelectNextSegment,error:new Error(s)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${a.start} --> ${a.end})`),e=a.segmentIndex,t=a.partIndex,i=a.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");s=ch.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:n,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=s.segmentIndex,t=s.partIndex,i=s.startTime}r.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+n:"currentTime "+n,r.mediaIndex=e,r.startOfSegment=i,r.partIndex=t,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${r.mediaIndex} `)}a=t[r.mediaIndex];let i=a&&"number"==typeof r.partIndex&&a.parts&&a.parts[r.partIndex];if(!a||"number"==typeof r.partIndex&&!i)return null;"number"!=typeof r.partIndex&&a.parts&&(r.partIndex=0,i=a.parts[0]);s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e||!i||s||i.independent||(0===r.partIndex?(e=(n=t[r.mediaIndex-1]).parts&&n.parts.length&&n.parts[n.parts.length-1])&&e.independent&&(--r.mediaIndex,r.partIndex=n.parts.length-1,r.independent="previous segment"):a.parts[r.partIndex-1].independent&&(--r.partIndex,r.independent="previous part")),s=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return r.mediaIndex>=t.length-1&&s&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,r.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(r))}getSyncInfoFromMediaSequenceSync_(e){var t;return this.mediaSequenceSync_&&(e!==(t=Math.max(e,this.mediaSequenceSync_.start))&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to `+t),e=this.mediaSequenceSync_.getSyncInfoForTime(t))?e.isAppended?(t=this.mediaSequenceSync_.getSyncInfoForTime(e.end))?(t.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),t):null:e:null}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:n}),qd(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Od);let r;for(r=0;r<e.length&&!(e[r].pts>s);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r}=[e][0],r||e!==t?!(e<t)&&s.length?s.end(s.length-1):i:null;var t,i,s,r}earlyAb
|
||
|
${Bu(s.uri)}
|
||
|
`+$u(s)),e.map&&!e.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),s.abortRequests=Au({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:e,abortFn:this.handleAbort_.bind(this,s),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",s.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",s.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:t,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_($u(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{t={segmentInfo:Qu({segment:t})};i&&(t.keyInfo=i),s&&(t.trackInfo=s),r&&(t.timingInfo=r),this.trigger({type:e,metadata:t})}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-R.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0<t&&this.remove(0,t)}createSimplifiedSegmentObj_(e){var t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,i={resolvedUri:(i||t).resolvedUri,byterange:(i||t).byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:r},s=e.playlist.segments[e.mediaIndex-1];return s&&s.timeline===t.timeline&&(s.videoTimingInfo?i.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(i.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key&&(r=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]),i.key=this.segmentKey(t.key),i.key.iv=r),t.map&&(i.map=this.initSegmentForMap(t.map)),i}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(e={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}},this.trigger({type:"bandwidthupdated",metadata:e}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===_u.ABORTED?void 0:(this.pause(),e.code===_u.TIMEOUT?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));e=this.pendingSegment_;this.saveBandwidthRelatedStats_(e.duration,t.stats),e.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=((e,t,i)=>{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r<e.length&&!(e[r].pts>=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()
|
||
|
`}return i}(s[i+"Buffered"]());s.logger_(`received "updateend" event for ${i} Source Buffer: `,t),s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),sc(i,s)};class dc extends E.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>sc("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Md("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=lc("video",this),this.onAudioUpdateEnd_=lc("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){oc({type:"mediaSource",sourceUpdater:this,action:ac.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){oc({type:e,sourceUpdater:this,action:ac.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?oc({type:"mediaSource",sourceUpdater:this,action:ac.removeSourceBuffer(e),name:"removeSourceBuffer"}):E.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!E.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?oc({type:e,sourceUpdater:this,action:ac.changeType(t),name:"changeType"}):E.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(e=t,oc({type:s,sourceUpdater:this,action:ac.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return nc(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Ud()}videoBuffered(){return nc(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Ud()}buffered(){var e=nc(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=nc(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,s=null,r=0;var n=[],a=[];if(!(e&&e.length&&t&&t.length))return Ud();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort(function(e,t){return e.time-t.time}),o=0;o<n.length;o++)"start"===n[o].type?2===++r&&(i=n[o].time):"end"===n[o].type&&1===--r&&(s=n[o].time),null!==i&&null!==s&&(a.
|
||
|
`,e.syncInfo=n});d.set(c,new gc(r,n)),h+=`${Bu(e.resolvedUri)} | Media Sequence: ${c} | Range: ${t} --> ${i} | Appended: ${s}\n`,c++,u=i}),this.end_=u,this.storage_=d,this.diagnostics_=h}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class yc extends fc{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){return this.storage_.size?super.calculateBaseTime_(e,t):(t=this.parent_.getSyncInfoForMediaSequence(e))?t.segmentSyncInfo.start:0}}let _c=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"MediaSequence",run:(e,t,i,s,r,n)=>{e=e.getMediaSequenceSync(n);return e&&e.isReliable&&(n=e.getSyncInfoForTime(r))?{time:n.start,partIndex:n.partIndex,segmentIndex:n.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Yd(i);r=r||0;for(let e=0;e<o.length;e++){var l=o[i.endList||0===r?e:o.length-(e+1)],d=l.segment,h=t.timelineToDatetimeMappings[d.timeline];if(h&&d.dateTimeObject){let t=d.dateTimeObject.getTime()/1e3+h;if(d.parts&&"number"==typeof l.partIndex)for(let e=0;e<l.partIndex;e++)t+=d.parts[e].duration;h=Math.abs(r-t);if(null!==a&&(0===h||a<h))break;a=h,n={time:t,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return n}},{name:"Segment",run:(e,t,i,s,r)=>{let n=null,a=null;r=r||0;var o=Yd(t);for(let e=0;e<o.length;e++){var l=o[t.endList||0===r?e:o.length-(e+1)],d=l.segment,h=l.part&&l.part.start||d&&d.start;if(d.timeline===s&&"undefined"!=typeof h){d=Math.abs(r-h);if(null!==a&&a<d)break;(!n||null===a||a>=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e<s.discontinuityStarts.length;e++){var a=s.discontinuityStarts[e],o=s.discontinuitySequence+e+1,o=i.discontinuities[o];if(o){var l=Math.abs(r-o.time);if(null!==t&&t<l)break;(!n||null===t||t>=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class vc extends E.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};var t=new fc,i=new yc(t),s=new yc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Md("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(t!==1/0)return _c.find(({name:e})=>"VOD"===e).run(this,e,t);var n,t=this.runStrategies_(e,t,i,s,r);if(!t.length)return null;for(n of t){var{syncPoint:a,strategy:o}=n,{segmentIndex:l,time:d}=a;if(!(l<0)){var h=d+e.segments[l].duration;if(this.logger_(`Strategy: ${o}. Current time: ${s}. selected segment: ${l}. Time: [${d} -> ${h}]}`),d<=s&&s<h)return this.logger_("Found sync point with exact match: ",a),a}}return this.selectSyncPoint_(t,{key:"time",value:s})}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+Hd({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(t,i,s,r,n){var a=[];for(let e=0;e<_c.length;e++){var o=_c[e],l=o.run(this,t,i,s,r,n);l&&(l.strategy=o.name,a.push({strategy:o.name,syncPoint:l}))}return a}selectSyncPoint_(t,i){let s=t[0].syncPoint,r=Math.abs(t[0].syncPoint[i.key]-i.value),n=t[0].strategy;for(let e=1;e<t.length;e++){var a=Math.abs(t[e].syncPoint[i.key]-i.value);a<r&&(r=a,s=t[e].syncPoint,n=t[e].strategy)}return this.logger_(`syncPoint for [${i.key}: ${i.value}] chosen with strategy`+` [${n}]: [time:${s.time},`+" segmentIndex:"+s.segmentIndex+("number"==typeof s.partIndex?",partIndex:"+s.partIndex:"")+"]"),s}saveExpiredSegmentIn
|
||
|
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
|
||
|
/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */
|
||
|
let h=null;class g{constructor(e){h=h||function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;var l,d,h,u,c=[],p=[];let m,g;for(n=0;n<256;n++)p[(c[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g<m;g++)p=y[d>>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);let a=new Uint8Array(e.byteLength),o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o<n.length;o+=r)i=new Uint32Array([f(n[o-4]),f(n[o-3]),f(n[o-2]),f(n[o-1])]),this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a));this.asyncStream_.push(function(){var e;s(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))})}static get STEP(){return 32e3}decryptChunk_(t,i,s,r){return function(){var e=function(e,t,i){var s,r,n,a,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m<o.length;m+=4)s=f(o[m]),r=f(o[m+1]),n=f(o[m+2]),a=f(o[m+3]),l.decrypt(s,r,n,a,d,m),d[m]=f(d[m]^h),d[m+1]=f(d[m+1]^u),d[m+2]=f(d[m+2]^c),d[m+3]=f(d[m+3]^p),h=s,u=r,c=n,p=a;return t}(t,i,s);r.set(e,t.byteOffset)}}}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t="undefined"!=typeof window?window:"undefined"!=typeof t?t:"undefined"!=typeof self?self:{},t=t.BigInt||Number;t("0x1"),t("0x100"),t("0x10000"),t("0x1000000"),t("0x100000000"),t("0x10000000000"),t("0x1000000000000"),t("0x100000000000000"),t("0x10000000000000000"),t=new Uint16Array([65484]),(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))[0];function r(s){let r={};return Object.keys(s).forEach(e=>{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){let i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i
|