ranui 0.4.1-alpha.2 → 0.4.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arc-DOGcyb-0.js → arc-BTq35m9x.js} +2 -2
- package/dist/{arc-ByizYZ13.cjs → arc-BjIU7MOi.cjs} +1 -1
- package/dist/builder-2HD21I6K.cjs +1 -0
- package/dist/builder.js +2 -2
- package/dist/{button-DFBA474n.js → button-BgWXCj7-.js} +4 -4
- package/dist/button.js +1 -1
- package/dist/{card-Cfkb7dIm.js → card-DzVv3ADA.js} +3 -3
- package/dist/card.js +1 -1
- package/dist/{checkbox-CeVzf_ff.js → checkbox-KOXDiwRr.js} +4 -4
- package/dist/checkbox.js +1 -1
- package/dist/{circle-DgoPsPmL.cjs → circle-By7YwAJj.cjs} +1 -1
- package/dist/{circle-fold-DGHgTbNx.cjs → circle-fold-BJWGLDa6.cjs} +1 -1
- package/dist/{circle-fold-CZf63cE1.js → circle-fold-DrwUHB-m.js} +2 -2
- package/dist/{circle-line-DDD6hHbp.cjs → circle-line-BsXpw2HA.cjs} +1 -1
- package/dist/{circle-line-vsuTmqx8.js → circle-line-DCUX3o9u.js} +2 -2
- package/dist/{circle-rotate-B7JrnjYG.cjs → circle-rotate-BK1tW3Jv.cjs} +1 -1
- package/dist/{circle-rotate-DDC3CKzB.js → circle-rotate-DeBqoVVp.js} +2 -2
- package/dist/{circle-spin-Djuwx9eN.js → circle-spin-Crycoffl.js} +2 -2
- package/dist/{circle-spin-CIMhAYj5.cjs → circle-spin-Ctoq0Wil.cjs} +1 -1
- package/dist/{circle-turn-DtYjq4Ky.js → circle-turn-DytKZEgU.js} +2 -2
- package/dist/{circle-turn-D1Z-dXF8.cjs → circle-turn-J9aToB75.cjs} +1 -1
- package/dist/{colorpicker-C8vbgSta.js → colorpicker-7adjGSuz.js} +7 -7
- package/dist/colorpicker.js +1 -1
- package/dist/{content-WyCTQEb9.js → content-BmwgR8WP.js} +3 -3
- package/dist/content.js +1 -1
- package/dist/{cube-BHbuhZjD.cjs → cube-BB32JJuI.cjs} +1 -1
- package/dist/{cube-dim-JK8OwqXU.cjs → cube-dim-DTcZAlcE.cjs} +1 -1
- package/dist/{cube-dim-FDQVX9Sb.js → cube-dim-DgfzlG3p.js} +2 -2
- package/dist/{cube-fold-DMmWEicy.cjs → cube-fold-CKVQ1IDZ.cjs} +1 -1
- package/dist/{cube-fold-68Pk6igJ.js → cube-fold-Dp4-pf7P.js} +2 -2
- package/dist/{cube-grid-C5ONBtr1.cjs → cube-grid-BrxyqSNh.cjs} +1 -1
- package/dist/{cube-grid-DTgwN5o-.js → cube-grid-DprxkSoT.js} +2 -2
- package/dist/{cube-BJr0a40o.js → cube-iOzgFQbc.js} +2 -2
- package/dist/{dot-bar-Ddbyx-0a.cjs → dot-bar-C2PcL7wc.cjs} +1 -1
- package/dist/{dot-bar-CXBmT1RL.js → dot-bar-vHWpqnhw.js} +2 -2
- package/dist/{dot-circle-DksscvAR.js → dot-circle-DQqpkRr_.js} +2 -2
- package/dist/{dot-circle-DxoSLiz7.cjs → dot-circle-EInrpGOw.cjs} +1 -1
- package/dist/{dot-D8taMWFZ.cjs → dot-do6V9GYP.cjs} +1 -1
- package/dist/{dot-line-CKcmWaBb.cjs → dot-line-BEFriL91.cjs} +1 -1
- package/dist/{dot-line-8Z2hpBOL.js → dot-line-CorWP6p2.js} +2 -2
- package/dist/{dot-pulse-DVwedcib.cjs → dot-pulse-BGidqqxA.cjs} +1 -1
- package/dist/{dot-pulse-BC7xaifX.js → dot-pulse-OtjDlpwG.js} +2 -2
- package/dist/{double-bounce-BVGrEHLy.js → double-bounce-CWAE4F5S.js} +2 -2
- package/dist/{double-bounce-Cxp3i6ip.cjs → double-bounce-DOehLE4X.cjs} +1 -1
- package/dist/{drop-q8qufm5t.cjs → drop-BkBi0TEt.cjs} +1 -1
- package/dist/{drop-CTufsC6T.js → drop-CTSvqyOb.js} +2 -2
- package/dist/{dropdown-B2Sk5gQF.js → dropdown-DQy4YvVn.js} +4 -4
- package/dist/dropdown.js +1 -1
- package/dist/{factory-Ce9hR27Y.js → factory-Bbul5tOL.js} +1 -1
- package/dist/{form-C0-UiXLj.js → form-DwjKUNz4.js} +3 -3
- package/dist/form.js +1 -1
- package/dist/{glass-TzHfgesD.js → glass-DKQAEAmc.js} +3 -3
- package/dist/glass.js +1 -1
- package/dist/{icon-BoaQYEij.js → icon-DSIyi1nQ.js} +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons.js +1 -1
- package/dist/iife/button.iife.js +1 -1
- package/dist/iife/card.iife.js +1 -1
- package/dist/iife/checkbox.iife.js +1 -1
- package/dist/iife/colorpicker.iife.js +1 -1
- package/dist/iife/content.iife.js +1 -1
- package/dist/iife/dropdown.iife.js +1 -1
- package/dist/iife/form.iife.js +1 -1
- package/dist/iife/glass.iife.js +1 -1
- package/dist/iife/icon.iife.js +1 -1
- package/dist/iife/image.iife.js +1 -1
- package/dist/iife/input.iife.js +1 -1
- package/dist/iife/link.iife.js +1 -1
- package/dist/iife/loading.iife.js +1 -1
- package/dist/iife/math.iife.js +1 -1
- package/dist/iife/mermaid.iife.js +1 -1
- package/dist/iife/message.iife.js +1 -1
- package/dist/iife/modal.iife.js +1 -1
- package/dist/iife/player.iife.js +1 -1
- package/dist/iife/popover.iife.js +1 -1
- package/dist/iife/progress.iife.js +1 -1
- package/dist/iife/radar.iife.js +1 -1
- package/dist/iife/route.iife.js +1 -1
- package/dist/iife/router.iife.js +1 -1
- package/dist/iife/scratch.iife.js +1 -1
- package/dist/iife/section.iife.js +1 -1
- package/dist/iife/select.iife.js +1 -1
- package/dist/iife/skeleton.iife.js +1 -1
- package/dist/iife/tab.iife.js +1 -1
- package/dist/iife/tabpane.iife.js +1 -1
- package/dist/iife/theme-switch.iife.js +1 -1
- package/dist/{image-CNpdv9k_.js → image-Bn0VuwO0.js} +3 -3
- package/dist/image.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.iife.js +106 -106
- package/dist/index.js +30 -30
- package/dist/{input-_iNjylVC.js → input-2Zz1gLzy.js} +4 -4
- package/dist/input.js +1 -1
- package/dist/{line-qgqu6ngc.cjs → line-BFm46PmI.cjs} +1 -1
- package/dist/{line-Bhz15vpy.js → line-Dt7YMxyn.js} +2 -2
- package/dist/{line-scale-CtMO8YfX.js → line-scale-BNCCcLKl.js} +2 -2
- package/dist/{line-scale-Dr9ILV5d.cjs → line-scale-Mzdq1fTx.cjs} +1 -1
- package/dist/{link-CmMSKe18.js → link-DcRMinJ9.js} +2 -2
- package/dist/link.js +1 -1
- package/dist/{loading-DHQDAkef.js → loading-BXZBOAbH.js} +30 -30
- package/dist/loading.js +1 -1
- package/dist/{math-DobANAnr.js → math-C6oaCrk-.js} +4 -4
- package/dist/math.js +1 -1
- package/dist/{mermaid-CwMPhttK.js → mermaid-Cmxzclzv.js} +4 -4
- package/dist/mermaid.js +1 -1
- package/dist/{message-CT-at-dX.js → message-E92Vu7SO.js} +4 -4
- package/dist/message.js +1 -1
- package/dist/{modal-COzuPRoz.cjs → modal-BQUM-5G3.cjs} +1 -1
- package/dist/{modal-DkFW7_It.js → modal-TayIRDMV.js} +3 -3
- package/dist/modal.js +1 -1
- package/dist/{pacman-DSIM9KGC.js → pacman-DqDqKzL4.js} +2 -2
- package/dist/{pacman-C7_BcAl5.cjs → pacman-hB0Vx_ut.cjs} +1 -1
- package/dist/{player-Dhv_QP4a.js → player-BZVIOmdS.js} +5 -5
- package/dist/player.js +1 -1
- package/dist/{popover-DR5ua2_I.js → popover-Bimxdeql.js} +6 -6
- package/dist/popover.js +1 -1
- package/dist/{progress-BRIBVXqD.js → progress-CNUdc_VD.js} +4 -4
- package/dist/progress.js +1 -1
- package/dist/{pulse-QISsDmFE.cjs → pulse-CPV8p0Lr.cjs} +1 -1
- package/dist/{pulse-DNmbppj-.js → pulse-IOuRzRUm.js} +2 -2
- package/dist/{radar-B9eKnRw8.js → radar-Dse0Dgma.js} +4 -4
- package/dist/radar.js +1 -1
- package/dist/{rotate-VMR047YI.cjs → rotate-O1KJozW0.cjs} +1 -1
- package/dist/{rotate-BX5qIRKZ.js → rotate-uZhtaw8R.js} +2 -2
- package/dist/{route-C9sC9d8P.js → route-Dh5S2dSW.js} +3 -3
- package/dist/route.js +1 -1
- package/dist/{router-CID9Dasr.js → router-DUxBSvIi.js} +3 -3
- package/dist/router.js +1 -1
- package/dist/{scale-out-aZu3503p.cjs → scale-out-CEERARri.cjs} +1 -1
- package/dist/{scale-out-DqffQsuL.js → scale-out-mSsKNtie.js} +2 -2
- package/dist/{scratch-y8Op8fTo.js → scratch-4TCqNbat.js} +3 -3
- package/dist/scratch.js +1 -1
- package/dist/{section-cgPwzwLR.js → section-CMN7tQ-S.js} +3 -3
- package/dist/section.js +1 -1
- package/dist/{select-Bqo_7nRL.js → select-D48kcwEy.js} +9 -9
- package/dist/select.js +1 -1
- package/dist/{skeleton-wq2ybbYv.js → skeleton-DbgMcQQ0.js} +3 -3
- package/dist/skeleton.js +1 -1
- package/dist/{solar-DaoF834l.cjs → solar-CdvkRr5X.cjs} +1 -1
- package/dist/{solar-BPmDmWLU.js → solar-Ck7RIK09.js} +2 -2
- package/dist/{square-DiBkWYAH.cjs → square-exSvykCu.cjs} +1 -1
- package/dist/{square-DKQ0d_O6.js → square-xGODzCyr.js} +2 -2
- package/dist/ssg.js +1 -1
- package/dist/{ssr-vZNJHtYm.js → ssr-BzHZ2bCe.js} +1 -1
- package/dist/ssr-stream.js +1 -1
- package/dist/ssr.js +1 -1
- package/dist/{stretch-BXJ4labN.js → stretch-Bv60MZD_.js} +2 -2
- package/dist/{stretch-LP22YEA3.cjs → stretch-CTFwefaK.cjs} +1 -1
- package/dist/{tab-DMUILL_2.js → tab-ADuziXeq.js} +3 -3
- package/dist/tab.js +1 -1
- package/dist/{tabpane-R8Kyn9jv.js → tabpane-Bisq-qpc.js} +3 -3
- package/dist/tabpane.js +1 -1
- package/dist/{text-C_XRjuGr.cjs → text-BniFEEB5.cjs} +1 -1
- package/dist/{text-8gI5TFOa.js → text-CX8UkbzB.js} +2 -2
- package/dist/{theme-DAG2-N5e.js → theme-DL6q_FZu.js} +1 -1
- package/dist/{theme-switch-D3MpVw-R.js → theme-switch-GbuiPclm.js} +4 -4
- package/dist/theme-switch.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/{triple-bounce-CMwTsw-f.js → triple-bounce-BwxTDpKz.js} +2 -2
- package/dist/{triple-bounce-CNjk5imb.cjs → triple-bounce-BzAtF-TA.cjs} +1 -1
- package/dist/{utils-DqjNwwjC.js → utils-X5_TIQTQ.js} +3 -3
- package/dist/{utils-nntJky78.js → utils-xccQZnoa.js} +29 -25
- package/package.json +2 -2
- package/dist/builder-BjRti6oP.cjs +0 -1
package/dist/iife/player.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ranui_player=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),i=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},a=class{_events=new Map;tap=(e,t)=>{this._events.get(e)&&e!==Symbol.for(`NEW_LISTENER`)&&this.call(Symbol.for(`NEW_LISTENER`),e);let n=this._events.get(e)||new Set;return typeof t==`function`?n.add({name:e,callback:t}):n.add(t),this._events.set(e,n),this};call=(e,...t)=>((this._events.get(e)||new Set).forEach(e=>{let{callback:n}=e;n(...t)}),this);callSync=async(e,...t)=>{let n=this._events.get(e)||new Set;for(let e of n){let{callback:n}=e;await n(...t)}return this};once=(e,t)=>{let n;if(typeof t==`function`)n={name:e,callback:(...r)=>{t(...r),this.off(e,n)},initialCallback:t};else{let{callback:r}=t;n={name:e,callback:(...t)=>{r(...t),this.off(e,n)},initialCallback:r}}return this.tap(e,n),this};off=(e,t)=>{let n=[...this._events.get(e)||new Set].filter(e=>{if(typeof t==`function`)return e.callback!==t&&e.initialCallback!==t;{let{callback:n}=t;return e.callback!==n&&e.initialCallback!==n}});return this._events.set(e,new Set(n)),this}};Math.PI/180,180/Math.PI,2*Math.PI;var o=(e=8)=>Math.random().toString(36).substring(2,e+2);function s(e){return e<10?`0${e}`:e}var c=e=>{if(e===0)return`00:00`;if(!e)return``;let t=Math.trunc(e/3600),n=Math.trunc(e%3600/60),r=s(Math.trunc(e-3600*t-60*n));return t===0?`${s(n)}:${r}`:`${s(t)}:${s(n)}:${r}`},l=typeof window<`u`,u=()=>{if(!l)return!1;let e=window.navigator.userAgent;return!!/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(e)};Object.freeze({});var d=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),f=e=>typeof e==`function`,p=12e4,m=`__ranuts_bridge__`,h=`default`,g=new class{bridges=new Set;attachedWindow=null;handleMessage=e=>{for(let t of Array.from(this.bridges))t.receive(e)};add(e){this.bridges.add(e),typeof window<`u`&&this.attachedWindow!==window&&(window.addEventListener(`message`,this.handleMessage),this.attachedWindow=window)}remove(e){this.bridges.delete(e),this.bridges.size===0&&this.attachedWindow&&(this.attachedWindow.removeEventListener(`message`,this.handleMessage),this.attachedWindow=null)}},_=class{targetWindow;targetOrigin;messageHandlers;pendingRequests;channel;senderId;available;constructor(e,t=`*`,n=h){this.targetOrigin=t,this.channel=n,this.senderId=o(12),this.messageHandlers=new Map,this.pendingRequests=new Map,this.available=typeof window<`u`,this.available?(this.targetWindow=e??window,g.add(this)):this.targetWindow=void 0}post(e,t){let n={...t,__bridge:m,channel:this.channel,senderId:this.senderId};e.postMessage(n,this.targetOrigin)}receive=e=>{if(!this.available||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||e.source&&e.source!==this.targetWindow)return;let t=e.data;if(!t||typeof t!=`object`||t.__bridge!==`__ranuts_bridge__`||(t.channel??`default`)!==this.channel)return;let{type:n,payload:r,id:i,isResponse:a,isError:o,senderId:s}=t;if(a&&i){let e=this.pendingRequests.get(i);e&&(o?e.reject(Error(typeof r==`string`?r:`Bridge request failed`)):e.resolve(r),this.pendingRequests.delete(i));return}if(s&&s===this.senderId||typeof n!=`string`||!this.messageHandlers.has(n))return;let c=this.messageHandlers.get(n);if(f(c)){let t=e.source??this.targetWindow;Promise.resolve(c(r)).then(e=>{i&&this.post(t,{type:n,payload:e,id:i,isResponse:!0})}).catch(e=>{i&&this.post(t,{type:n,payload:e instanceof Error?e.message:String(e),id:i,isResponse:!0,isError:!0})})}};on=(e,t)=>{this.messageHandlers.set(e,t)};off=e=>{this.messageHandlers.delete(e)};send=async(e,t)=>{if(!this.available)return Promise.reject(Error(`PostMessageBridge is unavailable outside a browser environment`));let n=o(10);return new Promise((r,i)=>{let a=setTimeout(()=>{this.pendingRequests.has(n)&&(this.pendingRequests.delete(n),i(Error(`Request timeout`)))},p),o=e=>{clearTimeout(a),i(e)};this.pendingRequests.set(n,{resolve:e=>{clearTimeout(a),r(e)},reject:o});try{this.post(this.targetWindow,{type:e,payload:t,id:n})}catch(e){this.pendingRequests.delete(n),o(e instanceof Error?e:Error(`Failed to post message`))}})};broadcast=e=>{if(this.available)try{this.post(this.targetWindow,{type:e.type,payload:e.payload})}catch{}};destroy=()=>{g.remove(this),this.messageHandlers.clear(),this.pendingRequests.forEach(e=>{e.reject(Error(`Bridge destroyed`))}),this.pendingRequests.clear()}};(class e{static instance;bridges=new Map;constructor(){}static getInstance(){return e.instance||=new e,e.instance}connectClient=({id:e,targetOrigin:t,targetWindow:n,channel:r})=>{let i=new _(n,t,r);if(e||=o(10),this.bridges.has(e))throw Error(`Bridge ${e} already exists`);return this.bridges.set(e,i),{bridge:i,id:e}};getClient=e=>this.bridges.get(e);removeClient=e=>{let t=this.bridges.get(e);t&&(t.destroy(),this.bridges.delete(e))};removeAllClient=()=>{this.bridges.forEach(e=>{e.destroy()}),this.bridges.clear()};broadcast=e=>{this.bridges.forEach(t=>{t.broadcast(e)})};sendTo=(e,t,n)=>{let r=this.getClient(e);return r?r.send(t,n):Promise.reject(Error(`Bridge ${e} not found`))}}).getInstance(),new a;var v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],y=class{highOrder;lowOrder;constructor(e,t){this.highOrder=e,this.lowOrder=t}};new y(v[0],3609767458),new y(v[1],602891725),new y(v[2],3964484399),new y(v[3],2173295548),new y(v[4],4081628472),new y(v[5],3053834265),new y(v[6],2937671579),new y(v[7],3664609560),new y(v[8],2734883394),new y(v[9],1164996542),new y(v[10],1323610764),new y(v[11],3590304994),new y(v[12],4068182383),new y(v[13],991336113),new y(v[14],633803317),new y(v[15],3479774868),new y(v[16],2666613458),new y(v[17],944711139),new y(v[18],2341262773),new y(v[19],2007800933),new y(v[20],1495990901),new y(v[21],1856431235),new y(v[22],3175218132),new y(v[23],2198950837),new y(v[24],3999719339),new y(v[25],766784016),new y(v[26],2566594879),new y(v[27],3203337956),new y(v[28],1034457026),new y(v[29],2466948901),new y(v[30],3758326383),new y(v[31],168717936),new y(v[32],1188179964),new y(v[33],1546045734),new y(v[34],1522805485),new y(v[35],2643833823),new y(v[36],2343527390),new y(v[37],1014477480),new y(v[38],1206759142),new y(v[39],344077627),new y(v[40],1290863460),new y(v[41],3158454273),new y(v[42],3505952657),new y(v[43],106217008),new y(v[44],3606008344),new y(v[45],1432725776),new y(v[46],1467031594),new y(v[47],851169720),new y(v[48],3100823752),new y(v[49],1363258195),new y(v[50],3750685593),new y(v[51],3785050280),new y(v[52],3318307427),new y(v[53],3812723403),new y(v[54],2003034995),new y(v[55],3602036899),new y(v[56],1575990012),new y(v[57],1125592928),new y(v[58],2716904306),new y(v[59],442776044),new y(v[60],593698344),new y(v[61],3733110249),new y(v[62],2999351573),new y(v[63],3815920427),new y(3391569614,3928383900),new y(3515267271,566280711),new y(3940187606,3454069534),new y(4118630271,4000239992),new y(116418474,1914138554),new y(174292421,2731055270),new y(289380356,3203993006),new y(460393269,320620315),new y(685471733,587496836),new y(852142971,1086792851),new y(1017036298,365543100),new y(1126000580,2618297676),new y(1288033470,3409855158),new y(1501505948,4234509866),new y(1607167915,987167468),new y(1816402316,1246189591),new y(0,1),new y(0,32898),new y(2147483648,32906),new y(2147483648,2147516416),new y(0,32907),new y(0,2147483649),new y(2147483648,2147516545),new y(2147483648,32777),new y(0,138),new y(0,136),new y(0,2147516425),new y(0,2147483658),new y(0,2147516555),new y(2147483648,139),new y(2147483648,32905),new y(2147483648,32771),new y(2147483648,32770),new y(2147483648,128),new y(0,32778),new y(2147483648,2147483658),new y(2147483648,2147516545),new y(2147483648,32896),new y(0,2147483649),new y(2147483648,2147516424);var b=(e,t)=>{if(typeof document>`u`)return;let n=e.classList;n.contains(t)||n.add(t)},x=(e,t)=>{if(typeof document>`u`)return;let n=e.classList;n.contains(t)&&n.remove(t)},S=/["'&<>]/;function C(e){let t=``+e,n=S.exec(t);if(!n)return t;let r,i=``,a=0,o=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=`"`;break;case 38:r=`&`;break;case 39:r=`'`;break;case 60:r=`<`;break;case 62:r=`>`;break;default:continue}o!==a&&(i+=t.substring(o,a)),o=a+1,i+=r}return o===a?i:i+t.substring(o,a)}var w=new Map,T=new Map,E=`data-adopted-style`,D=`data-adopted-sheet`,O=(e,t,n)=>{if(typeof CSSStyleSheet>`u`)return!1;try{if(!n.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),n.set(t,e)}let r=n.get(t);return e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]),!0}catch{return!1}},k=(e,t,n=E)=>{if(typeof document<`u`&&t&&!O(e,t,w)&&!e.querySelector(`style[${n}]`)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}},A=(e,t,n=D)=>{if(typeof document<`u`&&t&&!O(e,t,T)&&!Array.from(e.querySelectorAll(`style[${n}]`)).some(e=>e.textContent===t)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}};function j(e,t=300){let n,r=0,i=null,a=null,o=()=>{if(i=null,!a)return;let t=a,o=n;a=null,n=void 0,r=Date.now(),e.apply(o,t)},s=function(...e){let s=t-(Date.now()-r);n=this,a=e,s<=0?(i!==null&&(clearTimeout(i),i=null),o()):i===null&&(i=setTimeout(o,s))};return s.cancel=()=>{i!==null&&clearTimeout(i),i=null,a=null,n=void 0},s.pending=()=>i!==null,s}var M=new Map([[100,`Continue`],[101,`Switching Protocols`],[102,`Processing`],[103,`Early Hints`],[200,`OK`],[201,`Created`],[202,`Accepted`],[203,`Non-Authoritative Information`],[204,`No Content`],[205,`Reset Content`],[206,`Partial Content`],[207,`Multi-Status`],[208,`Already Reported`],[226,`IM Used`],[300,`Multiple Choices`],[301,`Moved Permanently`],[302,`Found`],[303,`See Other`],[304,`Not Modified`],[305,`Use Proxy`],[307,`Temporary Redirect`],[308,`Permanent Redirect`],[400,`Bad Request`],[401,`Unauthorized`],[402,`Payment Required`],[403,`Forbidden`],[404,`Not Found`],[405,`Method Not Allowed`],[406,`Not Acceptable`],[407,`Proxy Authentication Required`],[408,`Request Timeout`],[409,`Conflict`],[410,`Gone`],[411,`Length Required`],[412,`Precondition Failed`],[413,`Payload Too Large`],[414,`URI Too Long`],[415,`Unsupported Media Type`],[416,`Range Not Satisfiable`],[417,`Expectation Failed`],[418,`I'm a Teapot`],[421,`Misdirected Request`],[422,`Unprocessable Entity`],[423,`Locked`],[424,`Failed Dependency`],[425,`Too Early`],[426,`Upgrade Required`],[428,`Precondition Required`],[429,`Too Many Requests`],[431,`Request Header Fields Too Large`],[451,`Unavailable For Legal Reasons`],[500,`Internal Server Error`],[501,`Not Implemented`],[502,`Bad Gateway`],[503,`Service Unavailable`],[504,`Gateway Timeout`],[505,`HTTP Version Not Supported`],[506,`Variant Also Negotiates`],[507,`Insufficient Storage`],[508,`Loop Detected`],[509,`Bandwidth Limit Exceeded`],[510,`Not Extended`],[511,`Network Authentication Required`]]);(function(e){let t=new Map;for(let[n,r]of e)t.set(r.toLowerCase(),n);return t})(M),function(e){let t=[];for(let[n,r]of e)t.push(n);return t}(M),r(((e,t)=>{(function n(r){var i=this,a=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?e(Object(r),!0).forEach(function(e){o(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function d(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function f(e,t,n){return f=d()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&u(i,n.prototype),i},f.apply(null,arguments)}function p(e){var t=typeof Map==`function`?new Map:void 0;return p=function(e){if(e===null||(n=e,Function.toString.call(n).indexOf(`[native code]`)===-1))return e;var n;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,e)},p(e)}function m(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=(function(e,t){if(e){if(typeof e==`string`)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}})(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1
|
+
var ranui_player=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),i=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},a=class{_events=new Map;tap=(e,t)=>{this._events.get(e)&&e!==Symbol.for(`NEW_LISTENER`)&&this.call(Symbol.for(`NEW_LISTENER`),e);let n=this._events.get(e)||new Set;return typeof t==`function`?n.add({name:e,callback:t}):n.add(t),this._events.set(e,n),this};call=(e,...t)=>((this._events.get(e)||new Set).forEach(e=>{let{callback:n}=e;n(...t)}),this);callSync=async(e,...t)=>{let n=this._events.get(e)||new Set;for(let e of n){let{callback:n}=e;await n(...t)}return this};once=(e,t)=>{let n;if(typeof t==`function`)n={name:e,callback:(...r)=>{t(...r),this.off(e,n)},initialCallback:t};else{let{callback:r}=t;n={name:e,callback:(...t)=>{r(...t),this.off(e,n)},initialCallback:r}}return this.tap(e,n),this};off=(e,t)=>{let n=[...this._events.get(e)||new Set].filter(e=>{if(typeof t==`function`)return e.callback!==t&&e.initialCallback!==t;{let{callback:n}=t;return e.callback!==n&&e.initialCallback!==n}});return this._events.set(e,new Set(n)),this}};Math.PI/180,180/Math.PI,2*Math.PI;var o=(e=8)=>Math.random().toString(36).substring(2,e+2);function s(e){return e<10?`0${e}`:e}var c=e=>{if(e===0)return`00:00`;if(!e)return``;let t=Math.trunc(e/3600),n=Math.trunc(e%3600/60),r=s(Math.trunc(e-3600*t-60*n));return t===0?`${s(n)}:${r}`:`${s(t)}:${s(n)}:${r}`},l=typeof window<`u`,u=()=>{if(!l)return!1;let e=window.navigator.userAgent;return!!/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(e)};Object.freeze({});var d=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),f=e=>typeof e==`function`,p=12e4,m=`__ranuts_bridge__`,h=`default`,g=new class{bridges=new Set;attachedWindow=null;handleMessage=e=>{for(let t of Array.from(this.bridges))t.receive(e)};add(e){this.bridges.add(e),typeof window<`u`&&this.attachedWindow!==window&&(window.addEventListener(`message`,this.handleMessage),this.attachedWindow=window)}remove(e){this.bridges.delete(e),this.bridges.size===0&&this.attachedWindow&&(this.attachedWindow.removeEventListener(`message`,this.handleMessage),this.attachedWindow=null)}},_=class{targetWindow;targetOrigin;messageHandlers;pendingRequests;channel;senderId;available;constructor(e,t=`*`,n=h){this.targetOrigin=t,this.channel=n,this.senderId=o(12),this.messageHandlers=new Map,this.pendingRequests=new Map,this.available=typeof window<`u`,this.available?(this.targetWindow=e??window,g.add(this)):this.targetWindow=void 0}post(e,t){let n={...t,__bridge:m,channel:this.channel,senderId:this.senderId};e.postMessage(n,this.targetOrigin)}receive=e=>{if(!this.available||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||e.source&&e.source!==this.targetWindow)return;let t=e.data;if(!t||typeof t!=`object`||t.__bridge!==`__ranuts_bridge__`||(t.channel??`default`)!==this.channel)return;let{type:n,payload:r,id:i,isResponse:a,isError:o,senderId:s}=t;if(a&&i){let e=this.pendingRequests.get(i);e&&(o?e.reject(Error(typeof r==`string`?r:`Bridge request failed`)):e.resolve(r),this.pendingRequests.delete(i));return}if(s&&s===this.senderId||typeof n!=`string`||!this.messageHandlers.has(n))return;let c=this.messageHandlers.get(n);if(f(c)){let t=e.source??this.targetWindow;Promise.resolve(c(r)).then(e=>{i&&this.post(t,{type:n,payload:e,id:i,isResponse:!0})}).catch(e=>{i&&this.post(t,{type:n,payload:e instanceof Error?e.message:String(e),id:i,isResponse:!0,isError:!0})})}};on=(e,t)=>{this.messageHandlers.set(e,t)};off=e=>{this.messageHandlers.delete(e)};send=async(e,t)=>{if(!this.available)return Promise.reject(Error(`PostMessageBridge is unavailable outside a browser environment`));let n=o(10);return new Promise((r,i)=>{let a=setTimeout(()=>{this.pendingRequests.has(n)&&(this.pendingRequests.delete(n),i(Error(`Request timeout`)))},p),o=e=>{clearTimeout(a),i(e)};this.pendingRequests.set(n,{resolve:e=>{clearTimeout(a),r(e)},reject:o});try{this.post(this.targetWindow,{type:e,payload:t,id:n})}catch(e){this.pendingRequests.delete(n),o(e instanceof Error?e:Error(`Failed to post message`))}})};broadcast=e=>{if(this.available)try{this.post(this.targetWindow,{type:e.type,payload:e.payload})}catch{}};destroy=()=>{g.remove(this),this.messageHandlers.clear(),this.pendingRequests.forEach(e=>{e.reject(Error(`Bridge destroyed`))}),this.pendingRequests.clear()}};(class e{static instance;bridges=new Map;constructor(){}static getInstance(){return e.instance||=new e,e.instance}connectClient=({id:e,targetOrigin:t,targetWindow:n,channel:r})=>{let i=new _(n,t,r);if(e||=o(10),this.bridges.has(e))throw Error(`Bridge ${e} already exists`);return this.bridges.set(e,i),{bridge:i,id:e}};getClient=e=>this.bridges.get(e);removeClient=e=>{let t=this.bridges.get(e);t&&(t.destroy(),this.bridges.delete(e))};removeAllClient=()=>{this.bridges.forEach(e=>{e.destroy()}),this.bridges.clear()};broadcast=e=>{this.bridges.forEach(t=>{t.broadcast(e)})};sendTo=(e,t,n)=>{let r=this.getClient(e);return r?r.send(t,n):Promise.reject(Error(`Bridge ${e} not found`))}}).getInstance(),new a;var v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],y=class{highOrder;lowOrder;constructor(e,t){this.highOrder=e,this.lowOrder=t}};new y(v[0],3609767458),new y(v[1],602891725),new y(v[2],3964484399),new y(v[3],2173295548),new y(v[4],4081628472),new y(v[5],3053834265),new y(v[6],2937671579),new y(v[7],3664609560),new y(v[8],2734883394),new y(v[9],1164996542),new y(v[10],1323610764),new y(v[11],3590304994),new y(v[12],4068182383),new y(v[13],991336113),new y(v[14],633803317),new y(v[15],3479774868),new y(v[16],2666613458),new y(v[17],944711139),new y(v[18],2341262773),new y(v[19],2007800933),new y(v[20],1495990901),new y(v[21],1856431235),new y(v[22],3175218132),new y(v[23],2198950837),new y(v[24],3999719339),new y(v[25],766784016),new y(v[26],2566594879),new y(v[27],3203337956),new y(v[28],1034457026),new y(v[29],2466948901),new y(v[30],3758326383),new y(v[31],168717936),new y(v[32],1188179964),new y(v[33],1546045734),new y(v[34],1522805485),new y(v[35],2643833823),new y(v[36],2343527390),new y(v[37],1014477480),new y(v[38],1206759142),new y(v[39],344077627),new y(v[40],1290863460),new y(v[41],3158454273),new y(v[42],3505952657),new y(v[43],106217008),new y(v[44],3606008344),new y(v[45],1432725776),new y(v[46],1467031594),new y(v[47],851169720),new y(v[48],3100823752),new y(v[49],1363258195),new y(v[50],3750685593),new y(v[51],3785050280),new y(v[52],3318307427),new y(v[53],3812723403),new y(v[54],2003034995),new y(v[55],3602036899),new y(v[56],1575990012),new y(v[57],1125592928),new y(v[58],2716904306),new y(v[59],442776044),new y(v[60],593698344),new y(v[61],3733110249),new y(v[62],2999351573),new y(v[63],3815920427),new y(3391569614,3928383900),new y(3515267271,566280711),new y(3940187606,3454069534),new y(4118630271,4000239992),new y(116418474,1914138554),new y(174292421,2731055270),new y(289380356,3203993006),new y(460393269,320620315),new y(685471733,587496836),new y(852142971,1086792851),new y(1017036298,365543100),new y(1126000580,2618297676),new y(1288033470,3409855158),new y(1501505948,4234509866),new y(1607167915,987167468),new y(1816402316,1246189591),new y(0,1),new y(0,32898),new y(2147483648,32906),new y(2147483648,2147516416),new y(0,32907),new y(0,2147483649),new y(2147483648,2147516545),new y(2147483648,32777),new y(0,138),new y(0,136),new y(0,2147516425),new y(0,2147483658),new y(0,2147516555),new y(2147483648,139),new y(2147483648,32905),new y(2147483648,32771),new y(2147483648,32770),new y(2147483648,128),new y(0,32778),new y(2147483648,2147483658),new y(2147483648,2147516545),new y(2147483648,32896),new y(0,2147483649),new y(2147483648,2147516424);var b=(e,t)=>{if(typeof document>`u`)return;let n=e.classList;n.contains(t)||n.add(t)},x=(e,t)=>{if(typeof document>`u`)return;let n=e.classList;n.contains(t)&&n.remove(t)},S=/["'&<>]/;function C(e){let t=``+e,n=S.exec(t);if(!n)return t;let r,i=``,a=0,o=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=`"`;break;case 38:r=`&`;break;case 39:r=`'`;break;case 60:r=`<`;break;case 62:r=`>`;break;default:continue}o!==a&&(i+=t.substring(o,a)),o=a+1,i+=r}return o===a?i:i+t.substring(o,a)}var w=new Map,T=new Map,E=`data-adopted-style`,D=`data-adopted-sheet`,O=(e,t,n)=>{if(typeof CSSStyleSheet>`u`)return!1;try{if(!n.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),n.set(t,e)}let r=n.get(t);return e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]),!0}catch{return!1}},k=(e,t,n=E)=>{if(typeof document<`u`&&t&&!O(e,t,w)&&!e.querySelector(`style[${n}]`)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}},A=(e,t,n=D)=>{if(typeof document<`u`&&t&&!O(e,t,T)&&!Array.from(e.querySelectorAll(`style[${n}]`)).some(e=>e.textContent===t)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}};(()=>{let e=new Uint8Array(128);for(let t=0;t<78;t++)e[`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.,!?;:'"()[]{}`.charCodeAt(t)]=1;return e})();function j(e,t=300){let n,r=0,i=null,a=null,o=()=>{if(i=null,!a)return;let t=a,o=n;a=null,n=void 0,r=Date.now(),e.apply(o,t)},s=function(...e){let s=t-(Date.now()-r);n=this,a=e,s<=0?(i!==null&&(clearTimeout(i),i=null),o()):i===null&&(i=setTimeout(o,s))};return s.cancel=()=>{i!==null&&clearTimeout(i),i=null,a=null,n=void 0},s.pending=()=>i!==null,s}var M=new Map([[100,`Continue`],[101,`Switching Protocols`],[102,`Processing`],[103,`Early Hints`],[200,`OK`],[201,`Created`],[202,`Accepted`],[203,`Non-Authoritative Information`],[204,`No Content`],[205,`Reset Content`],[206,`Partial Content`],[207,`Multi-Status`],[208,`Already Reported`],[226,`IM Used`],[300,`Multiple Choices`],[301,`Moved Permanently`],[302,`Found`],[303,`See Other`],[304,`Not Modified`],[305,`Use Proxy`],[307,`Temporary Redirect`],[308,`Permanent Redirect`],[400,`Bad Request`],[401,`Unauthorized`],[402,`Payment Required`],[403,`Forbidden`],[404,`Not Found`],[405,`Method Not Allowed`],[406,`Not Acceptable`],[407,`Proxy Authentication Required`],[408,`Request Timeout`],[409,`Conflict`],[410,`Gone`],[411,`Length Required`],[412,`Precondition Failed`],[413,`Payload Too Large`],[414,`URI Too Long`],[415,`Unsupported Media Type`],[416,`Range Not Satisfiable`],[417,`Expectation Failed`],[418,`I'm a Teapot`],[421,`Misdirected Request`],[422,`Unprocessable Entity`],[423,`Locked`],[424,`Failed Dependency`],[425,`Too Early`],[426,`Upgrade Required`],[428,`Precondition Required`],[429,`Too Many Requests`],[431,`Request Header Fields Too Large`],[451,`Unavailable For Legal Reasons`],[500,`Internal Server Error`],[501,`Not Implemented`],[502,`Bad Gateway`],[503,`Service Unavailable`],[504,`Gateway Timeout`],[505,`HTTP Version Not Supported`],[506,`Variant Also Negotiates`],[507,`Insufficient Storage`],[508,`Loop Detected`],[509,`Bandwidth Limit Exceeded`],[510,`Not Extended`],[511,`Network Authentication Required`]]);(function(e){let t=new Map;for(let[n,r]of e)t.set(r.toLowerCase(),n);return t})(M),function(e){let t=[];for(let[n,r]of e)t.push(n);return t}(M),r(((e,t)=>{(function n(r){var i=this,a=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?e(Object(r),!0).forEach(function(e){o(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function d(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function f(e,t,n){return f=d()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&u(i,n.prototype),i},f.apply(null,arguments)}function p(e){var t=typeof Map==`function`?new Map:void 0;return p=function(e){if(e===null||(n=e,Function.toString.call(n).indexOf(`[native code]`)===-1))return e;var n;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,e)},p(e)}function m(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=(function(e,t){if(e){if(typeof e==`string`)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}})(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(e){var t=(function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)})(e,`string`);return typeof t==`symbol`?t:String(t)}function _(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var v={exports:{}};(function(e,t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw Error(`Error trying to parse relative URL.`);if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw Error(`Error trying to parse base URL.`);if(!s.netLoc&&s.path&&s.path[0]!==`/`){var c=r.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path=`/`);var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,a.path[0]!==`/`))if(a.path){var u=s.path,d=u.substring(0,u.lastIndexOf(`/`)+1)+a.path;l.path=o.normalizePath(d)}else l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));return l.path===null&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(i,``);e.length!==(e=e.replace(a,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o})(v);var y=v.exports,b=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},x=(function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUpdated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e})({}),S=(function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e})({}),C=(function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.UNKNOWN=`unknown`,e})({}),w=function(){},T={trace:w,debug:w,log:w,warn:w,info:w,error:w},E=T;function D(e){var t=self.console[e];return t?t.bind(self.console,`[`+e+`] >`):w}function O(e,t){if(self.console&&!0===e||typeof e==`object`){(function(e){[...arguments].slice(1).forEach(function(t){E[t]=e[t]?e[t].bind(e):D(t)})})(e,`debug`,`log`,`info`,`warn`,`error`);try{E.log(`Debug logs enabled for "`+t+`" in hls.js version 1.4.12`)}catch{E=T}}else E=T}var k=E,A=/^(\d+)x(\d+)$/,j=/(.+?)=(".*?"|.*?)(?:,|$)/g,M=(function(){function e(t){for(var n in typeof t==`string`&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(n)&&(n.substring(0,2)===`X-`&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(n)),this[n]=t[n])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>2**53-1?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||`0x`).slice(2);t=(1&t.length?`0`:``)+t;for(var n=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)n[r]=parseInt(t.slice(2*r,2*r+2),16);return n}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>2**53-1?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var n=this[e];return n?parseFloat(n):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return this[e]===`YES`},t.decimalResolution=function(e){var t=A.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,n={};for(j.lastIndex=0;(t=j.exec(e))!==null;){var r=t[2];r.indexOf(`"`)===0&&r.lastIndexOf(`"`)===r.length-1&&(r=r.slice(1,-1)),n[t[1].trim()]=r}return n},e})();function ee(e){return e===`SCTE35-OUT`||e===`SCTE35-IN`}var te=(function(){function e(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var n=t.attr;for(var r in n)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==n[r]){k.warn(`DATERANGE tag attribute: "`+r+`" does not match for tags with ID: "`+e.ID+`"`),this._badValueForSameId=r;break}e=s(new M({}),n,e)}if(this.attr=e,this._startDate=new Date(e[`START-DATE`]),`END-DATE`in this.attr){var i=new Date(this.attr[`END-DATE`]);b(i.getTime())&&(this._endDate=i)}}return a(e,[{key:`id`,get:function(){return this.attr.ID}},{key:`class`,get:function(){return this.attr.CLASS}},{key:`startDate`,get:function(){return this._startDate}},{key:`endDate`,get:function(){if(this._endDate)return this._endDate;var e=this.duration;return e===null?null:new Date(this._startDate.getTime()+1e3*e)}},{key:`duration`,get:function(){if(`DURATION`in this.attr){var e=this.attr.decimalFloatingPoint(`DURATION`);if(b(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:`plannedDuration`,get:function(){return`PLANNED-DURATION`in this.attr?this.attr.decimalFloatingPoint(`PLANNED-DURATION`):null}},{key:`endOnNext`,get:function(){return this.attr.bool(`END-ON-NEXT`)}},{key:`isValid`,get:function(){return!!this.id&&!this._badValueForSameId&&b(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e})(),ne=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},N=`audio`,P=`video`,F=`audiovideo`,I=(function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[N]=null,t[P]=null,t[F]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var n=e.split(`@`,2),r=[];n.length===1?r[0]=t?t.byteRangeEndOffset:0:r[0]=parseInt(n[1]),r[1]=parseInt(n[0])+r[0],this._byteRange=r},a(e,[{key:`byteRange`,get:function(){return this._byteRange?this._byteRange:[]}},{key:`byteRangeStartOffset`,get:function(){return this.byteRange[0]}},{key:`byteRangeEndOffset`,get:function(){return this.byteRange[1]}},{key:`url`,get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=y.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``},set:function(e){this._url=e}}]),e})(),re=(function(e){function t(t,n){var r;return(r=e.call(this,n)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new ne,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.type=t,r}c(t,e);var n=t.prototype;return n.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},n.abortRequests=function(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()},n.setElementaryStreamInfo=function(e,t,n,r,i,a){a===void 0&&(a=!1);var o=this.elementaryStreams,s=o[e];s?(s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)):o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:a}},n.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[N]=null,e[P]=null,e[F]=null},a(t,[{key:`decryptdata`,get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=Object.keys(this.levelkeys);if(t.length===1)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:`end`,get:function(){return this.start+this.duration}},{key:`endProgramDateTime`,get:function(){if(this.programDateTime===null||!b(this.programDateTime))return null;var e=b(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:`encrypted`,get:function(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),n=t.length;if(n>1||n===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}}]),t})(I),ie=(function(e){function t(t,n,r,i,a){var o;(o=e.call(this,r)||this).fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.stats=new ne,o.duration=t.decimalFloatingPoint(`DURATION`),o.gap=t.bool(`GAP`),o.independent=t.bool(`INDEPENDENT`),o.relurl=t.enumeratedString(`URI`),o.fragment=n,o.index=i;var s=t.enumeratedString(`BYTERANGE`);return s&&o.setByteRange(s,a),a&&(o.fragOffset=a.fragOffset+a.duration),o}return c(t,e),a(t,[{key:`start`,get:function(){return this.fragment.start+this.fragOffset}},{key:`end`,get:function(){return this.start+this.duration}},{key:`loaded`,get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t})(I),ae=(function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8=``,this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},a(e,[{key:`hasProgramDateTime`,get:function(){return!!this.fragments.length&&b(this.fragments[this.fragments.length-1].programDateTime)}},{key:`levelTargetDuration`,get:function(){return this.averagetargetduration||this.targetduration||10}},{key:`drift`,get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:`edge`,get:function(){return this.partEnd||this.fragmentEnd}},{key:`partEnd`,get:function(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:`fragmentEnd`,get:function(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:`age`,get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:`lastPartIndex`,get:function(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}},{key:`lastPartSn`,get:function(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e})();function L(e){return Uint8Array.from(atob(e),function(e){return e.charCodeAt(0)})}function oe(e){var t,n,r=e.split(`:`),i=null;if(r[0]===`data`&&r.length===2){var a=r[1].split(`;`),o=a[a.length-1].split(`,`);if(o.length===2){var s=o[0]===`base64`,c=o[1];s?(a.splice(-1,1),i=L(c)):(t=R(c).subarray(0,16),(n=new Uint8Array(16)).set(t,16-t.length),i=n)}}return i}function R(e){return Uint8Array.from(unescape(encodeURIComponent(e)),function(e){return e.charCodeAt(0)})}var z={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.fps`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`com.widevine.alpha`},B=`org.w3.clearkey`,V=`com.apple.streamingkeydelivery`,se=`com.microsoft.playready`,ce=`urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`;function le(e){switch(e){case V:return z.FAIRPLAY;case se:return z.PLAYREADY;case ce:return z.WIDEVINE;case B:return z.CLEARKEY}}var ue=`edef8ba979d64acea3c827dcd51d21ed`;function de(e){switch(e){case z.FAIRPLAY:return V;case z.PLAYREADY:return se;case z.WIDEVINE:return ce;case z.CLEARKEY:return B}}function fe(e){var t=e.drmSystems,n=e.widevineLicenseUrl,r=t?[z.FAIRPLAY,z.WIDEVINE,z.PLAYREADY,z.CLEARKEY].filter(function(e){return!!t[e]}):[];return!r[z.WIDEVINE]&&n&&r.push(z.WIDEVINE),r}var pe=typeof self<`u`&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function me(e,t,n){return Uint8Array.prototype.slice?e.slice(t,n):new Uint8Array(Array.prototype.slice.call(e,t,n))}var he,ge=function(e,t){return t+10<=e.length&&e[t]===73&&e[t+1]===68&&e[t+2]===51&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},_e=function(e,t){return t+10<=e.length&&e[t]===51&&e[t+1]===68&&e[t+2]===73&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},ve=function(e,t){for(var n=t,r=0;ge(e,t);)r+=10,r+=ye(e,t+6),_e(e,t+10)&&(r+=10),t+=r;if(r>0)return e.subarray(n,n+r)},ye=function(e,t){var n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3]},be=function(e,t){return ge(e,t)&&ye(e,t+6)+10<=e.length-t},xe=function(e){return e&&e.key===`PRIV`&&e.info===`com.apple.streaming.transportStreamTimestamp`},H=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),n=ye(e,4);return{type:t,size:n,data:e.subarray(10,10+n)}},Se=function(e){for(var t=0,n=[];ge(e,t);){for(var r=ye(e,t+6),i=(t+=10)+r;t+8<i;){var a=H(e.subarray(t)),o=Ce(a);o&&n.push(o),t+=a.size+10}_e(e,t)&&(t+=10)}return n},Ce=function(e){return e.type===`PRIV`?we(e):e.type[0]===`W`?Ee(e):Te(e)},we=function(e){if(!(e.size<2)){var t=Oe(e.data,!0),n=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:n.buffer}}},Te=function(e){if(!(e.size<2)){if(e.type===`TXXX`){var t=1,n=Oe(e.data.subarray(t),!0);t+=n.length+1;var r=Oe(e.data.subarray(t));return{key:e.type,info:n,data:r}}var i=Oe(e.data.subarray(1));return{key:e.type,data:i}}},Ee=function(e){if(e.type===`WXXX`){if(e.size<2)return;var t=1,n=Oe(e.data.subarray(t),!0);t+=n.length+1;var r=Oe(e.data.subarray(t));return{key:e.type,info:n,data:r}}var i=Oe(e.data);return{key:e.type,data:i}},De=function(e){if(e.data.byteLength===8){var t=new Uint8Array(e.data),n=1&t[3],r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}},Oe=function(e,t){t===void 0&&(t=!1);var n=ke();if(n){var r=n.decode(e);if(t){var i=r.indexOf(`\0`);return i===-1?r:r.substring(0,i)}return r.replace(/\0/g,``)}for(var a,o,s,c=e.length,l=``,u=0;u<c;){if((a=e[u++])===0&&t)return l;if(a!==0&&a!==3)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(a);break;case 12:case 13:o=e[u++],l+=String.fromCharCode((31&a)<<6|63&o);break;case 14:o=e[u++],s=e[u++],l+=String.fromCharCode((15&a)<<12|(63&o)<<6|(63&s)<<0)}}return l};function ke(){return he||self.TextDecoder===void 0||(he=new self.TextDecoder(`utf-8`)),he}var Ae=function(e){for(var t=``,n=0;n<e.length;n++){var r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t},je=2**32-1,Me=[].push,Ne={video:1,audio:2,id3:3,text:4};function U(e){return String.fromCharCode.apply(null,e)}function Pe(e,t){var n=e[t]<<8|e[t+1];return n<0?65536+n:n}function W(e,t){var n=Fe(e,t);return n<0?4294967296+n:n}function Fe(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Ie(e,t,n){e[t]=n>>24,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n}function G(e,t){var n=[];if(!t.length)return n;for(var r=e.byteLength,i=0;i<r;){var a=W(e,i),o=a>1?i+a:r;if(U(e.subarray(i+4,i+8))===t[0])if(t.length===1)n.push(e.subarray(i+8,o));else{var s=G(e.subarray(i+8,o),t.slice(1));s.length&&Me.apply(n,s)}i=o}return n}function K(e){var t=[],n=e[0],r=8,i=W(e,r);r+=4,r+=n===0?8:16,r+=2;var a=e.length+0,o=Pe(e,r);r+=2;for(var s=0;s<o;s++){var c=r,l=W(e,c);c+=4;var u=2147483647&l;if((2147483648&l)>>>31==1)return k.warn(`SIDX has hierarchical references (not supported)`),null;var d=W(e,c);c+=4,t.push({referenceSize:u,subsegmentDuration:d,info:{duration:d/i,start:a,end:a+u-1}}),a+=u,r=c+=4}return{earliestPresentationTime:0,timescale:i,version:n,referencesCount:o,references:t}}function q(e){for(var t=[],n=G(e,[`moov`,`trak`]),r=0;r<n.length;r++){var i=n[r],a=G(i,[`tkhd`])[0];if(a){var o=a[0],s=o===0?12:20,c=W(a,s),l=G(i,[`mdia`,`mdhd`])[0];if(l){var u=W(l,s=(o=l[0])===0?12:20),d=G(i,[`mdia`,`hdlr`])[0];if(d){var f=U(d.subarray(8,12)),p={soun:N,vide:P}[f];if(p){var m=G(i,[`mdia`,`minf`,`stbl`,`stsd`])[0],h=void 0;m&&(h=U(m.subarray(12,16))),t[c]={timescale:u,type:p},t[p]={timescale:u,id:c,codec:h}}}}}}return G(e,[`moov`,`mvex`,`trex`]).forEach(function(e){var n=t[W(e,4)];n&&(n.default={duration:W(e,12),flags:W(e,20)})}),t}function Le(e){var t=G(e,[`schm`])[0];if(t){var n=U(t.subarray(4,8));if(n===`cbcs`||n===`cenc`)return G(e,[`schi`,`tenc`])[0]}return k.error(`[eme] missing 'schm' box`),null}function Re(e){var t=W(e,0),n=8;1&t&&(n+=4),4&t&&(n+=4);for(var r=0,i=W(e,4),a=0;a<i;a++)256&t&&(r+=W(e,n),n+=4),512&t&&(n+=4),1024&t&&(n+=4),2048&t&&(n+=4);return r}function ze(e,t){var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Be(e,t){var n=[],r=t.samples,i=t.timescale,a=t.id,o=!1;return G(r,[`moof`]).map(function(s){var c=s.byteOffset-8;G(s,[`traf`]).map(function(s){var l=G(s,[`tfdt`]).map(function(e){var t=e[0],n=W(e,4);return t===1&&(n*=2**32,n+=W(e,8)),n/i})[0];return l!==void 0&&(e=l),G(s,[`tfhd`]).map(function(l){var u=W(l,4),d=16777215&W(l,0),f=0,p=(16&d)!=0,m=0,h=(32&d)!=0,g=8;u===a&&(1&d&&(g+=8),2&d&&(g+=4),8&d&&(f=W(l,g),g+=4),p&&(m=W(l,g),g+=4),h&&(g+=4),t.type===`video`&&(o=(function(e){if(!e)return!1;var t=e.indexOf(`.`),n=t<0?e:e.substring(0,t);return n===`hvc1`||n===`hev1`||n===`dvh1`||n===`dvhe`})(t.codec)),G(s,[`trun`]).map(function(a){var s=a[0],l=16777215&W(a,0),u=(1&l)!=0,d=0,p=(4&l)!=0,h=(256&l)!=0,g=0,_=(512&l)!=0,v=0,y=(1024&l)!=0,b=(2048&l)!=0,x=0,S=W(a,4),C=8;u&&(d=W(a,C),C+=4),p&&(C+=4);for(var w=d+c,T=0;T<S;T++){if(h?(g=W(a,C),C+=4):g=f,_?(v=W(a,C),C+=4):v=m,y&&(C+=4),b&&(x=s===0?W(a,C):Fe(a,C),C+=4),t.type===P)for(var E=0;E<v;){var D=W(r,w);Ve(o,r[w+=4])&&He(r.subarray(w,w+D),o?2:1,e+x/i,n),w+=D,E+=D+4}e+=g/i}}))})})}),n}function Ve(e,t){if(e){var n=t>>1&63;return n===39||n===40}return(31&t)==6}function He(e,t,n,r){var i=Ue(e),a=0;a+=t;for(var o=0,s=0,c=!1,l=0;a<i.length;){o=0;do{if(a>=i.length)break;o+=l=i[a++]}while(l===255);s=0;do{if(a>=i.length)break;s+=l=i[a++]}while(l===255);var u=i.length-a;if(!c&&o===4&&a<i.length){if(c=!0,i[a++]===181){var d=Pe(i,a);if(a+=2,d===49){var f=W(i,a);if(a+=4,f===1195456820){var p=i[a++];if(p===3){var m=i[a++],h=64&m,g=h?2+3*(31&m):0,_=new Uint8Array(g);if(h){_[0]=m;for(var v=1;v<g;v++)_[v]=i[a++]}r.push({type:p,payloadType:o,pts:n,bytes:_})}}}}}else if(o===5&&s<u){if(c=!0,s>16){for(var y=[],b=0;b<16;b++){var x=i[a++].toString(16);y.push(x.length==1?`0`+x:x),b!==3&&b!==5&&b!==7&&b!==9||y.push(`-`)}for(var S=s-16,C=new Uint8Array(S),w=0;w<S;w++)C[w]=i[a++];r.push({payloadType:o,pts:n,uuid:y.join(``),userData:Oe(C),userDataBytes:C})}}else if(s<u)a+=s;else if(s>u)break}}function Ue(e){for(var t=e.byteLength,n=[],r=1;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;var i=t-n.length,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}function We(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);var r,i,a;if(t){r=1,i=new Uint8Array(16*t.length);for(var o=0;o<t.length;o++){var s=t[o];if(s.byteLength!==16)throw RangeError(`Invalid key`);i.set(s,16*o)}}else r=0,i=new Uint8Array;r>0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;var c=new Uint8Array(4);return n&&n.byteLength>0&&new DataView(c.buffer).setUint32(0,n.byteLength,!1),(function(e){for(var t=[...arguments].slice(1),n=t.length,r=8,i=n;i--;)r+=t[i].byteLength;var a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=255&r,a.set(e,4),i=0,r=8;i<n;i++)a.set(t[i],r),r+=t[i].byteLength;return a})([112,115,115,104],new Uint8Array([r,0,0,0]),e,a,i,c,n||new Uint8Array)}var Ge={},Ke=(function(){function e(e,t,n,r,i){r===void 0&&(r=[1]),i===void 0&&(i=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=r,this.iv=i,this.encrypted=!!e&&e!==`NONE`,this.isCommonEncryption=this.encrypted&&e!==`AES-128`}e.clearKeyUriToKeyIdMap=function(){Ge={}};var t=e.prototype;return t.isSupported=function(){if(this.method){if(this.method===`AES-128`||this.method===`NONE`)return!0;if(this.keyFormat===`identity`)return this.method===`SAMPLE-AES`;switch(this.keyFormat){case V:case ce:case se:case B:return[`ISO-23001-7`,`SAMPLE-AES`,`SAMPLE-AES-CENC`,`SAMPLE-AES-CTR`].indexOf(this.method)!==-1}}return!1},t.getDecryptData=function(t){if(!this.encrypted||!this.uri)return null;if(this.method===`AES-128`&&this.uri&&!this.iv){typeof t!=`number`&&(this.method!==`AES-128`||this.iv||k.warn(`missing IV for initialization segment with method="`+this.method+`" - compliance issue`),t=0);var n=(function(e){for(var t=new Uint8Array(16),n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t})(t);return new e(this.method,this.uri,`identity`,this.keyFormatVersions,n)}var r=oe(this.uri);if(r)switch(this.keyFormat){case ce:this.pssh=r,r.length>=22&&(this.keyId=r.subarray(r.length-22,r.length-6));break;case se:var i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=We(i,null,r);var a=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),o=String.fromCharCode.apply(null,Array.from(a)),s=o.substring(o.indexOf(`<`),o.length),c=new DOMParser().parseFromString(s,`text/xml`).getElementsByTagName(`KID`)[0];if(c){var l=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute(`VALUE`);if(l){var u=L(l).subarray(0,16);(function(e){var t=function(e,t,n){var r=e[t];e[t]=e[n],e[n]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)})(u),this.keyId=u}}break;default:var d=r.subarray(0,16);if(d.length!==16){var f=new Uint8Array(16);f.set(d,16-d.length),d=f}this.keyId=d}if(!this.keyId||this.keyId.byteLength!==16){var p=Ge[this.uri];if(!p){var m=Object.keys(Ge).length%(2**53-1);p=new Uint8Array(16),new DataView(p.buffer,12,4).setUint32(0,m),Ge[this.uri]=p}this.keyId=p}return this},e})(),qe=/\{\$([a-zA-Z0-9-_]+)\}/g;function Je(e){return qe.test(e)}function Ye(e,t,n){if(e.variableList!==null||e.hasVariableRefs)for(var r=n.length;r--;){var i=n[r],a=t[i];a&&(t[i]=Xe(e,a))}}function Xe(e,t){if(e.variableList!==null||e.hasVariableRefs){var n=e.variableList;return t.replace(qe,function(t){var r=t.substring(2,t.length-1),i=n?.[r];return i===void 0?(e.playlistParsingError||=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "`+r+`"`),t):i})}return t}function Ze(e,t,n){var r,i,a=e.variableList;if(a||(e.variableList=a={}),`QUERYPARAM`in t){r=t.QUERYPARAM;try{var o=new self.URL(n).searchParams;if(!o.has(r))throw Error(`"`+r+`" does not match any query parameter in URI: "`+n+`"`);i=o.get(r)}catch(t){e.playlistParsingError||=Error(`EXT-X-DEFINE QUERYPARAM: `+t.message)}}else r=t.NAME,i=t.VALUE;r in a?e.playlistParsingError||=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "`+r+`"`):a[r]=i||``}function Qe(e,t,n){var r=t.IMPORT;if(n&&r in n){var i=e.variableList;i||(e.variableList=i={}),i[r]=n[r]}else e.playlistParsingError||=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "`+r+`"`)}function $e(){if(typeof self<`u`)return self.MediaSource||self.WebKitMediaSource}var et={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},tt=$e();function nt(e,t){var n;return(n=tt?.isTypeSupported((t||`video`)+`/mp4;codecs="`+e+`"`))!=null&&n}var rt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,it=/#EXT-X-MEDIA:(.*)/g,at=/^#EXT(?:INF|-X-TARGETDURATION):/m,ot=new RegExp([`#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?`,`(?!#) *(\\S[\\S ]*)`,`#EXT-X-BYTERANGE:*(.+)`,`#EXT-X-PROGRAM-DATE-TIME:(.+)`,`#.*`].join(`|`),`g`),st=new RegExp([`#(EXTM3U)`,`#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)`,`#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\\d+)`,`#EXT-X-(DISCONTINUITY|ENDLIST|GAP)`,`(#)([^:]*):(.*)`,`(#)(.*)(?:.*)\\r?\\n?`].join(`|`)),ct=(function(){function e(){}return e.findGroup=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.id===t)return r}},e.convertAVC1ToAVCOTI=function(e){var t=e.split(`.`);if(t.length>2){var n=t.shift()+`.`;return n+=parseInt(t.shift()).toString(16),n+=(`000`+parseInt(t.shift()).toString(16)).slice(-4)}return e},e.resolve=function(e,t){return y.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.isMediaPlaylist=function(e){return at.test(e)},e.parseMasterPlaylist=function(t,n){var r,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Je(t)},a=[];for(rt.lastIndex=0;(r=rt.exec(t))!=null;)if(r[1]){var o,s=new M(r[1]);Ye(i,s,[`CODECS`,`SUPPLEMENTAL-CODECS`,`ALLOWED-CPC`,`PATHWAY-ID`,`STABLE-VARIANT-ID`,`AUDIO`,`VIDEO`,`SUBTITLES`,`CLOSED-CAPTIONS`,`NAME`]);var c=Xe(i,r[2]),l={attrs:s,bitrate:s.decimalInteger(`AVERAGE-BANDWIDTH`)||s.decimalInteger(`BANDWIDTH`),name:s.NAME,url:e.resolve(c,n)},u=s.decimalResolution(`RESOLUTION`);u&&(l.width=u.width,l.height=u.height),dt((s.CODECS||``).split(/[ ,]+/).filter(function(e){return e}),l),l.videoCodec&&l.videoCodec.indexOf(`avc1`)!==-1&&(l.videoCodec=e.convertAVC1ToAVCOTI(l.videoCodec)),(o=l.unknownCodecs)!=null&&o.length||a.push(l),i.levels.push(l)}else if(r[3]){var d=r[3],f=r[4];switch(d){case`SESSION-DATA`:var p=new M(f);Ye(i,p,[`DATA-ID`,`LANGUAGE`,`VALUE`,`URI`]);var m=p[`DATA-ID`];m&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[m]=p);break;case`SESSION-KEY`:var h=lt(f,n,i);h.encrypted&&h.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(h)):k.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "`+f+`"`);break;case`DEFINE`:var g=new M(f);Ye(i,g,[`NAME`,`VALUE`,`QUERYPARAM`]),Ze(i,g,n);break;case`CONTENT-STEERING`:var _=new M(f);Ye(i,_,[`SERVER-URI`,`PATHWAY-ID`]),i.contentSteering={uri:e.resolve(_[`SERVER-URI`],n),pathwayId:_[`PATHWAY-ID`]||`.`};break;case`START`:i.startTimeOffset=ut(f)}}return i.levels=a.length>0&&a.length<i.levels.length?a:i.levels,i.levels.length===0&&(i.playlistParsingError=Error(`no levels found in manifest`)),i},e.parseMasterPlaylistMedia=function(t,n,r){var i,a={},o=r.levels,s={AUDIO:o.map(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}}),SUBTITLES:o.map(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(it.lastIndex=0;(i=it.exec(t))!==null;){var l=new M(i[1]),u=l.TYPE;if(u){var d=s[u],f=a[u]||[];a[u]=f,Ye(r,l,[`URI`,`GROUP-ID`,`LANGUAGE`,`ASSOC-LANGUAGE`,`STABLE-RENDITION-ID`,`NAME`,`INSTREAM-ID`,`CHARACTERISTICS`,`CHANNELS`]);var p={attrs:l,bitrate:0,id:c++,groupId:l[`GROUP-ID`]||``,instreamId:l[`INSTREAM-ID`],name:l.NAME||l.LANGUAGE||``,type:u,default:l.bool(`DEFAULT`),autoselect:l.bool(`AUTOSELECT`),forced:l.bool(`FORCED`),lang:l.LANGUAGE,url:l.URI?e.resolve(l.URI,n):``};if(d!=null&&d.length){var m=e.findGroup(d,p.groupId)||d[0];ft(p,m,`audioCodec`),ft(p,m,`textCodec`)}f.push(p)}}return a},e.parseLevelPlaylist=function(e,t,n,r,i,a){var o,c,l,u=new ae(t),d=u.fragments,f=null,p=0,m=0,h=0,g=0,_=null,v=new re(r,t),y=-1,x=!1;for(ot.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Je(e);(o=ot.exec(e))!==null;){x&&(x=!1,(v=new re(r,t)).start=h,v.sn=p,v.cc=g,v.level=n,f&&(v.initSegment=f,v.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null));var S=o[1];if(S){v.duration=parseFloat(S);var C=(` `+o[2]).slice(1);v.title=C||null,v.tagList.push(C?[`INF`,S,C]:[`INF`,S])}else if(o[3]){if(b(v.duration)){v.start=h,l&&ht(v,l,u),v.sn=p,v.level=n,v.cc=g,v.urlId=i,d.push(v);var w=(` `+o[3]).slice(1);v.relurl=Xe(u,w),pt(v,_),_=v,h+=v.duration,p++,m=0,x=!0}}else if(o[4]){var T=(` `+o[4]).slice(1);_?v.setByteRange(T,_):v.setByteRange(T)}else if(o[5])v.rawProgramDateTime=(` `+o[5]).slice(1),v.tagList.push([`PROGRAM-DATE-TIME`,v.rawProgramDateTime]),y===-1&&(y=d.length);else{if(!(o=o[0].match(st))){k.warn(`No matches on slow regex match for level playlist!`);continue}for(c=1;c<o.length&&o[c]===void 0;c++);var E=(` `+o[c]).slice(1),D=(` `+o[c+1]).slice(1),O=o[c+2]?(` `+o[c+2]).slice(1):``;switch(E){case`PLAYLIST-TYPE`:u.type=D.toUpperCase();break;case`MEDIA-SEQUENCE`:p=u.startSN=parseInt(D);break;case`SKIP`:var A=new M(D);Ye(u,A,[`RECENTLY-REMOVED-DATERANGES`]);var j=A.decimalInteger(`SKIPPED-SEGMENTS`);if(b(j)){u.skippedSegments=j;for(var ee=j;ee--;)d.unshift(null);p+=j}var ne=A.enumeratedString(`RECENTLY-REMOVED-DATERANGES`);ne&&(u.recentlyRemovedDateranges=ne.split(` `));break;case`TARGETDURATION`:u.targetduration=Math.max(parseInt(D),1);break;case`VERSION`:u.version=parseInt(D);break;case`EXTM3U`:break;case`ENDLIST`:u.live=!1;break;case`#`:(D||O)&&v.tagList.push(O?[D,O]:[D]);break;case`DISCONTINUITY`:g++,v.tagList.push([`DIS`]);break;case`GAP`:v.gap=!0,v.tagList.push([E]);break;case`BITRATE`:v.tagList.push([E,D]);break;case`DATERANGE`:var N=new M(D);Ye(u,N,[`ID`,`CLASS`,`START-DATE`,`END-DATE`,`SCTE35-CMD`,`SCTE35-OUT`,`SCTE35-IN`]),Ye(u,N,N.clientAttrs);var P=new te(N,u.dateRanges[N.ID]);P.isValid||u.skippedSegments?u.dateRanges[P.id]=P:k.warn(`Ignoring invalid DATERANGE tag: "`+D+`"`),v.tagList.push([`EXT-X-DATERANGE`,D]);break;case`DEFINE`:var F=new M(D);Ye(u,F,[`NAME`,`VALUE`,`IMPORT`,`QUERYPARAM`]),`IMPORT`in F?Qe(u,F,a):Ze(u,F,t);break;case`DISCONTINUITY-SEQUENCE`:g=parseInt(D);break;case`KEY`:var I=lt(D,t,u);if(I.isSupported()){if(I.method===`NONE`){l=void 0;break}l||={},l[I.keyFormat]&&(l=s({},l)),l[I.keyFormat]=I}else k.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "`+D+`"`);break;case`START`:u.startTimeOffset=ut(D);break;case`MAP`:var L=new M(D);if(Ye(u,L,[`BYTERANGE`,`URI`]),v.duration){var oe=new re(r,t);mt(oe,L,n,l),f=oe,v.initSegment=f,f.rawProgramDateTime&&!v.rawProgramDateTime&&(v.rawProgramDateTime=f.rawProgramDateTime)}else mt(v,L,n,l),f=v,x=!0;break;case`SERVER-CONTROL`:var R=new M(D);u.canBlockReload=R.bool(`CAN-BLOCK-RELOAD`),u.canSkipUntil=R.optionalFloat(`CAN-SKIP-UNTIL`,0),u.canSkipDateRanges=u.canSkipUntil>0&&R.bool(`CAN-SKIP-DATERANGES`),u.partHoldBack=R.optionalFloat(`PART-HOLD-BACK`,0),u.holdBack=R.optionalFloat(`HOLD-BACK`,0);break;case`PART-INF`:u.partTarget=new M(D).decimalFloatingPoint(`PART-TARGET`);break;case`PART`:var z=u.partList;z||=u.partList=[];var B=m>0?z[z.length-1]:void 0,V=m++,se=new M(D);Ye(u,se,[`BYTERANGE`,`URI`]);var ce=new ie(se,v,t,V,B);z.push(ce),v.duration+=ce.duration;break;case`PRELOAD-HINT`:var le=new M(D);Ye(u,le,[`URI`]),u.preloadHint=le;break;case`RENDITION-REPORT`:var ue=new M(D);Ye(u,ue,[`URI`]),u.renditionReports=u.renditionReports||[],u.renditionReports.push(ue);break;default:k.warn(`line parsed but not handled: `+o)}}}_&&!_.relurl?(d.pop(),h-=_.duration,u.partList&&(u.fragmentHint=_)):u.partList&&(pt(v,_),v.cc=g,u.fragmentHint=v,l&&ht(v,l,u));var de=d.length,fe=d[0],pe=d[de-1];if((h+=u.skippedSegments*u.targetduration)>0&&de&&pe){u.averagetargetduration=h/de;var me=pe.sn;u.endSN=me===`initSegment`?0:me,u.live||(pe.endList=!0),fe&&(u.startCC=fe.cc)}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(h+=u.fragmentHint.duration),u.totalduration=h,u.endCC=g,y>0&&(function(e,t){for(var n=e[t],r=t;r--;){var i=e[r];if(!i)return;i.programDateTime=n.programDateTime-1e3*i.duration,n=i}})(d,y),u},e})();function lt(e,t,n){var r=new M(e);Ye(n,r,[`KEYFORMAT`,`KEYFORMATVERSIONS`,`URI`,`IV`,`URI`]);var i=r.METHOD??``,a=r.URI,o=r.hexadecimalInteger(`IV`),s=r.KEYFORMATVERSIONS,c=r.KEYFORMAT??`identity`;return a&&r.IV&&!o&&k.error(`Invalid IV: `+r.IV),new Ke(i,a?ct.resolve(a,t):``,c,(s||`1`).split(`/`).map(Number).filter(Number.isFinite),o)}function ut(e){var t=new M(e).decimalFloatingPoint(`TIME-OFFSET`);return b(t)?t:null}function dt(e,t){[`video`,`audio`,`text`].forEach(function(n){var r=e.filter(function(e){return(function(e,t){var n=et[t];return!!n&&!0===n[e.slice(0,4)]})(e,n)});if(r.length){var i=r.filter(function(e){return e.lastIndexOf(`avc1`,0)===0||e.lastIndexOf(`mp4a`,0)===0});t[n+`Codec`]=i.length>0?i[0]:r[0],e=e.filter(function(e){return r.indexOf(e)===-1})}}),t.unknownCodecs=e}function ft(e,t,n){var r=t[n];r&&(e[n]=r)}function pt(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):t!=null&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),b(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function mt(e,t,n,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=n,e.sn=`initSegment`,r&&(e.levelkeys=r),e.initSegment=null}function ht(e,t,n){e.levelkeys=t;var r=n.encryptedFragments;r.length&&r[r.length-1].levelkeys===t||!Object.keys(t).some(function(e){return t[e].isCommonEncryption})||r.push(e)}var gt=`manifest`,_t=`level`,vt=`audioTrack`,yt=`subtitleTrack`,J=`main`,bt=`audio`,xt=`subtitle`;function St(e){switch(e.type){case vt:return bt;case yt:return xt;default:return J}}function Ct(e,t){var n=e.url;return n!==void 0&&n.indexOf(`data:`)!==0||(n=t.url),n}var wt=(function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var n=e.prototype;return n.startLoad=function(e){},n.stopLoad=function(){this.destroyInternalLoaders()},n.registerListeners=function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},n.unregisterListeners=function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},n.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,r=t.loader,i=new(n||r)(t);return this.loaders[e.type]=i,i},n.getInternalLoader=function(e){return this.loaders[e.type]},n.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},n.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},n.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},n.onManifestLoading=function(e,t){var n=t.url;this.variableList=null,this.load({id:null,level:0,responseType:`text`,type:gt,url:n,deliveryDirectives:null})},n.onLevelLoading=function(e,t){var n=t.id,r=t.level,i=t.url,a=t.deliveryDirectives;this.load({id:n,level:r,responseType:`text`,type:_t,url:i,deliveryDirectives:a})},n.onAudioTrackLoading=function(e,t){var n=t.id,r=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:`text`,type:vt,url:i,deliveryDirectives:a})},n.onSubtitleTrackLoading=function(e,t){var n=t.id,r=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:`text`,type:yt,url:i,deliveryDirectives:a})},n.load=function(e){var t,n,r,i=this,a=this.hls.config,o=this.getInternalLoader(e);if(o){var c=o.context;if(c&&c.url===e.url)return void k.trace(`[playlist-loader]: playlist request ongoing`);k.log(`[playlist-loader]: aborting previous loader for type: `+e.type),o.abort()}if(n=e.type===gt?a.manifestLoadPolicy.default:s({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===_t&&e.level!==null?r=this.hls.levels[e.level].details:e.type===vt&&e.id!==null?r=this.hls.audioTracks[e.id].details:e.type===yt&&e.id!==null&&(r=this.hls.subtitleTracks[e.id].details),r)){var l=r.partTarget,u=r.targetduration;if(l&&u){var d=1e3*Math.max(3*l,.8*u);n=s({},n,{maxTimeToFirstByteMs:Math.min(d,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,n.maxTimeToFirstByteMs)})}}var f=n.errorRetry||n.timeoutRetry||{},p={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0};o.load(e,p,{onSuccess:function(e,t,n,r){var a=i.getInternalLoader(n);i.resetInternalLoader(n.type);var o=e.data;o.indexOf(`#EXTM3U`)===0?(t.parsing.start=performance.now(),ct.isMediaPlaylist(o)?i.handleTrackOrLevelPlaylist(e,t,n,r||null,a):i.handleMasterPlaylist(e,t,n,r)):i.handleManifestParsingError(e,n,Error(`no EXTM3U delimiter`),r||null,t)},onError:function(e,t,n,r){i.handleNetworkError(t,n,!1,e,r)},onTimeout:function(e,t,n){i.handleNetworkError(t,n,!0,void 0,e)}})},n.handleMasterPlaylist=function(e,t,n,r){var i=this.hls,a=e.data,o=Ct(e,n),s=ct.parseMasterPlaylist(a,o);if(s.playlistParsingError)this.handleManifestParsingError(e,n,s.playlistParsingError,r,t);else{var c=s.contentSteering,l=s.levels,u=s.sessionData,d=s.sessionKeys,f=s.startTimeOffset,p=s.variableList;this.variableList=p;var m=ct.parseMasterPlaylistMedia(a,o,s),h=m.AUDIO,g=h===void 0?[]:h,_=m.SUBTITLES,v=m[`CLOSED-CAPTIONS`];g.length&&(g.some(function(e){return!e.url})||!l[0].audioCodec||l[0].attrs.AUDIO||(k.log(`[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one`),g.unshift({type:`main`,name:`main`,groupId:`main`,default:!1,autoselect:!1,forced:!1,id:-1,attrs:new M({}),bitrate:0,url:``}))),i.trigger(x.MANIFEST_LOADED,{levels:l,audioTracks:g,subtitles:_,captions:v,contentSteering:c,url:o,stats:t,networkDetails:r,sessionData:u,sessionKeys:d,startTimeOffset:f,variableList:p})}},n.handleTrackOrLevelPlaylist=function(e,t,n,r,i){var a=this.hls,o=n.id,s=n.level,c=n.type,l=Ct(e,n),u=b(o)?o:0,d=b(s)?s:u,f=St(n),p=ct.parseLevelPlaylist(e.data,l,d,f,u,this.variableList);if(c===gt){var m={attrs:new M({}),bitrate:0,details:p,name:``,url:l};a.trigger(x.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:l,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=p,this.handlePlaylistLoaded(p,e,t,n,r,i)},n.handleManifestParsingError=function(e,t,n,r,i){this.hls.trigger(x.ERROR,{type:S.NETWORK_ERROR,details:C.MANIFEST_PARSING_ERROR,fatal:t.type===gt,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})},n.handleNetworkError=function(e,n,r,i,a){r===void 0&&(r=!1);var o=`A network `+(r?`timeout`:`error`+(i?` (status `+i.code+`)`:``))+` occurred while loading `+e.type;e.type===_t?o+=`: `+e.level+` id: `+e.id:e.type!==vt&&e.type!==yt||(o+=` id: `+e.id+` group-id: "`+e.groupId+`"`);var s=Error(o);k.warn(`[playlist-loader]: `+o);var c=C.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case gt:c=r?C.MANIFEST_LOAD_TIMEOUT:C.MANIFEST_LOAD_ERROR,l=!0;break;case _t:c=r?C.LEVEL_LOAD_TIMEOUT:C.LEVEL_LOAD_ERROR,l=!1;break;case vt:c=r?C.AUDIO_TRACK_LOAD_TIMEOUT:C.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case yt:c=r?C.SUBTITLE_TRACK_LOAD_TIMEOUT:C.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type);var d={type:S.NETWORK_ERROR,details:c,fatal:l,url:e.url,loader:u,context:e,error:s,networkDetails:n,stats:a};i&&(d.response=t({url:n?.url||e.url,data:void 0},i)),this.hls.trigger(x.ERROR,d)},n.handlePlaylistLoaded=function(e,t,n,r,i,a){var o=this.hls,s=r.type,c=r.level,l=r.id,u=r.groupId,d=r.deliveryDirectives,f=Ct(t,r),p=St(r),m=typeof r.level==`number`&&p===J?c:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=Error(`Missing Target Duration`));var h=e.playlistParsingError;if(h)o.trigger(x.ERROR,{type:S.NETWORK_ERROR,details:C.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:h,reason:h.message,response:t,context:r,level:m,parent:p,networkDetails:i,stats:n});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),s){case gt:case _t:o.trigger(x.LEVEL_LOADED,{details:e,level:m||0,id:l||0,stats:n,networkDetails:i,deliveryDirectives:d});break;case vt:o.trigger(x.AUDIO_TRACK_LOADED,{details:e,id:l||0,groupId:u||``,stats:n,networkDetails:i,deliveryDirectives:d});break;case yt:o.trigger(x.SUBTITLE_TRACK_LOADED,{details:e,id:l||0,groupId:u||``,stats:n,networkDetails:i,deliveryDirectives:d})}}else{var g=Error(`No Segments found in Playlist`);o.trigger(x.ERROR,{type:S.NETWORK_ERROR,details:C.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:g,reason:g.message,response:t,context:r,level:m,parent:p,networkDetails:i,stats:n})}},e})();function Tt(e,t){var n;try{n=new Event(`addtrack`)}catch{(n=document.createEvent(`Event`)).initEvent(`addtrack`,!1,!1)}n.track=e,t.dispatchEvent(n)}function Et(e,t){var n=e.mode;if(n===`disabled`&&(e.mode=`hidden`),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error(`addCue is failed for: `+t)}catch(n){k.debug(`[texttrack-utils]: `+n);try{var r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}catch(e){k.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: `+e)}}n===`disabled`&&(e.mode=n)}function Dt(e){var t=e.mode;if(t===`disabled`&&(e.mode=`hidden`),e.cues)for(var n=e.cues.length;n--;)e.removeCue(e.cues[n]);t===`disabled`&&(e.mode=t)}function Ot(e,t,n,r){var i=e.mode;if(i===`disabled`&&(e.mode=`hidden`),e.cues&&e.cues.length>0)for(var a=(function(e,t,n){var r=[],i=(function(e,t){if(t<e[0].startTime)return 0;var n=e.length-1;if(t>e[n].endTime)return-1;for(var r=0,i=n;r<=i;){var a=Math.floor((i+r)/2);if(t<e[a].startTime)i=a-1;else{if(!(t>e[a].startTime&&r<n))return a;r=a+1}}return e[r].startTime-t<t-e[i].startTime?r:i})(e,t);if(i>-1)for(var a=i,o=e.length;a<o;a++){var s=e[a];if(s.startTime>=t&&s.endTime<=n)r.push(s);else if(s.startTime>n)return r}return r})(e.cues,t,n),o=0;o<a.length;o++)r&&!r(a[o])||e.removeCue(a[o]);i===`disabled`&&(e.mode=i)}var kt=`org.id3`,At=`com.apple.quicktime.HLS`,jt=`https://aomedia.org/emsg/ID3`;function Mt(){if(typeof self<`u`)return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var Nt=(function(){var e=Mt();try{new e(0,1/0,``)}catch{return Number.MAX_VALUE}return 1/0})();function Pt(e,t){return e.getTime()/1e3-t}var Ft=(function(){function e(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var t=e.prototype;return t.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},t._registerListeners=function(){var e=this.hls;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this)},t._unregisterListeners=function(){var e=this.hls;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this)},t.onMediaAttached=function(e,t){this.media=t.media},t.onMediaDetaching=function(){this.id3Track&&(Dt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},t.onManifestLoading=function(){this.dateRangeCuesAppended={}},t.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode=`hidden`,t},t.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var n=e[t];if(n.kind===`metadata`&&n.label===`id3`)return Tt(n,this.media),n}return this.media.addTextTrack(`metadata`,`id3`)}},t.onFragParsingMetadata=function(e,t){if(this.media){var n=this.hls.config,r=n.enableEmsgMetadataCues,i=n.enableID3MetadataCues;if(r||i){var a=t.samples;this.id3Track||=this.createTrack(this.media);for(var o=Mt(),s=0;s<a.length;s++){var c=a[s].type;if((c!==jt||r)&&i){var l=Se(a[s].data);if(l){var u=a[s].pts,d=u+a[s].duration;d>Nt&&(d=Nt),d-u<=0&&(d=u+.25);for(var f=0;f<l.length;f++){var p=l[f];if(!xe(p)){this.updateId3CueEnds(u,c);var m=new o(u,d,``);m.value=p,c&&(m.type=c),this.id3Track.addCue(m)}}}}}}}},t.updateId3CueEnds=function(e,t){var n=this.id3Track?.cues;if(n)for(var r=n.length;r--;){var i=n[r];i.type===t&&i.startTime<e&&i.endTime===Nt&&(i.endTime=e)}},t.onBufferFlushing=function(e,t){var n=t.startOffset,r=t.endOffset,i=t.type,a=this.id3Track,o=this.hls;if(o){var s=o.config,c=s.enableEmsgMetadataCues,l=s.enableID3MetadataCues;a&&(c||l)&&Ot(a,n,r,i===`audio`?function(e){return e.type===kt&&l}:i===`video`?function(e){return e.type===jt&&c}:function(e){return e.type===kt&&l||e.type===jt&&c})}},t.onLevelUpdated=function(e,t){var n=this,r=t.details;if(this.media&&r.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var i=this.dateRangeCuesAppended,a=this.id3Track,o=r.dateRanges,s=Object.keys(o);if(a)for(var c=Object.keys(i).filter(function(e){return!s.includes(e)}),l=function(){var e=c[u];Object.keys(i[e].cues).forEach(function(t){a.removeCue(i[e].cues[t])}),delete i[e]},u=c.length;u--;)l();var d=r.fragments[r.fragments.length-1];if(s.length!==0&&b(d?.programDateTime)){this.id3Track||=this.createTrack(this.media);for(var f=d.programDateTime/1e3-d.start,p=Mt(),m=function(){var e=s[h],t=o[e],r=i[e],a=r?.cues||{},c=r?.durationKnown||!1,l=Pt(t.startDate,f),u=Nt,d=t.endDate;if(d)u=Pt(d,f),c=!0;else if(t.endOnNext&&!c){var m=s.reduce(function(e,n){var r=o[n];return r.class===t.class&&r.id!==n&&r.startDate>t.startDate&&e.push(r),e},[]).sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()})[0];m&&(u=Pt(m.startDate,f),c=!0)}for(var g,_,v=Object.keys(t.attr),y=0;y<v.length;y++){var b=v[y];if((_=b)!==`ID`&&_!==`CLASS`&&_!==`START-DATE`&&_!==`DURATION`&&_!==`END-DATE`&&_!==`END-ON-NEXT`){var x=a[b];if(x)c&&!r.durationKnown&&(x.endTime=u);else{var S=t.attr[b];x=new p(l,u,``),ee(b)&&(g=S,S=Uint8Array.from(g.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer),x.value={key:b,data:S},x.type=At,x.id=e,n.id3Track.addCue(x),a[b]=x}}}i[e]={cues:a,dateRange:t,durationKnown:c}},h=0;h<s.length;h++)m()}}},e})(),It=(function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},t.registerListeners=function(){this.hls.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(x.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(x.ERROR,this.onError,this)},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener(`timeupdate`,this.timeupdateHandler)},t.onMediaDetaching=function(){this.media&&=(this.media.removeEventListener(`timeupdate`,this.timeupdateHandler),null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(e,t){var n=t.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener(`timeupdate`,this.timeupdateHandler)},t.onError=function(e,t){var n;t.details===C.BUFFER_STALLED_ERROR&&(this.stallCount++,(n=this.levelDetails)!=null&&n.live&&k.warn(`[playback-rate-controller]: Stall detected, adjusting target latency`))},t.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var n=this.computeLatency();if(n!==null){this._latency=n;var r=this.config,i=r.lowLatencyMode,a=r.maxLiveSyncPlaybackRate;if(i&&a!==1){var o=this.targetLatency;if(o!==null){var s=n-o,c=s<Math.min(this.maxLatency,o+t.targetduration);if(t.live&&c&&s>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,a)),u=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;e.playbackRate=Math.min(l,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}}}}},t.estimateLiveEdge=function(){var e=this.levelDetails;return e===null?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return e===null?null:e-this.currentTime},a(e,[{key:`latency`,get:function(){return this._latency||0}},{key:`maxLatency`,get:function(){var e=this.config,t=this.levelDetails;return e.liveMaxLatencyDuration===void 0?t?e.liveMaxLatencyDurationCount*t.targetduration:0:e.liveMaxLatencyDuration}},{key:`targetLatency`,get:function(){var e=this.levelDetails;if(e===null)return null;var t=e.holdBack,n=e.partHoldBack,r=e.targetduration,i=this.config,a=i.liveSyncDuration,o=i.liveSyncDurationCount,s=i.lowLatencyMode,c=this.hls.userConfig,l=s&&n||t;(c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=a===void 0?o*r:a);var u=r;return l+Math.min(1*this.stallCount,u)}},{key:`liveSyncPosition`,get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(e===null||t===null||n===null)return null;var r=n.edge,i=e-t-this.edgeStalled,a=r-n.totalduration,o=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,i),o)}},{key:`drift`,get:function(){var e=this.levelDetails;return e===null?1:e.drift}},{key:`edgeStalled`,get:function(){var e=this.levelDetails;if(e===null)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:`forwardBufferLength`,get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}}]),e})(),Lt=[`NONE`,`TYPE-0`,`TYPE-1`,null],Rt=``,zt=`YES`,Bt=`v2`,Vt=(function(){function e(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}return e.prototype.addDirectives=function(e){var 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},e})(),Ht=(function(){function e(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[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.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(function(e){return e}).join(`,`).replace(/\.[^.,]+/g,``)}return e.prototype.addFallback=function(e){this.url.push(e.url),this._attrs.push(e.attrs)},a(e,[{key:`maxBitrate`,get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:`attrs`,get:function(){return this._attrs[this._urlId]}},{key:`pathwayId`,get:function(){return this.attrs[`PATHWAY-ID`]||`.`}},{key:`uri`,get:function(){return this.url[this._urlId]||``}},{key:`urlId`,get:function(){return this._urlId},set:function(e){var t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}},{key:`audioGroupId`,get:function(){return this.audioGroupIds?.[this.urlId]}},{key:`textGroupId`,get:function(){return this.textGroupIds?.[this.urlId]}}]),e})();function Ut(e,t){var n=t.startPTS;if(b(n)){var r,i=0;t.sn>e.sn?(i=n-e.start,r=e):(i=e.start-n,r=t),r.duration!==i&&(r.duration=i)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function Wt(e,t,n,r,i,a){r-n<=0&&(k.warn(`Fragment should have a positive duration`,t),r=n+t.duration,a=i+t.duration);var o=n,s=r,c=t.startPTS,l=t.endPTS;if(b(c)){var u=Math.abs(c-n);b(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,o=Math.max(n,c),n=Math.min(n,c),i=Math.min(i,t.startDTS),s=Math.min(r,l),r=Math.max(r,l),a=Math.max(a,t.endDTS)}var d=n-t.start;t.start!==0&&(t.start=n),t.duration=r-t.start,t.startPTS=n,t.maxStartPTS=o,t.startDTS=i,t.endPTS=r,t.minEndPTS=s,t.endDTS=a;var f,p=t.sn;if(!e||p<e.startSN||p>e.endSN)return 0;var m=p-e.startSN,h=e.fragments;for(h[m]=t,f=m;f>0;f--)Ut(h[f],h[f-1]);for(f=m;f<h.length-1;f++)Ut(h[f],h[f+1]);return e.fragmentHint&&Ut(h[h.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Gt(e,t){for(var n=null,r=e.fragments,i=r.length-1;i>=0;i--){var a=r[i].initSegment;if(a){n=a;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var o,c,l,u,d,f=0;if((function(e,t,n){for(var r=t.skippedSegments,i=Math.max(e.startSN,t.startSN)-t.startSN,a=+!!e.fragmentHint+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,s=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i;l<=a;l++){var u=c[o+l],d=s[l];r&&!d&&l<r&&(d=t.fragments[l]=u),u&&d&&n(u,d)}})(e,t,function(e,r){e.relurl&&(f=e.cc-r.cc),b(e.startPTS)&&b(e.endPTS)&&(r.start=r.startPTS=e.startPTS,r.startDTS=e.startDTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.duration=e.endPTS-e.startPTS,r.duration&&(o=r),t.PTSKnown=t.alignedSliding=!0),r.elementaryStreams=e.elementaryStreams,r.loader=e.loader,r.stats=e.stats,r.urlId=e.urlId,e.initSegment&&(r.initSegment=e.initSegment,n=e.initSegment)}),n&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach(function(e){e.initSegment&&e.initSegment.relurl!==n?.relurl||(e.initSegment=n)}),t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some(function(e){return!e}),t.deltaUpdateFailed){k.warn(`[level-helper] Previous playlist missing segments skipped in delta playlist`);for(var p=t.skippedSegments;p--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=(c=e.dateRanges,l=t.dateRanges,u=t.recentlyRemovedDateranges,d=s({},c),u&&u.forEach(function(e){delete d[e]}),Object.keys(l).forEach(function(e){var t=new te(l[e].attr,d[e]);t.isValid?d[e]=t:k.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "`+JSON.stringify(l[e].attr)+`"`)}),d));var m=t.fragments;if(f){k.warn(`discontinuity sliding from playlist, take drift into account`);for(var h=0;h<m.length;h++)m[h].cc+=f}t.skippedSegments&&(t.startCC=t.fragments[0].cc),(function(e,t,n){if(e&&t)for(var r=0,i=0,a=e.length;i<=a;i++){var o=e[i],s=t[i+r];o&&s&&o.index===s.index&&o.fragment.sn===s.fragment.sn?n(o,s):r--}})(e.partList,t.partList,function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),o?Wt(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):Kt(e,t),m.length&&(t.totalduration=t.edge-m[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var g=t.advancedDateTime;if(t.advanced&&g){var _=t.edge;t.driftStart||=(t.driftStartTime=g,_),t.driftEndTime=g,t.driftEnd=_}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function Kt(e,t){var n=t.startSN+t.skippedSegments-e.startSN,r=e.fragments;n<0||n>=r.length||qt(t,r[n].start)}function qt(e,t){if(t){for(var n=e.fragments,r=e.skippedSegments;r<n.length;r++)n[r].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function Jt(e,t,n){return e!=null&&e.details?Yt(e.details?.partList,t,n):null}function Yt(e,t,n){if(e)for(var r=e.length;r--;){var i=e[r];if(i.index===n&&i.fragment.sn===t)return i}return null}function Xt(e){switch(e.details){case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_TIMEOUT:case C.LEVEL_LOAD_TIMEOUT:case C.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Zt(e,t){var n=Xt(t);return e.default[(n?`timeout`:`error`)+`Retry`]}function Qt(e,t){var n=e.backoff===`linear`?1:2**t;return Math.min(n*e.retryDelayMs,e.maxRetryDelayMs)}function $t(e){return t(t({},e),{errorRetry:null,timeoutRetry:null})}function en(e,t,n,r){return!!e&&t<e.maxNumRetry&&((function(e){return e===0&&!1===navigator.onLine||!!e&&(e<400||e>499)})(r)||!!n)}var tn=function(e,t){for(var n=0,r=e.length-1,i=null,a=null;n<=r;){var o=t(a=e[i=(n+r)/2|0]);if(o>0)n=i+1;else{if(!(o<0))return a;r=i-1}}return null};function nn(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=0);var i=null;if(e?i=t[e.sn-t[0].sn+1]||null:n===0&&t[0].start===0&&(i=t[0]),i&&rn(n,r,i)===0)return i;var a=tn(t,rn.bind(null,n,r));return!a||a===e&&i?i:a}function rn(e,t,n){if(e===void 0&&(e=0),t===void 0&&(t=0),n.start<=e&&n.start+n.duration>e)return 0;var r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=e?1:n.start-r>e&&n.start?-1:0}function an(e,t,n){var r=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-r>e}var on,sn=3e5,cn=0,ln=2,un=5,dn=0,fn=1,pn=2,mn=(function(){function e(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=k.log.bind(k,`[info]:`),this.warn=k.warn.bind(k,`[warning]:`),this.error=k.error.bind(k,`[error]:`),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(x.ERROR,this.onError,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(x.ERROR,this.onError,this),e.off(x.ERROR,this.onErrorOut,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this))},t.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},t.startLoad=function(e){this.playlistError=0},t.stopLoad=function(){},t.getVariantLevelIndex=function(e){return e?.type===J?e.level:this.hls.loadLevel},t.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},t.onLevelUpdated=function(){this.playlistError=0},t.onError=function(e,t){var n;if(!t.fatal){var r=this.hls,i=t.context;switch(t.details){case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case C.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap)return void(t.errorAction={action:cn,flags:dn});case C.FRAG_GAP:case C.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ln;return;case C.LEVEL_EMPTY_ERROR:case C.LEVEL_PARSING_ERROR:var a,o,s=t.parent===J?t.level:r.loadLevel;t.details===C.LEVEL_EMPTY_ERROR&&(a=t.context)!=null&&(o=a.levelDetails)!=null&&o.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,s));return;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:typeof i?.level==`number`&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.level));return;case C.AUDIO_TRACK_LOAD_ERROR:case C.AUDIO_TRACK_LOAD_TIMEOUT:case C.SUBTITLE_LOAD_ERROR:case C.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){var c=r.levels[r.loadLevel];if(c&&(i.type===vt&&i.groupId===c.audioGroupId||i.type===yt&&i.groupId===c.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=ln,void(t.errorAction.flags=fn)}return;case C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var l=r.levels[r.loadLevel]?.attrs[`HDCP-LEVEL`];l&&(t.errorAction={action:ln,flags:pn,hdcpLevel:l});return;case C.BUFFER_ADD_CODEC_ERROR:case C.REMUX_ALLOC_ERROR:t.errorAction=this.getLevelSwitchAction(t,t.level??r.loadLevel);return;case C.INTERNAL_EXCEPTION:case C.BUFFER_APPENDING_ERROR:case C.BUFFER_APPEND_ERROR:case C.BUFFER_FULL_ERROR:case C.LEVEL_SWITCH_ERROR:case C.BUFFER_STALLED_ERROR:case C.BUFFER_SEEK_OVER_HOLE:case C.BUFFER_NUDGE_ON_STALL:t.errorAction={action:cn,flags:dn};return}if(t.type===S.KEY_SYSTEM_ERROR){var u=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u);return}}},t.getPlaylistRetryOrSwitchAction=function(e,t){var n=Zt(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++,i=e.response?.code;if(en(n,r,Xt(e),i))return{action:un,flags:dn,retryConfig:n,retryCount:r};var a=this.getLevelSwitchAction(e,t);return n&&(a.retryConfig=n,a.retryCount=r),a},t.getFragRetryOrSwitchAction=function(e){var t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],i=t.config,a=i.fragLoadPolicy,o=i.keyLoadPolicy,s=Zt(e.details.startsWith(`key`)?o:a,e),c=t.levels.reduce(function(e,t){return e+t.fragmentError},0);if(r){e.details!==C.FRAG_GAP&&r.fragmentError++;var l=e.response?.code;if(en(s,c,Xt(e),l))return{action:un,flags:dn,retryConfig:s,retryCount:c}}var u=this.getLevelSwitchAction(e,n);return s&&(u.retryConfig=s,u.retryCount=c),u},t.getLevelSwitchAction=function(e,t){var n=this.hls;t??=n.loadLevel;var r=this.hls.levels[t];if(r&&(r.loadError++,n.autoLevelEnabled)){for(var i=-1,a=n.levels,o=n.loadLevel,s=n.minAutoLevel,c=n.maxAutoLevel,l=e.frag?.type,u=e.context??{},d=u.type,f=u.groupId,p=a.length;p--;){var m=(p+o)%a.length;if(m!==o&&m>=s&&m<=c&&a[m].loadError===0){var h=a[m];if(e.details===C.FRAG_GAP&&e.frag){var g=a[m].details;if(g){var _=nn(e.frag,g.fragments,e.frag.start);if(_!=null&&_.gap)continue}}else if(d===vt&&f===h.audioGroupId||d===yt&&f===h.textGroupId||l===bt&&r.audioGroupId===h.audioGroupId||l===xt&&r.textGroupId===h.textGroupId)continue;i=m;break}}if(i>-1&&n.loadLevel!==i)return e.levelRetry=!0,this.playlistError=0,{action:ln,flags:dn,nextAutoLevel:i}}return{action:ln,flags:fn}},t.onErrorOut=function(e,t){switch(t.errorAction?.action){case cn:break;case ln:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===C.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()},t.sendAlternateToPenaltyBox=function(e){var t=this.hls,n=e.errorAction;if(n){var r=n.flags,i=n.hdcpLevel,a=n.nextAutoLevel;switch(r){case dn:this.switchLevel(e,a);break;case fn:n.resolved||=this.redundantFailover(e);break;case pn:i&&(t.maxHdcpLevel=Lt[Lt.indexOf(i)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "`+t.maxHdcpLevel+`" or lower`)}n.resolved||this.switchLevel(e,a)}},t.switchLevel=function(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level `+t+` after `+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},t.redundantFailover=function(e){var t=this,n=this.hls,r=this.penalizedRenditions,i=e.parent===J?e.level:n.loadLevel,a=n.levels[i],o=a.url.length,s=e.frag?e.frag.urlId:a.urlId;a.urlId!==s||e.frag&&!a.details||this.penalizeRendition(a,e);for(var c=function(){var c=(s+l)%o,u=r[c];if(!u||(function(e,t,n){if(performance.now()-e.lastErrorPerfMs>sn)return!0;var r=e.details;if(t.details===C.FRAG_GAP&&r&&t.frag){var i=t.frag.start,a=nn(null,r.fragments,i);if(a&&!a.gap)return!0}if(n&&e.errors.length<n.errors.length){var o=e.errors[e.errors.length-1];if(r&&o.frag&&t.frag&&Math.abs(o.frag.start-t.frag.start)>3*r.targetduration)return!0}return!1})(u,e,r[s]))return t.warn(`Switching to Redundant Stream `+(c+1)+`/`+o+`: "`+a.url[c]+`" after `+e.details),t.playlistError=0,n.levels.forEach(function(e){e.urlId=c}),n.nextLoadLevel=i,{v:!0}},l=1;l<o;l++){var u=c();if(typeof u==`object`)return u.v}return!1},t.penalizeRendition=function(e,t){var n=this.penalizedRenditions,r=n[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,n[e.urlId]=r},e})(),hn=(function(){function e(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=k.log.bind(k,t+`:`),this.warn=k.warn.bind(k,t+`:`),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},t.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var n=t?.renditionReports;if(n){for(var r=-1,i=0;i<n.length;i++){var a=n[i],o=void 0;try{o=new self.URL(a.URI,t.url).href}catch(e){k.warn(`Could not construct new URL for Rendition Report: `+e),o=a.URI||``}if(o===e){r=i;break}o===e.substring(0,o.length)&&(r=i)}if(r!==-1){var s=n[r],c=parseInt(s[`LAST-MSN`])||t?.lastPartSn,l=parseInt(s[`LAST-PART`])||t?.lastPartIndex;if(this.hls.config.lowLatencyMode){var u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}return new Vt(c,l>=0?l:void 0,Rt)}}},t.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},t.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},t.shouldReloadPlaylist=function(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)},t.playlistLoaded=function(e,t,n){var r=this,i=t.details,a=t.stats,o=self.performance.now(),s=a.loading.first?Math.max(0,o-a.loading.first):0;if(i.advancedDateTime=Date.now()-s,i.live||n!=null&&n.live){if(i.reloaded(n),n&&this.log(`live playlist `+e+` `+(i.advanced?`REFRESHED `+i.lastPartSn+`-`+i.lastPartIndex:i.updated?`UPDATED`:`MISSED`)),n&&i.fragments.length>0&&Gt(n,i),!this.canLoad||!i.live)return;var c,l=void 0,u=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var d=this.hls.config.lowLatencyMode,f=i.lastPartSn,p=i.endSN,m=i.lastPartIndex,h=f===p;m===-1?l=p+1:(l=h?p+1:f,u=h?d?0:m:m+1);var g=i.age,_=g+i.ageHeader,v=Math.min(_-i.partTarget,1.5*i.targetduration);if(v>0){if(n&&v>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: `+n.tuneInGoal+` to: `+v+` with playlist age: `+i.age),v=0;else{var y=Math.floor(v/i.targetduration);l+=y,u!==void 0&&(u+=Math.round(v%i.targetduration/i.partTarget)),this.log(`CDN Tune-in age: `+i.ageHeader+`s last advanced `+g.toFixed(2)+`s goal: `+v+` skip sn `+y+` to part `+u)}i.tuneInGoal=v}if(c=this.getDeliveryDirectives(i,t.deliveryDirectives,l,u),d||!h)return void this.loadPlaylist(c)}else(i.canBlockReload||i.canSkipUntil)&&(c=this.getDeliveryDirectives(i,t.deliveryDirectives,l,u));var b=this.hls.mainForwardBufferInfo,x=b?b.end-b.len:0,S=(function(e,t){t===void 0&&(t=1/0);var n=1e3*e.targetduration;if(e.updated){var r=e.fragments;if(r.length&&4*n>t){var i=1e3*r[r.length-1].duration;i<n&&(n=i)}}else n/=2;return Math.round(n)})(i,1e3*(i.edge-x));i.updated&&o>this.requestScheduled+S&&(this.requestScheduled=a.loading.start),l!==void 0&&i.canBlockReload?this.requestScheduled=a.loading.first+S-(1e3*i.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+S<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=S);var C=this.requestScheduled-o;C=Math.max(0,C),this.log(`reload live playlist `+e+` in `+Math.round(C)+` ms`),this.timer=self.setTimeout(function(){return r.loadPlaylist(c)},C)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,n,r){var i=(function(e,t){var n=e.canSkipUntil,r=e.canSkipDateRanges,i=e.endSN;return n&&(t===void 0?0:t-i)<n?r?Bt:zt:Rt})(e,n);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,i=Rt),new Vt(n,r,i)},t.checkRetry=function(e){var t=this,n=e.details,r=Xt(e),i=e.errorAction,a=i||{},o=a.action,s=a.retryCount,c=s===void 0?0:s,l=a.retryConfig,u=!!i&&!!l&&(o===un||!i.resolved&&o===ln);if(u){var d;if(this.requestScheduled=-1,c>=l.maxNumRetry)return!1;if(r&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading `+(c+1)+`/`+l.maxNumRetry+` after "`+n+`" without delivery-directives`),this.loadPlaylist();else{var f=Qt(l,c);this.timer=self.setTimeout(function(){return t.loadPlaylist()},f),this.warn(`Retrying playlist loading `+(c+1)+`/`+l.maxNumRetry+` after "`+n+`" in `+f+`ms`)}e.levelRetry=!0,i.resolved=!0}return u},e})(),gn=(function(e){function t(t,n){var r;return(r=e.call(this,t,`[level-controller]`)||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=n,r._registerListeners(),r}c(t,e);var n=t.prototype;return n._registerListeners=function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this),e.on(x.ERROR,this.onError,this)},n._unregisterListeners=function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this),e.off(x.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},n.startLoad=function(){this._levels.forEach(function(e){e.loadError=0,e.fragmentError=0}),e.prototype.startLoad.call(this)},n.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},n.onManifestLoading=function(e,t){this.resetLevels()},n.onManifestLoaded=function(e,t){var n,r=[],i={};t.levels.forEach(function(e){var t=e.attrs;e.audioCodec?.indexOf(`mp4a.40.34`)!==-1&&(on||=/chrome|firefox/i.test(navigator.userAgent),on&&(e.audioCodec=void 0));var a=t.AUDIO,o=t.CODECS,s=t[`FRAME-RATE`],c=t[`PATHWAY-ID`],l=t.RESOLUTION,u=t.SUBTITLES,d=(c||`.`)+`-`+e.bitrate+`-`+l+`-`+s+`-`+o;(n=i[d])?n.addFallback(e):(n=new Ht(e),i[d]=n,r.push(n)),_n(n,`audio`,a),_n(n,`text`,u)}),this.filterAndSortMediaOptions(r,t)},n.filterAndSortMediaOptions=function(e,t){var n=this,r=[],i=[],a=!1,o=!1,s=!1,c=e.filter(function(e){var t=e.audioCodec,n=e.videoCodec,r=e.width,i=e.height,c=e.unknownCodecs;return a||=!(!r||!i),o||=!!n,s||=!!t,!(c!=null&&c.length)&&(!t||nt(t,`audio`))&&(!n||nt(n,`video`))});if((a||o)&&s&&(c=c.filter(function(e){var t=e.videoCodec,n=e.width,r=e.height;return!!t||!(!n||!r)})),c.length!==0){t.audioTracks&&vn(r=t.audioTracks.filter(function(e){return!e.audioCodec||nt(e.audioCodec,`audio`)})),t.subtitles&&vn(i=t.subtitles);var l=c.slice(0);c.sort(function(e,t){return e.attrs[`HDCP-LEVEL`]===t.attrs[`HDCP-LEVEL`]?e.bitrate===t.bitrate?e.attrs[`FRAME-RATE`]===t.attrs[`FRAME-RATE`]?e.attrs.SCORE===t.attrs.SCORE?a&&e.height!==t.height?e.height-t.height:0:e.attrs.decimalFloatingPoint(`SCORE`)-t.attrs.decimalFloatingPoint(`SCORE`):e.attrs.decimalFloatingPoint(`FRAME-RATE`)-t.attrs.decimalFloatingPoint(`FRAME-RATE`):e.bitrate-t.bitrate:(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1});var u=l[0];if(this.steering&&(c=this.steering.filterParsedLevels(c)).length!==l.length){for(var d=0;d<l.length;d++)if(l[d].pathwayId===c[0].pathwayId){u=l[d];break}}this._levels=c;for(var f=0;f<c.length;f++)if(c[f]===u){this._firstLevel=f,this.log(`manifest loaded, `+c.length+` level(s) found, first bitrate: `+u.bitrate);break}var p=s&&!o,m={levels:c,audioTracks:r,subtitleTracks:i,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:o,altAudio:!p&&r.some(function(e){return!!e.url})};this.hls.trigger(x.MANIFEST_PARSED,m),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(n.hls){var e=Error(`no level with compatible codecs found in manifest`);n.hls.trigger(x.ERROR,{type:S.MEDIA_ERROR,details:C.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}})},n.onError=function(e,t){!t.fatal&&t.context&&t.context.type===_t&&t.context.level===this.level&&this.checkRetry(t)},n.onFragLoaded=function(e,t){var n=t.frag;if(n!==void 0&&n.type===J){var r=this._levels[n.level];r!==void 0&&(r.loadError=0)}},n.onLevelLoaded=function(e,t){var n,r,i=t.level,a=t.details,o=this._levels[i];if(!o)return this.warn(`Invalid level index `+i),void((r=t.deliveryDirectives)!=null&&r.skip&&(a.deltaUpdateFailed=!0));i===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(i,t,o.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(a.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(e,t){var n=this.currentLevel;if(n){var r=this.hls.audioTracks[t.id].groupId;if(n.audioGroupIds&&n.audioGroupId!==r){for(var i=-1,a=0;a<n.audioGroupIds.length;a++)if(n.audioGroupIds[a]===r){i=a;break}i!==-1&&i!==n.urlId&&(n.urlId=i,this.canLoad&&this.startLoad())}}},n.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var n=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){var i=r.urlId,a=r.uri;if(t)try{a=t.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: `+e)}var o=r.attrs[`PATHWAY-ID`];this.log(`Loading level index `+n+(t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part)+` with`+(o?` Pathway `+o:``)+` URI `+(i+1)+`/`+r.url.length+` `+a),this.clearTimer(),this.hls.trigger(x.LEVEL_LOADING,{url:a,level:n,id:i,deliveryDirectives:t||null})}},n.removeLevel=function(e,t){var n=this,r=function(e,n){return n!==t},i=this._levels.filter(function(i,a){return a!==e||(i.url.length>1&&t!==void 0?(i.url=i.url.filter(r),i.audioGroupIds&&=i.audioGroupIds.filter(r),i.textGroupIds&&=i.textGroupIds.filter(r),i.urlId=0,!0):(n.steering&&n.steering.removeLevel(i),!1))});this.hls.trigger(x.LEVELS_UPDATED,{levels:i})},n.onLevelsUpdated=function(e,t){var n=t.levels;n.forEach(function(e,t){var n=e.details;n!=null&&n.fragments&&n.fragments.forEach(function(e){e.level=t})}),this._levels=n},a(t,[{key:`levels`,get:function(){return this._levels.length===0?null:this._levels}},{key:`level`,get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(t.length!==0){if(e<0||e>=t.length){var n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(x.ERROR,{type:S.OTHER_ERROR,details:C.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}var i=this.currentLevelIndex,a=this.currentLevel,o=a?a.attrs[`PATHWAY-ID`]:void 0,c=t[e],l=c.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=c,i!==e||!c.details||!a||o!==l){this.log(`Switching to level `+e+(l?` with Pathway `+l:``)+` from level `+i+(o?` with Pathway `+o:``));var u=s({},c,{level:e,maxBitrate:c.maxBitrate,attrs:c.attrs,uri:c.uri,urlId:c.urlId});delete u._attrs,delete u._urlId,this.hls.trigger(x.LEVEL_SWITCHING,u);var d=c.details;if(!d||d.live){var f=this.switchParams(c.uri,a?.details);this.loadPlaylist(f)}}}}},{key:`manualLevel`,get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:`firstLevel`,get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:`startLevel`,get:function(){if(this._startLevel===void 0){var e=this.hls.config.startLevel;return e===void 0?this._firstLevel:e}return this._startLevel},set:function(e){this._startLevel=e}},{key:`nextLoadLevel`,get:function(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex},set:function(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}}]),t})(hn);function _n(e,t,n){n&&(t===`audio`?(e.audioGroupIds||=[],e.audioGroupIds[e.url.length-1]=n):t===`text`&&(e.textGroupIds||=[],e.textGroupIds[e.url.length-1]=n))}function vn(e){var t={};e.forEach(function(e){var n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}var yn=`NOT_LOADED`,bn=`APPENDING`,xn=`PARTIAL`,Sn=`OK`,Cn=(function(){function e(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(x.BUFFER_APPENDED,this.onBufferAppended,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(x.BUFFER_APPENDED,this.onBufferAppended,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){var n=this.activePartLists[t];if(n)for(var r=n.length;r--;){var i=n[r];if(!i)break;var a=i.end;if(i.start<=e&&a!==null&&e<=a)return i}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var n=this.fragments,r=Object.keys(n),i=r.length;i--;){var a=n[r[i]];if(a?.body.type===t&&a.buffered){var o=a.body;if(o.start<=e&&e<=o.end)return o}}return null},t.detectEvictedFragments=function(e,t,n,r){var i=this;this.timeRanges&&(this.timeRanges[e]=t);var a=r?.fragment.sn||-1;Object.keys(this.fragments).forEach(function(r){var o=i.fragments[r];if(o&&!(a>=o.body.sn))if(o.buffered||o.loaded){var s=o.range[e];s&&s.time.some(function(e){var n=!i.isTimeBuffered(e.startPTS,e.endPTS,t);return n&&i.removeFragment(o.body),n})}else o.body.type===n&&i.removeFragment(o.body)})},t.detectPartialFragments=function(e){var t=this,n=this.timeRanges,r=e.frag,i=e.part;if(n&&r.sn!==`initSegment`){var a=Tn(r),o=this.fragments[a];if(!(!o||o.buffered&&r.gap)){var s=!r.relurl;Object.keys(n).forEach(function(e){var a=r.elementaryStreams[e];if(a){var c=n[e],l=s||!0===a.partial;o.range[e]=t.getBufferedTimes(r,i,l,c)}}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=r.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),wn(o)||this.removeParts(r.sn-1,r.type)):this.removeFragment(o.body)}}},t.removeParts=function(e,t){var n=this.activePartLists[t];n&&(this.activePartLists[t]=n.filter(function(t){return t.fragment.sn>=e}))},t.fragBuffered=function(e,t){var n=Tn(e),r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)},t.getBufferedTimes=function(e,t,n,r){for(var i={time:[],partial:n},a=e.start,o=e.end,s=e.minEndPTS||o,c=e.maxStartPTS||a,l=0;l<r.length;l++){var u=r.start(l)-this.bufferPadding,d=r.end(l)+this.bufferPadding;if(c>=u&&s<=d){i.time.push({startPTS:Math.max(a,r.start(l)),endPTS:Math.min(o,r.end(l))});break}if(a<d&&o>u)i.partial=!0,i.time.push({startPTS:Math.max(a,r.start(l)),endPTS:Math.min(o,r.end(l))});else if(o<=u)break}return i},t.getPartialFragment=function(e){var t,n,r,i=null,a=0,o=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(c){var l=s[c];l&&wn(l)&&(n=l.body.start-o,r=l.body.end+o,e>=n&&e<=r&&(t=Math.min(e-n,r-e),a<=t&&(i=l.body,a=t)))}),i},t.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||wn(t))},t.getState=function(e){var t=Tn(e),n=this.fragments[t];return n?n.buffered?wn(n)?xn:Sn:bn:yn},t.isTimeBuffered=function(e,t,n){for(var r,i,a=0;a<n.length;a++){if(r=n.start(a)-this.bufferPadding,i=n.end(a)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1},t.onFragLoaded=function(e,t){var n=t.frag,r=t.part;if(n.sn!==`initSegment`&&!n.bitrateTest){var i=r?null:t,a=Tn(n);this.fragments[a]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var n=this,r=t.frag,i=t.part,a=t.timeRanges;if(r.sn!==`initSegment`){var o=r.type;if(i){var s=this.activePartLists[o];s||(this.activePartLists[o]=s=[]),s.push(i)}this.timeRanges=a,Object.keys(a).forEach(function(e){var t=a[e];n.detectEvictedFragments(e,t,o,i)})}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=Tn(e);return!!this.fragments[t]},t.hasParts=function(e){var t;return!((t=this.activePartLists[e])==null||!t.length)},t.removeFragmentsInRange=function(e,t,n,r,i){var a=this;r&&!this.hasGaps||Object.keys(this.fragments).forEach(function(o){var s=a.fragments[o];if(s){var c=s.body;c.type!==n||r&&!c.gap||c.start<t&&c.end>e&&(s.buffered||i)&&a.removeFragment(c)}})},t.removeFragment=function(e){var t=Tn(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var n=this.activePartLists[e.type];if(n){var r=e.sn;this.activePartLists[e.type]=n.filter(function(e){return e.fragment.sn!==r})}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},e})();function wn(e){return e.buffered&&(e.body.gap||e.range.video?.partial||e.range.audio?.partial||e.range.audiovideo?.partial)}function Tn(e){return e.type+`_`+e.level+`_`+e.urlId+`_`+e.sn}var En=2**17,Dn=(function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var n=e.prototype;return n.destroy=function(){this.loader&&=(this.loader.destroy(),null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(e,n){var r=this,i=e.url;if(!i)return Promise.reject(new An({type:S.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error(`Fragment does not have a `+(i?`part list`:`url`)),networkDetails:null}));this.abort();var a=this.config,o=a.fLoader,s=a.loader;return new Promise(function(c,l){if(r.loader&&r.loader.destroy(),e.gap){if(e.tagList.some(function(e){return e[0]===`GAP`}))return void l(kn(e));e.gap=!1}var u=r.loader=e.loader=o?new o(a):new s(a),d=On(e),f=$t(a.fragLoadPolicy.default),p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn===`initSegment`?1/0:En};e.stats=u.stats,u.load(d,p,{onSuccess:function(t,n,i,a){r.resetLoader(e,u);var o=t.data;i.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),c({frag:e,part:null,payload:o,networkDetails:a})},onError:function(n,a,o,s){r.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t({url:i,data:void 0},n),error:Error(`HTTP Error `+n.code+` `+n.text),networkDetails:o,stats:s}))},onAbort:function(t,n,i){r.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error(`Aborted`),networkDetails:i,stats:t}))},onTimeout:function(t,n,i){r.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error(`Timeout after `+p.timeout+`ms`),networkDetails:i,stats:t}))},onProgress:function(t,r,i,a){n&&n({frag:e,part:null,payload:i,networkDetails:a})}})})},n.loadPart=function(e,n,r){var i=this;this.abort();var a=this.config,o=a.fLoader,s=a.loader;return new Promise(function(c,l){if(i.loader&&i.loader.destroy(),e.gap||n.gap)l(kn(e,n));else{var u=i.loader=e.loader=o?new o(a):new s(a),d=On(e,n),f=$t(a.fragLoadPolicy.default),p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:En};n.stats=u.stats,u.load(d,p,{onSuccess:function(t,a,o,s){i.resetLoader(e,u),i.updateStatsFromPart(e,n);var l={frag:e,part:n,payload:t.data,networkDetails:s};r(l),c(l)},onError:function(r,a,o,s){i.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:n,response:t({url:d.url,data:void 0},r),error:Error(`HTTP Error `+r.code+` `+r.text),networkDetails:o,stats:s}))},onAbort:function(t,r,a){e.stats.aborted=n.stats.aborted,i.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,part:n,error:Error(`Aborted`),networkDetails:a,stats:t}))},onTimeout:function(t,r,a){i.resetLoader(e,u),l(new An({type:S.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:n,error:Error(`Timeout after `+p.timeout+`ms`),networkDetails:a,stats:t}))}})}})},n.updateStatsFromPart=function(e,t){var n=e.stats,r=t.stats,i=r.total;if(n.loaded+=r.loaded,i){var a=Math.round(e.duration/t.duration),o=Math.min(Math.round(n.loaded/i),a),s=(a-o)*Math.round(n.loaded/o);n.total=n.loaded+s}else n.total=Math.max(n.loaded,n.total);var c=n.loading,l=r.loading;c.start?c.first+=l.first-l.start:(c.start=l.start,c.first=l.first),c.end=l.end},n.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e})();function On(e,t){t===void 0&&(t=null);var n=t||e,r={frag:e,part:t,responseType:`arraybuffer`,url:n.url,headers:{},rangeStart:0,rangeEnd:0},i=n.byteRangeStartOffset,a=n.byteRangeEndOffset;if(b(i)&&b(a)){var o=i,s=a;if(e.sn===`initSegment`&&e.decryptdata?.method===`AES-128`){var c=a-i;c%16&&(s=a+(16-c%16)),i!==0&&(r.resetIV=!0,o=i-16)}r.rangeStart=o,r.rangeEnd=s}return r}function kn(e,t){var n=Error(`GAP `+(e.gap?`tag`:`attribute`)+` found`),r={type:S.MEDIA_ERROR,details:C.FRAG_GAP,fatal:!1,frag:e,error:n,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new An(r)}var An=(function(e){function t(t){var n;return(n=e.call(this,t.error.message)||this).data=void 0,n.data=t,n}return c(t,e),t})(p(Error)),jn=(function(){function e(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var n=e.prototype;return n.abort=function(e){for(var t in this.keyUriToKeyInfo){var n=this.keyUriToKeyInfo[t].loader;if(n){if(e&&e!==n.context.frag.type)return;n.abort()}}},n.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},n.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},n.createKeyLoadError=function(e,t,n,r,i){return t===void 0&&(t=C.KEY_LOAD_ERROR),new An({type:S.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})},n.loadClear=function(e,t){var n=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,i=e.cc,a=function(){var e=t[o];if(i<=e.cc&&(r===`initSegment`||e.sn===`initSegment`||r<e.sn))return n.emeController.selectKeySystemFormat(e).then(function(t){e.setKeyFormat(t)}),`break`},o=0;o<t.length&&a()!==`break`;o++);},n.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(n){return t.loadInternal(e,n)}):this.loadInternal(e)},n.loadInternal=function(e,t){var n,r;t&&e.setKeyFormat(t);var i=e.decryptdata;if(!i){var a=Error(t?`Expected frag.decryptdata to be defined after setting format `+t:`Missing decryption data on fragment in onKeyLoading`);return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,a))}var o=i.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,Error(`Invalid key URI: "`+o+`"`)));var s=this.keyUriToKeyInfo[o];if((n=s)!=null&&n.decryptdata.key)return i.key=s.decryptdata.key,Promise.resolve({frag:e,keyInfo:s});if((r=s)!=null&&r.keyLoadPromise)switch(s.mediaKeySessionContext?.keyStatus){case void 0:case`status-pending`:case`usable`:case`usable-in-future`:return s.keyLoadPromise.then(function(t){return i.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:s}})}switch(s=this.keyUriToKeyInfo[o]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case`ISO-23001-7`:case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return i.keyFormat===`identity`?this.loadKeyHTTP(s,e):this.loadKeyEME(s,e);case`AES-128`:return this.loadKeyHTTP(s,e);default:return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "`+i.method+`"`)))}},n.loadKeyEME=function(e,t){var n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r=this.emeController.loadKey(n);if(r)return(e.keyLoadPromise=r.then(function(t){return e.mediaKeySessionContext=t,n})).catch(function(t){throw e.keyLoadPromise=null,t})}return Promise.resolve(n)},n.loadKeyHTTP=function(e,n){var r=this,i=this.config,a=new i.loader(i);return n.keyLoader=e.loader=a,e.keyLoadPromise=new Promise(function(o,s){var c={keyInfo:e,frag:n,responseType:`arraybuffer`,url:e.decryptdata.uri},l=i.keyLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};a.load(c,u,{onSuccess:function(e,t,n,i){var a=n.frag,c=n.keyInfo,l=n.url;if(!a.decryptdata||c!==r.keyUriToKeyInfo[l])return s(r.createKeyLoadError(a,C.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),i));c.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,c.loader=null,o({frag:a,keyInfo:c})},onError:function(e,i,a,o){r.resetLoader(i),s(r.createKeyLoadError(n,C.KEY_LOAD_ERROR,Error(`HTTP Error `+e.code+` loading key `+e.text),a,t({url:c.url,data:void 0},e)))},onTimeout:function(e,t,i){r.resetLoader(t),s(r.createKeyLoadError(n,C.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),i))},onAbort:function(e,t,i){r.resetLoader(t),s(r.createKeyLoadError(n,C.INTERNAL_ABORTED,Error(`key loading aborted`),i))}})})},n.resetLoader=function(e){var t=e.frag,n=e.keyInfo,r=e.url,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[r],i&&i.destroy()},e})(),Mn=(function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},t.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},t.doTick=function(){},e})(),Nn={length:0,start:function(){return 0},end:function(){return 0}},Y=(function(){function e(){}return e.isBuffered=function(t,n){try{if(t){for(var r=e.getBuffered(t),i=0;i<r.length;i++)if(n>=r.start(i)&&n<=r.end(i))return!0}}catch{}return!1},e.bufferInfo=function(t,n,r){try{if(t){var i,a=e.getBuffered(t),o=[];for(i=0;i<a.length;i++)o.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(o,n,r)}}catch{}return{len:0,start:n,end:n,nextStart:void 0}},e.bufferedInfo=function(e,t,n){t=Math.max(0,t),e.sort(function(e,t){return e.start-t.start||t.end-e.end});var r=[];if(n)for(var i=0;i<e.length;i++){var a=r.length;if(a){var o=r[a-1].end;e[i].start-o<n?e[i].end>o&&(r[a-1].end=e[i].end):r.push(e[i])}else r.push(e[i])}else r=e;for(var s,c=0,l=t,u=t,d=0;d<r.length;d++){var f=r[d].start,p=r[d].end;if(t+n>=f&&t<p)l=f,c=(u=p)-t;else if(t+n<f){s=f;break}}return{len:c,start:l||0,end:u||0,nextStart:s}},e.getBuffered=function(e){try{return e.buffered}catch(e){return k.log(`failed to get media.buffered`,e),Nn}},e})(),Pn=function(e,t,n,r,i,a){r===void 0&&(r=0),i===void 0&&(i=-1),a===void 0&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=i,this.partial=a};function Fn(e,t){for(var n=null,r=0,i=e.length;r<i;r++){var a=e[r];if(a&&a.cc===t){n=a;break}}return n}function In(e,t){if(e){var n=e.start+t;e.start=e.startPTS=n,e.endPTS=n+e.duration}}function Ln(e,t){for(var n=t.fragments,r=0,i=n.length;r<i;r++)In(n[r],e);t.fragmentHint&&In(t.fragmentHint,e),t.alignedSliding=!0}function Rn(e,t,n){t&&((function(e,t,n){if((function(e,t,n){return!(!t.details||!(n.endCC>n.startCC||e&&e.cc<n.startCC))})(e,n,t)){var r=(function(e,t,n){var r=e.fragments,i=t.fragments;if(i.length&&r.length){var a=Fn(r,i[0].cc);if(a&&(!a||a.startPTS))return a;k.log(`No frag in previous level to align on`)}else k.log(`No fragments to align`)})(n.details,t);r&&b(r.start)&&(k.log(`Adjusting PTS using last level due to CC increase within current level `+t.url),Ln(r.start,t))}})(e,n,t),!n.alignedSliding&&t.details&&(function(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var n=t.fragments[0].programDateTime,r=e.fragments[0].programDateTime,i=(r-n)/1e3+t.fragments[0].start;i&&b(i)&&(k.log(`Adjusting PTS using programDateTime delta `+(r-n)+`ms, sliding:`+i.toFixed(3)+` `+e.url+` `),Ln(i,e))}})(n,t.details),n.alignedSliding||!t.details||n.skippedSegments||Kt(t.details,n))}function zn(e,t){if(e.hasProgramDateTime&&t.hasProgramDateTime){var n=e.fragments,r=t.fragments;if(n.length&&r.length){var i=r[Math.round(r.length/2)-1],a=Fn(n,i.cc)||n[Math.round(n.length/2)-1],o=i.programDateTime,s=a.programDateTime;o!==null&&s!==null&&Ln((s-o)/1e3-(a.start-i.start),e)}}}var Bn=(function(){function e(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:`AES-CBC`,iv:this.aesIV},t,e)},e})(),Vn=(function(){function e(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey(`raw`,this.key,{name:`AES-CBC`},!1,[`encrypt`,`decrypt`])},e})(),Hn=(function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array,this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),n=new Uint32Array(4),r=0;r<4;r++)n[r]=t.getUint32(4*r);return n},t.initTable=function(){var e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],a=n[2],o=n[3],s=this.invSubMix,c=s[0],l=s[1],u=s[2],d=s[3],f=new Uint32Array(256),p=0,m=0,h=0;for(h=0;h<256;h++)f[h]=h<128?h<<1:h<<1^283;for(h=0;h<256;h++){var g=m^m<<1^m<<2^m<<3^m<<4;g=g>>>8^255&g^99,e[p]=g,t[g]=p;var _=f[p],v=f[_],y=f[v],b=257*f[g]^16843008*g;r[p]=b<<24|b>>>8,i[p]=b<<16|b>>>16,a[p]=b<<8|b>>>24,o[p]=b,b=16843009*y^65537*v^257*_^16843008*p,c[g]=b<<24|b>>>8,l[g]=b<<16|b>>>16,u[g]=b<<8|b>>>24,d[g]=b,p?(p=_^f[f[f[y^_]]],m^=f[f[m]]):p=m=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),n=!0,r=0;r<t.length&&n;)n=t[r]===this.key[r],r++;if(!n){this.key=t;var i=this.keySize=t.length;if(i!==4&&i!==6&&i!==8)throw Error(`Invalid aes key size=`+i);var a,o,s,c,l=this.ksRows=4*(i+6+1),u=this.keySchedule=new Uint32Array(l),d=this.invKeySchedule=new Uint32Array(l),f=this.sBox,p=this.rcon,m=this.invSubMix,h=m[0],g=m[1],_=m[2],v=m[3];for(a=0;a<l;a++)a<i?s=u[a]=t[a]:(c=s,a%i==0?(c=f[(c=c<<8|c>>>24)>>>24]<<24|f[c>>>16&255]<<16|f[c>>>8&255]<<8|f[255&c],c^=p[a/i|0]<<24):i>6&&a%i==4&&(c=f[c>>>24]<<24|f[c>>>16&255]<<16|f[c>>>8&255]<<8|f[255&c]),u[a]=s=(u[a-i]^c)>>>0);for(o=0;o<l;o++)a=l-o,c=3&o?u[a]:u[a-4],d[o]=o<4||a<=4?c:h[f[c>>>24]]^g[f[c>>>16&255]]^_[f[c>>>8&255]]^v[f[255&c]],d[o]=d[o]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,n){for(var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this.keySize+6,v=this.invKeySchedule,y=this.invSBox,b=this.invSubMix,x=b[0],S=b[1],C=b[2],w=b[3],T=this.uint8ArrayToUint32Array_(n),E=T[0],D=T[1],O=T[2],k=T[3],A=new Int32Array(e),j=new Int32Array(A.length),M=this.networkToHostOrderSwap;t<A.length;){for(d=M(A[t]),f=M(A[t+1]),p=M(A[t+2]),m=M(A[t+3]),s=d^v[0],c=m^v[1],l=p^v[2],u=f^v[3],h=4,g=1;g<_;g++)r=x[s>>>24]^S[c>>16&255]^C[l>>8&255]^w[255&u]^v[h],i=x[c>>>24]^S[l>>16&255]^C[u>>8&255]^w[255&s]^v[h+1],a=x[l>>>24]^S[u>>16&255]^C[s>>8&255]^w[255&c]^v[h+2],o=x[u>>>24]^S[s>>16&255]^C[c>>8&255]^w[255&l]^v[h+3],s=r,c=i,l=a,u=o,h+=4;r=y[s>>>24]<<24^y[c>>16&255]<<16^y[l>>8&255]<<8^y[255&u]^v[h],i=y[c>>>24]<<24^y[l>>16&255]<<16^y[u>>8&255]<<8^y[255&s]^v[h+1],a=y[l>>>24]<<24^y[u>>16&255]<<16^y[s>>8&255]<<8^y[255&c]^v[h+2],o=y[u>>>24]<<24^y[s>>16&255]<<16^y[c>>8&255]<<8^y[255&l]^v[h+3],j[t]=M(r^E),j[t+1]=M(o^D),j[t+2]=M(a^O),j[t+3]=M(i^k),E=d,D=f,O=p,k=m,t+=4}return j.buffer},e})(),Un=(function(){function e(e,t){var n=(t===void 0?{}:t).removePKCS7Padding,r=n===void 0||n;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=r,r)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var t=e.prototype;return t.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},t.isSync=function(){return this.useSoftware},t.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var n,r,i,a=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(r=(n=a).byteLength,(i=r&&new DataView(n.buffer).getUint8(r-1))?me(n,0,r-i):n):a},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&=null},t.decrypt=function(e,t,n){var r=this;return this.useSoftware?new Promise(function(i,a){r.softwareDecrypt(new Uint8Array(e),t,n);var o=r.flush();o?i(o.buffer):a(Error(`[softwareDecrypt] Failed to decrypt data`))}):this.webCryptoDecrypt(new Uint8Array(e),t,n)},t.softwareDecrypt=function(e,t,n){var r=this.currentIV,i=this.currentResult,a=this.remainderData;this.logOnce(`JS AES decrypt`),a&&(e=ze(a,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;r&&(n=r);var s=this.softwareDecrypter;s||=this.softwareDecrypter=new Hn,s.expandKey(t);var c=i;return this.currentResult=s.decrypt(o.buffer,0,n),this.currentIV=me(o,-16).buffer,c||null},t.webCryptoDecrypt=function(e,t,n){var r=this,i=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Vn(i,t)),this.fastAesKey.expandKey().then(function(t){return i?(r.logOnce(`WebCrypto AES decrypt`),new Bn(i,new Uint8Array(n)).decrypt(e.buffer,t)):Promise.reject(Error(`web crypto not initialized`))}).catch(function(i){return k.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, `+i.name+`: `+i.message),r.onWebCryptoError(e,t,n)})},t.onWebCryptoError=function(e,t,n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n);var r=this.flush();if(r)return r.buffer;throw Error(`WebCrypto and softwareDecrypt: failed to decrypt data`)},t.getValidChunk=function(e){var t=e,n=e.length-e.length%16;return n!==e.length&&(t=me(e,0,n),this.remainderData=me(e,n)),t},t.logOnce=function(e){this.logEnabled&&=(k.log(`[decrypter]: `+e),!1)},e})(),Wn=function(e){for(var t=``,n=e.length,r=0;r<n;r++)t+=`[`+e.start(r).toFixed(3)+`-`+e.end(r).toFixed(3)+`]`;return t},Gn=`STOPPED`,X=`IDLE`,Kn=`KEY_LOADING`,qn=`FRAG_LOADING`,Jn=`FRAG_LOADING_WAITING_RETRY`,Yn=`WAITING_TRACK`,Xn=`PARSING`,Zn=`PARSED`,Qn=`ENDED`,$n=`ERROR`,er=`WAITING_INIT_PTS`,tr=`WAITING_LEVEL`,nr=(function(e){function t(t,n,r,i,a){var o;return(o=e.call(this)||this).hls=void 0,o.fragPrevious=null,o.fragCurrent=null,o.fragmentTracker=void 0,o.transmuxer=null,o._state=Gn,o.playlistType=void 0,o.media=null,o.mediaBuffer=null,o.config=void 0,o.bitrateTest=!1,o.lastCurrentTime=0,o.nextLoadPosition=0,o.startPosition=0,o.startTimeOffset=null,o.loadedmetadata=!1,o.retryDate=0,o.levels=null,o.fragmentLoader=void 0,o.keyLoader=void 0,o.levelLastLoaded=null,o.startFragRequested=!1,o.decrypter=void 0,o.initPTS=[],o.onvseeking=null,o.onvended=null,o.logPrefix=``,o.log=void 0,o.warn=void 0,o.playlistType=a,o.logPrefix=i,o.log=k.log.bind(k,i+`:`),o.warn=k.warn.bind(k,i+`:`),o.hls=t,o.fragmentLoader=new Dn(t.config),o.keyLoader=r,o.fragmentTracker=n,o.config=t.config,o.decrypter=new Un(t.config),t.on(x.MANIFEST_LOADED,o.onManifestLoaded,(function(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e})(o)),o}c(t,e);var n=t.prototype;return n.doTick=function(){this.onTickEnd()},n.onTickEnd=function(){},n.startLoad=function(e){},n.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Gn},n._streamEnded=function(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;var n=t.partList;if(n!=null&&n.length){var r=n[n.length-1];return Y.isBuffered(this.media,r.start+r.duration/2)}var i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)},n.getLevelDetails=function(){if(this.levels&&this.levelLastLoaded!==null)return this.levels[this.levelLastLoaded]?.details},n.onMediaAttached=function(e,t){var n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener(`seeking`,this.onvseeking),n.addEventListener(`ended`,this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.state===Gn&&this.startLoad(r.startPosition)},n.onMediaDetaching=function(){var e=this.media;e!=null&&e.ended&&(this.log(`MSE detaching and video ended, reset startPosition`),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener(`seeking`,this.onvseeking),e.removeEventListener(`ended`,this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},n.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,n=this.media,r=this.mediaBuffer,i=this.state,a=n?n.currentTime:0,o=Y.bufferInfo(r||n,a,e.maxBufferHole);if(this.log(`media seeking to `+(b(a)?a.toFixed(3):a)+`, state: `+i),this.state===Qn)this.resetLoadingState();else if(t){var s=e.maxFragLookUpTolerance,c=t.start-s,l=t.start+t.duration+s;if(!o.len||l<o.start||c>o.end){var u=a>l;(a<c||u)&&(u&&t.loader&&(this.log(`seeking outside of buffer while fragment load in progress, cancel fragment load`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}n&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),this.loadedmetadata||o.len||(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()},n.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},n.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]},n.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},n.onHandlerDestroyed=function(){this.state=Gn,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},n.loadFragment=function(e,t,n){this._loadFragForPlayback(e,t,n)},n._loadFragForPlayback=function(e,t,n){var r=this;this._doFragLoad(e,t,n,function(t){if(r.fragContextChanged(e))return r.warn(`Fragment `+e.sn+(t.part?` p: `+t.part.index:``)+` of level `+e.level+` was dropped during download.`),void r.fragmentTracker.removeFragment(e);e.stats.chunkCount++,r._handleFragmentLoadProgress(t)}).then(function(t){if(t){var n=r.state;r.fragContextChanged(e)?(n===qn||!r.fragCurrent&&n===Xn)&&(r.fragmentTracker.removeFragment(e),r.state=X):(`payload`in t&&(r.log(`Loaded fragment `+e.sn+` of level `+e.level),r.hls.trigger(x.FRAG_LOADED,t)),r._handleFragmentLoadComplete(t))}}).catch(function(t){r.state!==Gn&&r.state!==$n&&(r.warn(t),r.resetFragmentLoading(e))})},n.clearTrackerIfNeeded=function(e){var t=this.fragmentTracker;if(t.getState(e)===bn){var n=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=Math.max(e.duration,r?r.len:this.config.maxBufferLength);this.reduceMaxBufferLength(i)&&t.removeFragment(e)}else this.mediaBuffer?.buffered.length===0?t.removeAllFragments():t.hasParts(e.type)&&(t.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),t.getState(e)===xn&&t.removeFragment(e))},n.checkLiveUpdate=function(e){if(e.updated&&!e.live){var t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)},n.flushMainBuffer=function(e,t,n){if(n===void 0&&(n=null),e-t){var r={startOffset:e,endOffset:t,type:n};this.hls.trigger(x.BUFFER_FLUSHING,r)}},n._loadInitSegment=function(e,t){var n=this;this._doFragLoad(e,t).then(function(t){if(!t||n.fragContextChanged(e)||!n.levels)throw Error(`init load aborted`);return t}).then(function(t){var r=n.hls,i=t.payload,a=e.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&a.method===`AES-128`){var o=self.performance.now();return n.decrypter.decrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).catch(function(t){throw r.trigger(x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(function(n){var i=self.performance.now();return r.trigger(x.FRAG_DECRYPTED,{frag:e,payload:n,stats:{tstart:o,tdecrypt:i}}),t.payload=n,t})}return t}).then(function(r){var i=n.fragCurrent,a=n.hls;if(!n.levels)throw Error(`init load aborted, missing levels`);var o=e.stats;n.state=X,t.fragmentError=0,e.data=new Uint8Array(r.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),r.frag===i&&a.trigger(x.FRAG_BUFFERED,{stats:o,frag:i,part:null,id:e.type}),n.tick()}).catch(function(t){n.state!==Gn&&n.state!==$n&&(n.warn(t),n.resetFragmentLoading(e))})},n.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},n.fragBufferedComplete=function(e,t){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered `+e.type+` sn: `+e.sn+(t?` part: `+t.index:``)+` of `+(this.playlistType===J?`level`:`track`)+` `+e.level+` (frag:[`+(e.startPTS??NaN).toFixed(3)+`-`+(e.endPTS??NaN).toFixed(3)+`] > buffer:`+(n?Wn(Y.getBuffered(n)):`(detached)`)+`)`),this.state=X,n&&(!this.loadedmetadata&&e.type==J&&n.buffered.length&&this.fragCurrent?.sn===this.fragPrevious?.sn&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},n.seekToStartPos=function(){},n._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var n=e.frag,r=e.part,i=e.partsLoaded,a=!i||i.length===0||i.some(function(e){return!e}),o=new Pn(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}},n._handleFragmentLoadProgress=function(e){},n._doFragLoad=function(e,t,n,r){var i,a=this;n===void 0&&(n=null);var o=t?.details;if(!this.levels||!o)throw Error(`frag load aborted, missing level`+(o?``:` detail`)+`s`);var s=null;if(!e.encrypted||(i=e.decryptdata)!=null&&i.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log(`Loading key for `+e.sn+` of [`+o.startSN+`-`+o.endSN+`], `+(this.logPrefix===`[stream-controller]`?`level`:`track`)+` `+e.level),this.state=Kn,this.fragCurrent=e,s=this.keyLoader.load(e).then(function(e){if(!a.fragContextChanged(e.frag))return a.hls.trigger(x.KEY_LOADED,e),a.state===Kn&&(a.state=X),e}),this.hls.trigger(x.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(s=Promise.reject(Error(`frag load aborted, context changed in KEY_LOADING`)))),n=Math.max(e.start,n||0),this.config.lowLatencyMode&&e.sn!==`initSegment`){var c=o.partList;if(c&&r){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);var l=this.getNextPart(c,e,n);if(l>-1){var u,d=c[l];return this.log(`Loading part sn: `+e.sn+` p: `+d.index+` cc: `+e.cc+` of playlist [`+o.startSN+`-`+o.endSN+`] parts [0-`+l+`-`+(c.length-1)+`] `+(this.logPrefix===`[stream-controller]`?`level`:`track`)+`: `+e.level+`, target: `+parseFloat(n.toFixed(3))),this.nextLoadPosition=d.start+d.duration,this.state=qn,u=s?s.then(function(n){return!n||a.fragContextChanged(n.frag)?null:a.doFragPartsLoad(e,d,t,r)}).catch(function(e){return a.handleFragLoadError(e)}):this.doFragPartsLoad(e,d,t,r).catch(function(e){return a.handleFragLoadError(e)}),this.hls.trigger(x.FRAG_LOADING,{frag:e,part:d,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING parts`)):u}if(!e.url||this.loadedEndOfParts(c,n))return Promise.resolve(null)}}this.log(`Loading fragment `+e.sn+` cc: `+e.cc+` `+(o?`of [`+o.startSN+`-`+o.endSN+`] `:``)+(this.logPrefix===`[stream-controller]`?`level`:`track`)+`: `+e.level+`, target: `+parseFloat(n.toFixed(3))),b(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=qn;var f,p=this.config.progressive;return f=p&&s?s.then(function(t){return!t||a.fragContextChanged(t?.frag)?null:a.fragmentLoader.load(e,r)}).catch(function(e){return a.handleFragLoadError(e)}):Promise.all([this.fragmentLoader.load(e,p?r:void 0),s]).then(function(e){var t=e[0];return!p&&t&&r&&r(t),t}).catch(function(e){return a.handleFragLoadError(e)}),this.hls.trigger(x.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING`)):f},n.doFragPartsLoad=function(e,t,n,r){var i=this;return new Promise(function(a,o){var s=[],c=n.details?.partList;(function t(l){i.fragmentLoader.loadPart(e,l,r).then(function(r){s[l.index]=r;var o=r.part;i.hls.trigger(x.FRAG_LOADED,r);var u=Jt(n,e.sn,l.index+1)||Yt(c,e.sn,l.index+1);if(!u)return a({frag:e,part:o,partsLoaded:s});t(u)}).catch(o)})(t)})},n.handleFragLoadError=function(e){if(`data`in e){var t=e.data;e.data&&t.details===C.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(x.ERROR,t)}else this.hls.trigger(x.ERROR,{type:S.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},n._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===Xn){var n=t.frag,r=t.part,i=t.level,a=self.performance.now();n.stats.parsing.end=a,r&&(r.stats.parsing.end=a),this.updateLevelTiming(n,r,i,e.partial)}else this.fragCurrent||this.state===Gn||this.state===$n||(this.state=X)},n.getCurrentContext=function(e){var t=this.levels,n=this.fragCurrent,r=e.level,i=e.sn,a=e.part;if(t==null||!t[r])return this.warn(`Levels object was unset while buffering fragment `+i+` of level `+r+`. The current chunk will not be buffered.`),null;var o=t[r],s=a>-1?Jt(o,i,a):null,c=s?s.fragment:(function(e,t,n){if(e==null||!e.details)return null;var r=e.details,i=r.fragments[t-r.startSN];return i||((i=r.fragmentHint)&&i.sn===t?i:t<r.startSN&&n&&n.sn===t?n:null)})(o,i,n);return c?(n&&n!==c&&(c.stats=n.stats),{frag:c,part:s,level:o}):null},n.bufferFragmentData=function(e,t,n,r,i){var a;if(e&&this.state===Xn){var o=e.data1,s=e.data2,c=o;if(o&&s&&(c=ze(o,s)),(a=c)!=null&&a.length){var l={type:e.type,frag:t,part:n,chunkMeta:r,parent:t.type,data:c};if(this.hls.trigger(x.BUFFER_APPENDING,l),e.dropped&&e.independent&&!n){if(i)return;this.flushBufferGap(t)}}}},n.flushBufferGap=function(e){var t=this.media;if(t)if(Y.isBuffered(t,t.currentTime)){var n=t.currentTime,r=Y.bufferInfo(t,n,0),i=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),o=Math.max(Math.min(e.start-a,r.end-a),n+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)},n.getFwdBufferInfo=function(e,t){var n=this.getLoadPosition();return b(n)?this.getFwdBufferInfoAtPos(e,n,t):null},n.getFwdBufferInfoAtPos=function(e,t,n){var r=this.config.maxBufferHole,i=Y.bufferInfo(e,t,r);if(i.len===0&&i.nextStart!==void 0){var a=this.fragmentTracker.getBufferedFrag(t,n);if(a&&i.nextStart<a.end)return Y.bufferInfo(e,t,Math.max(i.nextStart,r))}return i},n.getMaxBufferLength=function(e){var t,n=this.config;return t=e?Math.max(8*n.maxBufferSize/e,n.maxBufferLength):n.maxBufferLength,Math.min(t,n.maxMaxBufferLength)},n.reduceMaxBufferLength=function(e){var t=this.config,n=e||t.maxBufferLength;return t.maxMaxBufferLength>=n&&(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to `+t.maxMaxBufferLength+`s`),!0)},n.getAppendedFrag=function(e,t){var n=this.fragmentTracker.getAppendedFrag(e,J);return n&&`fragment`in n?n.fragment:n},n.getNextFragment=function(e,t){var n=t.fragments,r=n.length;if(!r)return null;var i,a=this.config,o=n[0].start;if(t.live){var s=a.initialLiveManifestSize;if(r<s)return this.warn(`Not enough fragments to start playback (have: `+r+`, need: `+s+`)`),null;t.PTSKnown||this.startFragRequested||this.startPosition!==-1||(i=this.getInitialLiveFragment(t,n),this.startPosition=i?this.hls.liveSyncPosition||i.start:e)}else e<=o&&(i=n[0]);if(!i){var c=a.lowLatencyMode?t.partEnd:t.fragmentEnd;i=this.getFragmentAtPosition(e,c,t)}return this.mapToInitFragWhenRequired(i)},n.isLoopLoading=function(e,t){var n=this.fragmentTracker.getState(e);return(n===Sn||n===xn&&!!e.gap)&&this.nextLoadPosition>t},n.getNextFragmentLoopLoading=function(e,t,n,r,i){var a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&n.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r);if(s!==null&&n.len+s.len>=i)return this.log(`buffer full after gaps in "`+r+`" playlist starting at sn: `+e.sn),null}return e},n.mapToInitFragWhenRequired=function(e){return e==null||!e.initSegment||e!=null&&e.initSegment.data||this.bitrateTest?e:e.initSegment},n.getNextPart=function(e,t,n){for(var r=-1,i=!1,a=!0,o=0,s=e.length;o<s;o++){var c=e[o];if(a&&=!c.independent,r>-1&&n<c.start)break;var l=c.loaded;l?r=-1:(i||c.independent||a)&&c.fragment===t&&(r=o),i=l}return r},n.loadedEndOfParts=function(e,t){var n=e[e.length-1];return n&&t>n.start&&n.loaded},n.getInitialLiveFragment=function(e,t){var n=this.fragPrevious,r=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: `+n.programDateTime),r=(function(e,t,n){if(t===null||!Array.isArray(e)||!e.length||!b(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;n||=0;for(var r=0;r<e.length;++r){var i=e[r];if(an(t,n,i))return i}return null})(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){var a=t[i-e.startSN];n.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: `+r.sn))}r||(r=(function(e,t){return tn(e,function(e){return e.cc<t?1:e.cc>t?-1:0})})(t,n.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: `+r.sn))}}else{var o=this.hls.liveSyncPosition;o!==null&&(r=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r},n.getFragmentAtPosition=function(e,t,n){var r,i=this.config,a=this.fragPrevious,o=n.fragments,s=n.endSN,c=n.fragmentHint,l=i.maxFragLookUpTolerance,u=n.partList,d=!!(i.lowLatencyMode&&u!=null&&u.length&&c);if(d&&c&&!this.bitrateTest&&(o=o.concat(c),s=c.sn),r=e<t?nn(a,o,e,e>t-l?0:l):o[o.length-1]){var f=r.sn-n.startSN,p=this.fragmentTracker.getState(r);if((p===Sn||p===xn&&r.gap)&&(a=r),a&&r.sn===a.sn&&(!d||u[0].fragment.sn>r.sn)&&a&&r.level===a.level){var m=o[f+1];r=r.sn<s&&this.fragmentTracker.getState(m)!==Sn?m:null}}return r},n.synchronizeToLiveEdge=function(e){var t=this.config,n=this.media;if(n){var r=this.hls.liveSyncPosition,i=n.currentTime,a=e.fragments[0].start,o=e.edge,s=i>=a-t.maxFragLookUpTolerance&&i<=o;if(r!==null&&n.duration>r&&(i<r||!s)){var c=t.liveMaxLatencyDuration===void 0?t.liveMaxLatencyDurationCount*e.targetduration:t.liveMaxLatencyDuration;(!s&&n.readyState<4||i<o-c)&&(this.loadedmetadata||(this.nextLoadPosition=r),n.readyState&&(this.warn(`Playback: `+i.toFixed(3)+` is located too far from the end of live sliding playlist: `+o+`, reset currentTime to : `+r.toFixed(3)),n.currentTime=r))}}},n.alignPlaylists=function(e,t){var n=this.levels,r=this.levelLastLoaded,i=this.fragPrevious,a=r===null?null:n[r],o=e.fragments.length;if(!o)return this.warn(`No fragments in live playlist`),0;var s=e.fragments[0].start,c=!t,l=e.alignedSliding&&b(s);if(c||!l&&!s){Rn(i,a,e);var u=e.fragments[0].start;return this.log(`Live playlist sliding: `+u.toFixed(2)+` start-sn: `+(t?t.startSN:`na`)+`->`+e.startSN+` prev-sn: `+(i?i.sn:`na`)+` fragments: `+o),u}return s},n.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},n.setStartPosition=function(e,t){var n=this.startPosition;if(n<t&&(n=-1),n===-1||this.lastCurrentTime===-1){var r=this.startTimeOffset!==null,i=r?this.startTimeOffset:e.startTimeOffset;i!==null&&b(i)?(n=t+i,i<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Start time offset `+i+` found in `+(r?`multivariant`:`media`)+` playlist, adjust startPosition to `+n),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n},n.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},n.handleFragLoadAborted=function(e,t){this.transmuxer&&e.sn!==`initSegment`&&e.stats.aborted&&(this.warn(`Fragment `+e.sn+(t?` part `+t.index:``)+` of level `+e.level+` was aborted`),this.resetFragmentLoading(e))},n.resetFragmentLoading=function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===Jn)||(this.state=X)},n.onFragmentOrKeyLoadError=function(e,t){if(t.chunkMeta&&!t.frag){var n=this.getCurrentContext(t.chunkMeta);n&&(t.frag=n.frag)}var r=t.frag;if(r&&r.type===e&&this.levels)if(this.fragContextChanged(r))this.warn(`Frag load error must match current frag to retry `+r.url+` > `+this.fragCurrent?.url);else{var i=t.details===C.FRAG_GAP;i&&this.fragmentTracker.fragBuffered(r,!0);var a=t.errorAction,o=a||{},s=o.action,c=o.retryCount,l=c===void 0?0:c,u=o.retryConfig;if(a&&s===un&&u){this.resetStartWhenNotLoaded(this.levelLastLoaded??r.level);var d=Qt(u,l);this.warn(`Fragment `+r.sn+` of `+e+` `+r.level+` errored with `+t.details+`, retrying loading `+(l+1)+`/`+u.maxNumRetry+` in `+d+`ms`),a.resolved=!0,this.retryDate=self.performance.now()+d,this.state=Jn}else u&&a?(this.resetFragmentErrors(e),l<u.maxNumRetry?i||(a.resolved=!0):k.warn(t.details+` reached or exceeded max retry (`+l+`)`)):a?.action===ln?this.state=tr:this.state=$n;this.tickImmediate()}},n.reduceLengthAndFlushBuffer=function(e){if(this.state===Xn||this.state===Zn){var t=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,t),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len);var i=!r;return i&&this.warn(`Buffer full error while media.currentTime is not buffered, flush `+t+` buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),i}return!1},n.resetFragmentErrors=function(e){e===bt&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Gn&&(this.state=X)},n.afterBufferFlushed=function(e,t,n){if(e){var r=Y.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===Qn&&this.resetLoadingState()}},n.resetLoadingState=function(){this.log(`Reset loading state`),this.fragCurrent=null,this.fragPrevious=null,this.state=X},n.resetStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=this.levels?this.levels[e].details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},n.resetWhenMissingContext=function(e){this.warn(`The loading context changed while buffering fragment `+e.sn+` of level `+e.level+`. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded??e.level),this.resetLoadingState()},n.removeUnbufferedFrags=function(e){e===void 0&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},n.updateLevelTiming=function(e,t,n,r){var i=this,a=n.details;if(a){if(Object.keys(e.elementaryStreams).reduce(function(t,o){var s=e.elementaryStreams[o];if(s){var c=s.endPTS-s.startPTS;if(c<=0)return i.warn(`Could not parse fragment `+e.sn+` `+o+` duration reliably (`+c+`)`),t||!1;var l=r?0:Wt(a,e,s.startPTS,s.endPTS,s.startDTS,s.endDTS);return i.hls.trigger(x.LEVEL_PTS_UPDATED,{details:a,level:n,drift:l,type:o,frag:e,start:s.startPTS,end:s.endPTS}),!0}return t},!1))n.fragmentError=0;else if(this.transmuxer?.error===null){var o=Error(`Found no media in fragment `+e.sn+` of level `+e.level+` resetting transmuxer to fallback to playlist timing`);if(n.fragmentError===0&&(n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(o.message),this.hls.trigger(x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:o,frag:e,reason:`Found no media in msn `+e.sn+` of level "`+n.url+`"`}),!this.hls)return;this.resetTransmuxer()}this.state=Zn,this.hls.trigger(x.FRAG_PARSED,{frag:e,part:t})}else this.warn(`level.details undefined`)},n.resetTransmuxer=function(){this.transmuxer&&=(this.transmuxer.destroy(),null)},n.recoverWorkerError=function(e){e.event===`demuxerWorker`&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded??this.fragCurrent?.level??0),this.resetLoadingState())},a(t,[{key:`state`,get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+`->`+e))}}]),t})(Mn);function rr(){return self.SourceBuffer||self.WebKitSourceBuffer}function ir(e,t){return e===void 0&&(e=``),t===void 0&&(t=9e4),{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var ar=(function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,n,r){this._id3Track={type:`id3`,id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},t.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,n){},t.demux=function(e,t){this.cachedData&&=(e=ze(this.cachedData,e),null);var n,r=ve(e,0),i=r?r.length:0,a=this._audioTrack,o=this._id3Track,s=r?(function(e){for(var t=Se(e),n=0;n<t.length;n++){var r=t[n];if(xe(r))return De(r)}})(r):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&b(s))&&(this.basePTS=or(s,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:kt,duration:1/0});i<c;){if(this.canParse(e,i)){var l=this.appendFrame(a,e,i);l?(this.frameIndex++,this.lastPTS=l.sample.pts,n=i+=l.length):i=c}else be(e,i)?(r=ve(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:kt,duration:1/0}),n=i+=r.length):i++;if(i===c&&n!==c){var u=me(e,n);this.cachedData?this.cachedData=ze(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,videoTrack:ir(),id3Track:o,textTrack:ir()}},t.demuxSampleAes=function(e,t,n){return Promise.reject(Error(`[`+this+`] This demuxer does not support Sample-AES decryption`))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ir(),id3Track:this._id3Track,textTrack:ir()}},t.destroy=function(){},e})(),or=function(e,t,n){return b(e)?90*e:9e4*t+(n?9e4*n.baseTime/n.timescale:0)};function sr(e,t){return e[t]===255&&(246&e[t+1])==240}function cr(e,t){return 1&e[t+1]?7:9}function lr(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function ur(e,t){return t+1<e.length&&sr(e,t)}function dr(e,t){if(ur(e,t)){var n=cr(e,t);if(t+n>=e.length)return!1;var r=lr(e,t);if(r<=n)return!1;var i=t+r;return i===e.length||ur(e,i)}return!1}function fr(e,t,n,r,i){if(!e.samplerate){var a=(function(e,t,n,r){var i,a,o,s,c=navigator.userAgent.toLowerCase(),l=r,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=1+((192&t[n+2])>>>6);var d=(60&t[n+2])>>>2;if(!(d>u.length-1))return o=(1&t[n+2])<<2,o|=(192&t[n+3])>>>6,k.log(`manifest codec:`+r+`, ADTS type:`+i+`, samplingIndex:`+d),/firefox/i.test(c)?d>=6?(i=5,s=[,,,,],a=d-3):(i=2,s=[,,],a=d):c.indexOf(`android`)===-1?(i=5,s=[,,,,],r&&(r.indexOf(`mp4a.40.29`)!==-1||r.indexOf(`mp4a.40.5`)!==-1)||!r&&d>=6?a=d-3:((r&&r.indexOf(`mp4a.40.2`)!==-1&&(d>=6&&o===1||/vivaldi/i.test(c))||!r&&o===1)&&(i=2,s=[,,]),a=d)):(i=2,s=[,,],a=d),s[0]=i<<3,s[0]|=(14&d)>>1,s[1]|=(1&d)<<7,s[1]|=o<<3,i===5&&(s[1]|=(14&a)>>1,s[2]=(1&a)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:u[d],channelCount:o,codec:`mp4a.40.`+i,manifestCodec:l};e.trigger(x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!0,reason:`invalid ADTS sampling index:`+d})})(t,n,r,i);if(!a)return;e.config=a.config,e.samplerate=a.samplerate,e.channelCount=a.channelCount,e.codec=a.codec,e.manifestCodec=a.manifestCodec,k.log(`parsed codec:`+e.codec+`, rate:`+a.samplerate+`, channels:`+a.channelCount)}}function pr(e){return 9216e4/e}function mr(e,t,n,r,i){var a,o=r+i*pr(e.samplerate),s=(function(e,t){var n=cr(e,t);if(t+n<=e.length){var r=lr(e,t)-n;if(r>0)return{headerLength:n,frameLength:r}}})(t,n);if(s){var c=s.frameLength,l=s.headerLength,u=l+c,d=Math.max(0,n+u-t.length);d?(a=new Uint8Array(u-l)).set(t.subarray(n+l,t.length),0):a=t.subarray(n+l,n+u);var f={unit:a,pts:o};return d||e.samples.push(f),{sample:f,length:u,missing:d}}var p=t.length-n;return(a=new Uint8Array(p)).set(t.subarray(n,t.length),0),{sample:{unit:a,pts:o},length:p,missing:-1}}var hr=(function(e){function t(t,n){var r;return(r=e.call(this)||this).observer=void 0,r.config=void 0,r.observer=t,r.config=n,r}c(t,e);var n=t.prototype;return n.resetInitSegment=function(t,n,r,i){e.prototype.resetInitSegment.call(this,t,n,r,i),this._audioTrack={container:`audio/adts`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`aac`,samples:[],manifestCodec:n,duration:i,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;for(var t=(ve(e,0)||[]).length,n=e.length;t<n;t++)if(dr(e,t))return k.log(`ADTS sync word found !`),!0;return!1},n.canParse=function(e,t){return(function(e,t){return(function(e,t){return t+5<e.length})(e,t)&&sr(e,t)&&lr(e,t)<=e.length-t})(e,t)},n.appendFrame=function(e,t,n){fr(e,this.observer,t,n,e.manifestCodec);var r=mr(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r},t})(ar),gr=/\/emsg[-/]ID3/i,_r=(function(){function e(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(e,t,n,r){var i=this.videoTrack=ir(`video`,1),a=this.audioTrack=ir(`audio`,1),o=this.txtTrack=ir(`text`,1);if(this.id3Track=ir(`id3`,1),this.timeOffset=0,e!=null&&e.byteLength){var s=q(e);if(s.video){var c=s.video,l=c.id,u=c.timescale,d=c.codec;i.id=l,i.timescale=o.timescale=u,i.codec=d}if(s.audio){var f=s.audio,p=f.id,m=f.timescale,h=f.codec;a.id=p,a.timescale=m,a.codec=h}o.id=Ne.text,i.sampleDuration=0,i.duration=a.duration=r}},t.resetContiguity=function(){this.remainderData=null},e.probe=function(e){return G(e=e.length>16384?e.subarray(0,16384):e,[`moof`]).length>0},t.demux=function(e,t){this.timeOffset=t;var n=e,r=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=ze(this.remainderData,e));var a=(function(e){var t={valid:null,remainder:null},n=G(e,[`moof`]);if(!n)return t;if(n.length<2)return t.remainder=e,t;var r=n[n.length-1];return t.valid=me(e,0,r.byteOffset-8),t.remainder=me(e,r.byteOffset-8),t})(n);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=n;var o=this.extractID3Track(r,t);return i.samples=Be(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}},t.flush=function(){var e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var r=this.extractID3Track(t,this.timeOffset);return n.samples=Be(e,t),{videoTrack:t,audioTrack:ir(),id3Track:r,textTrack:ir()}},t.extractID3Track=function(e,t){var n=this.id3Track;if(e.samples.length){var r=G(e.samples,[`emsg`]);r&&r.forEach(function(e){var r=(function(e){var t=e[0],n=``,r=``,i=0,a=0,o=0,s=0,c=0,l=0;if(t===0){for(;U(e.subarray(l,l+1))!==`\0`;)n+=U(e.subarray(l,l+1)),l+=1;for(n+=U(e.subarray(l,l+1)),l+=1;U(e.subarray(l,l+1))!==`\0`;)r+=U(e.subarray(l,l+1)),l+=1;r+=U(e.subarray(l,l+1)),l+=1,i=W(e,12),a=W(e,16),s=W(e,20),c=W(e,24),l=28}else if(t===1){i=W(e,l+=4);var u=W(e,l+=4),d=W(e,l+=4);for(l+=4,o=2**32*u+d,Number.isSafeInteger(o)||(o=2**53-1,k.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),s=W(e,l),c=W(e,l+=4),l+=4;U(e.subarray(l,l+1))!==`\0`;)n+=U(e.subarray(l,l+1)),l+=1;for(n+=U(e.subarray(l,l+1)),l+=1;U(e.subarray(l,l+1))!==`\0`;)r+=U(e.subarray(l,l+1)),l+=1;r+=U(e.subarray(l,l+1)),l+=1}return{schemeIdUri:n,value:r,timeScale:i,presentationTime:o,presentationTimeDelta:a,eventDuration:s,id:c,payload:e.subarray(l,e.byteLength)}})(e);if(gr.test(r.schemeIdUri)){var i=b(r.presentationTime)?r.presentationTime/r.timeScale:t+r.presentationTimeDelta/r.timeScale,a=r.eventDuration===4294967295?1/0:r.eventDuration/r.timeScale;a<=.001&&(a=1/0);var o=r.payload;n.samples.push({data:o,len:o.byteLength,dts:i,pts:i,type:jt,duration:a})}})}return n},t.demuxSampleAes=function(e,t,n){return Promise.reject(Error(`The MP4 demuxer does not support SAMPLE-AES decryption`))},t.destroy=function(){},e})(),vr=null,yr=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],br=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],xr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Sr=[0,1,1,4];function Cr(e,t,n,r,i){if(!(n+24>t.length)){var a=wr(t,n);if(a&&n+a.frameLength<=t.length){var o=r+i*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(n,n+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength,missing:0}}}}function wr(e,t){var n=e[t+1]>>3&3,r=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3;if(n!==1&&i!==0&&i!==15&&a!==3){var o=e[t+2]>>1&1,s=e[t+3]>>6,c=1e3*yr[14*(n===3?3-r:r===3?3:4)+i-1],l=br[3*(n===3?0:n===2?1:2)+a],u=s===3?1:2,d=xr[n][r],f=Sr[r],p=8*d*f,m=Math.floor(d*c/l+o)*f;if(vr===null){var h=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);vr=h?parseInt(h[1]):0}return vr&&vr<=87&&r===2&&c>=224e3&&s===0&&(e[t+3]=128|e[t+3]),{sampleRate:l,channelCount:u,frameLength:m,samplesPerFrame:p}}}function Tr(e,t){return e[t]===255&&(224&e[t+1])==224&&(6&e[t+1])!=0}function Er(e,t){return t+1<e.length&&Tr(e,t)}function Dr(e,t){if(t+1<e.length&&Tr(e,t)){var n=wr(e,t),r=4;n!=null&&n.frameLength&&(r=n.frameLength);var i=t+r;return i===e.length||Er(e,i)}return!1}var Or=(function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(i===0)throw Error(`no bytes available`);r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),n=this.word>>>32-t;if(e>32&&k.error(`Cannot read more than 32 bits at a time`),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw Error(`no bits available`);this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?n<<t|this.readBits(t):n},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return this.readBits(1)===1},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,n=8,r=0;r<e;r++)n!==0&&(n=(t+this.readEG()+256)%256),t=n===0?t:n},t.readSPS=function(){var e,t,n,r=0,i=0,a=0,o=0,s=this.readUByte.bind(this),c=this.readBits.bind(this),l=this.readUEG.bind(this),u=this.readBoolean.bind(this),d=this.skipBits.bind(this),f=this.skipEG.bind(this),p=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);s();var h=s();if(c(5),d(3),s(),p(),h===100||h===110||h===122||h===244||h===44||h===83||h===86||h===118||h===128){var g=l();if(g===3&&d(1),p(),p(),d(1),u())for(t=g===3?12:8,n=0;n<t;n++)u()&&m(n<6?16:64)}p();var _=l();if(_===0)l();else if(_===1)for(d(1),f(),f(),e=l(),n=0;n<e;n++)f();p(),d(1);var v=l(),y=l(),b=c(1);b===0&&d(1),d(1),u()&&(r=l(),i=l(),a=l(),o=l());var x=[1,1];if(u()&&u())switch(s()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:x=[s()<<8|s(),s()<<8|s()]}return{width:Math.ceil(16*(v+1)-2*r-2*i),height:(2-b)*(y+1)*16-(b?2:4)*(a+o),pixelRatio:x}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e})(),kr=(function(){function e(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Un(t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},t.decryptAacSample=function(e,t,n){var r=this,i=e[t].unit;if(!(i.length<=16)){var a=i.subarray(16,i.length-i.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(o).then(function(a){var o=new Uint8Array(a);i.set(o,16),r.decrypter.isSync()||r.decryptAacSamples(e,t+1,n)})}},t.decryptAacSamples=function(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,n),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t),r=0,i=32;i<e.length-16;i+=160,r+=16)n.set(e.subarray(i,i+16),r);return n},t.getAvcDecryptedUnit=function(e,t){for(var n=new Uint8Array(t),r=0,i=32;i<e.length-16;i+=160,r+=16)e.set(n.subarray(r,r+16),i);return e},t.decryptAvcSample=function(e,t,n,r,i){var a=this,o=Ue(i.data),s=this.getAvcEncryptedData(o);this.decryptBuffer(s.buffer).then(function(s){i.data=a.getAvcDecryptedUnit(o,s),a.decrypter.isSync()||a.decryptAvcSamples(e,t,n+1,r)})},t.decryptAvcSamples=function(e,t,n,r){if(e instanceof Uint8Array)throw Error(`Cannot decrypt samples of type Uint8Array`);for(;;t++,n=0){if(t>=e.length)return void r();for(var i=e[t].units;!(n>=i.length);n++){var a=i[n];if(!(a.data.length<=48||a.type!==1&&a.type!==5||(this.decryptAvcSample(e,t,n,r,a),this.decrypter.isSync())))return}}},e})(),Z=188,Ar=(function(){function e(e,t,n){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=n}e.probe=function(t){var n=e.syncOffset(t);return n>0&&k.warn(`MPEG2-TS detected but first sync word found @ offset `+n),n!==-1},e.syncOffset=function(e){for(var t=e.length,n=Math.min(940,e.length-Z)+1,r=0;r<n;){for(var i=!1,a=-1,o=0,s=r;s<t;s+=Z){if(e[s]!==71){if(o)return-1;break}if(o++,a===-1&&(a=s)!==0&&(n=Math.min(a+18612,e.length-Z)+1),i||=Mr(e,s)===0,i&&o>1&&(a===0&&o>2||s+Z>n))return a}r++}return-1},e.createTrack=function(e,t){return{container:e===`video`||e===`audio`?`video/mp2t`:void 0,type:e,id:Ne[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e===`audio`?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,n,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack(`video`),this._audioTrack=e.createTrack(`audio`,i),this._id3Track=e.createTrack(`id3`),this._txtTrack=e.createTrack(`text`),this._audioTrack.segmentCodec=`aac`,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=r,this._duration=i},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,n=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},t.demux=function(t,n,r,i){var a;r===void 0&&(r=!1),i===void 0&&(i=!1),r||(this.sampleAes=null);var o=this._avcTrack,s=this._audioTrack,c=this._id3Track,l=this._txtTrack,u=o.pid,d=o.pesData,f=s.pid,p=c.pid,m=s.pesData,h=c.pesData,g=null,_=this.pmtParsed,v=this._pmtId,y=t.length;if(this.remainderData&&=(y=(t=ze(this.remainderData,t)).length,null),y<Z&&!i)return this.remainderData=t,{audioTrack:s,videoTrack:o,id3Track:c,textTrack:l};var b=Math.max(0,e.syncOffset(t));(y-=(y-b)%Z)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,y,t.buffer.byteLength-y));for(var w=0,T=b;T<y;T+=Z)if(t[T]===71){var E=!!(64&t[T+1]),D=Mr(t,T),O=void 0;if((48&t[T+3])>>4>1){if((O=T+5+t[T+4])===T+Z)continue}else O=T+4;switch(D){case u:E&&(d&&(a=Fr(d))&&this.parseAVCPES(o,l,a,!1),d={data:[],size:0}),d&&(d.data.push(t.subarray(O,T+Z)),d.size+=T+Z-O);break;case f:if(E){if(m&&(a=Fr(m)))switch(s.segmentCodec){case`aac`:this.parseAACPES(s,a);break;case`mp3`:this.parseMPEGPES(s,a)}m={data:[],size:0}}m&&(m.data.push(t.subarray(O,T+Z)),m.size+=T+Z-O);break;case p:E&&(h&&(a=Fr(h))&&this.parseID3PES(c,a),h={data:[],size:0}),h&&(h.data.push(t.subarray(O,T+Z)),h.size+=T+Z-O);break;case 0:E&&(O+=t[O]+1),v=this._pmtId=Nr(t,O);break;case v:E&&(O+=t[O]+1);var A=Pr(t,O,this.typeSupported,r);(u=A.avc)>0&&(o.pid=u),(f=A.audio)>0&&(s.pid=f,s.segmentCodec=A.segmentCodec),(p=A.id3)>0&&(c.pid=p),g===null||_||(k.warn(`MPEG-TS PMT found at `+T+` after unknown PID '`+g+`'. Backtracking to sync byte @`+b+` to parse all TS packets.`),g=null,T=b-188),_=this.pmtParsed=!0;break;case 17:case 8191:break;default:g=D}}else w++;if(w>0){var j=Error(`Found `+w+` TS packet/s that do not start with 0x47`);this.observer.emit(x.ERROR,x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:j,reason:j.message})}o.pesData=d,s.pesData=m,c.pesData=h;var M={audioTrack:s,videoTrack:o,id3Track:c,textTrack:l};return i&&this.extractRemainingSamples(M),M},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,n=e.audioTrack,r=e.videoTrack,i=e.id3Track,a=e.textTrack,o=r.pesData,s=n.pesData,c=i.pesData;if(o&&(t=Fr(o))?(this.parseAVCPES(r,a,t,!0),r.pesData=null):r.pesData=o,s&&(t=Fr(s))){switch(n.segmentCodec){case`aac`:this.parseAACPES(n,t);break;case`mp3`:this.parseMPEGPES(n,t)}n.pesData=null}else s!=null&&s.size&&k.log(`last AAC PES packet truncated,might overlap between fragments`),n.pesData=s;c&&(t=Fr(c))?(this.parseID3PES(i,t),i.pesData=null):i.pesData=c},t.demuxSampleAes=function(e,t,n){var r=this.demux(e,n,!0,!this.config.progressive),i=this.sampleAes=new kr(this.observer,this.config,t);return this.decrypt(r,i)},t.decrypt=function(e,t){return new Promise(function(n){var r=e.audioTrack,i=e.videoTrack;r.samples&&r.segmentCodec===`aac`?t.decryptAacSamples(r.samples,0,function(){i.samples?t.decryptAvcSamples(i.samples,0,0,function(){n(e)}):n(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,function(){n(e)})})},t.destroy=function(){this._duration=0},t.parseAVCPES=function(e,t,n,r){var i,a=this,o=this.parseAVCNALu(e,n.data),s=this.avcSample,c=!1;n.data=null,s&&o.length&&!e.audFound&&(Ir(s,e),s=this.avcSample=jr(!1,n.pts,n.dts,``)),o.forEach(function(r){var o;switch(r.type){case 1:var l=!1;i=!0;var u,d=r.data;if(c&&d.length>4){var f=new Or(d).readSliceType();f!==2&&f!==4&&f!==7&&f!==9||(l=!0)}l&&(u=s)!=null&&u.frame&&!s.key&&(Ir(s,e),s=a.avcSample=null),s||=a.avcSample=jr(!0,n.pts,n.dts,``),s.frame=!0,s.key=l;break;case 5:i=!0,(o=s)!=null&&o.frame&&!s.key&&(Ir(s,e),s=a.avcSample=null),s||=a.avcSample=jr(!0,n.pts,n.dts,``),s.key=!0,s.frame=!0;break;case 6:i=!0,He(r.data,1,n.pts,t.samples);break;case 7:if(i=!0,c=!0,!e.sps){var p=r.data,m=new Or(p).readSPS();e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.sps=[p],e.duration=a._duration;for(var h=p.subarray(1,4),g=`avc1.`,_=0;_<3;_++){var v=h[_].toString(16);v.length<2&&(v=`0`+v),g+=v}e.codec=g}break;case 8:i=!0,e.pps||=[r.data];break;case 9:i=!1,e.audFound=!0,s&&Ir(s,e),s=a.avcSample=jr(!1,n.pts,n.dts,``);break;case 12:i=!0;break;default:i=!1,s&&(s.debug+=`unknown NAL `+r.type+` `)}s&&i&&s.units.push(r)}),r&&s&&(Ir(s,e),this.avcSample=null)},t.getLastNalUnit=function(e){var t,n,r=this.avcSample;if(r&&r.units.length!==0||(r=e[e.length-1]),(t=r)!=null&&t.units){var i=r.units;n=i[i.length-1]}return n},t.parseAVCNALu=function(e,t){var n,r,i=t.byteLength,a=e.naluState||0,o=a,s=[],c=0,l=-1,u=0;for(a===-1&&(l=0,u=31&t[0],a=0,c=1);c<i;)if(n=t[c++],a)if(a!==1)if(n)if(n===1){if(l>=0){var d={data:t.subarray(l,c-a-1),type:u};s.push(d)}else{var f=this.getLastNalUnit(e.samples);if(f&&(o&&c<=4-o&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-o)),(r=c-a-1)>0)){var p=new Uint8Array(f.data.byteLength+r);p.set(f.data,0),p.set(t.subarray(0,r),f.data.byteLength),f.data=p,f.state=0}}c<i?(l=c,u=31&t[c],a=0):a=-1}else a=0;else a=3;else a=n?0:2;else a=+!n;if(l>=0&&a>=0){var m={data:t.subarray(l,i),type:u,state:a};s.push(m)}if(s.length===0){var h=this.getLastNalUnit(e.samples);if(h){var g=new Uint8Array(h.data.byteLength+t.byteLength);g.set(h.data,0),g.set(t,h.data.byteLength),h.data=g}}return e.naluState=a,s},t.parseAACPES=function(e,t){var n,r,i,a=0,o=this.aacOverFlow,s=t.data;if(o){this.aacOverFlow=null;var c=o.missing,l=o.sample.unit.byteLength;if(c===-1){var u=new Uint8Array(l+s.byteLength);u.set(o.sample.unit,0),u.set(s,l),s=u}else{var d=l-c;o.sample.unit.set(s.subarray(0,c),d),e.samples.push(o.sample),a=o.missing}}for(n=a,r=s.length;n<r-1&&!ur(s,n);n++);if(n!==a){var f,p=n<r-1;f=p?`AAC PES did not start with ADTS header,offset:`+n:`No ADTS header found in AAC PES`;var m=Error(f);if(k.warn(`parsing error: `+f),this.observer.emit(x.ERROR,x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,levelRetry:p,error:m,reason:f}),!p)return}if(fr(e,this.observer,s,n,this.audioCodec),t.pts!==void 0)i=t.pts;else{if(!o)return void k.warn(`[tsdemuxer]: AAC PES unknown PTS`);var h=pr(e.samplerate);i=o.sample.pts+h}for(var g,_=0;n<r;){if(n+=(g=mr(e,s,n,i,_)).length,g.missing){this.aacOverFlow=g;break}for(_++;n<r-1&&!ur(s,n);n++);}},t.parseMPEGPES=function(e,t){var n=t.data,r=n.length,i=0,a=0,o=t.pts;if(o!==void 0)for(;a<r;)if(Er(n,a)){var s=Cr(e,n,a,o,i);if(!s)break;a+=s.length,i++}else a++;else k.warn(`[tsdemuxer]: MPEG PES unknown PTS`)},t.parseID3PES=function(e,t){if(t.pts!==void 0){var n=s({},t,{type:this._avcTrack?jt:kt,duration:1/0});e.samples.push(n)}else k.warn(`[tsdemuxer]: ID3 PES unknown PTS`)},e})();function jr(e,t,n,r){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:r,length:0}}function Mr(e,t){return((31&e[t+1])<<8)+e[t+2]}function Nr(e,t){return(31&e[t+10])<<8|e[t+11]}function Pr(e,t,n,r){var i={audio:-1,avc:-1,id3:-1,segmentCodec:`aac`},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var o=Mr(e,t);switch(e[t]){case 207:if(!r){k.log(`ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream`);break}case 15:i.audio===-1&&(i.audio=o);break;case 21:i.id3===-1&&(i.id3=o);break;case 219:if(!r){k.log(`H.264 with AES-128-CBC slice encryption found in unencrypted stream`);break}case 27:i.avc===-1&&(i.avc=o);break;case 3:case 4:!0!==n.mpeg&&!0!==n.mp3?k.log(`MPEG audio found, not supported in this browser`):i.audio===-1&&(i.audio=o,i.segmentCodec=`mp3`);break;case 36:k.warn(`Unsupported HEVC stream type found`)}t+=5+((15&e[t+3])<<8|e[t+4])}return i}function Fr(e){var t,n,r,i,a,o=0,s=e.data;if(!e||e.size===0)return null;for(;s[0].length<19&&s.length>1;){var c=new Uint8Array(s[0].length+s[1].length);c.set(s[0]),c.set(s[1],s[0].length),s[0]=c,s.splice(1,1)}if(((t=s[0])[0]<<16)+(t[1]<<8)+t[2]===1){if((n=(t[4]<<8)+t[5])&&n>e.size-6)return null;var l=t[7];192&l&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?i-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(k.warn(Math.round((i-a)/9e4)+`s delta between PTS and DTS, align them`),i=a):a=i);var u=(r=t[8])+9;if(e.size<=u)return null;e.size-=u;for(var d=new Uint8Array(e.size),f=0,p=s.length;f<p;f++){var m=(t=s[f]).byteLength;if(u){if(u>m){u-=m;continue}t=t.subarray(u),m-=u,u=0}d.set(t,o),o+=m}return n&&(n-=r+3),{data:d,pts:i,dts:a,len:n}}return null}function Ir(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){var n=t.samples,r=n.length;if(!r)return void t.dropped++;var i=n[r-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&k.log(e.pts+`/`+e.dts+`:`+e.debug)}var Lr=(function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var n=t.prototype;return n.resetInitSegment=function(t,n,r,i){e.prototype.resetInitSegment.call(this,t,n,r,i),this._audioTrack={container:`audio/mpeg`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`mp3`,samples:[],manifestCodec:n,duration:i,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;for(var t=(ve(e,0)||[]).length,n=e.length;t<n;t++)if(Dr(e,t))return k.log(`MPEG Audio sync word found !`),!0;return!1},n.canParse=function(e,t){return(function(e,t){return Tr(e,t)&&4<=e.length-t})(e,t)},n.appendFrame=function(e,t,n){if(this.basePTS!==null)return Cr(e,t,n,this.basePTS,this.frameIndex)},t})(ar),Rr=(function(){function e(){}return e.getSilentFrame=function(e,t){if(e===`mp4a.40.2`){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2||t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},e})(),zr=2**32-1,Q=(function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);e.HDLR_TYPES={video: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]),audio: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])};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);e.STTS=e.STSC=e.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var r=new Uint8Array([105,115,111,109]),i=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,r,a,r,i),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))},e.box=function(e){for(var t=8,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var a=r.length,o=a;a--;)t+=r[a].byteLength;var s=new Uint8Array(t);for(s[0]=t>>24&255,s[1]=t>>16&255,s[2]=t>>8&255,s[3]=255&t,s.set(e,4),a=0,t=8;a<o;a++)s.set(r[a],t),t+=r[a].byteLength;return s},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,n){n*=t;var r=Math.floor(n/(zr+1)),i=Math.floor(n%(zr+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return t.type===`audio`?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,n,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,n))},e.moov=function(t){for(var n=t.length,r=[];n--;)r[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r,e.mvex(t)))},e.mvex=function(t){for(var n=t.length,r=[];n--;)r[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(r))},e.mvhd=function(t,n){n*=t;var r=Math.floor(n/(zr+1)),i=Math.floor(n%(zr+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)},e.sdtp=function(t){var n,r,i=t.samples||[],a=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,a[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var n,r,i,a=[],o=[];for(n=0;n<t.sps.length;n++)i=(r=t.sps[n]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));for(n=0;n<t.pps.length;n++)i=(r=t.pps[n]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));var s=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a,[t.pps.length],o))),c=t.width,l=t.height,u=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,255&c,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t].concat(e.config,[6,1,2]))},e.mp4a=function(t){var n=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var n=t.samplerate;return e.box(e.types[`.mp3`],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},e.stsd=function(t){return t.type===`audio`?t.segmentCodec===`mp3`&&t.codec===`mp3`?e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var n=t.id,r=t.duration*t.timescale,i=t.width,a=t.height,o=Math.floor(r/(zr+1)),s=Math.floor(r%(zr+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,n){var r=e.sdtp(t),i=t.id,a=Math.floor(n/(zr+1)),o=Math.floor(n%(zr+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,r.length+16+20+8+16+8+8),r)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,n){var r,i,a,o,s,c,l=t.samples||[],u=l.length,d=12+16*u,f=new Uint8Array(d);for(n+=8+d,f.set([+(t.type===`video`),0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r<u;r++)a=(i=l[r]).duration,o=i.size,s=i.flags,c=i.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*r);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var n=e.moov(t),r=new Uint8Array(e.FTYP.byteLength+n.byteLength);return r.set(e.FTYP),r.set(n,e.FTYP.byteLength),r},e})();function Br(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=!1);var i=e*t*n;return r?Math.round(i):i}function Vr(e,t){return t===void 0&&(t=!1),Br(e,1e3,1/9e4,t)}Q.types=void 0,Q.HDLR_TYPES=void 0,Q.STTS=void 0,Q.STSC=void 0,Q.STCO=void 0,Q.STSZ=void 0,Q.VMHD=void 0,Q.SMHD=void 0,Q.STSD=void 0,Q.FTYP=void 0,Q.DINF=void 0;var Hr=null,Ur=null,Wr=(function(){function e(e,t,n,r){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,Hr===null){var i=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);Hr=i?parseInt(i[1]):0}if(Ur===null){var a=navigator.userAgent.match(/Safari\/(\d+)/i);Ur=a?parseInt(a[1]):0}}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){k.log(`[mp4-remuxer]: initPTS & initDTS reset`),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){k.log(`[mp4-remuxer]: reset next timestamp`),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){k.log(`[mp4-remuxer]: ISGenerated flag reset`),this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,n=e.reduce(function(e,n){var r=n.pts-e;return r<-4294967296?(t=!0,Gr(e,n.pts)):r>0?e:n.pts},e[0].pts);return t&&k.debug(`PTS rollover detected`),n},t.remux=function(e,t,n,r,i,a,o,s){var c,l,u,d,f,p,m=i,h=i,g=e.pid>-1,_=t.pid>-1,v=t.samples.length,y=e.samples.length>0,b=o&&v>0||v>1;if((!g||y)&&(!_||b)||this.ISGenerated||o){this.ISGenerated||(u=this.generateIS(e,t,i,a));var x,S=this.isVideoContiguous,C=-1;if(b&&(C=(function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1})(t.samples),!S&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,C>0){k.warn(`[mp4-remuxer]: Dropped `+C+` out of `+v+` video samples due to a missing keyframe`);var w=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(C),t.dropped+=C,x=h+=(t.samples[0].pts-w)/t.inputTimeScale}else C===-1&&(k.warn(`[mp4-remuxer]: No keyframe found out of `+v+` video samples`),p=!1);if(this.ISGenerated){if(y&&b){var T=this.getVideoStartPts(t.samples),E=(Gr(e.samples[0].pts,T)-T)/t.inputTimeScale;m+=Math.max(0,E),h+=Math.max(0,-E)}if(y){if(e.samplerate||(k.warn(`[mp4-remuxer]: regenerate InitSegment as audio detected`),u=this.generateIS(e,t,i,a)),l=this.remuxAudio(e,m,this.isAudioContiguous,a,_||b||s===bt?h:void 0),b){var D=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(k.warn(`[mp4-remuxer]: regenerate InitSegment as video detected`),u=this.generateIS(e,t,i,a)),c=this.remuxVideo(t,h,S,D)}}else b&&(c=this.remuxVideo(t,h,S,0));c&&(c.firstKeyFrame=C,c.independent=C!==-1,c.firstKeyFramePTS=x)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(f=Kr(n,i,this._initPTS,this._initDTS)),r.samples.length&&(d=qr(r,i,this._initPTS))),{audio:l,video:c,initSegment:u,independent:p,text:d,id3:f}},t.generateIS=function(e,t,n,r){var i,a,o,s=e.samples,c=t.samples,l=this.typeSupported,u={},d=this._initPTS,f=!d||r,p=`audio/mp4`;if(f&&(i=a=1/0),e.config&&s.length&&(e.timescale=e.samplerate,e.segmentCodec===`mp3`&&(l.mpeg?(p=`audio/mpeg`,e.codec=``):l.mp3&&(e.codec=`mp3`)),u.audio={id:`audio`,container:p,codec:e.codec,initSegment:e.segmentCodec===`mp3`&&l.mpeg?new Uint8Array:Q.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(o=e.inputTimeScale,d&&o===d.timescale?f=!1:i=a=s[0].pts-Math.round(o*n))),t.sps&&t.pps&&c.length&&(t.timescale=t.inputTimeScale,u.video={id:`main`,container:`video/mp4`,codec:t.codec,initSegment:Q.initSegment([t]),metadata:{width:t.width,height:t.height}},f))if(o=t.inputTimeScale,d&&o===d.timescale)f=!1;else{var m=this.getVideoStartPts(c),h=Math.round(o*n);a=Math.min(a,Gr(c[0].dts,m)-h),i=Math.min(i,m-h)}if(Object.keys(u).length)return this.ISGenerated=!0,f?(this._initPTS={baseTime:i,timescale:o},this._initDTS={baseTime:a,timescale:o}):i=o=void 0,{tracks:u,initPTS:i,timescale:o}},t.remuxVideo=function(e,t,n,r){var i,a,o=e.inputTimeScale,c=e.samples,l=[],u=c.length,d=this._initPTS,f=this.nextAvcDts,p=8,m=this.videoSampleDuration,h=1/0,g=-1/0,_=!1;n&&f!==null||(f=t*o-(c[0].pts-Gr(c[0].dts,c[0].pts)));for(var v=d.baseTime*o/d.timescale,y=0;y<u;y++){var b=c[y];b.pts=Gr(b.pts-v,f),b.dts=Gr(b.dts-v,f),b.dts<c[y>0?y-1:y].dts&&(_=!0)}_&&c.sort(function(e,t){var n=e.dts-t.dts,r=e.pts-t.pts;return n||r}),i=c[0].dts;var w=(a=c[c.length-1].dts)-i,T=w?Math.round(w/(u-1)):m||e.inputTimeScale/30;if(n){var E=i-f,D=E>T,O=E<-1;if((D||O)&&(D?k.warn(`AVC: `+Vr(E,!0)+` ms (`+E+`dts) hole between fragments detected, filling it`):k.warn(`AVC: `+Vr(-E,!0)+` ms (`+E+`dts) overlapping between fragments detected`),!O||f>=c[0].pts)){i=f;var A=c[0].pts-E;c[0].dts=i,c[0].pts=A,k.log(`Video: First PTS/DTS adjusted: `+Vr(A,!0)+`/`+Vr(i,!0)+`, delta: `+Vr(E,!0)+` ms`)}}i=Math.max(0,i);for(var j=0,M=0,ee=0;ee<u;ee++){for(var te=c[ee],ne=te.units,N=ne.length,P=0,F=0;F<N;F++)P+=ne[F].data.length;M+=P,j+=N,te.length=P,te.dts=Math.max(te.dts,i),h=Math.min(te.pts,h),g=Math.max(te.pts,g)}a=c[u-1].dts;var I,re=M+4*j+8;try{I=new Uint8Array(re)}catch(e){this.observer.emit(x.ERROR,x.ERROR,{type:S.MUX_ERROR,details:C.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:re,reason:`fail allocating video mdat `+re});return}var ie=new DataView(I.buffer);ie.setUint32(0,re),I.set(Q.types.mdat,4);for(var ae=!1,L=1/0,oe=1/0,R=-1/0,z=-1/0,B=0;B<u;B++){for(var V=c[B],se=V.units,ce=0,le=0,ue=se.length;le<ue;le++){var de=se[le],fe=de.data,pe=de.data.byteLength;ie.setUint32(p,pe),p+=4,I.set(fe,p),p+=pe,ce+=4+pe}var me=void 0;if(B<u-1)m=c[B+1].dts-V.dts,me=c[B+1].pts-V.pts;else{var he=this.config,ge=B>0?V.dts-c[B-1].dts:T;if(me=B>0?V.pts-c[B-1].pts:T,he.stretchShortVideoTrack&&this.nextAudioPts!==null){var _e=Math.floor(he.maxBufferHole*o),ve=(r?h+r*o:this.nextAudioPts)-V.pts;ve>_e?((m=ve-ge)<0?m=ge:ae=!0,k.log(`[mp4-remuxer]: It is approximately `+ve/90+` ms to the next segment; using duration `+m/90+` ms for the last video frame.`)):m=ge}else m=ge}var ye=Math.round(V.pts-V.dts);L=Math.min(L,m),R=Math.max(R,m),oe=Math.min(oe,me),z=Math.max(z,me),l.push(new Yr(V.key,m,ce,ye))}if(l.length){if(Hr){if(Hr<70){var be=l[0].flags;be.dependsOn=2,be.isNonSync=0}}else if(Ur&&z-oe<R-L&&T/R<.025&&l[0].cts===0){k.warn(`Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.`);for(var xe=i,H=0,Se=l.length;H<Se;H++){var Ce=xe+l[H].duration,we=xe+l[H].cts;if(H<Se-1){var Te=Ce+l[H+1].cts;l[H].duration=Te-we}else l[H].duration=H?l[H-1].duration:T;l[H].cts=0,xe=Ce}}}m=ae||!m?T:m,this.nextAvcDts=f=a+m,this.videoSampleDuration=m,this.isVideoContiguous=!0;var Ee={data1:Q.moof(e.sequenceNumber++,i,s({},e,{samples:l})),data2:I,startPTS:h/o,endPTS:(g+m)/o,startDTS:i/o,endDTS:f/o,type:`video`,hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ee},t.remuxAudio=function(e,t,n,r,i){var a=e.inputTimeScale,o=a/(e.samplerate?e.samplerate:a),c=e.segmentCodec===`aac`?1024:1152,l=c*o,u=this._initPTS,d=e.segmentCodec===`mp3`&&this.typeSupported.mpeg,f=[],p=i!==void 0,m=e.samples,h=d?0:8,g=this.nextAudioPts||-1,_=t*a,v=u.baseTime*a/u.timescale;if(this.isAudioContiguous=n||=m.length&&g>0&&(r&&Math.abs(_-g)<9e3||Math.abs(Gr(m[0].pts-v,_)-g)<20*l),m.forEach(function(e){e.pts=Gr(e.pts-v,_)}),!n||g<0){if(m=m.filter(function(e){return e.pts>=0}),!m.length)return;g=i===0?0:r&&!p?Math.max(0,_):m[0].pts}if(e.segmentCodec===`aac`)for(var y=this.config.maxAudioFramesDrift,b=0,w=g;b<m.length;b++){var T=m[b],E=T.pts,D=E-w,O=Math.abs(1e3*D/a);if(D<=-y*l&&p)b===0&&(k.warn(`Audio frame @ `+(E/a).toFixed(3)+`s overlaps nextAudioPts by `+Math.round(1e3*D/a)+` ms.`),this.nextAudioPts=g=w=E);else if(D>=y*l&&O<1e4&&p){var A=Math.round(D/l);(w=E-A*l)<0&&(A--,w+=l),b===0&&(this.nextAudioPts=g=w),k.warn(`[mp4-remuxer]: Injecting `+A+` audio frame @ `+(w/a).toFixed(3)+`s due to `+Math.round(1e3*D/a)+` ms gap.`);for(var j=0;j<A;j++){var M=Math.max(w,0),ee=Rr.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ee||=(k.log(`[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead.`),T.unit.subarray()),m.splice(b,0,{unit:ee,pts:M}),w+=l,b++}}T.pts=w,w+=l}for(var te,ne=null,N=null,P=0,F=m.length;F--;)P+=m[F].unit.byteLength;for(var I=0,re=m.length;I<re;I++){var ie=m[I],ae=ie.unit,L=ie.pts;if(N!==null)f[I-1].duration=Math.round((L-N)/o);else{if(n&&e.segmentCodec===`aac`&&(L=g),ne=L,!(P>0))return;P+=h;try{te=new Uint8Array(P)}catch(e){this.observer.emit(x.ERROR,x.ERROR,{type:S.MUX_ERROR,details:C.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:P,reason:`fail allocating audio mdat `+P});return}d||(new DataView(te.buffer).setUint32(0,P),te.set(Q.types.mdat,4))}te.set(ae,h);var oe=ae.byteLength;h+=oe,f.push(new Yr(!0,c,oe,0)),N=L}var R=f.length;if(R){var z=f[f.length-1];this.nextAudioPts=g=N+o*z.duration;var B=d?new Uint8Array:Q.moof(e.sequenceNumber++,ne/o,s({},e,{samples:f}));e.samples=[];var V=ne/a,se=g/a,ce={data1:B,data2:te,startPTS:V,endPTS:se,startDTS:V,endDTS:se,type:`audio`,hasAudio:!0,hasVideo:!1,nb:R};return this.isAudioContiguous=!0,ce}},t.remuxEmptyAudio=function(e,t,n,r){var i=e.inputTimeScale,a=i/(e.samplerate?e.samplerate:i),o=this.nextAudioPts,s=this._initDTS,c=9e4*s.baseTime/s.timescale,l=(o===null?r.startDTS*i:o)+c,u=r.endDTS*i+c,d=1024*a,f=Math.ceil((u-l)/d),p=Rr.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(k.warn(`[mp4-remuxer]: remux empty Audio`),p){for(var m=[],h=0;h<f;h++){var g=l+h*d;m.push({unit:p,pts:g,dts:g})}return e.samples=m,this.remuxAudio(e,t,n,!1)}k.trace(`[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec`)},e})();function Gr(e,t){var n;if(t===null)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}function Kr(e,t,n,r){var i=e.samples.length;if(i){for(var a=e.inputTimeScale,o=0;o<i;o++){var s=e.samples[o];s.pts=Gr(s.pts-n.baseTime*a/n.timescale,t*a)/a,s.dts=Gr(s.dts-r.baseTime*a/r.timescale,t*a)/a}var c=e.samples;return e.samples=[],{samples:c}}}function qr(e,t,n){var r=e.samples.length;if(r){for(var i=e.inputTimeScale,a=0;a<r;a++){var o=e.samples[a];o.pts=Gr(o.pts-n.baseTime*i/n.timescale,t*i)/i}e.samples.sort(function(e,t){return e.pts-t.pts});var s=e.samples;return e.samples=[],{samples:s}}}var Jr,Yr=function(e,t,n,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=r,this.flags=new Xr(e)},Xr=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=+!e},Zr=(function(){function e(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},t.resetNextTimestamp=function(){this.lastEndTime=null},t.resetInitSegment=function(e,t,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment((function(e,t){if(!e||!t)return e;var n=t.keyId;return n&&t.isCommonEncryption&&G(e,[`moov`,`trak`]).forEach(function(e){var t=G(e,[`mdia`,`minf`,`stbl`,`stsd`])[0].subarray(8),r=G(t,[`enca`]),i=r.length>0;i||(r=G(t,[`encv`])),r.forEach(function(e){G(i?e.subarray(28):e.subarray(78),[`sinf`]).forEach(function(e){var t=Le(e);if(t){var r=t.subarray(8,24);r.some(function(e){return e!==0})||(k.log(`[eme] Patching keyId in 'enc`+(i?`a`:`v`)+`>sinf>>tenc' box: `+Ae(r)+` -> `+Ae(n)),t.set(n,8))}})})}),e})(e,r)),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,n=this.videoCodec;if(e==null||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=q(e);t||=Qr(r.audio,N),n||=Qr(r.video,P);var i={};r.audio&&r.video?i.audiovideo={container:`video/mp4`,codec:t+`,`+n,initSegment:e,id:`main`}:r.audio?i.audio={container:`audio/mp4`,codec:t,initSegment:e,id:`audio`}:r.video?i.video={container:`video/mp4`,codec:n,initSegment:e,id:`main`}:k.warn(`[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.`),this.initTracks=i},t.remux=function(e,t,n,r,i,a){var o,s,c=this.initPTS,l=this.lastEndTime,u={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};b(l)||(l=this.lastEndTime=i||0);var d=t.samples;if(d==null||!d.length)return u;var f={initPTS:void 0,timescale:1},p=this.initData;if((o=p)!=null&&o.length||(this.generateInitSegment(d),p=this.initData),(s=p)==null||!s.length)return k.warn(`[passthrough-remuxer.ts]: Failed to generate initSegment.`),u;this.emitInitSegment&&=(f.tracks=this.initTracks,!1);var m=(function(e,t){for(var n=0,r=0,i=0,a=G(e,[`moof`,`traf`]),o=0;o<a.length;o++){var s=a[o],c=G(s,[`tfhd`])[0],l=t[W(c,4)];if(l){var u=l.default,d=W(c,0)|u?.flags,f=u?.duration;8&d&&(f=W(c,2&d?12:8));for(var p=l.timescale||9e4,m=G(s,[`trun`]),h=0;h<m.length;h++)!(n=Re(m[h]))&&f&&(n=f*W(m[h],4)),l.type===P?r+=n/p:l.type===N&&(i+=n/p)}}if(r===0&&i===0){for(var g=0,_=G(e,[`sidx`]),v=0;v<_.length;v++){var y=K(_[v]);y!=null&&y.references&&(g+=y.references.reduce(function(e,t){return e+t.info.duration||0},0))}return g}return r||i})(d,p),h=(function(e,t){return G(t,[`moof`,`traf`]).reduce(function(t,n){var r=G(n,[`tfdt`])[0],i=r[0],a=G(n,[`tfhd`]).reduce(function(t,n){var a=e[W(n,4)];if(a){var o=W(r,4);if(i===1){if(o===je)return k.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`),t;o*=je+1,o+=W(r,8)}var s=o/(a.timescale||9e4);if(isFinite(s)&&(t===null||s<t))return s}return t},null);return a!==null&&isFinite(a)&&(t===null||a<t)?a:t},null)})(p,d),g=h===null?i:h;((function(e,t,n,r){if(e===null)return!0;var i=Math.max(r,1),a=t-e.baseTime/e.timescale;return Math.abs(a-n)>i})(c,g,i,m)||f.timescale!==c.timescale&&a)&&(f.initPTS=g-i,c&&c.timescale===1&&k.warn(`Adjusting initPTS by `+(f.initPTS-c.baseTime)),this.initPTS=c={baseTime:f.initPTS,timescale:1});var _=e?g-c.baseTime/c.timescale:l,v=_+m;(function(e,t,n){G(t,[`moof`,`traf`]).forEach(function(t){G(t,[`tfhd`]).forEach(function(r){var i=e[W(r,4)];if(i){var a=i.timescale||9e4;G(t,[`tfdt`]).forEach(function(e){var t=e[0],r=W(e,4);if(t===0)r-=n*a,Ie(e,4,r=Math.max(r,0));else{r*=2**32,r+=W(e,8),r-=n*a,r=Math.max(r,0);var i=Math.floor(r/(je+1)),o=Math.floor(r%(je+1));Ie(e,4,i),Ie(e,8,o)}})}})})})(p,d,c.baseTime/c.timescale),m>0?this.lastEndTime=v:(k.warn(`Duration parsed from mp4 should be greater than zero`),this.resetNextTimestamp());var y=!!p.audio,x=!!p.video,S=``;y&&(S+=`audio`),x&&(S+=`video`);var C={data1:d,startPTS:_,startDTS:_,endPTS:v,endDTS:v,type:S,hasAudio:y,hasVideo:x,nb:1,dropped:0};return u.audio=C.type===`audio`?C:void 0,u.video=C.type===`audio`?void 0:C,u.initSegment=f,u.id3=Kr(n,i,c,c),r.samples.length&&(u.text=qr(r,i,c)),u},e})();function Qr(e,t){var n=e?.codec;return n&&n.length>4?n:n===`hvc1`||n===`hev1`?`hvc1.1.6.L120.90`:n===`av01`?`av01.0.04M.08`:n===`avc1`||t===P?`avc1.42e01e`:`mp4a.40.5`}try{Jr=self.performance.now.bind(self.performance)}catch{k.debug(`Unable to use Performance API on this environment`),Jr=typeof self<`u`&&self.Date.now}var $r=[{demux:_r,remux:Zr},{demux:Ar,remux:Wr},{demux:hr,remux:Wr},{demux:Lr,remux:Wr}],ei=(function(){function e(e,t,n,r,i){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.vendor=r,this.id=i}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,n,r){var i=this,a=n.transmuxing;a.executeStart=Jr();var o=new Uint8Array(e),s=this.currentTransmuxState,c=this.transmuxConfig;r&&(this.currentTransmuxState=r);var l=r||s,u=l.contiguous,d=l.discontinuity,f=l.trackSwitch,p=l.accurateTimeOffset,m=l.timeOffset,h=l.initSegmentChange,g=c.audioCodec,_=c.videoCodec,v=c.defaultInitPts,y=c.duration,b=c.initSegmentData,w=(function(e,t){var n=null;return e.byteLength>0&&t!=null&&t.key!=null&&t.iv!==null&&t.method!=null&&(n=t),n})(o,t);if(w&&w.method===`AES-128`){var T=this.getDecrypter();if(!T.isSync())return this.decryptionPromise=T.webCryptoDecrypt(o,w.key.buffer,w.iv.buffer).then(function(e){var t=i.push(e,null,n);return i.decryptionPromise=null,t}),this.decryptionPromise;var E=T.softwareDecrypt(o,w.key.buffer,w.iv.buffer);if(n.part>-1&&(E=T.flush()),!E)return a.executeEnd=Jr(),ti(n);o=new Uint8Array(E)}var D=this.needsProbing(d,f);if(D){var O=this.configureTransmuxer(o);if(O)return k.warn(`[transmuxer] `+O.message),this.observer.emit(x.ERROR,x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:O,reason:O.message}),a.executeEnd=Jr(),ti(n)}(d||f||h||D)&&this.resetInitSegment(b,g,_,y,t),(d||h||D)&&this.resetInitialTimestamp(v),u||this.resetContiguity();var A=this.transmux(o,w,m,p,n),j=this.currentTransmuxState;return j.contiguous=!0,j.discontinuity=!1,j.trackSwitch=!1,a.executeEnd=Jr(),A},t.flush=function(e){var t=this,n=e.transmuxing;n.executeStart=Jr();var r=this.decrypter,i=this.currentTransmuxState,a=this.decryptionPromise;if(a)return a.then(function(){return t.flush(e)});var o=[],s=i.timeOffset;if(r){var c=r.flush();c&&o.push(this.push(c,null,e))}var l=this.demuxer,u=this.remuxer;if(!l||!u)return n.executeEnd=Jr(),[ti(e)];var d=l.flush(s);return ni(d)?d.then(function(n){return t.flushRemux(o,n,e),o}):(this.flushRemux(o,d,e),o)},t.flushRemux=function(e,t,n){var r=t.audioTrack,i=t.videoTrack,a=t.id3Track,o=t.textTrack,s=this.currentTransmuxState,c=s.accurateTimeOffset,l=s.timeOffset;k.log(`[transmuxer.ts]: Flushed fragment `+n.sn+(n.part>-1?` p: `+n.part:``)+` of level `+n.level);var u=this.remuxer.remux(r,i,a,o,l,c,!0,this.id);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=Jr()},t.resetInitialTimestamp=function(e){var t=this.demuxer,n=this.remuxer;t&&n&&(t.resetTimeStamp(e),n.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,n,r,i){var a=this.demuxer,o=this.remuxer;a&&o&&(a.resetInitSegment(e,t,n,r),o.resetInitSegment(e,t,n,i))},t.destroy=function(){this.demuxer&&=(this.demuxer.destroy(),void 0),this.remuxer&&=(this.remuxer.destroy(),void 0)},t.transmux=function(e,t,n,r,i){return t&&t.method===`SAMPLE-AES`?this.transmuxSampleAes(e,t,n,r,i):this.transmuxUnencrypted(e,n,r,i)},t.transmuxUnencrypted=function(e,t,n,r){var i=this.demuxer.demux(e,t,!1,!this.config.progressive),a=i.audioTrack,o=i.videoTrack,s=i.id3Track,c=i.textTrack;return{remuxResult:this.remuxer.remux(a,o,s,c,t,n,!1,this.id),chunkMeta:r}},t.transmuxSampleAes=function(e,t,n,r,i){var a=this;return this.demuxer.demuxSampleAes(e,t,n).then(function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,n,r,!1,a.id),chunkMeta:i}})},t.configureTransmuxer=function(e){for(var t,n=this.config,r=this.observer,i=this.typeSupported,a=this.vendor,o=0,s=$r.length;o<s;o++)if($r[o].demux.probe(e)){t=$r[o];break}if(!t)return Error(`Failed to find demuxer by probing fragment data`);var c=this.demuxer,l=this.remuxer,u=t.remux,d=t.demux;l&&l instanceof u||(this.remuxer=new u(r,n,i,a)),c&&c instanceof d||(this.demuxer=new d(r,n,i),this.probe=d.probe)},t.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},t.getDecrypter=function(){var e=this.decrypter;return e||=this.decrypter=new Un(this.config),e},e})(),ti=function(e){return{remuxResult:{},chunkMeta:e}};function ni(e){return`then`in e&&e.then instanceof Function}var ri=function(e,t,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i||null},ii=function(e,t,n,r,i,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=a},ai={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount==0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(this._eventsCount===0)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,a),!0;case 6:return u.fn.call(u.context,t,r,i,a,o),!0}for(l=1,c=Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var f,p=u.length;for(l=0;l<p;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,r);break;case 4:u[l].fn.call(u[l].context,t,r,i);break;default:if(!c)for(f=1,c=Array(d-1);f<d;f++)c[f-1]=arguments[f];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(ai);var oi=_(ai.exports);function si(e,t){if(!((n=t.remuxResult).audio||n.video||n.text||n.id3||n.initSegment))return!1;var n,r=[],i=t.remuxResult,a=i.audio,o=i.video;return a&&ci(r,a),o&&ci(r,o),e.postMessage({event:`transmuxComplete`,data:t},r),!0}function ci(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function li(e,t,n){t.reduce(function(t,n){return si(e,n)||t},!1)||e.postMessage({event:`transmuxComplete`,data:t[0]}),e.postMessage({event:`flush`,data:n})}r!==void 0&&r&&(function(e){var t=new oi,n=function(t,n){e.postMessage({event:t,data:n})};t.on(x.FRAG_DECRYPTED,n),t.on(x.ERROR,n);var r=function(){var e=function(e){k[e]=function(t){n(`workerLog`,{logType:e,message:t})}};for(var t in k)e(t)};e.addEventListener(`message`,function(i){var a=i.data;switch(a.cmd){case`init`:var o=JSON.parse(a.config);e.transmuxer=new ei(t,a.typeSupported,o,a.vendor,a.id),O(o.debug,a.id),r(),n(`init`,null);break;case`configure`:e.transmuxer.configure(a.config);break;case`demux`:var s=e.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);ni(s)?(e.transmuxer.async=!0,s.then(function(t){si(e,t)}).catch(function(e){n(x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:e,err:e,reason:`transmuxer-worker push error`})})):(e.transmuxer.async=!1,si(e,s));break;case`flush`:var c=a.chunkMeta,l=e.transmuxer.flush(c);ni(l)||e.transmuxer.async?(ni(l)||(l=Promise.resolve(l)),l.then(function(t){li(e,t,c)}).catch(function(e){n(x.ERROR,{type:S.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:e,err:e,reason:`transmuxer-worker flush error`})})):li(e,l,c)}})})(self);var $=$e()||{isTypeSupported:function(){return!1}},ui=(function(){function e(e,t,r,i){var a=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var o=e.config;this.hls=e,this.id=t,this.useWorker=!!o.enableWorker,this.onTransmuxComplete=r,this.onFlush=i;var s=function(e,t){(t||={}).frag=a.frag,t.id=a.id,e===x.ERROR&&(a.error=t.error),a.hls.trigger(e,t)};this.observer=new oi,this.observer.on(x.FRAG_DECRYPTED,s),this.observer.on(x.ERROR,s);var c,l,u,d,f={mp4:$.isTypeSupported(`video/mp4`),mpeg:$.isTypeSupported(`audio/mpeg`),mp3:$.isTypeSupported(`audio/mp4; codecs="mp3"`)},p=navigator.vendor;if(!this.useWorker||typeof Worker>`u`||(o.workerPath,0))this.transmuxer=new ei(this.observer,f,o,p,t);else try{o.workerPath?(k.log(`loading Web Worker `+o.workerPath+` for "`+t+`"`),this.workerContext=(u=o.workerPath,d=new self.URL(u,self.location.href).href,{worker:new self.Worker(d),scriptURL:d})):(k.log(`injecting Web Worker for "`+t+`"`),this.workerContext=(c=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(`+n.toString()+`)(true);`],{type:`text/javascript`}),l=self.URL.createObjectURL(c),{worker:new self.Worker(l),objectURL:l})),this.onwmsg=function(e){return a.onWorkerMessage(e)};var m=this.workerContext.worker;m.addEventListener(`message`,this.onwmsg),m.onerror=function(e){var n=Error(e.message+` (`+e.filename+`:`+e.lineno+`)`);o.enableWorker=!1,k.warn(`Error in "`+t+`" Web Worker, fallback to inline`),a.hls.trigger(x.ERROR,{type:S.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,fatal:!1,event:`demuxerWorker`,error:n})},m.postMessage({cmd:`init`,typeSupported:f,vendor:p,id:t,config:JSON.stringify(o)})}catch(e){k.warn(`Error setting up "`+t+`" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new ei(this.observer,f,o,p,t)}}var t=e.prototype;return t.resetWorker=function(){if(this.workerContext){var e=this.workerContext,t=e.worker,n=e.objectURL;n&&self.URL.revokeObjectURL(n),t.removeEventListener(`message`,this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}},t.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},t.push=function(e,t,n,r,i,a,o,s,c,l){var u=this;c.transmuxing.start=self.performance.now();var d=this.transmuxer,f=a?a.start:i.start,p=i.decryptdata,m=this.frag,h=!(m&&i.cc===m.cc),g=!(m&&c.level===m.level),_=m?c.sn-m.sn:-1,v=this.part?c.part-this.part.index:-1,y=_===0&&c.id>1&&c.id===m?.stats.chunkCount,b=!g&&(_===1||_===0&&(v===1||y&&v<=0)),x=self.performance.now();(g||_||i.stats.parsing.start===0)&&(i.stats.parsing.start=x),!a||!v&&b||(a.stats.parsing.start=x);var S=!(m&&i.initSegment?.url===m.initSegment?.url),C=new ii(h,b,s,g,f,S);if(!b||h||S){k.log(`[transmuxer-interface, `+i.type+`]: Starting new transmux session for sn: `+c.sn+` p: `+c.part+` level: `+c.level+` id: `+c.id+`
|
|
3
3
|
discontinuity: `+h+`
|
|
4
4
|
trackSwitch: `+g+`
|