@mux/mux-player 0.1.0-beta.21

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.
Files changed (118) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/LICENSE +9 -0
  3. package/README.md +231 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +87 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +161 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +196 -0
  12. package/coverage/lcov-report/src/dialog.ts.html +247 -0
  13. package/coverage/lcov-report/src/errors.ts.html +574 -0
  14. package/coverage/lcov-report/src/helpers.ts.html +478 -0
  15. package/coverage/lcov-report/src/html.ts.html +580 -0
  16. package/coverage/lcov-report/src/index.html +251 -0
  17. package/coverage/lcov-report/src/index.ts.html +2941 -0
  18. package/coverage/lcov-report/src/logger.ts.html +163 -0
  19. package/coverage/lcov-report/src/media-chrome/dialog.ts.html +661 -0
  20. package/coverage/lcov-report/src/media-chrome/index.html +131 -0
  21. package/coverage/lcov-report/src/media-chrome/time-display.ts.html +295 -0
  22. package/coverage/lcov-report/src/media-theme-mux/icons/airplay.svg.html +109 -0
  23. package/coverage/lcov-report/src/media-theme-mux/icons/captions-off.svg.html +100 -0
  24. package/coverage/lcov-report/src/media-theme-mux/icons/captions-on.svg.html +100 -0
  25. package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-enter.svg.html +100 -0
  26. package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-exit.svg.html +100 -0
  27. package/coverage/lcov-report/src/media-theme-mux/icons/index.html +326 -0
  28. package/coverage/lcov-report/src/media-theme-mux/icons/pause.svg.html +100 -0
  29. package/coverage/lcov-report/src/media-theme-mux/icons/pip-enter.svg.html +100 -0
  30. package/coverage/lcov-report/src/media-theme-mux/icons/pip-exit.svg.html +100 -0
  31. package/coverage/lcov-report/src/media-theme-mux/icons/play.svg.html +100 -0
  32. package/coverage/lcov-report/src/media-theme-mux/icons/seek-backward.svg.html +124 -0
  33. package/coverage/lcov-report/src/media-theme-mux/icons/seek-forward.svg.html +124 -0
  34. package/coverage/lcov-report/src/media-theme-mux/icons/volume-high.svg.html +103 -0
  35. package/coverage/lcov-report/src/media-theme-mux/icons/volume-low.svg.html +103 -0
  36. package/coverage/lcov-report/src/media-theme-mux/icons/volume-medium.svg.html +103 -0
  37. package/coverage/lcov-report/src/media-theme-mux/icons/volume-off.svg.html +103 -0
  38. package/coverage/lcov-report/src/media-theme-mux/icons.ts.html +184 -0
  39. package/coverage/lcov-report/src/media-theme-mux/index.html +146 -0
  40. package/coverage/lcov-report/src/media-theme-mux/media-theme-mux.ts.html +1279 -0
  41. package/coverage/lcov-report/src/media-theme-mux/styles.css.html +586 -0
  42. package/coverage/lcov-report/src/styles.css.html +211 -0
  43. package/coverage/lcov-report/src/template.ts.html +463 -0
  44. package/coverage/lcov-report/src/utils.ts.html +385 -0
  45. package/coverage/lcov-report/src/video-api.ts.html +979 -0
  46. package/coverage/lcov.info +4058 -0
  47. package/dist/index.cjs.js +1432 -0
  48. package/dist/index.mjs +709 -0
  49. package/dist/mux-player.js +1478 -0
  50. package/dist/mux-player.mjs +1478 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -0
  52. package/dist/types/dialog.d.ts +6 -0
  53. package/dist/types/errors.d.ts +6 -0
  54. package/dist/types/helpers.d.ts +26 -0
  55. package/dist/types/html.d.ts +18 -0
  56. package/dist/types/index.d.ts +199 -0
  57. package/dist/types/logger.d.ts +5 -0
  58. package/dist/types/media-chrome/dialog.d.ts +12 -0
  59. package/dist/types/media-chrome/time-display.d.ts +9 -0
  60. package/dist/types/media-theme-mux/icons.d.ts +15 -0
  61. package/dist/types/media-theme-mux/media-theme-mux.d.ts +29 -0
  62. package/dist/types/template.d.ts +5 -0
  63. package/dist/types/utils.d.ts +10 -0
  64. package/dist/types/video-api.d.ts +64 -0
  65. package/dist/types-ts3.4/dialog.d.ts +6 -0
  66. package/dist/types-ts3.4/errors.d.ts +6 -0
  67. package/dist/types-ts3.4/helpers.d.ts +26 -0
  68. package/dist/types-ts3.4/html.d.ts +18 -0
  69. package/dist/types-ts3.4/index.d.ts +180 -0
  70. package/dist/types-ts3.4/logger.d.ts +5 -0
  71. package/dist/types-ts3.4/media-chrome/dialog.d.ts +12 -0
  72. package/dist/types-ts3.4/media-chrome/time-display.d.ts +9 -0
  73. package/dist/types-ts3.4/media-theme-mux/icons.d.ts +15 -0
  74. package/dist/types-ts3.4/media-theme-mux/media-theme-mux.d.ts +29 -0
  75. package/dist/types-ts3.4/template.d.ts +5 -0
  76. package/dist/types-ts3.4/utils.d.ts +10 -0
  77. package/dist/types-ts3.4/video-api.d.ts +53 -0
  78. package/lang/en.json +32 -0
  79. package/lang/nl.json +31 -0
  80. package/package.json +107 -0
  81. package/src/dialog.ts +54 -0
  82. package/src/errors.ts +163 -0
  83. package/src/helpers.ts +131 -0
  84. package/src/html.ts +165 -0
  85. package/src/index.ts +952 -0
  86. package/src/logger.ts +26 -0
  87. package/src/media-chrome/dialog.ts +192 -0
  88. package/src/media-chrome/time-display.ts +70 -0
  89. package/src/media-theme-mux/icons/airplay.svg +8 -0
  90. package/src/media-theme-mux/icons/captions-off.svg +5 -0
  91. package/src/media-theme-mux/icons/captions-on.svg +5 -0
  92. package/src/media-theme-mux/icons/fullscreen-enter.svg +5 -0
  93. package/src/media-theme-mux/icons/fullscreen-exit.svg +5 -0
  94. package/src/media-theme-mux/icons/pause.svg +5 -0
  95. package/src/media-theme-mux/icons/pip-enter.svg +5 -0
  96. package/src/media-theme-mux/icons/pip-exit.svg +5 -0
  97. package/src/media-theme-mux/icons/play.svg +5 -0
  98. package/src/media-theme-mux/icons/seek-backward.svg +13 -0
  99. package/src/media-theme-mux/icons/seek-forward.svg +13 -0
  100. package/src/media-theme-mux/icons/volume-high.svg +6 -0
  101. package/src/media-theme-mux/icons/volume-low.svg +6 -0
  102. package/src/media-theme-mux/icons/volume-medium.svg +6 -0
  103. package/src/media-theme-mux/icons/volume-off.svg +6 -0
  104. package/src/media-theme-mux/icons.ts +33 -0
  105. package/src/media-theme-mux/media-theme-mux.ts +398 -0
  106. package/src/media-theme-mux/styles.css +167 -0
  107. package/src/styles.css +42 -0
  108. package/src/template.ts +126 -0
  109. package/src/types.d.ts +52 -0
  110. package/src/utils.ts +100 -0
  111. package/src/video-api.ts +298 -0
  112. package/test/errors.test.js +169 -0
  113. package/test/helpers.test.js +78 -0
  114. package/test/player.test.js +696 -0
  115. package/test/template.test.js +70 -0
  116. package/test/utils.test.js +21 -0
  117. package/test/web-test-runner.config.mjs +29 -0
  118. package/tsconfig.json +21 -0
@@ -0,0 +1,1478 @@
1
+ (()=>{var fo=Object.create;var si=Object.defineProperty;var ho=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var mo=Object.getPrototypeOf,go=Object.prototype.hasOwnProperty;var po=h=>si(h,"__esModule",{value:!0});var sn=(h,e)=>()=>(e||h((e={exports:{}}).exports,e),e.exports);var Eo=(h,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of vo(e))!go.call(h,l)&&l!=="default"&&si(h,l,{get:()=>e[l],enumerable:!(t=ho(e,l))||t.enumerable});return h},mr=h=>Eo(po(si(h!=null?fo(mo(h)):{},"default",h&&h.__esModule&&"default"in h?{get:()=>h.default,enumerable:!0}:{value:h,enumerable:!0})),h);var oi=(h,e,t)=>{if(!e.has(h))throw TypeError("Cannot "+t)};var Ye=(h,e,t)=>(oi(h,e,"read from private field"),t?t.call(h):e.get(h)),je=(h,e,t)=>{if(e.has(h))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(h):e.set(h,t)},Et=(h,e,t,l)=>(oi(h,e,"write to private field"),l?l.call(h,t):e.set(h,t),t);var Ce=(h,e,t)=>(oi(h,e,"access private method"),t);var on=sn((gr,li)=>{(function(){var h=!1;(function(e,t){typeof gr=="object"&&typeof li=="object"?li.exports=t():typeof h=="function"&&h.amd?h("mux",[],t):typeof gr=="object"?gr.mux=t():e.mux=t()})(typeof self!="undefined"?self:this,function(){return function(e){function t(n){if(l[n])return l[n].exports;var v=l[n]={i:n,l:!1,exports:{}};return e[n].call(v.exports,v,v.exports,t),v.l=!0,v.exports}var l={};return t.m=e,t.c=l,t.d=function(n,v,R){t.o(n,v)||Object.defineProperty(n,v,{configurable:!1,enumerable:!0,get:R})},t.n=function(n){var v=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(v,"a",v),v},t.o=function(n,v){return Object.prototype.hasOwnProperty.call(n,v)},t.p="",t(t.s=18)}([function(e,t,l){(function(n){var v;v=typeof window!="undefined"?window:n!==void 0?n:typeof self!="undefined"?self:{},e.exports=v}).call(t,l(20))},function(e,t){function l(k,N,B){switch(B.length){case 0:return k.call(N);case 1:return k.call(N,B[0]);case 2:return k.call(N,B[0],B[1]);case 3:return k.call(N,B[0],B[1],B[2])}return k.apply(N,B)}function n(k,N){for(var B=-1,K=Array(k);++B<k;)K[B]=N(B);return K}function v(k,N){var B=w(k)||b(k)?n(k.length,String):[],K=B.length,W=!!K;for(var F in k)!N&&!c.call(k,F)||W&&(F=="length"||E(F,K))||B.push(F);return B}function R(k,N,B){var K=k[N];c.call(k,N)&&D(K,B)&&(B!==void 0||N in k)||(k[N]=B)}function T(k){if(!M(k))return C(k);var N=[];for(var B in Object(k))c.call(k,B)&&B!="constructor"&&N.push(B);return N}function L(k,N){return N=O(N===void 0?k.length-1:N,0),function(){for(var B=arguments,K=-1,W=O(B.length-N,0),F=Array(W);++K<W;)F[K]=B[N+K];K=-1;for(var H=Array(N+1);++K<N;)H[K]=B[K];return H[N]=F,l(k,this,H)}}function _(k,N,B,K){B||(B={});for(var W=-1,F=N.length;++W<F;){var H=N[W],Y=K?K(B[H],k[H],H,B,k):void 0;R(B,H,Y===void 0?k[H]:Y)}return B}function E(k,N){return!!(N=N==null?o:N)&&(typeof k=="number"||g.test(k))&&k>-1&&k%1==0&&k<N}function I(k,N,B){if(!i(B))return!1;var K=typeof N;return!!(K=="number"?A(B)&&E(N,B.length):K=="string"&&N in B)&&D(B[N],k)}function M(k){var N=k&&k.constructor;return k===(typeof N=="function"&&N.prototype||f)}function D(k,N){return k===N||k!==k&&N!==N}function b(k){return u(k)&&c.call(k,"callee")&&(!S.call(k,"callee")||x.call(k)==y)}function A(k){return k!=null&&s(k.length)&&!r(k)}function u(k){return a(k)&&A(k)}function r(k){var N=i(k)?x.call(k):"";return N==p||N==m}function s(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=o}function i(k){var N=typeof k;return!!k&&(N=="object"||N=="function")}function a(k){return!!k&&typeof k=="object"}function d(k){return A(k)?v(k):T(k)}var o=9007199254740991,y="[object Arguments]",p="[object Function]",m="[object GeneratorFunction]",g=/^(?:0|[1-9]\d*)$/,f=Object.prototype,c=f.hasOwnProperty,x=f.toString,S=f.propertyIsEnumerable,C=function(k,N){return function(B){return k(N(B))}}(Object.keys,Object),O=Math.max,P=!S.call({valueOf:1},"valueOf"),w=Array.isArray,U=function(k){return L(function(N,B){var K=-1,W=B.length,F=W>1?B[W-1]:void 0,H=W>2?B[2]:void 0;for(F=k.length>3&&typeof F=="function"?(W--,F):void 0,H&&I(B[0],B[1],H)&&(F=W<3?void 0:F,W=1),N=Object(N);++K<W;){var Y=B[K];Y&&k(N,Y,K,F)}return N})}(function(k,N){if(P||M(N)||A(N))return void _(N,d(N),k);for(var B in N)c.call(N,B)&&R(k,B,N[B])});e.exports=U},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(0),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R={};R.now=function(){var T=v.default.performance,L=T&&T.timing;return L&&typeof L.navigationStart=="number"&&typeof T.now=="function"?L.navigationStart+T.now():Date.now()},t.default=R},function(e,t,l){"use strict";function n(v,R,T){T=T===void 0?1:T,v[R]=v[R]||0,v[R]+=T}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(21),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=v.default.methodFactory;v.default.methodFactory=function(T,L,_){var E=R(T,L,_);return function(){for(var I=["[mux]"],M=0;M<arguments.length;M++)I.push(arguments[M]);E.apply(void 0,I)}},v.default.setLevel(v.default.getLevel()),t.default=v.default},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(T){return R(T)[0]},v=function(T){return R(T)[1]},R=function(T){if(typeof T!="string"||T==="")return["localhost"];var L=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,_=T.match(L)||[],E=_[4],I=void 0;return E&&(I=(E.match(/[^\.]+\.[^\.]+$/)||[])[0]),[E,I]};t.extractHostnameAndDomain=R,t.extractHostname=n,t.extractDomain=v},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(R){var T=16*Math.random()|0;return(R==="x"?T:3&T|8).toString(16)})},v=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)};t.generateUUID=n,t.generateShortID=v},function(e,t,l){"use strict";function n(R){R=R||"";var T={};return R.trim().split(/[\r\n]+/).forEach(function(L){if(L){var _=L.split(": "),E=_.shift();E&&(v.indexOf(E.toLowerCase())>=0||E.toLowerCase().indexOf("x-litix-")===0)&&(T[E]=_.join(": "))}}),T}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=["x-cdn","content-type"]},function(e,t,l){"use strict";var n=SyntaxError,v=Function,R=TypeError,T=function(c){try{return v('"use strict"; return ('+c+").constructor;")()}catch{}},L=Object.getOwnPropertyDescriptor;if(L)try{L({},"")}catch{L=null}var _=function(){throw new R},E=L?function(){try{return arguments.callee,_}catch{try{return L(arguments,"callee").get}catch{return _}}}():_,I=l(43)(),M=Object.getPrototypeOf||function(c){return c.__proto__},D={},b=typeof Uint8Array=="undefined"?void 0:M(Uint8Array),A={"%AggregateError%":typeof AggregateError=="undefined"?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":I?M([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics=="undefined"?void 0:Atomics,"%BigInt%":typeof BigInt=="undefined"?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?void 0:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?void 0:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?void 0:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array=="undefined"?void 0:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?void 0:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I?M(M([][Symbol.iterator]())):void 0,"%JSON%":typeof JSON=="object"?JSON:void 0,"%Map%":typeof Map=="undefined"?void 0:Map,"%MapIteratorPrototype%":typeof Map!="undefined"&&I?M(new Map()[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?void 0:Promise,"%Proxy%":typeof Proxy=="undefined"?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?void 0:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?void 0:Set,"%SetIteratorPrototype%":typeof Set!="undefined"&&I?M(new Set()[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I?M(""[Symbol.iterator]()):void 0,"%Symbol%":I?Symbol:void 0,"%SyntaxError%":n,"%ThrowTypeError%":E,"%TypedArray%":b,"%TypeError%":R,"%Uint8Array%":typeof Uint8Array=="undefined"?void 0:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?void 0:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?void 0:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?void 0:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?void 0:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?void 0:WeakSet},u=function c(x){var S;if(x==="%AsyncFunction%")S=T("async function () {}");else if(x==="%GeneratorFunction%")S=T("function* () {}");else if(x==="%AsyncGeneratorFunction%")S=T("async function* () {}");else if(x==="%AsyncGenerator%"){var C=c("%AsyncGeneratorFunction%");C&&(S=C.prototype)}else if(x==="%AsyncIteratorPrototype%"){var O=c("%AsyncGenerator%");O&&(S=M(O.prototype))}return A[x]=S,S},r={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=l(9),i=l(46),a=s.call(Function.call,Array.prototype.concat),d=s.call(Function.apply,Array.prototype.splice),o=s.call(Function.call,String.prototype.replace),y=s.call(Function.call,String.prototype.slice),p=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,m=/\\(\\)?/g,g=function(c){var x=y(c,0,1),S=y(c,-1);if(x==="%"&&S!=="%")throw new n("invalid intrinsic syntax, expected closing `%`");if(S==="%"&&x!=="%")throw new n("invalid intrinsic syntax, expected opening `%`");var C=[];return o(c,p,function(O,P,w,U){C[C.length]=w?o(U,m,"$1"):P||O}),C},f=function(c,x){var S,C=c;if(i(r,C)&&(S=r[C],C="%"+S[0]+"%"),i(A,C)){var O=A[C];if(O===D&&(O=u(C)),O===void 0&&!x)throw new R("intrinsic "+c+" exists, but is not available. Please file an issue!");return{alias:S,name:C,value:O}}throw new n("intrinsic "+c+" does not exist!")};e.exports=function(c,x){if(typeof c!="string"||c.length===0)throw new R("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof x!="boolean")throw new R('"allowMissing" argument must be a boolean');var S=g(c),C=S.length>0?S[0]:"",O=f("%"+C+"%",x),P=O.name,w=O.value,U=!1,k=O.alias;k&&(C=k[0],d(S,a([0,1],k)));for(var N=1,B=!0;N<S.length;N+=1){var K=S[N],W=y(K,0,1),F=y(K,-1);if((W==='"'||W==="'"||W==="`"||F==='"'||F==="'"||F==="`")&&W!==F)throw new n("property names with quotes must have matching quotes");if(K!=="constructor"&&B||(U=!0),C+="."+K,P="%"+C+"%",i(A,P))w=A[P];else if(w!=null){if(!(K in w)){if(!x)throw new R("base intrinsic for "+c+" exists, but the property is not available.");return}if(L&&N+1>=S.length){var H=L(w,K);B=!!H,w=B&&"get"in H&&!("originalValue"in H.get)?H.get:w[K]}else B=i(w,K),w=w[K];B&&!U&&(A[P]=w)}}return w}},function(e,t,l){"use strict";var n=l(45);e.exports=Function.prototype.bind||n},function(e,t,l){"use strict";var n=String.prototype.replace,v=/%20/g,R={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports={default:R.RFC3986,formatters:{RFC1738:function(T){return n.call(T,v,"+")},RFC3986:function(T){return String(T)}},RFC1738:R.RFC1738,RFC3986:R.RFC3986}},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findMediaElement=t.getMuxPlayerId=void 0;var n=l(6),v=function(T){return T&&T.nodeName!==void 0?(T.muxId||(T.muxId=T.id||(0,n.generateShortID)()),T.muxId):T},R=function(T){var L=void 0;return T&&T.nodeName!==void 0?(L=T,T=v(L)):L=document.querySelector(T),[L,T,L&&L.nodeName?L.nodeName.toLowerCase():""]};t.getMuxPlayerId=v,t.findMediaElement=R},function(e,t,l){"use strict";function n(){return(R.default.doNotTrack||R.default.navigator&&(R.default.navigator.doNotTrack||R.default.navigator.msDoNotTrack))==="1"}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=l(0),R=function(T){return T&&T.__esModule?T:{default:T}}(v)},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(0),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R={};R.exists=function(){var T=v.default.performance;return(T&&T.timing)!==void 0},R.domContentLoadedEventEnd=function(){var T=v.default.performance,L=T&&T.timing;return L&&L.domContentLoadedEventEnd},R.navigationStart=function(){var T=v.default.performance,L=T&&T.timing;return L&&L.navigationStart},t.default=R},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(v){var R={};for(var T in v){var L=v[T];L["DATA-ID"].search("io.litix.data.")!==-1&&(R[L["DATA-ID"].replace("io.litix.data.","")]=L.VALUE)}return R};t.default=n},function(e,t,l){"use strict";var n=l(41),v=l(51),R=l(10);e.exports={formats:R,parse:v,stringify:n}},function(e,t,l){"use strict";var n=l(10),v=Object.prototype.hasOwnProperty,R=Array.isArray,T=function(){for(var i=[],a=0;a<256;++a)i.push("%"+((a<16?"0":"")+a.toString(16)).toUpperCase());return i}(),L=function(i){for(;i.length>1;){var a=i.pop(),d=a.obj[a.prop];if(R(d)){for(var o=[],y=0;y<d.length;++y)d[y]!==void 0&&o.push(d[y]);a.obj[a.prop]=o}}},_=function(i,a){for(var d=a&&a.plainObjects?Object.create(null):{},o=0;o<i.length;++o)i[o]!==void 0&&(d[o]=i[o]);return d},E=function i(a,d,o){if(!d)return a;if(typeof d!="object"){if(R(a))a.push(d);else{if(!a||typeof a!="object")return[a,d];(o&&(o.plainObjects||o.allowPrototypes)||!v.call(Object.prototype,d))&&(a[d]=!0)}return a}if(!a||typeof a!="object")return[a].concat(d);var y=a;return R(a)&&!R(d)&&(y=_(a,o)),R(a)&&R(d)?(d.forEach(function(p,m){if(v.call(a,m)){var g=a[m];g&&typeof g=="object"&&p&&typeof p=="object"?a[m]=i(g,p,o):a.push(p)}else a[m]=p}),a):Object.keys(d).reduce(function(p,m){var g=d[m];return v.call(p,m)?p[m]=i(p[m],g,o):p[m]=g,p},y)},I=function(i,a){return Object.keys(a).reduce(function(d,o){return d[o]=a[o],d},i)},M=function(i,a,d){var o=i.replace(/\+/g," ");if(d==="iso-8859-1")return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch{return o}},D=function(i,a,d,o,y){if(i.length===0)return i;var p=i;if(typeof i=="symbol"?p=Symbol.prototype.toString.call(i):typeof i!="string"&&(p=String(i)),d==="iso-8859-1")return escape(p).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var m="",g=0;g<p.length;++g){var f=p.charCodeAt(g);f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||y===n.RFC1738&&(f===40||f===41)?m+=p.charAt(g):f<128?m+=T[f]:f<2048?m+=T[192|f>>6]+T[128|63&f]:f<55296||f>=57344?m+=T[224|f>>12]+T[128|f>>6&63]+T[128|63&f]:(g+=1,f=65536+((1023&f)<<10|1023&p.charCodeAt(g)),m+=T[240|f>>18]+T[128|f>>12&63]+T[128|f>>6&63]+T[128|63&f])}return m},b=function(i){for(var a=[{obj:{o:i},prop:"o"}],d=[],o=0;o<a.length;++o)for(var y=a[o],p=y.obj[y.prop],m=Object.keys(p),g=0;g<m.length;++g){var f=m[g],c=p[f];typeof c=="object"&&c!==null&&d.indexOf(c)===-1&&(a.push({obj:p,prop:f}),d.push(c))}return L(a),i},A=function(i){return Object.prototype.toString.call(i)==="[object RegExp]"},u=function(i){return!(!i||typeof i!="object")&&!!(i.constructor&&i.constructor.isBuffer&&i.constructor.isBuffer(i))},r=function(i,a){return[].concat(i,a)},s=function(i,a){if(R(i)){for(var d=[],o=0;o<i.length;o+=1)d.push(a(i[o]));return d}return a(i)};e.exports={arrayToObject:_,assign:I,combine:r,compact:b,decode:M,encode:D,isBuffer:u,isRegExp:A,maybeMap:s,merge:E}},function(e,t,l){"use strict";function n(A){return A&&A.__esModule?A:{default:A}}function v(A){var u={};for(var r in A)A.hasOwnProperty(r)&&(u[A[r]]=r);return u}function R(A){var u={},r={};return Object.keys(A).forEach(function(s){var i=!1;if(A.hasOwnProperty(s)&&A[s]!==void 0){var a=s.split("_"),d=a[0],o=M[d];o||(L.default.info("Data key word `"+a[0]+"` not expected in "+s),o=d+"_"),a.splice(1).forEach(function(y){y==="url"&&(i=!0),b[y]?o+=b[y]:Number(y)&&Math.floor(Number(y))===Number(y)?o+=y:(L.default.info("Data key word `"+y+"` not expected in "+s),o+="_"+y+"_")}),i?r[o]=A[s]:u[o]=A[s]}}),(0,E.default)(u,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=R;var T=l(4),L=n(T),_=l(1),E=n(_),I={a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"},M=v(I),D={ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",ca:"cached",cb:"cancel",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ep:"experiments",fi:"first",fm:"family",ft:"format",fq:"frequency",fr:"frame",fs:"fullscreen",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"},b=v(D)},function(e,t,l){"use strict";e.exports=l(19).default},function(e,t,l){"use strict";function n(m){return m&&m.__esModule?m:{default:m}}Object.defineProperty(t,"__esModule",{value:!0});var v=function(){function m(g,f){var c=[],x=!0,S=!1,C=void 0;try{for(var O,P=g[Symbol.iterator]();!(x=(O=P.next()).done)&&(c.push(O.value),!f||c.length!==f);x=!0);}catch(w){S=!0,C=w}finally{try{!x&&P.return&&P.return()}finally{if(S)throw C}}return c}return function(g,f){if(Array.isArray(g))return g;if(Symbol.iterator in Object(g))return m(g,f);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=l(0),T=n(R),L=l(11),_=l(4),E=n(_),I=l(12),M=n(I),D=l(2),b=n(D),A=l(22),u=n(A),r=l(58),s=n(r),i=l(59),a=n(i),d=l(64),o=n(d),y={},p=function m(g){var f=arguments;typeof g=="string"?m.hasOwnProperty(g)?T.default.setTimeout(function(){f=Array.prototype.splice.call(f,1),m[g].apply(null,f)},0):E.default.warn("`"+g+"` is an unknown task"):typeof g=="function"?T.default.setTimeout(function(){g(m)},0):E.default.warn("`"+g+"` is invalid.")};p.loaded=b.default.now(),p.NAME="mux-embed",p.VERSION="4.8.0",p.API_VERSION="2.1",p.PLAYER_TRACKED=!1,p.monitor=function(m,g){return(0,s.default)(p,m,g)},p.destroyMonitor=function(m){var g=(0,L.findMediaElement)(m),f=v(g,1),c=f[0];c&&c.mux&&typeof c.mux.destroy=="function"?c.mux.destroy():E.default.error("A video element monitor for `"+m+"` has not been initialized via `mux.monitor`.")},p.addHLSJS=function(m,g){var f=(0,L.getMuxPlayerId)(m);y[f]?y[f].addHLSJS(g):E.default.error("A monitor for `"+f+"` has not been initialized.")},p.addDashJS=function(m,g){var f=(0,L.getMuxPlayerId)(m);y[f]?y[f].addDashJS(g):E.default.error("A monitor for `"+f+"` has not been initialized.")},p.removeHLSJS=function(m){var g=(0,L.getMuxPlayerId)(m);y[g]?y[g].removeHLSJS():E.default.error("A monitor for `"+g+"` has not been initialized.")},p.removeDashJS=function(m){var g=(0,L.getMuxPlayerId)(m);y[g]?y[g].removeDashJS():E.default.error("A monitor for `"+g+"` has not been initialized.")},p.init=function(m,g){(0,M.default)()&&g&&g.respectDoNotTrack&&E.default.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var f=(0,L.getMuxPlayerId)(m);y[f]=new u.default(p,f,g)},p.emit=function(m,g,f){var c=(0,L.getMuxPlayerId)(m);y[c]?(y[c].emit(g,f),g==="destroy"&&delete y[c]):E.default.error("A monitor for `"+c+"` has not been initialized.")},T.default!==void 0&&typeof T.default.addEventListener=="function"&&T.default.addEventListener("pagehide",function(m){m.persisted||(p.WINDOW_UNLOADING=!0)},!1),p.checkDoNotTrack=M.default,p.log=E.default,p.utils=a.default,p.events=o.default,t.default=p},function(e,t){var l;l=function(){return this}();try{l=l||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(l=window)}e.exports=l},function(e,t,l){var n,v;(function(R,T){"use strict";n=T,(v=typeof n=="function"?n.call(t,l,t,e):n)!==void 0&&(e.exports=v)})(0,function(){"use strict";function R(a,d){var o=a[d];if(typeof o.bind=="function")return o.bind(a);try{return Function.prototype.bind.call(o,a)}catch{return function(){return Function.prototype.apply.apply(o,[a,arguments])}}}function T(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function L(a){return a==="debug"&&(a="log"),typeof console!==b&&(a==="trace"&&A?T:console[a]!==void 0?R(console,a):console.log!==void 0?R(console,"log"):D)}function _(a,d){for(var o=0;o<u.length;o++){var y=u[o];this[y]=o<a?D:this.methodFactory(y,a,d)}this.log=this.debug}function E(a,d,o){return function(){typeof console!==b&&(_.call(this,d,o),this[a].apply(this,arguments))}}function I(a,d,o){return L(a)||E.apply(this,arguments)}function M(a,d,o){function y(S){var C=(u[S]||"silent").toUpperCase();if(typeof window!==b&&c){try{return void(window.localStorage[c]=C)}catch{}try{window.document.cookie=encodeURIComponent(c)+"="+C+";"}catch{}}}function p(){var S;if(typeof window!==b&&c){try{S=window.localStorage[c]}catch{}if(typeof S===b)try{var C=window.document.cookie,O=C.indexOf(encodeURIComponent(c)+"=");O!==-1&&(S=/^([^;]+)/.exec(C.slice(O))[1])}catch{}return f.levels[S]===void 0&&(S=void 0),S}}function m(){if(typeof window!==b&&c){try{return void window.localStorage.removeItem(c)}catch{}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}var g,f=this;d=d==null?"WARN":d;var c="loglevel";typeof a=="string"?c+=":"+a:typeof a=="symbol"&&(c=void 0),f.name=a,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=o||I,f.getLevel=function(){return g},f.setLevel=function(S,C){if(typeof S=="string"&&f.levels[S.toUpperCase()]!==void 0&&(S=f.levels[S.toUpperCase()]),!(typeof S=="number"&&S>=0&&S<=f.levels.SILENT))throw"log.setLevel() called with invalid level: "+S;if(g=S,C!==!1&&y(S),_.call(f,S,a),typeof console===b&&S<f.levels.SILENT)return"No console available for logging"},f.setDefaultLevel=function(S){d=S,p()||f.setLevel(S,!1)},f.resetLevel=function(){f.setLevel(d,!1),m()},f.enableAll=function(S){f.setLevel(f.levels.TRACE,S)},f.disableAll=function(S){f.setLevel(f.levels.SILENT,S)};var x=p();x==null&&(x=d),f.setLevel(x,!1)}var D=function(){},b="undefined",A=typeof window!==b&&typeof window.navigator!==b&&/Trident\/|MSIE /.test(window.navigator.userAgent),u=["trace","debug","info","warn","error"],r=new M,s={};r.getLogger=function(a){if(typeof a!="symbol"&&typeof a!="string"||a==="")throw new TypeError("You must supply a name when creating a logger.");var d=s[a];return d||(d=s[a]=new M(a,r.getLevel(),r.methodFactory)),d};var i=typeof window!==b?window.log:void 0;return r.noConflict=function(){return typeof window!==b&&window.log===r&&(window.log=i),r},r.getLoggers=function(){return s},r.default=r,r})},function(e,t,l){"use strict";function n(Q){return Q&&Q.__esModule?Q:{default:Q}}Object.defineProperty(t,"__esModule",{value:!0});var v=function(){function Q(te,ee){var he=[],_e=!0,Ee=!1,be=void 0;try{for(var Ie,Ne=te[Symbol.iterator]();!(_e=(Ie=Ne.next()).done)&&(he.push(Ie.value),!ee||he.length!==ee);_e=!0);}catch(ye){Ee=!0,be=ye}finally{try{!_e&&Ne.return&&Ne.return()}finally{if(Ee)throw be}}return he}return function(te,ee){if(Array.isArray(te))return te;if(Symbol.iterator in Object(te))return Q(te,ee);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=l(4),T=n(R),L=l(1),_=n(L),E=l(6),I=l(5),M=l(0),D=n(M),b=l(13),A=n(b),u=l(3),r=n(u),s=l(23),i=l(24),a=l(25),d=n(a),o=l(26),y=n(o),p=l(27),m=n(p),g=l(28),f=n(g),c=l(29),x=n(c),S=l(30),C=n(S),O=l(31),P=n(O),w=l(32),U=n(w),k=l(33),N=n(k),B=l(34),K=n(B),W=l(35),F=n(W),H=l(36),Y=n(H),$=l(37),Z=n($),q=l(38),oe=n(q),X=l(39),ie=n(X),fe=l(57),ue=n(fe),Se=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],re=function(Q,te,ee){var he=this;this.DOM_CONTENT_LOADED_EVENT_END=A.default.domContentLoadedEventEnd(),this.NAVIGATION_START=A.default.navigationStart();var _e={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(ye){return ye}};this.mux=Q,this.id=te,ee=(0,_.default)(_e,ee),ee.data=ee.data||{},ee.data.property_key&&(ee.data.env_key=ee.data.property_key,delete ee.data.property_key),T.default.setLevel(ee.debug?"debug":"warn"),this.getPlayheadTime=ee.getPlayheadTime,this.getStateData=ee.getStateData||function(){},this.getAdData=ee.getAdData||function(){},this.minimumRebufferDuration=ee.minimumRebufferDuration,this.sustainedRebufferThreshold=ee.sustainedRebufferThreshold,this.playbackHeartbeatTime=ee.playbackHeartbeatTime,this.disableRebufferTracking=ee.disableRebufferTracking,this.disableRebufferTracking&&this.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),this.errorTranslator=ee.errorTranslator,this.playbackEventDispatcher=new ie.default(Q,ee.data.env_key,ee),this.data={player_instance_id:(0,E.generateUUID)(),mux_sample_rate:ee.sampleRate,beacon_domain:ee.beaconCollectionDomain?ee.beaconCollectionDomain:ee.beaconDomain},this.data.view_sequence_number=1,this.data.player_sequence_number=1,this.oldEmit=this.emit,this.emit=function(ye,Te){Te=(0,_.default)({viewer_time:this.mux.utils.now()},Te),this.oldEmit(ye,Te)};var Ee=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(this);this.on("viewinit",function(ye,Te){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),(0,_.default)(this.data,Te),this._initializeViewData(),this.one("play",Ee),this.one("adbreakstart",Ee)});var be=function(ye){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",ye)}.bind(this);if(this.on("videochange",function(ye,Te){be(Te)}),this.on("programchange",function(ye,Te){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),be((0,_.default)(Te,{view_program_changed:!0})),Ee(),this.emit("play"),this.emit("playing")}),this.on("fragmentchange",function(ye,Te){this.currentFragmentPDT=Te.currentFragmentPDT,this.currentFragmentStart=Te.currentFragmentStart}),this.on("destroy",this.destroy),D.default!==void 0&&typeof D.default.addEventListener=="function"&&typeof D.default.removeEventListener=="function"){var Ie=function(ye){ye.persisted||he.destroy()};D.default.addEventListener("pagehide",Ie,!1),this.on("destroy",function(){D.default.removeEventListener("pagehide",Ie)})}this.on("playerready",function(ye,Te){(0,_.default)(this.data,Te)}),Se.forEach(function(ye){he.on(ye,function(Te,Be){ye.indexOf("ad")!==0&&this._updateStateData(),(0,_.default)(this.data,Be),this._sanitizeData()}),he.on("after"+ye,function(){(ye!=="error"||this.viewErrored)&&this.send(ye)})}),this.on("viewend",function(ye,Te){(0,_.default)(he.data,Te)});var Ne=function(ye){var Te=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Te-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};this.one("playerready",Ne),m.default.apply(this),oe.default.apply(this),F.default.apply(this),C.default.apply(this),y.default.apply(this),K.default.apply(this),f.default.apply(this),x.default.apply(this),Y.default.apply(this),P.default.apply(this),U.default.apply(this),N.default.apply(this),Z.default.apply(this),ue.default.apply(this),ee.hlsjs&&this.addHLSJS(ee),ee.dashjs&&this.addDashJS(ee),this.emit("viewinit",ee.data)};(0,_.default)(re.prototype,d.default.prototype),(0,_.default)(re.prototype,C.default.prototype),(0,_.default)(re.prototype,F.default.prototype),(0,_.default)(re.prototype,y.default.prototype),(0,_.default)(re.prototype,f.default.prototype),(0,_.default)(re.prototype,x.default.prototype),(0,_.default)(re.prototype,Y.default.prototype),(0,_.default)(re.prototype,U.default.prototype),(0,_.default)(re.prototype,N.default.prototype),re.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),D.default.clearTimeout(this._heartBeatTimeout))},re.prototype.send=function(Q){var te=(0,_.default)({},this.data),ee=["player_program_time","player_manifest_newest_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"];if(te.video_source_is_live===void 0&&(te.player_source_duration===1/0||te.video_source_duration===1/0?te.video_source_is_live=!0:(te.player_source_duration>0||te.video_source_duration>0)&&(te.video_source_is_live=!1)),te.video_source_is_live||ee.forEach(function(Ie){te[Ie]=void 0}),te.video_source_url=te.video_source_url||te.player_source_url,te.video_source_url){var he=(0,I.extractHostnameAndDomain)(te.video_source_url),_e=v(he,2),Ee=_e[0],be=_e[1];te.video_source_domain=be,te.video_source_hostname=Ee}delete te.ad_request_id,this.playbackEventDispatcher.send(Q,te),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()},re.prototype._updateStateData=function(){(0,_.default)(this.data,this.getStateData()),this._updatePlayheadTime(),this._sanitizeData()},re.prototype._sanitizeData=function(){var Q=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(te){var ee=parseInt(Q.data[te],10);Q.data[te]=isNaN(ee)?void 0:ee}),["player_source_url","video_source_url"].forEach(function(te){if(Q.data[te]){var ee=Q.data[te].toLowerCase();ee.indexOf("data:")!==0&&ee.indexOf("blob:")!==0||(Q.data[te]="MSE style URL")}})},re.prototype._resetVideoData=function(Q,te){var ee=this;Object.keys(this.data).forEach(function(he){he.indexOf("video_")===0&&delete ee.data[he]})},re.prototype._resetViewData=function(){var Q=this;Object.keys(this.data).forEach(function(te){te.indexOf("view_")===0&&delete Q.data[te]}),this.data.view_sequence_number=1},re.prototype._resetErrorData=function(Q,te){delete this.data.player_error_code,delete this.data.player_error_message},re.prototype._initializeViewData=function(){var Q=this,te=this.data.view_id=(0,E.generateUUID)(),ee=function(){te===Q.data.view_id&&(0,r.default)(Q.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",ee):ee()},re.prototype._restartHeartBeat=function(){var Q=this;D.default.clearTimeout(this._heartBeatTimeout),this.viewErrored||(this._heartBeatTimeout=D.default.setTimeout(function(){Q.data.player_is_paused||Q.emit("hb")},1e4))},re.prototype.addHLSJS=function(Q){return Q.hlsjs?this.hlsjs?void this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=Q.hlsjs,void(0,s.monitorHlsJs)(this.mux,this.id,Q.hlsjs,{},Q.Hls||D.default.Hls)):void this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")},re.prototype.removeHLSJS=function(){this.hlsjs&&((0,s.stopMonitoringHlsJs)(this.hlsjs),this.hlsjs=void 0)},re.prototype.addDashJS=function(Q){return Q.dashjs?this.dashjs?void this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=Q.dashjs,void(0,i.monitorDashJS)(this.mux,this.id,Q.dashjs)):void this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")},re.prototype.removeDashJS=function(){this.dashjs&&((0,i.stopMonitoringDashJS)(this.dashjs),this.dashjs=void 0)},t.default=re},function(e,t,l){"use strict";function n(u){return u&&u.__esModule?u:{default:u}}Object.defineProperty(t,"__esModule",{value:!0}),t.stopMonitoringHlsJs=t.monitorHlsJs=void 0;var v=l(7),R=n(v),T=l(13),L=n(T),_=l(5),E=l(14),I=n(E),M=function(u){if(!u)return{};var r=L.default.navigationStart(),s=u.loading,i=s?s.start:u.trequest,a=s?s.first:u.tfirst,d=s?s.end:u.tload;return{bytesLoaded:u.total,requestStart:Math.round(r+i),responseStart:Math.round(r+a),responseEnd:Math.round(r+d)}},D=function(u){if(u&&typeof u.getAllResponseHeaders=="function")return(0,R.default)(u.getAllResponseHeaders())},b=function(u,r,s){var i=(arguments.length>3&&arguments[3]!==void 0&&arguments[3],arguments[4]),a=u.log,d=u.utils.secondsToMs,o=function(O){var P=parseInt(i.version),w=void 0;return P===1&&O.programDateTime!==null&&(w=O.programDateTime),P===0&&O.pdt!==null&&(w=O.pdt),w};if(!L.default.exists())return void a.warn("performance timing not supported. Not tracking HLS.js.");var y=function(O,P){return u.emit(r,O,P)},p=function(O,P){var w=P.levels,U=P.audioTracks,k=P.url,N=P.stats,B=P.networkDetails,K=P.sessionData,W={},F={},H={};H=(0,I.default)(K),w.forEach(function(X,ie){W[ie]={width:X.width,height:X.height,bitrate:X.bitrate,attrs:X.attrs}}),U.forEach(function(X,ie){F[ie]={name:X.name,language:X.lang,bitrate:X.bitrate}});var Y=M(N),$=Y.bytesLoaded,Z=Y.requestStart,q=Y.responseStart,oe=Y.responseEnd;H.request_event_type=O,H.request_bytes_loaded=$,H.request_start=Z,H.request_response_start=q,H.request_response_end=oe,H.request_type="manifest",H.request_hostname=(0,_.extractHostname)(k),H.request_response_headers=D(B),H.request_rendition_lists={media:W,audio:F,video:{}},y("requestcompleted",H)};s.on(i.Events.MANIFEST_LOADED,p);var m=function(O,P){var w=P.details,U=P.level,k=P.networkDetails,N=P.stats,B=M(N),K=B.bytesLoaded,W=B.requestStart,F=B.responseStart,H=B.responseEnd,Y=w.fragments[w.fragments.length-1],$=o(Y)+d(Y.duration);y("requestcompleted",{request_event_type:O,request_bytes_loaded:K,request_start:W,request_response_start:F,request_response_end:H,request_current_level:U,request_type:"manifest",request_hostname:(0,_.extractHostname)(w.url),request_response_headers:D(k),video_holdback:w.holdBack&&d(w.holdBack),video_part_holdback:w.partHoldBack&&d(w.partHoldBack),video_part_target_duration:w.partTarget&&d(w.partTarget),video_target_duration:w.targetduration&&d(w.targetduration),video_source_is_live:w.live,player_manifest_newest_program_time:isNaN($)?void 0:$})};s.on(i.Events.LEVEL_LOADED,m);var g=function(O,P){var w=P.details,U=P.networkDetails,k=P.stats,N=M(k),B=N.bytesLoaded,K=N.requestStart,W=N.responseStart,F=N.responseEnd;y("requestcompleted",{request_event_type:O,request_bytes_loaded:B,request_start:K,request_response_start:W,request_response_end:F,request_type:"manifest",request_hostname:(0,_.extractHostname)(w.url),request_response_headers:D(U)})};s.on(i.Events.AUDIO_TRACK_LOADED,g);var f=function(O,P){var w=P.stats,U=P.networkDetails,k=P.frag,N=M(w),B=N.bytesLoaded,K=N.requestStart,W=N.responseStart,F=N.responseEnd,H={request_event_type:O,request_bytes_loaded:B,request_start:K,request_response_start:W,request_response_end:F,request_hostname:U?(0,_.extractHostname)(U.responseURL):void 0,request_response_headers:D(U),request_media_duration:k.duration};k.type==="main"?(H.request_type="media",H.request_current_level=k.level,H.request_video_width=(s.levels[k.level]||{}).width,H.request_video_height=(s.levels[k.level]||{}).height):H.request_type=k.type,y("requestcompleted",H)};s.on(i.Events.FRAG_LOADED,f);var c=function(O,P){var w=P.frag,U=w.start,k=o(w),N={currentFragmentPDT:k,currentFragmentStart:d(U)};y("fragmentchange",N)};s.on(i.Events.FRAG_CHANGED,c);var x=function(O,P){var w=P.type,U=P.details,k=P.response,N=P.fatal,B=P.context,K=P.frag;if(U===i.ErrorDetails.MANIFEST_LOAD_ERROR||U===i.ErrorDetails.MANIFEST_LOAD_TIMEOUT||U===i.ErrorDetails.FRAG_LOAD_ERROR||U===i.ErrorDetails.FRAG_LOAD_TIMEOUT||U===i.ErrorDetails.LEVEL_LOAD_ERROR||U===i.ErrorDetails.LEVEL_LOAD_TIMEOUT){var W=K&&K.url||B&&B.url||"";y("requestfailed",{request_error:U,request_url:W,request_hostname:(0,_.extractHostname)(W),request_type:U===i.ErrorDetails.FRAG_LOAD_ERROR||U===i.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:k&&k.code,request_error_text:k&&k.text})}N&&y("error",{player_error_code:w,player_error_message:U})};s.on(i.Events.ERROR,x);var S=function(O,P){var w=P.frag,U=w&&w._url||"";y("requestcanceled",{request_cancel:O,request_url:U,request_type:"media",request_hostname:(0,_.extractHostname)(U)})};s.on(i.Events.FRAG_LOAD_EMERGENCY_ABORTED,S);var C=function(O,P){var w=P.level,U=s.levels[w];if(U&&U.attrs&&U.attrs.BANDWIDTH){var k=U.attrs.BANDWIDTH;k?y("renditionchange",{video_source_bitrate:k,video_source_width:U.width,video_source_height:U.height}):a.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};s.on(i.Events.LEVEL_SWITCHED,C),s._stopMuxMonitor=function(){s.off(i.Events.MANIFEST_LOADED,p),s.off(i.Events.LEVEL_LOADED,m),s.off(i.Events.AUDIO_TRACK_LOADED,g),s.off(i.Events.FRAG_LOADED,f),s.off(i.Events.FRAG_CHANGED,c),s.off(i.Events.ERROR,x),s.off(i.Events.FRAG_LOAD_EMERGENCY_ABORTED,S),s.off(i.Events.LEVEL_SWITCHED,C),s.off(i.Events.DESTROYING,s._stopMuxMonitor),delete s._stopMuxMonitor},s.on(i.Events.DESTROYING,s._stopMuxMonitor)},A=function(u){u&&typeof u._stopMuxMonitor=="function"&&u._stopMuxMonitor()};t.monitorHlsJs=b,t.stopMonitoringHlsJs=A},function(e,t,l){"use strict";function n(b){return b&&b.__esModule?b:{default:b}}Object.defineProperty(t,"__esModule",{value:!0}),t.stopMonitoringDashJS=t.monitorDashJS=void 0;var v=l(0),R=n(v),T=l(7),L=n(T),_=l(5),E=function(b,A){if(!b||typeof b.getRequests!="function")return{};var u=b.getRequests({state:"executed"});if(u.length===0)return{};var r=u[u.length-1],s=(0,_.extractHostname)(r.url),i=r.bytesLoaded,a=new Date(r.requestStartDate).getTime(),d=new Date(r.firstByteDate).getTime(),o=new Date(r.requestEndDate).getTime(),y=isNaN(r.duration)?0:r.duration,p=typeof A.getMetricsFor=="function"?A.getMetricsFor(r.mediaType).HttpList:A.getDashMetrics().getHttpRequests(r.mediaType),m=void 0;return p.length>0&&(m=(0,L.default)(p[p.length-1]._responseHeaders||"")),{requestStart:a,requestResponseStart:d,requestResponseEnd:o,requestBytesLoaded:i,requestResponseHeaders:m,requestMediaDuration:y,requestHostname:s}},I=function(b,A){var u=A.getQualityFor(b),r=A.getCurrentTrackFor(b),s=r.bitrateList;return s?{currentLevel:u,renditionWidth:s[u].width||null,renditionHeight:s[u].height||null,renditionBitrate:s[u].bandwidth}:{}},M=function(b,A,u){var r=(arguments.length>3&&arguments[3]!==void 0&&arguments[3],b.log);if(!u||!u.on)return void r.warn("Invalid dash.js player reference. Monitoring blocked.");var s=function(f,c){return b.emit(A,f,c)},i=function(f){var c=f.type,x=f.data,S=x||{},C=S.url;s("requestcompleted",{request_event_type:c,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:(0,_.extractHostname)(C)})};u.on("manifestLoaded",i);var a={},d=function(f){var c=f.type,x=f.fragmentModel,S=f.chunk,C=S||{},O=C.mediaInfo,P=O||{},w=P.type,U=P.bitrateList;U=U||[];var k={};U.forEach(function($,Z){k[Z]={},k[Z].width=$.width,k[Z].height=$.height,k[Z].bitrate=$.bandwidth,k[Z].attrs={}}),w==="video"?a.video=k:w==="audio"?a.audio=k:a.media=k;var N=E(x,u),B=N.requestStart,K=N.requestResponseStart,W=N.requestResponseEnd,F=N.requestResponseHeaders,H=N.requestMediaDuration,Y=N.requestHostname;s("requestcompleted",{request_event_type:c,request_start:B,request_response_start:K,request_response_end:W,request_bytes_loaded:-1,request_type:w+"_init",request_response_headers:F,request_hostname:Y,request_media_duration:H,request_rendition_lists:a})};u.on("initFragmentLoaded",d);var o=function(f){var c=f.type,x=f.fragmentModel,S=f.chunk,C=S||{},O=C.mediaInfo,P=C.start,w=O||{},U=w.type,k=E(x,u),N=k.requestStart,B=k.requestResponseStart,K=k.requestResponseEnd,W=k.requestBytesLoaded,F=k.requestResponseHeaders,H=k.requestMediaDuration,Y=k.requestHostname,$=I(U,u),Z=$.currentLevel,q=$.renditionWidth,oe=$.renditionHeight,X=$.renditionBitrate;s("requestcompleted",{request_event_type:c,request_start:N,request_response_start:B,request_response_end:K,request_bytes_loaded:W,request_type:U,request_response_headers:F,request_hostname:Y,request_media_start_time:P,request_media_duration:H,request_current_level:Z,request_labeled_bitrate:X,request_video_width:q,request_video_height:oe})};u.on("mediaFragmentLoaded",o);var y={video:void 0,audio:void 0,totalBitrate:void 0},p=function(){if(y.video&&typeof y.video.bitrate=="number"){if(!y.video.width||!y.video.height)return void r.warn("have bitrate info for video but missing width/height");var f=y.video.bitrate;return y.audio&&typeof y.audio.bitrate=="number"&&(f+=y.audio.bitrate),f!==y.totalBitrate?(y.totalBitrate=f,{video_source_bitrate:f,video_source_height:y.video.height,video_source_width:y.video.width}):void 0}},m=function(f,c,x){if(typeof f.newQuality!="number")return void r.warn("missing evt.newQuality in qualityChangeRendered event",f);var S=f.mediaType;if(S==="audio"||S==="video"){var C=u.getBitrateInfoListFor(S).find(function(P){return P.qualityIndex===f.newQuality});if(!C||typeof C.bitrate!="number")return void r.warn("missing bitrate info for "+S);y[S]=C;var O=p();O&&s("renditionchange",O)}};u.on("qualityChangeRendered",m);var g=function(f){var c=f.error,x=f.event;x=x||{};var S=x.request||{},C=R.default.event&&R.default.event.currentTarget||{};s("requestfailed",{request_error:c+"_"+x.id+"_"+S.type,request_url:x.url,request_hostname:(0,_.extractHostname)(x.url),request_type:S.mediaType,request_error_code:C.status,request_error_type:C.statusText})};u.on("error",g),u._stopMuxMonitor=function(){u.off("manifestLoaded",i),u.off("initFragmentLoaded",d),u.off("mediaFragmentLoaded",o),u.off("qualityChangeRendered",m),u.off("error",g),delete u._stopMuxMonitor}},D=function(b){b&&typeof b._stopMuxMonitor=="function"&&b._stopMuxMonitor()};t.monitorDashJS=M,t.stopMonitoringDashJS=D},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){},v=0;n.prototype.on=function(R,T,L){return T._eventEmitterGuid=T._eventEmitterGuid||++v,this._listeners=this._listeners||{},this._listeners[R]=this._listeners[R]||[],L&&(T=T.bind(L)),this._listeners[R].push(T),T},n.prototype.off=function(R,T){var L=this._listeners&&this._listeners[R];L&&L.forEach(function(_,E){_._eventEmitterGuid===T._eventEmitterGuid&&L.splice(E,1)})},n.prototype.one=function(R,T,L){var _=this;T._eventEmitterGuid=T._eventEmitterGuid||++v;var E=function I(){_.off(R,I),T.apply(L||this,arguments)};E._eventEmitterGuid=T._eventEmitterGuid,this.on(R,E)},n.prototype.emit=function(R,T){var L=this;if(this._listeners){T=T||{};var _=this._listeners["before*"]||[],E=this._listeners[R]||[],I=this._listeners["after"+R]||[],M=function(D,b){D=D.slice(),D.forEach(function(A){A.call(L,{type:R},b)})};M(_,T),M(E,T),M(I,T)}},t.default=n},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(0),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=function(){this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,this.on("playing",function(){this._playheadShouldBeProgressing=!0}),this.on("play",this._startPlaybackHeartbeatInterval),this.on("playing",this._startPlaybackHeartbeatInterval),this.on("adbreakstart",this._startPlaybackHeartbeatInterval),this.on("adplay",this._startPlaybackHeartbeatInterval),this.on("adplaying",this._startPlaybackHeartbeatInterval),this.on("seeking",this._startPlaybackHeartbeatInterval),this.on("devicewake",this._startPlaybackHeartbeatInterval),this.on("viewstart",this._startPlaybackHeartbeatInterval),this.on("rebufferstart",this._startPlaybackHeartbeatInterval),this.on("pause",this._stopPlaybackHeartbeatInterval),this.on("ended",this._stopPlaybackHeartbeatInterval),this.on("viewend",this._stopPlaybackHeartbeatInterval),this.on("error",this._stopPlaybackHeartbeatInterval),this.on("aderror",this._stopPlaybackHeartbeatInterval),this.on("adpause",this._stopPlaybackHeartbeatInterval),this.on("adended",this._stopPlaybackHeartbeatInterval),this.on("adbreakend",this._stopPlaybackHeartbeatInterval),this.on("seeked",function(){this.data.player_is_paused?this._stopPlaybackHeartbeatInterval():this._startPlaybackHeartbeatInterval()}),this.on("timeupdate",function(){this._playbackHeartbeatInterval!==null&&this.emit("playbackheartbeat")}),this.on("devicesleep",function(T,L){this._playbackHeartbeatInterval!==null&&(v.default.clearInterval(this._playbackHeartbeatInterval),this.emit("playbackheartbeatend",{viewer_time:L.viewer_time}),this._playbackHeartbeatInterval=null)})};R.prototype._startPlaybackHeartbeatInterval=function(){var T=this;this._playbackHeartbeatInterval===null&&(this.emit("playbackheartbeat"),this._playbackHeartbeatInterval=v.default.setInterval(function(){T.emit("playbackheartbeat")},this.playbackHeartbeatTime))},R.prototype._stopPlaybackHeartbeatInterval=function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(v.default.clearInterval(this._playbackHeartbeatInterval),this.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)},t.default=R},function(e,t,l){"use strict";function n(){var v=this;this.on("viewinit",function(){v.viewErrored=!1}),this.on("error",function(){try{var R=v.errorTranslator({player_error_code:v.data.player_error_code,player_error_message:v.data.player_error_message});R?(v.data.player_error_code=R.player_error_code,v.data.player_error_message=R.player_error_message,v.viewErrored=!0):(delete v.data.player_error_code,delete v.data.player_error_message)}catch(T){v.mux.log.warn("Exception in error translator callback.",T),v.viewErrored=!0}})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(3),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=function(){this._watchTimeTrackerLastCheckedTime=null,this.on("playbackheartbeat",this._updateWatchTime),this.on("playbackheartbeatend",this._clearWatchTimeState)};R.prototype._updateWatchTime=function(T,L){var _=L.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=_),(0,v.default)(this.data,"view_watch_time",_-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=_},R.prototype._clearWatchTimeState=function(T,L){this._updateWatchTime(T,L),this._watchTimeTrackerLastCheckedTime=null},t.default=R},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(3),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=function(){this._playbackTimeTrackerLastPlayheadPosition=-1,this.on("playbackheartbeat",this._updatePlaybackTime),this.on("playbackheartbeatend",this._clearPlaybackTimeState),this.on("seeking",this._clearPlaybackTimeState)};R.prototype._updatePlaybackTime=function(){var T=this.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&T>this._playbackTimeTrackerLastPlayheadPosition){var L=T-this._playbackTimeTrackerLastPlayheadPosition;L<=1e3&&(0,v.default)(this.data,"view_content_playback_time",L)}this._playbackTimeTrackerLastPlayheadPosition=T},R.prototype._clearPlaybackTimeState=function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1},t.default=R},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){this.on("playbackheartbeat",this._updatePlayheadTime),this.on("playbackheartbeatend",this._updatePlayheadTime),this.on("timeupdate",this._updatePlayheadTime),this.on("destroy",function(){this.off("timeupdate",this._updatePlayheadTime)})};n.prototype._updateMaxPlayheadPosition=function(){this.data.view_max_playhead_position=this.data.view_max_playhead_position===void 0?this.data.player_playhead_time:Math.max(this.data.view_max_playhead_position,this.data.player_playhead_time)},n.prototype._updatePlayheadTime=function(v,R){var T=this,L=function(){T.currentFragmentPDT&&T.currentFragmentStart&&(T.data.player_program_time=T.currentFragmentPDT+T.data.player_playhead_time-T.currentFragmentStart)};if(R&&R.player_playhead_time)this.data.player_playhead_time=R.player_playhead_time,L(),this._updateMaxPlayheadPosition();else if(this.getPlayheadTime){var _=this.getPlayheadTime();_!==void 0&&(this.data.player_playhead_time=_,L(),this._updateMaxPlayheadPosition())}},t.default=n},function(e,t,l){"use strict";function n(){var T=this;if(!this.disableRebufferTracking){var L=void 0,_=function(){if(L){var E=T.data.viewer_time-L;(0,R.default)(T.data,"view_rebuffer_duration",E),L=T.data.viewer_time}T.data.view_watch_time>=0&&T.data.view_rebuffer_count>0&&(T.data.view_rebuffer_frequency=T.data.view_rebuffer_count/T.data.view_watch_time,T.data.view_rebuffer_percentage=T.data.view_rebuffer_duration/T.data.view_watch_time)};this.on("playbackheartbeat",function(){return _()}),this.on("rebufferstart",function(){L||((0,R.default)(T.data,"view_rebuffer_count",1),L=T.data.viewer_time,T.one("rebufferend",function(){_(),L=void 0}))})}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=l(3),R=function(T){return T&&T.__esModule?T:{default:T}}(v)},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(2),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=function(){this.disableRebufferTracking||this.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,this.on("playbackheartbeat",this._checkIfRebuffering),this.on("playbackheartbeatend",this._cleanupRebufferTracker),this.on("seeking",function(){this._cleanupRebufferTracker(null,{viewer_time:v.default.now()})}))};R.prototype._checkIfRebuffering=function(T,L){return this.isSeeking||this.isAdBreak||!this._playheadShouldBeProgressing?void this._cleanupRebufferTracker(T,L):this._lastCheckedTime===null?void this._prepareRebufferTrackerState(L.viewer_time):this._lastPlayheadTime!==this.data.player_playhead_time?void this._cleanupRebufferTracker(T,L,!0):(L.viewer_time-this._lastPlayheadTimeUpdatedTime>=this.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),void(this._lastCheckedTime=L.viewer_time))},R.prototype._clearRebufferTrackerState=function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null},R.prototype._prepareRebufferTrackerState=function(T){this._lastCheckedTime=T,this._lastPlayheadTime=this.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=T},R.prototype._cleanupRebufferTracker=function(T,L){var _=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.emit("rebufferend",{viewer_time:L.viewer_time});else{if(this._lastCheckedTime===null)return;var E=this.data.player_playhead_time-this._lastPlayheadTime,I=L.viewer_time-this._lastPlayheadTimeUpdatedTime;E>0&&I-E>this.minimumRebufferDuration&&(this.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+I-E}))}_?this._prepareRebufferTrackerState(L.viewer_time):this._clearRebufferTrackerState()},t.default=R},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(2),v=function(T){return T&&T.__esModule?T:{default:T}}(n),R=function(){this.on("viewinit",function(){var T=this.data,L=T.view_id;if(!T.view_program_changed){var _=function(E,I){var M=I.viewer_time;E.type==="playing"&&this.data.view_time_to_first_frame===void 0?this.calculateTimeToFirstFrame(M||v.default.now(),L):E.type!=="adplaying"||this.data.view_time_to_first_frame!==void 0&&!this.inPrerollPosition()||this.calculateTimeToFirstFrame(M||v.default.now(),L)};this.one("playing",_),this.one("adplaying",_),this.one("viewend",function(){this.off("playing",_),this.off("adplaying",_)})}})};R.prototype.calculateTimeToFirstFrame=function(T,L){L===this.data.view_id&&(this._updateWatchTime(null,{viewer_time:T}),this.data.view_time_to_first_frame=this.data.view_watch_time,(this.data.player_autoplay_on||this.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.data.view_aggregate_startup_time=this.data.view_start+this.data.view_watch_time-this.NAVIGATION_START))},t.default=R},function(e,t,l){"use strict";function n(){var T=this;this.on("viewinit",function(){this._lastPlayheadPosition=-1});var L=["pause","rebufferstart","seeking","error","adbreakstart","hb"],_=["playing","hb"];L.forEach(function(E){T.on(E,function(){if(this._lastPlayheadPosition>=0&&this.data.player_playhead_time>=0&&this._lastPlayerWidth>=0&&this._lastSourceWidth>0&&this._lastPlayerHeight>=0&&this._lastSourceHeight>0){var I=this.data.player_playhead_time-this._lastPlayheadPosition;if(I<0)return void(this._lastPlayheadPosition=-1);var M=Math.min(this._lastPlayerWidth/this._lastSourceWidth,this._lastPlayerHeight/this._lastSourceHeight),D=Math.max(0,M-1),b=Math.max(0,1-M);this.data.view_max_upscale_percentage=Math.max(this.data.view_max_upscale_percentage||0,D),this.data.view_max_downscale_percentage=Math.max(this.data.view_max_downscale_percentage||0,b),(0,R.default)(this.data,"view_total_content_playback_time",I),(0,R.default)(this.data,"view_total_upscaling",D*I),(0,R.default)(this.data,"view_total_downscaling",b*I)}this._lastPlayheadPosition=-1})}),_.forEach(function(E){T.on(E,function(){this._lastPlayheadPosition=this.data.player_playhead_time,this._lastPlayerWidth=this.data.player_width,this._lastPlayerHeight=this.data.player_height,this._lastSourceWidth=this.data.video_source_width,this._lastSourceHeight=this.data.video_source_height})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=l(3),R=function(T){return T&&T.__esModule?T:{default:T}}(v)},function(e,t,l){"use strict";function n(M){return M&&M.__esModule?M:{default:M}}function v(){this.isSeeking=!1,this.on("seeking",function(M,D){(0,I.default)(this.data,D),this._lastSeekingTime=T.default.now(),this.isSeeking===!1&&(this.isSeeking=!0,this.send("seeking"))}),this.on("seeked",function(){this.isSeeking=!1;var M=this._lastSeekingTime||T.default.now(),D=T.default.now()-M;(0,_.default)(this.data,"view_seek_count",1),(0,_.default)(this.data,"view_seek_duration",D);var b=this.data.view_max_seek_time||0;this.data.view_max_seek_time=Math.max(b,D)}),this.on("viewend",function(){this.isSeeking=!1})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var R=l(2),T=n(R),L=l(3),_=n(L),E=l(1),I=n(E)},function(e,t,l){"use strict";function n(b){return b&&b.__esModule?b:{default:b}}Object.defineProperty(t,"__esModule",{value:!0});var v=function(){function b(A,u){var r=[],s=!0,i=!1,a=void 0;try{for(var d,o=A[Symbol.iterator]();!(s=(d=o.next()).done)&&(r.push(d.value),!u||r.length!==u);s=!0);}catch(y){i=!0,a=y}finally{try{!s&&o.return&&o.return()}finally{if(i)throw a}}return r}return function(A,u){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return b(A,u);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=l(3),T=n(R),L=l(5),_=l(1),E=n(_),I=function(b,A){b.push(A),b.sort(function(u,r){return u.viewer_time-r.viewer_time})},M=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],D=function(){var b=this;this.on("viewinit",function(){this.isAdBreak=!1,this._currentAdRequestNumber=0,this._currentAdResponseNumber=0,this._adRequests=[],this._adResponses=[],this._adHasPlayed=!1,this._wouldBeNewAdPlay=!0,this._prerollPlayTime=void 0}),M.forEach(function(u){return b.on(u,b._updateAdData)});var A=function(){b.isAdBreak=!1};this.on("adbreakstart",function(){this.isAdBreak=!0}),this.on("play",A),this.on("playing",A),this.on("viewend",A),this.on("adrequest",function(u,r){r=(0,E.default)({ad_request_id:"generatedAdRequestId"+this._currentAdRequestNumber++},r),I(this._adRequests,r),(0,T.default)(this.data,"view_ad_request_count"),this.inPrerollPosition()&&(this.data.view_preroll_requested=!0,this._adHasPlayed||(0,T.default)(this.data,"view_preroll_request_count"))}),this.on("adresponse",function(u,r){r=(0,E.default)({ad_request_id:"generatedAdRequestId"+this._currentAdResponseNumber++},r),I(this._adResponses,r);var s=this.findAdRequest(r.ad_request_id);s&&(0,T.default)(this.data,"view_ad_request_time",Math.max(0,r.viewer_time-s.viewer_time))}),this.on("adplay",function(u,r){this._adHasPlayed=!0,this._wouldBeNewAdPlay&&(this._wouldBeNewAdPlay=!1,(0,T.default)(this.data,"view_ad_played_count")),this.inPrerollPosition()&&!this.data.view_preroll_played&&(this.data.view_preroll_played=!0,this._adRequests.length>0&&(this.data.view_preroll_request_time=Math.max(0,r.viewer_time-this._adRequests[0].viewer_time)),this.data.view_start&&(this.data.view_startup_preroll_request_time=Math.max(0,r.viewer_time-this.data.view_start)),this._prerollPlayTime=r.viewer_time)}),this.on("adplaying",function(u,r){this.inPrerollPosition()&&this.data.view_preroll_load_time===void 0&&this._prerollPlayTime!==void 0&&(this.data.view_preroll_load_time=r.viewer_time-this._prerollPlayTime,this.data.view_startup_preroll_load_time=r.viewer_time-this._prerollPlayTime)}),this.on("adended",function(){this._wouldBeNewAdPlay=!0}),this.on("aderror",function(){this._wouldBeNewAdPlay=!0})};D.prototype.inPrerollPosition=function(){return this.data.view_content_playback_time===void 0||this.data.view_content_playback_time<=1e3},D.prototype.findAdRequest=function(b){for(var A=0;A<this._adRequests.length;A++)if(this._adRequests[A].ad_request_id===b)return this._adRequests[A]},D.prototype._updateAdData=function(b,A){if(this.inPrerollPosition()){if(!this.data.view_preroll_ad_tag_hostname&&A.ad_tag_url){var u=(0,L.extractHostnameAndDomain)(A.ad_tag_url),r=v(u,2),s=r[0],i=r[1];this.data.view_preroll_ad_tag_domain=i,this.data.view_preroll_ad_tag_hostname=s}if(!this.data.view_preroll_ad_asset_hostname&&A.ad_asset_url){var a=(0,L.extractHostnameAndDomain)(A.ad_asset_url),d=v(a,2),o=d[0],y=d[1];this.data.view_preroll_ad_asset_domain=y,this.data.view_preroll_ad_asset_hostname=o}}},t.default=D},function(e,t,l){"use strict";function n(E){return E&&E.__esModule?E:{default:E}}function v(){var E=this,I=void 0,M=void 0,D=function(){E.disableRebufferTracking||((0,_.default)(E.data,"view_waiting_rebuffer_count",1),I=T.default.now(),M=window.setInterval(function(){if(I){var s=T.default.now();(0,_.default)(E.data,"view_waiting_rebuffer_duration",s-I),I=s}},250))},b=function(){E.disableRebufferTracking||I&&((0,_.default)(E.data,"view_waiting_rebuffer_duration",T.default.now()-I),I=!1,window.clearInterval(M))},A=!1,u=function(){A=!0},r=function(){A=!1,b()};this.on("waiting",function(){A&&D()}),this.on("playing",function(){b(),u()}),this.on("pause",r),this.on("seeking",r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var R=l(2),T=n(R),L=l(3),_=n(L)},function(e,t,l){"use strict";function n(M){return M&&M.__esModule?M:{default:M}}function v(){var M=this;this.one("playbackheartbeat",E),this.on("playbackheartbeatend",function(){M.off("before*",I),M.one("playbackheartbeat",E)})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var R=l(1),T=n(R),L=l(2),_=n(L),E=function(){this.lastWallClockTime=_.default.now(),this.on("before*",I)},I=function(M){var D=_.default.now(),b=this.lastWallClockTime;this.lastWallClockTime=D,D-b>3e4&&(this.emit("devicesleep",{viewer_time:b}),(0,T.default)(this.data,{viewer_time:b}),this.send("devicesleep"),this.emit("devicewake",{viewer_time:D}),(0,T.default)(this.data,{viewer_time:D}),this.send("devicewake"))}},function(e,t,l){"use strict";function n(c){return c&&c.__esModule?c:{default:c}}Object.defineProperty(t,"__esModule",{value:!0});var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},R=l(0),T=n(R),L=l(40),_=l(4),E=n(_),I=l(53),M=n(I),D=l(12),b=n(D),A=l(54),u=n(A),r=l(17),s=n(r),i=l(55),a=n(i),d=l(1),o=n(d),y=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],p=["viewstart","error","ended","viewend"],m=function(c,x){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.mux=c,this.envKey=x,this.eventQueue=new a.default((0,M.default)(x,S)),this.previousBeaconData=null,this.lastEventTime=null,this.sampleRate=S.sampleRate,this.disableCookies=S.disableCookies,this.respectDoNotTrack=S.respectDoNotTrack;var C=S.platform||{};this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:C.name,viewer_application_version:C.version,viewer_application_engine:C.layout,viewer_device_name:C.product,viewer_device_category:"",viewer_device_manufacturer:C.manufacturer,viewer_os_family:C.os&&C.os.family,viewer_os_architecture:C.os&&C.os.architecture,viewer_os_version:C.os&&C.os.version};var O=(0,u.default)();O&&(this.pageLevelData=(0,o.default)(this.pageLevelData,{viewer_connection_type:O})),T.default!==void 0&&T.default.location&&T.default.location.href&&(this.pageLevelData.page_url=T.default.location.href),this.viewerData=this.disableCookies?{}:(0,L.getAndUpdateViewerData)()};m.prototype.send=function(c,x){if(c){if(this.respectDoNotTrack&&(0,b.default)())return E.default.info("Not sending `"+c+"` because Do Not Track is enabled");if(!x||(x===void 0?"undefined":v(x))!=="object")return E.default.error("A data object was expected in send() but was not provided");var S=this.disableCookies?{}:(0,L.getAndUpdateSessionData)(),C={};(0,o.default)(C,this.pageLevelData),(0,o.default)(C,x),(0,o.default)(C,S),(0,o.default)(C,this.viewerData),C.event=c,C.env_key=this.envKey,C.user_id&&(C.viewer_user_id=C.user_id,delete C.user_id);var O=C.mux_sample_number>=this.sampleRate,P=this._deduplicateBeaconData(c,C),w=(0,s.default)(P);if(this.lastEventTime=this.mux.utils.now(),O)return E.default.info("Not sending event due to sample rate restriction",c,C,w);if(this.envKey||E.default.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",c,C,w),!this.rateLimited){if(E.default.info("Sending event",c,C,w),this.rateLimited=!this.eventQueue.queueEvent(c,w),this.mux.WINDOW_UNLOADING&&c==="viewend")this.eventQueue.destroy(!0);else if((p.indexOf(c)>=0||this.mux.WINDOW_VISIBLE===!1&&c==="hb")&&this.eventQueue.flushEvents(),this.rateLimited)return C.event="eventrateexceeded",w=(0,s.default)(C),this.eventQueue.queueEvent(C.event,w),E.default.error("Beaconing disabled due to rate limit.")}}},m.prototype.destroy=function(){this.eventQueue.destroy(!1)};var g=function(c,x,S,C){return!(!c||x.indexOf("request_")!==0)&&(x==="request_response_headers"||(S===void 0?"undefined":v(S))!=="object"||(C===void 0?"undefined":v(C))!=="object"||Object.keys(S||{}).length!==Object.keys(C||{}).length)},f=function(c,x){return c==="renditionchange"&&x.indexOf("video_source_")===0};m.prototype._deduplicateBeaconData=function(c,x){var S=this,C={},O=x.view_id;if(!O||c==="viewstart"||c==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)C=(0,o.default)({},x),O&&(this.previousBeaconData=C),O&&c==="viewend"&&(this.previousBeaconData=null);else{var P=c.indexOf("request")===0;Object.keys(x).forEach(function(w){var U=x[w];(U!==S.previousBeaconData[w]||y.indexOf(w)>-1||g(P,w,U,S.previousBeaconData[w])||f(c,w))&&(C[w]=U,S.previousBeaconData[w]=U)})}return C},t.default=m},function(e,t,l){"use strict";function n(u){return u&&u.__esModule?u:{default:u}}Object.defineProperty(t,"__esModule",{value:!0}),t.getAndUpdateSessionData=t.getAndUpdateViewerData=void 0;var v=l(15),R=n(v),T=l(52),L=n(T),_=l(6),E=l(2),I=n(E),M=function(){var u=void 0;try{u=R.default.parse(L.default.get("muxData")||"")}catch{u={}}return u},D=function(u){try{L.default.set("muxData",R.default.stringify(u),{expires:7300})}catch{}},b=function(){var u=M();return u.mux_viewer_id=u.mux_viewer_id||(0,_.generateUUID)(),u.msn=u.msn||Math.random(),D(u),{mux_viewer_id:u.mux_viewer_id,mux_sample_number:u.msn}},A=function(){var u=M(),r=I.default.now();return u.session_start&&(u.sst=u.session_start,delete u.session_start),u.session_id&&(u.sid=u.session_id,delete u.session_id),u.session_expires&&(u.sex=u.session_expires,delete u.session_expires),(!u.sex||u.sex<r)&&(u.sid=(0,_.generateUUID)(),u.sst=r),u.sex=r+15e5,D(u),{session_id:u.sid,session_start:u.sst,session_expires:u.sex}};t.getAndUpdateViewerData=b,t.getAndUpdateSessionData=A},function(e,t,l){"use strict";var n=l(42),v=l(16),R=l(10),T=Object.prototype.hasOwnProperty,L={brackets:function(a){return a+"[]"},comma:"comma",indices:function(a,d){return a+"["+d+"]"},repeat:function(a){return a}},_=Array.isArray,E=String.prototype.split,I=Array.prototype.push,M=function(a,d){I.apply(a,_(d)?d:[d])},D=Date.prototype.toISOString,b=R.default,A={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:v.encode,encodeValuesOnly:!1,format:b,formatter:R.formatters[b],indices:!1,serializeDate:function(a){return D.call(a)},skipNulls:!1,strictNullHandling:!1},u=function(a){return typeof a=="string"||typeof a=="number"||typeof a=="boolean"||typeof a=="symbol"||typeof a=="bigint"},r={},s=function a(d,o,y,p,m,g,f,c,x,S,C,O,P,w,U){for(var k=d,N=U,B=0,K=!1;(N=N.get(r))!==void 0&&!K;){var W=N.get(d);if(B+=1,W!==void 0){if(W===B)throw new RangeError("Cyclic object value");K=!0}N.get(r)===void 0&&(B=0)}if(typeof f=="function"?k=f(o,k):k instanceof Date?k=S(k):y==="comma"&&_(k)&&(k=v.maybeMap(k,function(re){return re instanceof Date?S(re):re})),k===null){if(p)return g&&!P?g(o,A.encoder,w,"key",C):o;k=""}if(u(k)||v.isBuffer(k)){if(g){var F=P?o:g(o,A.encoder,w,"key",C);if(y==="comma"&&P){for(var H=E.call(String(k),","),Y="",$=0;$<H.length;++$)Y+=($===0?"":",")+O(g(H[$],A.encoder,w,"value",C));return[O(F)+"="+Y]}return[O(F)+"="+O(g(k,A.encoder,w,"value",C))]}return[O(o)+"="+O(String(k))]}var Z=[];if(k===void 0)return Z;var q;if(y==="comma"&&_(k))q=[{value:k.length>0?k.join(",")||null:void 0}];else if(_(f))q=f;else{var oe=Object.keys(k);q=c?oe.sort(c):oe}for(var X=0;X<q.length;++X){var ie=q[X],fe=typeof ie=="object"&&ie.value!==void 0?ie.value:k[ie];if(!m||fe!==null){var ue=_(k)?typeof y=="function"?y(o,ie):o:o+(x?"."+ie:"["+ie+"]");U.set(d,B);var Se=n();Se.set(r,U),M(Z,a(fe,ue,y,p,m,g,f,c,x,S,C,O,P,w,Se))}}return Z},i=function(a){if(!a)return A;if(a.encoder!==null&&a.encoder!==void 0&&typeof a.encoder!="function")throw new TypeError("Encoder has to be a function.");var d=a.charset||A.charset;if(a.charset!==void 0&&a.charset!=="utf-8"&&a.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var o=R.default;if(a.format!==void 0){if(!T.call(R.formatters,a.format))throw new TypeError("Unknown format option provided.");o=a.format}var y=R.formatters[o],p=A.filter;return(typeof a.filter=="function"||_(a.filter))&&(p=a.filter),{addQueryPrefix:typeof a.addQueryPrefix=="boolean"?a.addQueryPrefix:A.addQueryPrefix,allowDots:a.allowDots===void 0?A.allowDots:!!a.allowDots,charset:d,charsetSentinel:typeof a.charsetSentinel=="boolean"?a.charsetSentinel:A.charsetSentinel,delimiter:a.delimiter===void 0?A.delimiter:a.delimiter,encode:typeof a.encode=="boolean"?a.encode:A.encode,encoder:typeof a.encoder=="function"?a.encoder:A.encoder,encodeValuesOnly:typeof a.encodeValuesOnly=="boolean"?a.encodeValuesOnly:A.encodeValuesOnly,filter:p,format:o,formatter:y,serializeDate:typeof a.serializeDate=="function"?a.serializeDate:A.serializeDate,skipNulls:typeof a.skipNulls=="boolean"?a.skipNulls:A.skipNulls,sort:typeof a.sort=="function"?a.sort:null,strictNullHandling:typeof a.strictNullHandling=="boolean"?a.strictNullHandling:A.strictNullHandling}};e.exports=function(a,d){var o,y,p=a,m=i(d);typeof m.filter=="function"?(y=m.filter,p=y("",p)):_(m.filter)&&(y=m.filter,o=y);var g=[];if(typeof p!="object"||p===null)return"";var f;f=d&&d.arrayFormat in L?d.arrayFormat:d&&"indices"in d?d.indices?"indices":"repeat":"indices";var c=L[f];o||(o=Object.keys(p)),m.sort&&o.sort(m.sort);for(var x=n(),S=0;S<o.length;++S){var C=o[S];m.skipNulls&&p[C]===null||M(g,s(p[C],C,c,m.strictNullHandling,m.skipNulls,m.encode?m.encoder:null,m.filter,m.sort,m.allowDots,m.serializeDate,m.format,m.formatter,m.encodeValuesOnly,m.charset,x))}var O=g.join(m.delimiter),P=m.addQueryPrefix===!0?"?":"";return m.charsetSentinel&&(m.charset==="iso-8859-1"?P+="utf8=%26%2310003%3B&":P+="utf8=%E2%9C%93&"),O.length>0?P+O:""}},function(e,t,l){"use strict";var n=l(8),v=l(47),R=l(49),T=n("%TypeError%"),L=n("%WeakMap%",!0),_=n("%Map%",!0),E=v("WeakMap.prototype.get",!0),I=v("WeakMap.prototype.set",!0),M=v("WeakMap.prototype.has",!0),D=v("Map.prototype.get",!0),b=v("Map.prototype.set",!0),A=v("Map.prototype.has",!0),u=function(a,d){for(var o,y=a;(o=y.next)!==null;y=o)if(o.key===d)return y.next=o.next,o.next=a.next,a.next=o,o},r=function(a,d){var o=u(a,d);return o&&o.value},s=function(a,d,o){var y=u(a,d);y?y.value=o:a.next={key:d,next:a.next,value:o}},i=function(a,d){return!!u(a,d)};e.exports=function(){var a,d,o,y={assert:function(p){if(!y.has(p))throw new T("Side channel does not contain "+R(p))},get:function(p){if(L&&p&&(typeof p=="object"||typeof p=="function")){if(a)return E(a,p)}else if(_){if(d)return D(d,p)}else if(o)return r(o,p)},has:function(p){if(L&&p&&(typeof p=="object"||typeof p=="function")){if(a)return M(a,p)}else if(_){if(d)return A(d,p)}else if(o)return i(o,p);return!1},set:function(p,m){L&&p&&(typeof p=="object"||typeof p=="function")?(a||(a=new L),I(a,p,m)):_?(d||(d=new _),b(d,p,m)):(o||(o={key:{},next:null}),s(o,p,m))}};return y}},function(e,t,l){"use strict";var n=typeof Symbol!="undefined"&&Symbol,v=l(44);e.exports=function(){return typeof n=="function"&&typeof Symbol=="function"&&typeof n("foo")=="symbol"&&typeof Symbol("bar")=="symbol"&&v()}},function(e,t,l){"use strict";e.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},v=Symbol("test"),R=Object(v);if(typeof v=="string"||Object.prototype.toString.call(v)!=="[object Symbol]"||Object.prototype.toString.call(R)!=="[object Symbol]")return!1;n[v]=42;for(v in n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var T=Object.getOwnPropertySymbols(n);if(T.length!==1||T[0]!==v||!Object.prototype.propertyIsEnumerable.call(n,v))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var L=Object.getOwnPropertyDescriptor(n,v);if(L.value!==42||L.enumerable!==!0)return!1}return!0}},function(e,t,l){"use strict";var n=Array.prototype.slice,v=Object.prototype.toString;e.exports=function(R){var T=this;if(typeof T!="function"||v.call(T)!=="[object Function]")throw new TypeError("Function.prototype.bind called on incompatible "+T);for(var L,_=n.call(arguments,1),E=function(){if(this instanceof L){var A=T.apply(this,_.concat(n.call(arguments)));return Object(A)===A?A:this}return T.apply(R,_.concat(n.call(arguments)))},I=Math.max(0,T.length-_.length),M=[],D=0;D<I;D++)M.push("$"+D);if(L=Function("binder","return function ("+M.join(",")+"){ return binder.apply(this,arguments); }")(E),T.prototype){var b=function(){};b.prototype=T.prototype,L.prototype=new b,b.prototype=null}return L}},function(e,t,l){"use strict";var n=l(9);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},function(e,t,l){"use strict";var n=l(8),v=l(48),R=v(n("String.prototype.indexOf"));e.exports=function(T,L){var _=n(T,!!L);return typeof _=="function"&&R(T,".prototype.")>-1?v(_):_}},function(e,t,l){"use strict";var n=l(9),v=l(8),R=v("%Function.prototype.apply%"),T=v("%Function.prototype.call%"),L=v("%Reflect.apply%",!0)||n.call(T,R),_=v("%Object.getOwnPropertyDescriptor%",!0),E=v("%Object.defineProperty%",!0),I=v("%Math.max%");if(E)try{E({},"a",{value:1})}catch{E=null}e.exports=function(D){var b=L(n,T,arguments);return _&&E&&_(b,"length").configurable&&E(b,"length",{value:1+I(0,D.length-(arguments.length-1))}),b};var M=function(){return L(n,R,arguments)};E?E(e.exports,"apply",{value:M}):e.exports.apply=M},function(e,t,l){function n(G,V){if(G===1/0||G===-1/0||G!==G||G&&G>-1e3&&G<1e3||he.call(/e/,V))return V;var de=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof G=="number"){var ce=G<0?-Ie(-G):Ie(G);if(ce!==G){var Me=String(ce),Re=re.call(V,Me.length+1);return Q.call(Me,de,"$&_")+"."+Q.call(Q.call(Re,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Q.call(V,de,"$&_")}function v(G,V,de){var ce=(de.quoteStyle||V)==="double"?'"':"'";return ce+G+ce}function R(G){return Q.call(String(G),/"/g,"&quot;")}function T(G){return!(r(G)!=="[object Array]"||Ae&&typeof G=="object"&&Ae in G)}function L(G){return!(r(G)!=="[object Date]"||Ae&&typeof G=="object"&&Ae in G)}function _(G){return!(r(G)!=="[object RegExp]"||Ae&&typeof G=="object"&&Ae in G)}function E(G){return!(r(G)!=="[object Error]"||Ae&&typeof G=="object"&&Ae in G)}function I(G){return!(r(G)!=="[object String]"||Ae&&typeof G=="object"&&Ae in G)}function M(G){return!(r(G)!=="[object Number]"||Ae&&typeof G=="object"&&Ae in G)}function D(G){return!(r(G)!=="[object Boolean]"||Ae&&typeof G=="object"&&Ae in G)}function b(G){if(Be)return G&&typeof G=="object"&&G instanceof Symbol;if(typeof G=="symbol")return!0;if(!G||typeof G!="object"||!Te)return!1;try{return Te.call(G),!0}catch{}return!1}function A(G){if(!G||typeof G!="object"||!Ne)return!1;try{return Ne.call(G),!0}catch{}return!1}function u(G,V){return et.call(G,V)}function r(G){return fe.call(G)}function s(G){if(G.name)return G.name;var V=Se.call(ue.call(G),/^function\s*([\w$]+)/);return V?V[1]:null}function i(G,V){if(G.indexOf)return G.indexOf(V);for(var de=0,ce=G.length;de<ce;de++)if(G[de]===V)return de;return-1}function a(G){if(!N||!G||typeof G!="object")return!1;try{N.call(G);try{F.call(G)}catch{return!0}return G instanceof Map}catch{}return!1}function d(G){if(!$||!G||typeof G!="object")return!1;try{$.call(G,$);try{q.call(G,q)}catch{return!0}return G instanceof WeakMap}catch{}return!1}function o(G){if(!X||!G||typeof G!="object")return!1;try{return X.call(G),!0}catch{}return!1}function y(G){if(!F||!G||typeof G!="object")return!1;try{F.call(G);try{N.call(G)}catch{return!0}return G instanceof Set}catch{}return!1}function p(G){if(!q||!G||typeof G!="object")return!1;try{q.call(G,q);try{$.call(G,$)}catch{return!0}return G instanceof WeakSet}catch{}return!1}function m(G){return!(!G||typeof G!="object")&&(typeof HTMLElement!="undefined"&&G instanceof HTMLElement||typeof G.nodeName=="string"&&typeof G.getAttribute=="function")}function g(G,V){if(G.length>V.maxStringLength){var de=G.length-V.maxStringLength,ce="... "+de+" more character"+(de>1?"s":"");return g(re.call(G,0,V.maxStringLength),V)+ce}return v(Q.call(Q.call(G,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,f),"single",V)}function f(G){var V=G.charCodeAt(0),de={8:"b",9:"t",10:"n",12:"f",13:"r"}[V];return de?"\\"+de:"\\x"+(V<16?"0":"")+te.call(V.toString(16))}function c(G){return"Object("+G+")"}function x(G){return G+" { ? }"}function S(G,V,de,ce){return G+" ("+V+") {"+(ce?P(de,ce):Ee.call(de,", "))+"}"}function C(G){for(var V=0;V<G.length;V++)if(i(G[V],`
2
+ `)>=0)return!1;return!0}function O(G,V){var de;if(G.indent===" ")de=" ";else{if(!(typeof G.indent=="number"&&G.indent>0))return null;de=Ee.call(Array(G.indent+1)," ")}return{base:de,prev:Ee.call(Array(V+1),de)}}function P(G,V){if(G.length===0)return"";var de=`
3
+ `+V.prev+V.base;return de+Ee.call(G,","+de)+`
4
+ `+V.prev}function w(G,V){var de=T(G),ce=[];if(de){ce.length=G.length;for(var Me=0;Me<G.length;Me++)ce[Me]=u(G,Me)?V(G[Me],G):""}var Re,le=typeof ye=="function"?ye(G):[];if(Be){Re={};for(var Qe=0;Qe<le.length;Qe++)Re["$"+le[Qe]]=le[Qe]}for(var Ke in G)u(G,Ke)&&(de&&String(Number(Ke))===Ke&&Ke<G.length||Be&&Re["$"+Ke]instanceof Symbol||(he.call(/[^\w$]/,Ke)?ce.push(V(Ke,G)+": "+V(G[Ke],G)):ce.push(Ke+": "+V(G[Ke],G))));if(typeof ye=="function")for(var tt=0;tt<le.length;tt++)Ze.call(G,le[tt])&&ce.push("["+V(le[tt])+"]: "+V(G[le[tt]],G));return ce}var U=typeof Map=="function"&&Map.prototype,k=Object.getOwnPropertyDescriptor&&U?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,N=U&&k&&typeof k.get=="function"?k.get:null,B=U&&Map.prototype.forEach,K=typeof Set=="function"&&Set.prototype,W=Object.getOwnPropertyDescriptor&&K?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,F=K&&W&&typeof W.get=="function"?W.get:null,H=K&&Set.prototype.forEach,Y=typeof WeakMap=="function"&&WeakMap.prototype,$=Y?WeakMap.prototype.has:null,Z=typeof WeakSet=="function"&&WeakSet.prototype,q=Z?WeakSet.prototype.has:null,oe=typeof WeakRef=="function"&&WeakRef.prototype,X=oe?WeakRef.prototype.deref:null,ie=Boolean.prototype.valueOf,fe=Object.prototype.toString,ue=Function.prototype.toString,Se=String.prototype.match,re=String.prototype.slice,Q=String.prototype.replace,te=String.prototype.toUpperCase,ee=String.prototype.toLowerCase,he=RegExp.prototype.test,_e=Array.prototype.concat,Ee=Array.prototype.join,be=Array.prototype.slice,Ie=Math.floor,Ne=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ye=Object.getOwnPropertySymbols,Te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Be=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ae=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Be?"object":"symbol")?Symbol.toStringTag:null,Ze=Object.prototype.propertyIsEnumerable,Ue=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(G){return G.__proto__}:null),$e=l(50).custom,qe=$e&&b($e)?$e:null;e.exports=function G(V,de,ce,Me){function Re(Ot,vr,co){if(vr&&(Me=be.call(Me),Me.push(vr)),co){var an={depth:le.depth};return u(le,"quoteStyle")&&(an.quoteStyle=le.quoteStyle),G(Ot,an,ce+1,Me)}return G(Ot,le,ce+1,Me)}var le=de||{};if(u(le,"quoteStyle")&&le.quoteStyle!=="single"&&le.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(u(le,"maxStringLength")&&(typeof le.maxStringLength=="number"?le.maxStringLength<0&&le.maxStringLength!==1/0:le.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Qe=!u(le,"customInspect")||le.customInspect;if(typeof Qe!="boolean"&&Qe!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(u(le,"indent")&&le.indent!==null&&le.indent!==" "&&!(parseInt(le.indent,10)===le.indent&&le.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(u(le,"numericSeparator")&&typeof le.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ke=le.numericSeparator;if(V===void 0)return"undefined";if(V===null)return"null";if(typeof V=="boolean")return V?"true":"false";if(typeof V=="string")return g(V,le);if(typeof V=="number"){if(V===0)return 1/0/V>0?"0":"-0";var tt=String(V);return Ke?n(V,tt):tt}if(typeof V=="bigint"){var Gt=String(V)+"n";return Ke?n(V,Gt):Gt}var cr=le.depth===void 0?5:le.depth;if(ce===void 0&&(ce=0),ce>=cr&&cr>0&&typeof V=="object")return T(V)?"[Array]":"[Object]";var ct=O(le,ce);if(Me===void 0)Me=[];else if(i(Me,V)>=0)return"[Circular]";if(typeof V=="function"){var fr=s(V),Rt=w(V,Re);return"[Function"+(fr?": "+fr:" (anonymous)")+"]"+(Rt.length>0?" { "+Ee.call(Rt,", ")+" }":"")}if(b(V)){var Vt=Be?Q.call(String(V),/^(Symbol\(.*\))_[^)]*$/,"$1"):Te.call(V);return typeof V!="object"||Be?Vt:c(Vt)}if(m(V)){for(var Ct="<"+ee.call(String(V.nodeName)),$t=V.attributes||[],hr=0;hr<$t.length;hr++)Ct+=" "+$t[hr].name+"="+v(R($t[hr].value),"double",le);return Ct+=">",V.childNodes&&V.childNodes.length&&(Ct+="..."),Ct+="</"+ee.call(String(V.nodeName))+">"}if(T(V)){if(V.length===0)return"[]";var ti=w(V,Re);return ct&&!C(ti)?"["+P(ti,ct)+"]":"[ "+Ee.call(ti,", ")+" ]"}if(E(V)){var ri=w(V,Re);return"cause"in V&&!Ze.call(V,"cause")?"{ ["+String(V)+"] "+Ee.call(_e.call("[cause]: "+Re(V.cause),ri),", ")+" }":ri.length===0?"["+String(V)+"]":"{ ["+String(V)+"] "+Ee.call(ri,", ")+" }"}if(typeof V=="object"&&Qe){if(qe&&typeof V[qe]=="function")return V[qe]();if(Qe!=="symbol"&&typeof V.inspect=="function")return V.inspect()}if(a(V)){var en=[];return B.call(V,function(Ot,vr){en.push(Re(vr,V,!0)+" => "+Re(Ot,V))}),S("Map",N.call(V),en,ct)}if(y(V)){var tn=[];return H.call(V,function(Ot){tn.push(Re(Ot,V))}),S("Set",F.call(V),tn,ct)}if(d(V))return x("WeakMap");if(p(V))return x("WeakSet");if(o(V))return x("WeakRef");if(M(V))return c(Re(Number(V)));if(A(V))return c(Re(Ne.call(V)));if(D(V))return c(ie.call(V));if(I(V))return c(Re(String(V)));if(!L(V)&&!_(V)){var ii=w(V,Re),rn=Ue?Ue(V)===Object.prototype:V instanceof Object||V.constructor===Object,ni=V instanceof Object?"":"null prototype",nn=!rn&&Ae&&Object(V)===V&&Ae in V?re.call(r(V),8,-1):ni?"Object":"",uo=rn||typeof V.constructor!="function"?"":V.constructor.name?V.constructor.name+" ":"",ai=uo+(nn||ni?"["+Ee.call(_e.call([],nn||[],ni||[]),": ")+"] ":"");return ii.length===0?ai+"{}":ct?ai+"{"+P(ii,ct)+"}":ai+"{ "+Ee.call(ii,", ")+" }"}return String(V)};var et=Object.prototype.hasOwnProperty||function(G){return G in this}},function(e,t){},function(e,t,l){"use strict";var n=l(16),v=Object.prototype.hasOwnProperty,R=Array.isArray,T={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},L=function(b){return b.replace(/&#(\d+);/g,function(A,u){return String.fromCharCode(parseInt(u,10))})},_=function(b,A){return b&&typeof b=="string"&&A.comma&&b.indexOf(",")>-1?b.split(","):b},E=function(b,A){var u,r={},s=A.ignoreQueryPrefix?b.replace(/^\?/,""):b,i=A.parameterLimit===1/0?void 0:A.parameterLimit,a=s.split(A.delimiter,i),d=-1,o=A.charset;if(A.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]==="utf8=%E2%9C%93"?o="utf-8":a[u]==="utf8=%26%2310003%3B"&&(o="iso-8859-1"),d=u,u=a.length);for(u=0;u<a.length;++u)if(u!==d){var y,p,m=a[u],g=m.indexOf("]="),f=g===-1?m.indexOf("="):g+1;f===-1?(y=A.decoder(m,T.decoder,o,"key"),p=A.strictNullHandling?null:""):(y=A.decoder(m.slice(0,f),T.decoder,o,"key"),p=n.maybeMap(_(m.slice(f+1),A),function(c){return A.decoder(c,T.decoder,o,"value")})),p&&A.interpretNumericEntities&&o==="iso-8859-1"&&(p=L(p)),m.indexOf("[]=")>-1&&(p=R(p)?[p]:p),v.call(r,y)?r[y]=n.combine(r[y],p):r[y]=p}return r},I=function(b,A,u,r){for(var s=r?A:_(A,u),i=b.length-1;i>=0;--i){var a,d=b[i];if(d==="[]"&&u.parseArrays)a=[].concat(s);else{a=u.plainObjects?Object.create(null):{};var o=d.charAt(0)==="["&&d.charAt(d.length-1)==="]"?d.slice(1,-1):d,y=parseInt(o,10);u.parseArrays||o!==""?!isNaN(y)&&d!==o&&String(y)===o&&y>=0&&u.parseArrays&&y<=u.arrayLimit?(a=[],a[y]=s):o!=="__proto__"&&(a[o]=s):a={0:s}}s=a}return s},M=function(b,A,u,r){if(b){var s=u.allowDots?b.replace(/\.([^.[]+)/g,"[$1]"):b,i=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,d=u.depth>0&&i.exec(s),o=d?s.slice(0,d.index):s,y=[];if(o){if(!u.plainObjects&&v.call(Object.prototype,o)&&!u.allowPrototypes)return;y.push(o)}for(var p=0;u.depth>0&&(d=a.exec(s))!==null&&p<u.depth;){if(p+=1,!u.plainObjects&&v.call(Object.prototype,d[1].slice(1,-1))&&!u.allowPrototypes)return;y.push(d[1])}return d&&y.push("["+s.slice(d.index)+"]"),I(y,A,u,r)}},D=function(b){if(!b)return T;if(b.decoder!==null&&b.decoder!==void 0&&typeof b.decoder!="function")throw new TypeError("Decoder has to be a function.");if(b.charset!==void 0&&b.charset!=="utf-8"&&b.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var A=b.charset===void 0?T.charset:b.charset;return{allowDots:b.allowDots===void 0?T.allowDots:!!b.allowDots,allowPrototypes:typeof b.allowPrototypes=="boolean"?b.allowPrototypes:T.allowPrototypes,allowSparse:typeof b.allowSparse=="boolean"?b.allowSparse:T.allowSparse,arrayLimit:typeof b.arrayLimit=="number"?b.arrayLimit:T.arrayLimit,charset:A,charsetSentinel:typeof b.charsetSentinel=="boolean"?b.charsetSentinel:T.charsetSentinel,comma:typeof b.comma=="boolean"?b.comma:T.comma,decoder:typeof b.decoder=="function"?b.decoder:T.decoder,delimiter:typeof b.delimiter=="string"||n.isRegExp(b.delimiter)?b.delimiter:T.delimiter,depth:typeof b.depth=="number"||b.depth===!1?+b.depth:T.depth,ignoreQueryPrefix:b.ignoreQueryPrefix===!0,interpretNumericEntities:typeof b.interpretNumericEntities=="boolean"?b.interpretNumericEntities:T.interpretNumericEntities,parameterLimit:typeof b.parameterLimit=="number"?b.parameterLimit:T.parameterLimit,parseArrays:b.parseArrays!==!1,plainObjects:typeof b.plainObjects=="boolean"?b.plainObjects:T.plainObjects,strictNullHandling:typeof b.strictNullHandling=="boolean"?b.strictNullHandling:T.strictNullHandling}};e.exports=function(b,A){var u=D(A);if(b===""||b===null||b===void 0)return u.plainObjects?Object.create(null):{};for(var r=typeof b=="string"?E(b,u):b,s=u.plainObjects?Object.create(null):{},i=Object.keys(r),a=0;a<i.length;++a){var d=i[a],o=M(d,r[d],u,typeof b=="string");s=n.merge(s,o,u)}return u.allowSparse===!0?s:n.compact(s)}},function(e,t,l){"use strict";var n,v,R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(T){return typeof T}:function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T};(function(T){var L=!1;if(n=T,(v=typeof n=="function"?n.call(t,l,t,e):n)!==void 0&&(e.exports=v),L=!0,R(t)==="object"&&(e.exports=T(),L=!0),!L){var _=window.Cookies,E=window.Cookies=T();E.noConflict=function(){return window.Cookies=_,E}}})(function(){function T(_){function E(I,M,D){var b;if(typeof document!="undefined"){if(arguments.length>1){if(D=L({path:"/"},E.defaults,D),typeof D.expires=="number"){var A=new Date;A.setMilliseconds(A.getMilliseconds()+864e5*D.expires),D.expires=A}try{b=JSON.stringify(M),/^[\{\[]/.test(b)&&(M=b)}catch{}return M=_.write?_.write(M,I):encodeURIComponent(String(M)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),I=encodeURIComponent(String(I)),I=I.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),I=I.replace(/[\(\)]/g,escape),document.cookie=[I,"=",M,D.expires?"; expires="+D.expires.toUTCString():"",D.path?"; path="+D.path:"",D.domain?"; domain="+D.domain:"",D.secure?"; secure":""].join("")}I||(b={});for(var u=document.cookie?document.cookie.split("; "):[],r=/(%[0-9A-Z]{2})+/g,s=0;s<u.length;s++){var i=u[s].split("="),a=i.slice(1).join("=");a.charAt(0)==='"'&&(a=a.slice(1,-1));try{var d=i[0].replace(r,decodeURIComponent);if(a=_.read?_.read(a,d):_(a,d)||a.replace(r,decodeURIComponent),this.json)try{a=JSON.parse(a)}catch{}if(I===d){b=a;break}I||(b[d]=a)}catch{}}return b}}return E.set=E,E.get=function(I){return E.call(E,I)},E.getJSON=function(){return E.apply({json:!0},[].slice.call(arguments))},E.defaults={},E.remove=function(I,M){E(I,"",L(M,{expires:-1}))},E.withConverter=T,E}var L=function(){for(var _=0,E={};_<arguments.length;_++){var I=arguments[_];for(var M in I)E[M]=I[M]}return E};return T(function(){})})},function(e,t,l){"use strict";function n(v,R){var T=R.beaconCollectionDomain,L=R.beaconDomain;if(T)return"https://"+T;v=v||"inferred";var _=L||"litix.io";return v.match(/^[a-z0-9]+$/)?"https://"+v+"."+_:"https://img.litix.io/a.gif"}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(0),v=function(L){return L&&L.__esModule?L:{default:L}}(n),R=function(){var L=void 0;switch(T()){case"cellular":L="cellular";break;case"ethernet":L="wired";break;case"wifi":L="wifi";break;case void 0:break;default:L="other"}return L},T=function(){var L=v.default.navigator,_=L&&(L.connection||L.mozConnection||L.webkitConnection);return _&&_.type};t.default=R},function(e,t,l){"use strict";function n(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(t,"__esModule",{value:!0});var v=l(0),R=n(v),T=l(4),L=n(T),_=l(56),E=n(_),I=l(1),M=n(I),D=l(17),b=n(D),A=l(2),u=n(A),r=!!R.default.XMLHttpRequest&&"withCredentials"in new R.default.XMLHttpRequest,s={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4},i=function(a,d){this._beaconUrl=a||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=(0,M.default)({},s,d)};i.prototype.queueEvent=function(a,d){var o=(0,M.default)({},d);return r?(this._eventQueue.length<=this._options.maxQueueLength||a==="eventrateexceeded")&&(this._eventQueue.push(o),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):(E.default.send(this._beaconUrl,o),!0)},i.prototype.flushEvents=function(){r&&(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},i.prototype.destroy=function(){var a=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,a?this._clearBeaconQueue():this.flushEvents(),R.default.clearTimeout(this._sendTimeout)},i.prototype._clearBeaconQueue=function(){var a=R.default.navigator,d=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,o=this._eventQueue.slice(d);d>0&&(0,M.default)(o[o.length-1],(0,b.default)({mux_view_message:"event queue truncated"}));var y=this._createPayload(o);if(a.sendBeacon)a.sendBeacon(this._beaconUrl,y);else if(R.default.XMLHttpRequest){var p=new R.default.XMLHttpRequest;p.open("POST",this._beaconUrl),p.setRequestHeader("Content-Type","application/json"),p.send(y)}else E.default.send(this._beaconUrl,o[o.length-1])},i.prototype._sendBeaconQueue=function(){var a=this;if(R.default.XMLHttpRequest&&!this._postInFlight){var d=new R.default.XMLHttpRequest,o=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0,d.onreadystatechange=function(){d.readyState===4&&(d.status!==200?(a._eventQueue=o.concat(a._eventQueue),a._failureCount+=1,L.default.info("Error sending beacon: "+d.status),L.default.info(d.responseText)):a._failureCount=0,a._roundTripTime=u.default.now()-p,a._postInFlight=!1)},d.open("POST",this._beaconUrl),d.setRequestHeader("Content-Type","application/json");var y=this._createPayload(o),p=u.default.now();d.send(y)}},i.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var a=Math.pow(2,this._failureCount-1);return(1+(a*=Math.random()))*this._options.baseTimeBetweenBeacons},i.prototype._startBeaconSending=function(){var a=this;R.default.clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=R.default.setTimeout(function(){a._eventQueue.length&&a._sendBeaconQueue(),a._startBeaconSending()},this._getNextBeaconTime()))},i.prototype._createPayload=function(a){var d={transmission_timestamp:Math.round(u.default.now())};return this._roundTripTime&&(d.rtt_ms=Math.round(this._roundTripTime)),JSON.stringify({metadata:d,events:a})},t.default=i},function(e,t,l){"use strict";function n(E){return E&&E.__esModule?E:{default:E}}Object.defineProperty(t,"__esModule",{value:!0});var v=l(15),R=n(v),T=l(0),L=n(T),_={};_.send=function(E,I){function M(){D.src=A+(b?"&rc="+b:"")}var D=new Image,b=0,A=E+"?"+R.default.stringify(I);return D.addEventListener("error",function(){b>3||L.default.setTimeout(function(){b++,M()},5e3*b)}),M(),D},t.default=_},function(e,t,l){"use strict";function n(){function v(A,u){var r=u.request_start,s=u.request_response_start,i=u.request_response_end,a=u.request_bytes_loaded;I++;var d=void 0,o=void 0;if(s?(d=s-r,o=i-s):o=i-r,o>0&&a>0){var y=a/o*8e3;M++,_+=a,E+=o,this.data.view_min_request_throughput=Math.min(this.data.view_min_request_throughput||1/0,y),this.data.view_average_request_throughput=_/E*8e3,this.data.view_request_count=I,d>0&&(L+=d,this.data.view_max_request_latency=Math.max(this.data.view_max_request_latency||0,d),this.data.view_average_request_latency=L/M)}}function R(A,u){I++,D++,this.data.view_request_count=I,this.data.view_request_failed_count=D}function T(A,u){I++,b++,this.data.view_request_count=I,this.data.view_request_canceled_count=b}var L=0,_=0,E=0,I=0,M=0,D=0,b=0;this.on("requestcompleted",v),this.on("requestfailed",R),this.on("requestcanceled",T)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,l){"use strict";function n(M,D,b){var A=(0,_.findMediaElement)(D),u=R(A,3),r=u[0],s=u[1],i=u[2],a=M.log,d=M.utils.getComputedStyle,o=M.utils.secondsToMs,y={automaticErrorTracking:!0};if(!r)return a.error("No element was found with the `"+s+"` query selector.");if(i!=="video"&&i!=="audio")return a.error("The element of `"+s+"` was not a media element.");b=(0,L.default)(y,b),b.data=(0,L.default)({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:"4.8.0"},b.data),b.getPlayheadTime=function(){return o(r.currentTime)},b.getStateData=function(){var m=this.hlsjs&&this.hlsjs.url,g=this.dashjs&&v(this.dashjs.getSource==="function")&&this.dashjs.getSource();return{player_is_paused:r.paused,player_playhead_time:o(r.currentTime),player_width:parseInt(d(r,"width")),player_height:parseInt(d(r,"height")),player_autoplay_on:r.autoplay,player_preload_on:r.preload,video_poster_url:r.poster,video_source_url:m||g||r.currentSrc,video_source_duration:o(r.duration),video_source_height:r.videoHeight,video_source_width:r.videoWidth}},r.mux=r.mux||{},r.mux.deleted=!1,r.mux.emit=function(m,g){M.emit(s,m,g)};var p=function(){a.error("The monitor for this video element has already been destroyed.")};r.mux.destroy=function(){Object.keys(r.mux.listeners).forEach(function(m){r.removeEventListener(m,r.mux.listeners[m],!1)}),delete r.mux.listeners,r.mux.destroy=p,r.mux.swapElement=p,r.mux.emit=p,r.mux.addHLSJS=p,r.mux.addDashJS=p,r.mux.removeHLSJS=p,r.mux.removeDashJS=p,r.mux.deleted=!0,M.emit(s,"destroy")},r.mux.swapElement=function(m){var g=(0,_.findMediaElement)(m),f=R(g,3),c=f[0],x=f[1],S=f[2];return c?S!=="video"&&S!=="audio"?M.log.error("The element of `"+x+"` was not a media element."):(c.muxId=r.muxId,delete r.muxId,c.mux=c.mux||{},c.mux.listeners=(0,L.default)({},r.mux.listeners),delete r.mux.listeners,Object.keys(c.mux.listeners).forEach(function(C){r.removeEventListener(C,c.mux.listeners[C],!1),c.addEventListener(C,c.mux.listeners[C],!1)}),c.mux.swapElement=r.mux.swapElement,c.mux.destroy=r.mux.destroy,delete r.mux,void(r=c)):M.log.error("No element was found with the `"+x+"` query selector.")},r.mux.addHLSJS=function(m){M.addHLSJS(s,m)},r.mux.addDashJS=function(m){M.addDashJS(s,m)},r.mux.removeHLSJS=function(){M.removeHLSJS(s)},r.mux.removeDashJS=function(){M.removeDashJS(s)},M.init(s,b),M.emit(s,"playerready"),r.paused||(M.emit(s,"play"),r.readyState>2&&M.emit(s,"playing")),r.mux.listeners={},E.forEach(function(m){(m!=="error"||b.automaticErrorTracking)&&(r.mux.listeners[m]=function(){var g={};if(m==="error"){if(!r.error||r.error.code===1)return;g.player_error_code=r.error.code,g.player_error_message=I[r.error.code]||r.error.message}M.emit(s,m,g)},r.addEventListener(m,r.mux.listeners[m],!1))})}Object.defineProperty(t,"__esModule",{value:!0});var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},R=function(){function M(D,b){var A=[],u=!0,r=!1,s=void 0;try{for(var i,a=D[Symbol.iterator]();!(u=(i=a.next()).done)&&(A.push(i.value),!b||A.length!==b);u=!0);}catch(d){r=!0,s=d}finally{try{!u&&a.return&&a.return()}finally{if(r)throw s}}return A}return function(D,b){if(Array.isArray(D))return D;if(Symbol.iterator in Object(D))return M(D,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=n;var T=l(1),L=function(M){return M&&M.__esModule?M:{default:M}}(T),_=l(11),E=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],I={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"}},function(e,t,l){"use strict";function n(y){return y&&y.__esModule?y:{default:y}}Object.defineProperty(t,"__esModule",{value:!0});var v=l(60),R=n(v),T=l(3),L=n(T),_=l(61),E=n(_),I=l(62),M=n(I),D=l(1),b=n(D),A=l(7),u=n(A),r=l(5),s=l(2),i=n(s),a=l(63),d=n(a),o={};o.safeCall=R.default,o.safeIncrement=L.default,o.getComputedStyle=E.default,o.secondsToMs=M.default,o.assign=b.default,o.headersStringToObject=u.default,o.extractHostnameAndDomain=r.extractHostnameAndDomain,o.extractHostname=r.extractHostname,o.now=i.default.now,o.manifestParser=d.default,t.default=o},function(e,t,l){"use strict";function n(T,L,_,E){var I=E;if(T&&typeof T[L]=="function")try{I=T[L].apply(T,_)}catch(M){R.default.info("safeCall error",M)}return I}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=l(4),R=function(T){return T&&T.__esModule?T:{default:T}}(v)},function(e,t,l){"use strict";function n(L,_){if(L&&_&&R.default&&typeof R.default.getComputedStyle=="function"){var E=void 0;return T&&T.has(L)&&(E=T.get(L)),E||(E=R.default.getComputedStyle(L,null),T&&T.set(L,E)),E.getPropertyValue(_)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var v=l(0),R=function(L){return L&&L.__esModule?L:{default:L}}(v),T=void 0;R.default&&R.default.WeakMap&&(T=new WeakMap)},function(e,t,l){"use strict";function n(v){return Math.floor(1e3*v)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,l){"use strict";function n(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(t,"__esModule",{value:!0});var v=l(1),R=n(v),T=l(14),L=n(T),_={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},E=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};E.prototype.process=function(i){var a=void 0;for(this.buffer+=i,a=this.buffer.indexOf(`
5
+ `);a>-1;a=this.buffer.indexOf(`
6
+ `))this.processLine(this.buffer.substring(0,a)),this.buffer=this.buffer.substring(a+1)},E.prototype.processLine=function(i){var a=i.indexOf(":"),d=r(i,a),o=d[0],y=d.length===2?D(d[1]):void 0;if(o[0]!=="#")this.currentUri.uri=o,this.manifest.segments.push(this.currentUri),!this.manifest.targetDuration||"duration"in this.currentUri||(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(o){case _.TARGET_DURATION:if(!isFinite(y)||y<0)return;this.manifest.targetDuration=y,this.setHoldBack();break;case _.PART_INF:I(this.manifest,d),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case _.SERVER_CONTROL:I(this.manifest,d),this.setHoldBack();break;case _.INF:y===0?this.currentUri.duration=.01:y>0&&(this.currentUri.duration=y);break;case _.PROGRAM_DATE_TIME:var p=y,m=new Date(p);this.manifest.dateTimeString||(this.manifest.dateTimeString=p,this.manifest.dateTimeObject=m),this.currentUri.dateTimeString=p,this.currentUri.dateTimeObject=m;break;case _.VERSION:I(this.manifest,d);break;case _.SESSION_DATA:var g=s(d[1]),f=(0,L.default)(g);(0,R.default)(this.manifest.sessionData,f)}},E.prototype.setHoldBack=function(){var i=this.manifest,a=i.serverControl,d=i.targetDuration,o=i.partTargetDuration;if(a){var y="holdBack",p="partHoldBack",m=d&&3*d,g=o&&2*o;d&&!a.hasOwnProperty(y)&&(a[y]=m),m&&a[y]<m&&(a[y]=m),o&&!a.hasOwnProperty(p)&&(a[p]=3*o),o&&a[p]<g&&(a[p]=g)}};var I=function(i,a){var d=M(a[0].replace("#EXT-X-","")),o=void 0;u(a[1])?(o={},o=(0,R.default)(A(a[1]),o)):o=D(a[1]),i[d]=o},M=function(i){return i.toLowerCase().replace(/-(\w)/g,function(a){return a[1].toUpperCase()})},D=function(i){if(i.toLowerCase()==="yes"||i.toLowerCase()==="no")return i.toLowerCase()==="yes";var a=i.indexOf(":")!==-1?i:parseFloat(i);return isNaN(a)?i:a},b=function(i){var a={},d=i.split("=");return d.length>1&&(a[M(d[0])]=D(d[1])),a},A=function(i){for(var a=i.split(","),d={},o=0;a.length>o;o++){var y=a[o],p=b(y);d=(0,R.default)(p,d)}return d},u=function(i){return i.indexOf("=")>-1},r=function(i,a){return a===-1?[i]:[i.substring(0,a),i.substring(a+1)]},s=function(i){var a={};if(i){var d=i.search(",");return[i.slice(0,d),i.slice(d+1)].forEach(function(o,y){for(var p=o.replace(/['"]+/g,"").split("="),m=0;m<p.length;m++)p[m]==="DATA-ID"&&(a["DATA-ID"]=p[1-m]),p[m]==="VALUE"&&(a.VALUE=p[1-m])}),{data:a}}};t.default=E},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};t.default=n}])})})()});var pr=sn((Yt,ui)=>{typeof window!="undefined"&&function(e,t){typeof Yt=="object"&&typeof ui=="object"?ui.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Yt=="object"?Yt.Hls=t():e.Hls=t()}(Yt,function(){return function(h){var e={};function t(l){if(e[l])return e[l].exports;var n=e[l]={i:l,l:!1,exports:{}};return h[l].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=h,t.c=e,t.d=function(l,n,v){t.o(l,n)||Object.defineProperty(l,n,{enumerable:!0,get:v})},t.r=function(l){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},t.t=function(l,n){if(n&1&&(l=t(l)),n&8||n&4&&typeof l=="object"&&l&&l.__esModule)return l;var v=Object.create(null);if(t.r(v),Object.defineProperty(v,"default",{enumerable:!0,value:l}),n&2&&typeof l!="string")for(var R in l)t.d(v,R,function(T){return l[T]}.bind(null,R));return v},t.n=function(l){var n=l&&l.__esModule?function(){return l.default}:function(){return l};return t.d(n,"a",n),n},t.o=function(l,n){return Object.prototype.hasOwnProperty.call(l,n)},t.p="/dist/",t(t.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(h,e,t){"use strict";var l=Object.prototype.hasOwnProperty,n="~";function v(){}Object.create&&(v.prototype=Object.create(null),new v().__proto__||(n=!1));function R(E,I,M){this.fn=E,this.context=I,this.once=M||!1}function T(E,I,M,D,b){if(typeof M!="function")throw new TypeError("The listener must be a function");var A=new R(M,D||E,b),u=n?n+I:I;return E._events[u]?E._events[u].fn?E._events[u]=[E._events[u],A]:E._events[u].push(A):(E._events[u]=A,E._eventsCount++),E}function L(E,I){--E._eventsCount==0?E._events=new v:delete E._events[I]}function _(){this._events=new v,this._eventsCount=0}_.prototype.eventNames=function(){var I=[],M,D;if(this._eventsCount===0)return I;for(D in M=this._events)l.call(M,D)&&I.push(n?D.slice(1):D);return Object.getOwnPropertySymbols?I.concat(Object.getOwnPropertySymbols(M)):I},_.prototype.listeners=function(I){var M=n?n+I:I,D=this._events[M];if(!D)return[];if(D.fn)return[D.fn];for(var b=0,A=D.length,u=new Array(A);b<A;b++)u[b]=D[b].fn;return u},_.prototype.listenerCount=function(I){var M=n?n+I:I,D=this._events[M];return D?D.fn?1:D.length:0},_.prototype.emit=function(I,M,D,b,A,u){var r=n?n+I:I;if(!this._events[r])return!1;var s=this._events[r],i=arguments.length,a,d;if(s.fn){switch(s.once&&this.removeListener(I,s.fn,void 0,!0),i){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,M),!0;case 3:return s.fn.call(s.context,M,D),!0;case 4:return s.fn.call(s.context,M,D,b),!0;case 5:return s.fn.call(s.context,M,D,b,A),!0;case 6:return s.fn.call(s.context,M,D,b,A,u),!0}for(d=1,a=new Array(i-1);d<i;d++)a[d-1]=arguments[d];s.fn.apply(s.context,a)}else{var o=s.length,y;for(d=0;d<o;d++)switch(s[d].once&&this.removeListener(I,s[d].fn,void 0,!0),i){case 1:s[d].fn.call(s[d].context);break;case 2:s[d].fn.call(s[d].context,M);break;case 3:s[d].fn.call(s[d].context,M,D);break;case 4:s[d].fn.call(s[d].context,M,D,b);break;default:if(!a)for(y=1,a=new Array(i-1);y<i;y++)a[y-1]=arguments[y];s[d].fn.apply(s[d].context,a)}}return!0},_.prototype.on=function(I,M,D){return T(this,I,M,D,!1)},_.prototype.once=function(I,M,D){return T(this,I,M,D,!0)},_.prototype.removeListener=function(I,M,D,b){var A=n?n+I:I;if(!this._events[A])return this;if(!M)return L(this,A),this;var u=this._events[A];if(u.fn)u.fn===M&&(!b||u.once)&&(!D||u.context===D)&&L(this,A);else{for(var r=0,s=[],i=u.length;r<i;r++)(u[r].fn!==M||b&&!u[r].once||D&&u[r].context!==D)&&s.push(u[r]);s.length?this._events[A]=s.length===1?s[0]:s:L(this,A)}return this},_.prototype.removeAllListeners=function(I){var M;return I?(M=n?n+I:I,this._events[M]&&L(this,M)):(this._events=new v,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=n,_.EventEmitter=_,h.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(h,e,t){(function(l){var n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,v=/^([^\/?#]*)([^]*)$/,R=/(?:\/|^)\.(?=\/)/g,T=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,L={buildAbsoluteURL:function(_,E,I){if(I=I||{},_=_.trim(),E=E.trim(),!E){if(!I.alwaysNormalize)return _;var M=L.parseURL(_);if(!M)throw new Error("Error trying to parse base URL.");return M.path=L.normalizePath(M.path),L.buildURLFromParts(M)}var D=L.parseURL(E);if(!D)throw new Error("Error trying to parse relative URL.");if(D.scheme)return I.alwaysNormalize?(D.path=L.normalizePath(D.path),L.buildURLFromParts(D)):E;var b=L.parseURL(_);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var A=v.exec(b.path);b.netLoc=A[1],b.path=A[2]}b.netLoc&&!b.path&&(b.path="/");var u={scheme:b.scheme,netLoc:D.netLoc,path:null,params:D.params,query:D.query,fragment:D.fragment};if(!D.netLoc&&(u.netLoc=b.netLoc,D.path[0]!=="/"))if(!D.path)u.path=b.path,D.params||(u.params=b.params,D.query||(u.query=b.query));else{var r=b.path,s=r.substring(0,r.lastIndexOf("/")+1)+D.path;u.path=L.normalizePath(s)}return u.path===null&&(u.path=I.alwaysNormalize?L.normalizePath(D.path):D.path),L.buildURLFromParts(u)},parseURL:function(_){var E=n.exec(_);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(R,"");_.length!==(_=_.replace(T,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};h.exports=L})(this)},"./node_modules/webworkify-webpack/index.js":function(h,e,t){function l(I){var M={};function D(A){if(M[A])return M[A].exports;var u=M[A]={i:A,l:!1,exports:{}};return I[A].call(u.exports,u,u.exports,D),u.l=!0,u.exports}D.m=I,D.c=M,D.i=function(A){return A},D.d=function(A,u,r){D.o(A,u)||Object.defineProperty(A,u,{configurable:!1,enumerable:!0,get:r})},D.r=function(A){Object.defineProperty(A,"__esModule",{value:!0})},D.n=function(A){var u=A&&A.__esModule?function(){return A.default}:function(){return A};return D.d(u,"a",u),u},D.o=function(A,u){return Object.prototype.hasOwnProperty.call(A,u)},D.p="/",D.oe=function(A){throw console.error(A),A};var b=D(D.s=ENTRY_MODULE);return b.default||b}var n="[\\.|\\-|\\+|\\w|/|@]+",v="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function R(I){return(I+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function T(I){return!isNaN(1*I)}function L(I,M,D){var b={};b[D]=[];var A=M.toString(),u=A.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return b;for(var r=u[1],s=new RegExp("(\\\\n|\\W)"+R(r)+v,"g"),i;i=s.exec(A);)i[3]!=="dll-reference"&&b[D].push(i[3]);for(s=new RegExp("\\("+R(r)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+v,"g");i=s.exec(A);)I[i[2]]||(b[D].push(i[1]),I[i[2]]=t(i[1]).m),b[i[2]]=b[i[2]]||[],b[i[2]].push(i[4]);for(var a=Object.keys(b),d=0;d<a.length;d++)for(var o=0;o<b[a[d]].length;o++)T(b[a[d]][o])&&(b[a[d]][o]=1*b[a[d]][o]);return b}function _(I){var M=Object.keys(I);return M.reduce(function(D,b){return D||I[b].length>0},!1)}function E(I,M){for(var D={main:[M]},b={main:[]},A={main:{}};_(D);)for(var u=Object.keys(D),r=0;r<u.length;r++){var s=u[r],i=D[s],a=i.pop();if(A[s]=A[s]||{},!(A[s][a]||!I[s][a])){A[s][a]=!0,b[s]=b[s]||[],b[s].push(a);for(var d=L(I,I[s][a],s),o=Object.keys(d),y=0;y<o.length;y++)D[o[y]]=D[o[y]]||[],D[o[y]]=D[o[y]].concat(d[o[y]])}}return b}h.exports=function(I,M){M=M||{};var D={main:t.m},b=M.all?{main:Object.keys(D.main)}:E(D,I),A="";Object.keys(b).filter(function(a){return a!=="main"}).forEach(function(a){for(var d=0;b[a][d];)d++;b[a].push(d),D[a][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",A=A+"var "+a+" = ("+l.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+b[a].map(function(o){return""+JSON.stringify(o)+": "+D[a][o].toString()}).join(",")+`});
7
+ `}),A=A+"new (("+l.toString().replace("ENTRY_MODULE",JSON.stringify(I))+")({"+b.main.map(function(a){return""+JSON.stringify(a)+": "+D.main[a].toString()}).join(",")+"}))(self);";var u=new window.Blob([A],{type:"text/javascript"});if(M.bare)return u;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,s=r.createObjectURL(u),i=new window.Worker(s);return i.objectURL=s,i}},"./src/config.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"hlsDefaultConfig",function(){return y}),t.d(e,"mergeConfig",function(){return m}),t.d(e,"enableStreamingMode",function(){return g});var l=t("./src/controller/abr-controller.ts"),n=t("./src/controller/audio-stream-controller.ts"),v=t("./src/controller/audio-track-controller.ts"),R=t("./src/controller/subtitle-stream-controller.ts"),T=t("./src/controller/subtitle-track-controller.ts"),L=t("./src/controller/buffer-controller.ts"),_=t("./src/controller/timeline-controller.ts"),E=t("./src/controller/cap-level-controller.ts"),I=t("./src/controller/fps-controller.ts"),M=t("./src/controller/eme-controller.ts"),D=t("./src/controller/cmcd-controller.ts"),b=t("./src/utils/xhr-loader.ts"),A=t("./src/utils/fetch-loader.ts"),u=t("./src/utils/cues.ts"),r=t("./src/utils/mediakeys-helper.ts"),s=t("./src/utils/logger.ts");function i(){return i=Object.assign||function(f){for(var c=1;c<arguments.length;c++){var x=arguments[c];for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&(f[S]=x[S])}return f},i.apply(this,arguments)}function a(f,c){var x=Object.keys(f);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(f);c&&(S=S.filter(function(C){return Object.getOwnPropertyDescriptor(f,C).enumerable})),x.push.apply(x,S)}return x}function d(f){for(var c=1;c<arguments.length;c++){var x=arguments[c]!=null?arguments[c]:{};c%2?a(Object(x),!0).forEach(function(S){o(f,S,x[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(x)):a(Object(x)).forEach(function(S){Object.defineProperty(f,S,Object.getOwnPropertyDescriptor(x,S))})}return f}function o(f,c,x){return c in f?Object.defineProperty(f,c,{value:x,enumerable:!0,configurable:!0,writable:!0}):f[c]=x,f}var y=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:l.default,bufferController:L.default,capLevelController:E.default,fpsController:I.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},p()),{},{subtitleStreamController:R.SubtitleStreamController,subtitleTrackController:T.default,timelineController:_.TimelineController,audioStreamController:n.default,audioTrackController:v.default,emeController:M.default,cmcdController:D.default});function p(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function m(f,c){if((c.liveSyncDurationCount||c.liveMaxLatencyDurationCount)&&(c.liveSyncDuration||c.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(c.liveMaxLatencyDurationCount!==void 0&&(c.liveSyncDurationCount===void 0||c.liveMaxLatencyDurationCount<=c.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(c.liveMaxLatencyDuration!==void 0&&(c.liveSyncDuration===void 0||c.liveMaxLatencyDuration<=c.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return i({},f,c)}function g(f){var c=f.loader;if(c!==A.default&&c!==b.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),f.progressive=!1;else{var x=Object(A.fetchSupported)();x&&(f.loader=A.default,f.progressive=!0,f.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/polyfills/number.ts"),n=t("./src/utils/ewma-bandwidth-estimator.ts"),v=t("./src/events.ts"),R=t("./src/utils/buffer-helper.ts"),T=t("./src/errors.ts"),L=t("./src/types/loader.ts"),_=t("./src/utils/logger.ts");function E(D,b){for(var A=0;A<b.length;A++){var u=b[A];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(D,u.key,u)}}function I(D,b,A){return b&&E(D.prototype,b),A&&E(D,A),D}var M=function(){function D(A){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=A;var u=A.config;this.bwEstimator=new n.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var b=D.prototype;return b.registerListeners=function(){var u=this.hls;u.on(v.Events.FRAG_LOADING,this.onFragLoading,this),u.on(v.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(v.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(v.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var u=this.hls;u.off(v.Events.FRAG_LOADING,this.onFragLoading,this),u.off(v.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(v.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(v.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(u,r){var s=r.frag;if(s.type===L.PlaylistLevelType.MAIN&&!this.timer){var i;this.fragCurrent=s,this.partCurrent=(i=r.part)!=null?i:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(u,r){var s=this.hls.config;r.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var u=this.fragCurrent,r=this.partCurrent,s=this.hls,i=s.autoLevelEnabled,a=s.config,d=s.media;if(!(!u||!d)){var o=r?r.stats:u.stats,y=r?r.duration:u.duration;if(o.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!(!i||d.paused||!d.playbackRate||!d.readyState)){var p=performance.now()-o.loading.start,m=Math.abs(d.playbackRate);if(!(p<=500*y/m)){var g=s.levels,f=s.minAutoLevel,c=g[u.level],x=o.total||Math.max(o.loaded,Math.round(y*c.maxBitrate/8)),S=Math.max(1,o.bwEstimate?o.bwEstimate/8:o.loaded*1e3/p),C=(x-o.loaded)/S,O=d.currentTime,P=(R.BufferHelper.bufferInfo(d,O,a.maxBufferHole).end-O)/m;if(!(P>=2*y/m||C<=P)){var w=Number.POSITIVE_INFINITY,U;for(U=u.level-1;U>f;U--){var k=g[U].maxBitrate;if(w=y*k/(8*.8*S),w<P)break}if(!(w>=C)){var N=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+u.sn+(r?" part "+r.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+U+`
8
+ Current BW estimate: `+(Object(l.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
9
+ Estimated load time for current fragment: `+C.toFixed(3)+` s
10
+ Estimated load time for the next fragment: `+w.toFixed(3)+` s
11
+ Time to underbuffer: `+P.toFixed(3)+" s"),s.nextLoadLevel=U,this.bwEstimator.sample(p,o.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(v.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:r,stats:o})}}}}}},b.onFragLoaded=function(u,r){var s=r.frag,i=r.part;if(s.type===L.PlaylistLevelType.MAIN&&Object(l.isFiniteNumber)(s.sn)){var a=i?i.stats:s.stats,d=i?i.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var o=this.hls.levels[s.level],y=(o.loaded?o.loaded.bytes:0)+a.loaded,p=(o.loaded?o.loaded.duration:0)+d;o.loaded={bytes:y,duration:p},o.realBitrate=Math.round(8*y/p)}if(s.bitrateTest){var m={stats:a,frag:s,part:i,id:s.type};this.onFragBuffered(v.Events.FRAG_BUFFERED,m),s.bitrateTest=!1}}},b.onFragBuffered=function(u,r){var s=r.frag,i=r.part,a=i?i.stats:s.stats;if(!a.aborted&&!(s.type!==L.PlaylistLevelType.MAIN||s.sn==="initSegment")){var d=a.parsing.end-a.loading.start;this.bwEstimator.sample(d,a.loaded),a.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0}},b.onError=function(u,r){switch(r.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var u=this.fragCurrent,r=this.partCurrent,s=this.hls,i=s.maxAutoLevel,a=s.config,d=s.minAutoLevel,o=s.media,y=r?r.duration:u?u.duration:0,p=o?o.currentTime:0,m=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1,g=this.bwEstimator?this.bwEstimator.getEstimate():a.abrEwmaDefaultEstimate,f=(R.BufferHelper.bufferInfo(o,p,a.maxBufferHole).end-p)/m,c=this.findBestLevel(g,d,i,f,a.abrBandWidthFactor,a.abrBandWidthUpFactor);if(c>=0)return c;_.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=y?Math.min(y,a.maxStarvationDelay):a.maxStarvationDelay,S=a.abrBandWidthFactor,C=a.abrBandWidthUpFactor;if(!f){var O=this.bitrateTestDelay;if(O){var P=y?Math.min(y,a.maxLoadingDelay):a.maxLoadingDelay;x=P-O,_.logger.trace("bitrate test took "+Math.round(1e3*O)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),S=C=1}}return c=this.findBestLevel(g,d,i,f+x,S,C),Math.max(c,0)},b.findBestLevel=function(u,r,s,i,a,d){for(var o,y=this.fragCurrent,p=this.partCurrent,m=this.lastLoadedFragLevel,g=this.hls.levels,f=g[m],c=!!(f!=null&&(o=f.details)!==null&&o!==void 0&&o.live),x=f==null?void 0:f.codecSet,S=p?p.duration:y?y.duration:0,C=s;C>=r;C--){var O=g[C];if(!(!O||x&&O.codecSet!==x)){var P=O.details,w=(p?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||S,U=void 0;C<=m?U=a*u:U=d*u;var k=g[C].maxBitrate,N=k*w/U;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+C+"/"+Math.round(U)+"/"+k+"/"+w+"/"+i+"/"+N),U>k&&(!N||c&&!this.bitrateTestDelay||N<i))return C}}return-1},I(D,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,r=this.bwEstimator;if(u!==-1&&(!r||!r.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),D}();e.default=M},"./src/controller/audio-stream-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/polyfills/number.ts"),n=t("./src/controller/base-stream-controller.ts"),v=t("./src/events.ts"),R=t("./src/utils/buffer-helper.ts"),T=t("./src/controller/fragment-tracker.ts"),L=t("./src/types/level.ts"),_=t("./src/types/loader.ts"),E=t("./src/loader/fragment.ts"),I=t("./src/demux/chunk-cache.ts"),M=t("./src/demux/transmuxer-interface.ts"),D=t("./src/types/transmuxer.ts"),b=t("./src/controller/fragment-finders.ts"),A=t("./src/utils/discontinuities.ts"),u=t("./src/errors.ts"),r=t("./src/utils/logger.ts");function s(){return s=Object.assign||function(y){for(var p=1;p<arguments.length;p++){var m=arguments[p];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(y[g]=m[g])}return y},s.apply(this,arguments)}function i(y,p){y.prototype=Object.create(p.prototype),y.prototype.constructor=y,a(y,p)}function a(y,p){return a=Object.setPrototypeOf||function(g,f){return g.__proto__=f,g},a(y,p)}var d=100,o=function(y){i(p,y);function p(g,f){var c;return c=y.call(this,g,f,"[audio-stream-controller]")||this,c.videoBuffer=null,c.videoTrackCC=-1,c.waitingVideoCC=-1,c.audioSwitch=!1,c.trackId=-1,c.waitingData=null,c.mainDetails=null,c.bufferFlushed=!1,c._registerListeners(),c}var m=p.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var f=this.hls;f.on(v.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(v.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),f.on(v.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(v.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),f.on(v.Events.ERROR,this.onError,this),f.on(v.Events.BUFFER_RESET,this.onBufferReset,this),f.on(v.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(v.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.on(v.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var f=this.hls;f.off(v.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(v.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),f.off(v.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(v.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),f.off(v.Events.ERROR,this.onError,this),f.off(v.Events.BUFFER_RESET,this.onBufferReset,this),f.off(v.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(v.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(v.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(f,c){var x=c.frag,S=c.id,C=c.initPTS;if(S==="main"){var O=x.cc;this.initPTS[x.cc]=C,this.log("InitPTS for cc: "+O+" found from main: "+C),this.videoTrackCC=O,this.state===n.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(f){if(!this.levels){this.startPosition=f,this.state=n.State.STOPPED;return}var c=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,c>0&&f===-1?(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),this.state=n.State.IDLE):(this.loadedmetadata=!1,this.state=n.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()},m.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_TRACK:{var f,c=this.levels,x=this.trackId,S=c==null||(f=c[x])===null||f===void 0?void 0:f.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=n.State.WAITING_INIT_PTS}break}case n.State.FRAG_LOADING_WAITING_RETRY:{var C,O=performance.now(),P=this.retryDate;(!P||O>=P||(C=this.media)!==null&&C!==void 0&&C.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=n.State.IDLE);break}case n.State.WAITING_INIT_PTS:{var w=this.waitingData;if(w){var U=w.frag,k=w.part,N=w.cache,B=w.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.FRAG_LOADING;var K=N.flush(),W={frag:U,part:k,payload:K,networkDetails:null};this._handleFragmentLoadProgress(W),B&&y.prototype._handleFragmentLoadComplete.call(this,W)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var F=this.getLoadPosition(),H=R.BufferHelper.bufferInfo(this.mediaBuffer,F,this.config.maxBufferHole),Y=Object(b.fragmentWithinToleranceTest)(H.end,this.config.maxFragLookUpTolerance,U);Y<0&&(r.logger.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+H.end+" is needed"),this.clearWaitingFragment())}}else this.state=n.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var f=this.waitingData;f&&(this.fragmentTracker.removeFragment(f.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.IDLE)},m.onTickEnd=function(){var f=this.media;if(!(!f||!f.readyState)){var c=this.mediaBuffer?this.mediaBuffer:f,x=c.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=f.currentTime}},m.doTickIdle=function(){var f,c,x=this.hls,S=this.levels,C=this.media,O=this.trackId,P=x.config;if(!(!S||!S[O])&&!(!C&&(this.startFragRequested||!P.startFragPrefetch))){var w=S[O],U=w.details;if(!U||U.live&&this.levelLastLoaded!==O||this.waitForCdnTuneIn(U)){this.state=n.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(k!==null){var N=k.len,B=this.getMaxBufferLength(),K=this.audioSwitch;if(!(N>=B&&!K)){if(!K&&this._streamEnded(k,U)){x.trigger(v.Events.BUFFER_EOS,{type:"audio"}),this.state=n.State.ENDED;return}var W=U.fragments,F=W[0].start,H=k.end;if(K){var Y=this.getLoadPosition();H=Y,U.PTSKnown&&Y<F&&(k.end>F||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),C.currentTime=F+.05)}var $=this.getNextFragment(H,U);if(!$){this.bufferFlushed=!0;return}((f=$.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((c=$.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey($,U):this.loadFragment($,U,H)}}}},m.getMaxBufferLength=function(){var f=y.prototype.getMaxBufferLength.call(this),c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return c===null?f:Math.max(f,c.len)},m.onMediaDetaching=function(){this.videoBuffer=null,y.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(f,c){var x=c.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(S){return new L.Level(S)})},m.onAudioTrackSwitching=function(f,c){var x=!!c.url;this.trackId=c.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(d):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(f,c){this.mainDetails=c.details},m.onAudioTrackLoaded=function(f,c){var x,S=this.levels,C=c.details,O=c.id;if(!S){this.warn("Audio tracks were reset while loading level "+O);return}this.log("Track "+O+" loaded ["+C.startSN+","+C.endSN+"],duration:"+C.totalduration);var P=S[O],w=0;if(C.live||(x=P.details)!==null&&x!==void 0&&x.live){var U=this.mainDetails;if(C.fragments[0]||(C.deltaUpdateFailed=!0),C.deltaUpdateFailed||!U)return;!P.details&&C.hasProgramDateTime&&U.hasProgramDateTime?(Object(A.alignMediaPlaylistByPDT)(C,U),w=C.fragments[0].start):w=this.alignPlaylists(C,P.details)}P.details=C,this.levelLastLoaded=O,!this.startFragRequested&&(this.mainDetails||!C.live)&&this.setStartPosition(P.details,w),this.state===n.State.WAITING_TRACK&&!this.waitForCdnTuneIn(C)&&(this.state=n.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(f){var c,x=f.frag,S=f.part,C=f.payload,O=this.config,P=this.trackId,w=this.levels;if(!w){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var U=w[P];console.assert(U,"Audio track is defined on fragment load progress");var k=U.details;console.assert(k,"Audio track details are defined on fragment load progress");var N=O.defaultAudioCodec||U.audioCodec||"mp4a.40.2",B=this.transmuxer;B||(B=this.transmuxer=new M.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[x.cc],W=(c=x.initSegment)===null||c===void 0?void 0:c.data;if(K!==void 0){var F=!1,H=S?S.index:-1,Y=H!==-1,$=new D.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,C.byteLength,H,Y);B.push(C,W,N,"",x,S,k.totalduration,F,$,K)}else{r.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+P);var Z=this.waitingData=this.waitingData||{frag:x,part:S,cache:new I.default,complete:!1},q=Z.cache;q.push(new Uint8Array(C)),this.waitingVideoCC=this.videoTrackCC,this.state=n.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(f){if(this.waitingData){this.waitingData.complete=!0;return}y.prototype._handleFragmentLoadComplete.call(this,f)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(f,c){var x=c.tracks.audio;x&&(this.mediaBuffer=x.buffer),c.tracks.video&&(this.videoBuffer=c.tracks.video.buffer)},m.onFragBuffered=function(f,c){var x=c.frag,S=c.part;if(x.type===_.PlaylistLevelType.AUDIO){if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(S?" p: "+S.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(v.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,S)}},m.onError=function(f,c){switch(c.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,c);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=c.fatal?n.State.ERROR:n.State.IDLE,this.warn(c.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="audio"&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var x=!0,S=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);S&&S.len>.5&&(x=!this.reduceMaxBufferLength(S.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,y.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(f,c){var x=c.type;x===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(f){var c,x="audio",S=this.hls,C=f.remuxResult,O=f.chunkMeta,P=this.getCurrentContext(O);if(!P){this.warn("The loading context changed while buffering fragment "+O.sn+" of level "+O.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(O.level);return}var w=P.frag,U=P.part,k=C.audio,N=C.text,B=C.id3,K=C.initSegment;if(!this.fragContextChanged(w)){if(this.state=n.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),K!=null&&K.tracks&&(this._bufferInitSegment(K.tracks,w,O),S.trigger(v.Events.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:x,tracks:K.tracks})),k){var W=k.startPTS,F=k.endPTS,H=k.startDTS,Y=k.endDTS;U&&(U.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:W,endPTS:F,startDTS:H,endDTS:Y}),w.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,W,F,H,Y),this.bufferFragmentData(k,w,U,O)}if(B!=null&&(c=B.samples)!==null&&c!==void 0&&c.length){var $=s({frag:w,id:x},B);S.trigger(v.Events.FRAG_PARSING_METADATA,$)}if(N){var Z=s({frag:w,id:x},N);S.trigger(v.Events.FRAG_PARSING_USERDATA,Z)}}},m._bufferInitSegment=function(f,c,x){if(this.state===n.State.PARSING){f.video&&delete f.video;var S=f.audio;if(!!S){S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(v.Events.BUFFER_CODECS,f);var C=S.initSegment;if(C!=null&&C.byteLength){var O={type:"audio",frag:c,part:null,chunkMeta:x,parent:c.type,data:C};this.hls.trigger(v.Events.BUFFER_APPENDING,O)}this.tick()}}},m.loadFragment=function(f,c,x){var S=this.fragmentTracker.getState(f);this.fragCurrent=f,(this.audioSwitch||S===T.FragmentState.NOT_LOADED||S===T.FragmentState.PARTIAL)&&(f.sn==="initSegment"?this._loadInitSegment(f):c.live&&!Object(l.isFiniteNumber)(this.initPTS[f.cc])?(this.log("Waiting for video PTS in continuity counter "+f.cc+" of live stream before loading audio fragment "+f.sn+" of level "+this.trackId),this.state=n.State.WAITING_INIT_PTS):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,f,c,x)))},m.completeAudioSwitch=function(){var f=this.hls,c=this.media,x=this.trackId;c&&(this.log("Switching audio track : flushing all audio"),y.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,f.trigger(v.Events.AUDIO_TRACK_SWITCHED,{id:x})},p}(n.default);e.default=o},"./src/controller/audio-track-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts"),n=t("./src/errors.ts"),v=t("./src/controller/base-playlist-controller.ts"),R=t("./src/types/loader.ts");function T(M,D){for(var b=0;b<D.length;b++){var A=D[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(M,A.key,A)}}function L(M,D,b){return D&&T(M.prototype,D),b&&T(M,b),M}function _(M,D){M.prototype=Object.create(D.prototype),M.prototype.constructor=M,E(M,D)}function E(M,D){return E=Object.setPrototypeOf||function(A,u){return A.__proto__=u,A},E(M,D)}var I=function(M){_(D,M);function D(A){var u;return u=M.call(this,A,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var b=D.prototype;return b.registerListeners=function(){var u=this.hls;u.on(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(l.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(l.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(l.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var u=this.hls;u.off(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(l.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(l.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(l.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(u,r){this.tracks=r.audioTracks||[]},b.onAudioTrackLoaded=function(u,r){var s=r.id,i=r.details,a=this.tracksInGroup[s];if(!a){this.warn("Invalid audio track id "+s);return}var d=a.details;a.details=r.details,this.log("audioTrack "+s+" loaded ["+i.startSN+"-"+i.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,r,d))},b.onLevelLoading=function(u,r){this.switchLevel(r.level)},b.onLevelSwitching=function(u,r){this.switchLevel(r.level)},b.switchLevel=function(u){var r=this.hls.levels[u];if(!!(r!=null&&r.audioGroupIds)){var s=r.audioGroupIds[r.urlId];if(this.groupId!==s){this.groupId=s;var i=this.tracks.filter(function(d){return!s||d.groupId===s});this.selectDefaultTrack&&!i.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var a={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(l.Events.AUDIO_TRACKS_UPDATED,a),this.selectInitialTrack()}}},b.onError=function(u,r){M.prototype.onError.call(this,u,r),!(r.fatal||!r.context)&&r.context.type===R.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},b.setAudioTrack=function(u){var r=this.tracksInGroup;if(u<0||u>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=r[this.trackId];this.log("Now switching to audio-track index "+u);var i=r[u],a=i.id,d=i.groupId,o=d===void 0?"":d,y=i.name,p=i.type,m=i.url;if(this.trackId=u,this.trackName=y,this.selectDefaultTrack=!1,this.hls.trigger(l.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:y,type:p,url:m}),!(i.details&&!i.details.live)){var g=this.switchParams(i.url,s==null?void 0:s.details);this.loadPlaylist(g)}},b.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,s=this.findTrackId(r)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(u){for(var r=this.tracksInGroup,s=0;s<r.length;s++){var i=r[s];if((!this.selectDefaultTrack||i.default)&&(!u||u===i.name))return i.id}return-1},b.loadPlaylist=function(u){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var s=r.id,i=r.groupId,a=r.url;if(u)try{a=u.addDirectives(a)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(l.Events.AUDIO_TRACK_LOADING,{url:a,id:s,groupId:i,deliveryDirectives:u||null})}},L(D,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),D}(v.default);e.default=I},"./src/controller/base-playlist-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return L});var l=t("./src/polyfills/number.ts"),n=t("./src/types/level.ts"),v=t("./src/controller/level-helper.ts"),R=t("./src/utils/logger.ts"),T=t("./src/errors.ts"),L=function(){function _(I,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=R.logger.log.bind(R.logger,M+":"),this.warn=R.logger.warn.bind(R.logger,M+":"),this.hls=I}var E=_.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(M,D){D.fatal&&D.type===T.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(M,D){var b=D==null?void 0:D.renditionReports;if(b)for(var A=0;A<b.length;A++){var u=b[A],r=""+u.URI;if(r===M.substr(-r.length)){var s=parseInt(u["LAST-MSN"]),i=parseInt(u["LAST-PART"]);if(D&&this.hls.config.lowLatencyMode){var a=Math.min(D.age-D.partTarget,D.targetduration);i!==void 0&&a>D.partTarget&&(i+=1)}if(Object(l.isFiniteNumber)(s))return new n.HlsUrlParameters(s,Object(l.isFiniteNumber)(i)?i:void 0,n.HlsSkip.No)}}},E.loadPlaylist=function(M){},E.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},E.playlistLoaded=function(M,D,b){var A=this,u=D.details,r=D.stats,s=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||b!=null&&b.live){if(u.reloaded(b),b&&this.log("live playlist "+M+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),b&&u.fragments.length>0&&Object(v.mergeDetails)(b,u),!this.canLoad||!u.live)return;var i,a=void 0,d=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var o=this.hls.config.lowLatencyMode,y=u.lastPartSn,p=u.endSN,m=u.lastPartIndex,g=m!==-1,f=y===p,c=o?0:m;g?(a=f?p+1:y,d=f?c:m+1):a=p+1;var x=u.age,S=x+u.ageHeader,C=Math.min(S-u.partTarget,u.targetduration*1.5);if(C>0){if(b&&C>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+C+" with playlist age: "+u.age),C=0;else{var O=Math.floor(C/u.targetduration);if(a+=O,d!==void 0){var P=Math.round(C%u.targetduration/u.partTarget);d+=P}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+C+" skip sn "+O+" to part "+d)}u.tuneInGoal=C}if(i=this.getDeliveryDirectives(u,D.deliveryDirectives,a,d),o||!f){this.loadPlaylist(i);return}}else i=this.getDeliveryDirectives(u,D.deliveryDirectives,a,d);var w=Object(v.computeReloadInterval)(u,r);a!==void 0&&u.canBlockReload&&(w-=u.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(w)+" ms"),this.timer=self.setTimeout(function(){return A.loadPlaylist(i)},w)}else this.clearTimer()},E.getDeliveryDirectives=function(M,D,b,A){var u=Object(n.getSkipValue)(M,b);return D!=null&&D.skip&&M.deltaUpdateFailed&&(b=D.msn,A=D.part,u=n.HlsSkip.No),new n.HlsUrlParameters(b,A,u)},E.retryLoadingOrFail=function(M){var D=this,b=this.hls.config,A=this.retryCount<b.levelLoadingMaxRetry;if(A){var u;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(u=M.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return D.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return A},_}()},"./src/controller/base-stream-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"State",function(){return p}),t.d(e,"default",function(){return m});var l=t("./src/polyfills/number.ts"),n=t("./src/task-loop.ts"),v=t("./src/controller/fragment-tracker.ts"),R=t("./src/utils/buffer-helper.ts"),T=t("./src/utils/logger.ts"),L=t("./src/events.ts"),_=t("./src/errors.ts"),E=t("./src/types/transmuxer.ts"),I=t("./src/utils/mp4-tools.ts"),M=t("./src/utils/discontinuities.ts"),D=t("./src/controller/fragment-finders.ts"),b=t("./src/controller/level-helper.ts"),A=t("./src/loader/fragment-loader.ts"),u=t("./src/crypt/decrypter.ts"),r=t("./src/utils/time-ranges.ts"),s=t("./src/types/loader.ts");function i(g,f){for(var c=0;c<f.length;c++){var x=f[c];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(g,x.key,x)}}function a(g,f,c){return f&&i(g.prototype,f),c&&i(g,c),g}function d(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function o(g,f){g.prototype=Object.create(f.prototype),g.prototype.constructor=g,y(g,f)}function y(g,f){return y=Object.setPrototypeOf||function(x,S){return x.__proto__=S,x},y(g,f)}var p={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},m=function(g){o(f,g);function f(x,S,C){var O;return O=g.call(this)||this,O.hls=void 0,O.fragPrevious=null,O.fragCurrent=null,O.fragmentTracker=void 0,O.transmuxer=null,O._state=p.STOPPED,O.media=void 0,O.mediaBuffer=void 0,O.config=void 0,O.bitrateTest=!1,O.lastCurrentTime=0,O.nextLoadPosition=0,O.startPosition=0,O.loadedmetadata=!1,O.fragLoadError=0,O.retryDate=0,O.levels=null,O.fragmentLoader=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.logPrefix=C,O.log=T.logger.log.bind(T.logger,C+":"),O.warn=T.logger.warn.bind(T.logger,C+":"),O.hls=x,O.fragmentLoader=new A.default(x.config),O.fragmentTracker=S,O.config=x.config,O.decrypter=new u.default(x,x.config),x.on(L.Events.KEY_LOADED,O.onKeyLoaded,d(O)),O}var c=f.prototype;return c.doTick=function(){this.onTickEnd()},c.onTickEnd=function(){},c.startLoad=function(S){},c.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=p.STOPPED},c._streamEnded=function(S,C){var O=this.fragCurrent,P=this.fragmentTracker;if(!C.live&&O&&O.sn>=C.endSN&&!S.nextStart){var w=C.partList;if(w!=null&&w.length){var U=w[w.length-1],k=R.BufferHelper.isBuffered(this.media,U.start+U.duration/2);return k}var N=P.getState(O);return N===v.FragmentState.PARTIAL||N===v.FragmentState.OK}return!1},c.onMediaAttached=function(S,C){var O=this.media=this.mediaBuffer=C.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),O.addEventListener("seeking",this.onvseeking),O.addEventListener("ended",this.onvended);var P=this.config;this.levels&&P.autoStartLoad&&this.state===p.STOPPED&&this.startLoad(P.startPosition)},c.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},c.onMediaSeeking=function(){var S=this.config,C=this.fragCurrent,O=this.media,P=this.mediaBuffer,w=this.state,U=O?O.currentTime:0,k=R.BufferHelper.bufferInfo(P||O,U,S.maxBufferHole);if(this.log("media seeking to "+(Object(l.isFiniteNumber)(U)?U.toFixed(3):U)+", state: "+w),w===p.ENDED)this.resetLoadingState();else if(C&&!k.len){var N=S.maxFragLookUpTolerance,B=C.start-N,K=C.start+C.duration+N,W=U>K;(U<B||W)&&(W&&C.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),C.loader.abort()),this.resetLoadingState())}O&&(this.lastCurrentTime=U),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=U),this.tickImmediate()},c.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},c.onKeyLoaded=function(S,C){if(!(this.state!==p.KEY_LOADING||C.frag!==this.fragCurrent||!this.levels)){this.state=p.IDLE;var O=this.levels[C.frag.level].details;O&&this.loadFragment(C.frag,O,C.frag.start)}},c.onHandlerDestroying=function(){this.stopLoad(),g.prototype.onHandlerDestroying.call(this)},c.onHandlerDestroyed=function(){this.state=p.STOPPED,this.hls.off(L.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,g.prototype.onHandlerDestroyed.call(this)},c.loadKey=function(S,C){this.log("Loading key for "+S.sn+" of ["+C.startSN+"-"+C.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=p.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(L.Events.KEY_LOADING,{frag:S})},c.loadFragment=function(S,C,O){this._loadFragForPlayback(S,C,O)},c._loadFragForPlayback=function(S,C,O){var P=this,w=function(k){if(P.fragContextChanged(S)){P.warn("Fragment "+S.sn+(k.part?" p: "+k.part.index:"")+" of level "+S.level+" was dropped during download."),P.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,P._handleFragmentLoadProgress(k)};this._doFragLoad(S,C,O,w).then(function(U){if(!!U){P.fragLoadError=0;var k=P.state;if(P.fragContextChanged(S)){(k===p.FRAG_LOADING||k===p.BACKTRACKING||!P.fragCurrent&&k===p.PARSING)&&(P.fragmentTracker.removeFragment(S),P.state=p.IDLE);return}if("payload"in U&&(P.log("Loaded fragment "+S.sn+" of level "+S.level),P.hls.trigger(L.Events.FRAG_LOADED,U),P.state===p.BACKTRACKING)){P.fragmentTracker.backtrack(S,U),P.resetFragmentLoading(S);return}P._handleFragmentLoadComplete(U)}}).catch(function(U){P.warn(U),P.resetFragmentLoading(S)})},c.flushMainBuffer=function(S,C,O){if(O===void 0&&(O=null),!!(S-C)){var P={startOffset:S,endOffset:C,type:O};this.fragLoadError=0,this.hls.trigger(L.Events.BUFFER_FLUSHING,P)}},c._loadInitSegment=function(S){var C=this;this._doFragLoad(S).then(function(O){if(!O||C.fragContextChanged(S)||!C.levels)throw new Error("init load aborted");return O}).then(function(O){var P=C.hls,w=O.payload,U=S.decryptdata;if(w&&w.byteLength>0&&U&&U.key&&U.iv&&U.method==="AES-128"){var k=self.performance.now();return C.decrypter.webCryptoDecrypt(new Uint8Array(w),U.key.buffer,U.iv.buffer).then(function(N){var B=self.performance.now();return P.trigger(L.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:k,tdecrypt:B}}),O.payload=N,O})}return O}).then(function(O){var P=C.fragCurrent,w=C.hls,U=C.levels;if(!U)throw new Error("init load aborted, missing levels");var k=U[S.level].details;console.assert(k,"Level details are defined when init segment is loaded");var N=S.stats;C.state=p.IDLE,C.fragLoadError=0,S.data=new Uint8Array(O.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),O.frag===P&&w.trigger(L.Events.FRAG_BUFFERED,{stats:N,frag:P,part:null,id:S.type}),C.tick()}).catch(function(O){C.warn(O),C.resetFragmentLoading(S)})},c.fragContextChanged=function(S){var C=this.fragCurrent;return!S||!C||S.level!==C.level||S.sn!==C.sn||S.urlId!==C.urlId},c.fragBufferedComplete=function(S,C){var O=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(C?" part: "+C.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+r.default.toString(R.BufferHelper.getBuffered(O))),this.state=p.IDLE,this.tick()},c._handleFragmentLoadComplete=function(S){var C=this.transmuxer;if(!!C){var O=S.frag,P=S.part,w=S.partsLoaded,U=!w||w.length===0||w.some(function(N){return!N}),k=new E.ChunkMetadata(O.level,O.sn,O.stats.chunkCount+1,0,P?P.index:-1,!U);C.flush(k)}},c._handleFragmentLoadProgress=function(S){},c._doFragLoad=function(S,C,O,P){var w=this;if(O===void 0&&(O=null),!this.levels)throw new Error("frag load aborted, missing levels");if(O=Math.max(S.start,O||0),this.config.lowLatencyMode&&C){var U=C.partList;if(U&&P){O>S.end&&C.fragmentHint&&(S=C.fragmentHint);var k=this.getNextPart(U,S,O);if(k>-1){var N=U[k];return this.log("Loading part sn: "+S.sn+" p: "+N.index+" cc: "+S.cc+" of playlist ["+C.startSN+"-"+C.endSN+"] parts [0-"+k+"-"+(U.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(O.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=p.FRAG_LOADING,this.hls.trigger(L.Events.FRAG_LOADING,{frag:S,part:U[k],targetBufferTime:O}),this.doFragPartsLoad(S,U,k,P).catch(function(B){return w.handleFragLoadError(B)})}else if(!S.url||this.loadedEndOfParts(U,O))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(C?"of ["+C.startSN+"-"+C.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(O.toFixed(3))),Object(l.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=p.FRAG_LOADING,this.hls.trigger(L.Events.FRAG_LOADING,{frag:S,targetBufferTime:O}),this.fragmentLoader.load(S,P).catch(function(B){return w.handleFragLoadError(B)})},c.doFragPartsLoad=function(S,C,O,P){var w=this;return new Promise(function(U,k){var N=[],B=function K(W){var F=C[W];w.fragmentLoader.loadPart(S,F,P).then(function(H){N[F.index]=H;var Y=H.part;w.hls.trigger(L.Events.FRAG_LOADED,H);var $=C[W+1];if($&&$.fragment===S)K(W+1);else return U({frag:S,part:Y,partsLoaded:N})}).catch(k)};B(O)})},c.handleFragLoadError=function(S){var C=S.data;return C&&C.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(C.frag,C.part):this.hls.trigger(L.Events.ERROR,C),null},c._handleTransmuxerFlush=function(S){var C=this.getCurrentContext(S);if(!C||this.state!==p.PARSING){this.fragCurrent||(this.state=p.IDLE);return}var O=C.frag,P=C.part,w=C.level,U=self.performance.now();O.stats.parsing.end=U,P&&(P.stats.parsing.end=U),this.updateLevelTiming(O,P,w,S.partial)},c.getCurrentContext=function(S){var C=this.levels,O=S.level,P=S.sn,w=S.part;if(!C||!C[O])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+O+". The current chunk will not be buffered."),null;var U=C[O],k=w>-1?Object(b.getPartWith)(U,P,w):null,N=k?k.fragment:Object(b.getFragmentWithSN)(U,P,this.fragCurrent);return N?{frag:N,part:k,level:U}:null},c.bufferFragmentData=function(S,C,O,P){if(!(!S||this.state!==p.PARSING)){var w=S.data1,U=S.data2,k=w;if(w&&U&&(k=Object(I.appendUint8Array)(w,U)),!(!k||!k.length)){var N={type:S.type,frag:C,part:O,chunkMeta:P,parent:C.type,data:k};this.hls.trigger(L.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!O&&this.flushBufferGap(C)}}},c.flushBufferGap=function(S){var C=this.media;if(!!C){if(!R.BufferHelper.isBuffered(C,C.currentTime)){this.flushMainBuffer(0,S.start);return}var O=C.currentTime,P=R.BufferHelper.bufferInfo(C,O,0),w=S.duration,U=Math.min(this.config.maxFragLookUpTolerance*2,w*.25),k=Math.max(Math.min(S.start-U,P.end-U),O+U);S.start-k>U&&this.flushMainBuffer(k,S.start)}},c.getFwdBufferInfo=function(S,C){var O=this.config,P=this.getLoadPosition();if(!Object(l.isFiniteNumber)(P))return null;var w=R.BufferHelper.bufferInfo(S,P,O.maxBufferHole);if(w.len===0&&w.nextStart!==void 0){var U=this.fragmentTracker.getBufferedFrag(P,C);if(U&&w.nextStart<U.end)return R.BufferHelper.bufferInfo(S,P,Math.max(w.nextStart,O.maxBufferHole))}return w},c.getMaxBufferLength=function(S){var C=this.config,O;return S?O=Math.max(8*C.maxBufferSize/S,C.maxBufferLength):O=C.maxBufferLength,Math.min(O,C.maxMaxBufferLength)},c.reduceMaxBufferLength=function(S){var C=this.config,O=S||C.maxBufferLength;return C.maxMaxBufferLength>=O?(C.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+C.maxMaxBufferLength+"s"),!0):!1},c.getNextFragment=function(S,C){var O,P,w=C.fragments,U=w.length;if(!U)return null;var k=this.config,N=w[0].start,B;if(C.live){var K=k.initialLiveManifestSize;if(U<K)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+K+")"),null;!C.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(B=this.getInitialLiveFragment(C,w),this.startPosition=B?this.hls.liveSyncPosition||B.start:S)}else S<=N&&(B=w[0]);if(!B){var W=k.lowLatencyMode?C.partEnd:C.fragmentEnd;B=this.getFragmentAtPosition(S,W,C)}return(O=B)!==null&&O!==void 0&&O.initSegment&&!((P=B)!==null&&P!==void 0&&P.initSegment.data)&&!this.bitrateTest&&(B=B.initSegment),B},c.getNextPart=function(S,C,O){for(var P=-1,w=!1,U=!0,k=0,N=S.length;k<N;k++){var B=S[k];if(U=U&&!B.independent,P>-1&&O<B.start)break;var K=B.loaded;!K&&(w||B.independent||U)&&B.fragment===C&&(P=k),w=K}return P},c.loadedEndOfParts=function(S,C){var O=S[S.length-1];return O&&C>O.start&&O.loaded},c.getInitialLiveFragment=function(S,C){var O=this.fragPrevious,P=null;if(O){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+O.programDateTime),P=Object(D.findFragmentByPDT)(C,O.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var w=O.sn+1;if(w>=S.startSN&&w<=S.endSN){var U=C[w-S.startSN];O.cc===U.cc&&(P=U,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(D.findFragWithCC)(C,O.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(P=this.getFragmentAtPosition(k,this.bitrateTest?S.fragmentEnd:S.edge,S))}return P},c.getFragmentAtPosition=function(S,C,O){var P=this.config,w=this.fragPrevious,U=O.fragments,k=O.endSN,N=O.fragmentHint,B=P.maxFragLookUpTolerance,K=!!(P.lowLatencyMode&&O.partList&&N);K&&N&&!this.bitrateTest&&(U=U.concat(N),k=N.sn);var W;if(S<C){var F=S>C-B?0:B;W=Object(D.findFragmentByPTS)(w,U,S,F)}else W=U[U.length-1];if(W){var H=W.sn-O.startSN,Y=w&&W.level===w.level,$=U[H+1],Z=this.fragmentTracker.getState(W);if(Z===v.FragmentState.BACKTRACKED){W=null;for(var q=H;U[q]&&this.fragmentTracker.getState(U[q])===v.FragmentState.BACKTRACKED;)w?W=U[q--]:W=U[--q];W||(W=$)}else w&&W.sn===w.sn&&!K&&Y&&(W.sn<k&&this.fragmentTracker.getState($)!==v.FragmentState.OK?(this.log("SN "+W.sn+" just loaded, load next one: "+$.sn),W=$):W=null)}return W},c.synchronizeToLiveEdge=function(S){var C=this.config,O=this.media;if(!!O){var P=this.hls.liveSyncPosition,w=O.currentTime,U=S.fragments[0].start,k=S.edge,N=w>=U-C.maxFragLookUpTolerance&&w<=k;if(P!==null&&O.duration>P&&(w<P||!N)){var B=C.liveMaxLatencyDuration!==void 0?C.liveMaxLatencyDuration:C.liveMaxLatencyDurationCount*S.targetduration;(!N&&O.readyState<4||w<k-B)&&(this.loadedmetadata||(this.nextLoadPosition=P),O.readyState&&(this.warn("Playback: "+w.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+P.toFixed(3)),O.currentTime=P))}}},c.alignPlaylists=function(S,C){var O=this.levels,P=this.levelLastLoaded,w=this.fragPrevious,U=P!==null?O[P]:null,k=S.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,B=!C,K=S.alignedSliding&&Object(l.isFiniteNumber)(N);if(B||!K&&!N){Object(M.alignStream)(w,U,S);var W=S.fragments[0].start;return this.log("Live playlist sliding: "+W.toFixed(2)+" start-sn: "+(C?C.startSN:"na")+"->"+S.startSN+" prev-sn: "+(w?w.sn:"na")+" fragments: "+k),W}return N},c.waitForCdnTuneIn=function(S){var C=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*C)},c.setStartPosition=function(S,C){var O=this.startPosition;if(O<C&&(O=-1),O===-1||this.lastCurrentTime===-1){var P=S.startTimeOffset;Object(l.isFiniteNumber)(P)?(O=C+P,P<0&&(O+=S.totalduration),O=Math.min(Math.max(C,O),C+S.totalduration),this.log("Start time offset "+P+" found in playlist, adjust startPosition to "+O),this.startPosition=O):S.live?O=this.hls.liveSyncPosition||C:this.startPosition=O=0,this.lastCurrentTime=O}this.nextLoadPosition=O},c.getLoadPosition=function(){var S=this.media,C=0;return this.loadedmetadata&&S?C=S.currentTime:this.nextLoadPosition&&(C=this.nextLoadPosition),C},c.handleFragLoadAborted=function(S,C){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(C?" part"+C.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},c.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=p.IDLE)},c.onFragmentOrKeyLoadError=function(S,C){if(!C.fatal){var O=C.frag;if(!(!O||O.type!==S)){var P=this.fragCurrent;console.assert(P&&O.sn===P.sn&&O.level===P.level&&O.urlId===P.urlId,"Frag load error must match current frag to retry");var w=this.config;if(this.fragLoadError+1<=w.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(O.level))return;var U=Math.min(Math.pow(2,this.fragLoadError)*w.fragLoadingRetryDelay,w.fragLoadingMaxRetryTimeout);this.warn("Fragment "+O.sn+" of "+S+" "+O.level+" failed to load, retrying in "+U+"ms"),this.retryDate=self.performance.now()+U,this.fragLoadError++,this.state=p.FRAG_LOADING_WAITING_RETRY}else C.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=p.IDLE):(T.logger.error(C.details+" reaches max retry, redispatch as fatal ..."),C.fatal=!0,this.hls.stopLoad(),this.state=p.ERROR)}}},c.afterBufferFlushed=function(S,C,O){if(!!S){var P=R.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(C,P,O),this.state===p.ENDED&&this.resetLoadingState()}},c.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=p.IDLE},c.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var C=this.levels?this.levels[S].details:null;if(C!=null&&C.live)return this.startPosition=-1,this.setStartPosition(C,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},c.updateLevelTiming=function(S,C,O,P){var w=this,U=O.details;console.assert(!!U,"level.details must be defined");var k=Object.keys(S.elementaryStreams).reduce(function(N,B){var K=S.elementaryStreams[B];if(K){var W=K.endPTS-K.startPTS;if(W<=0)return w.warn("Could not parse fragment "+S.sn+" "+B+" duration reliably ("+W+") resetting transmuxer to fallback to playlist timing"),w.resetTransmuxer(),N||!1;var F=P?0:Object(b.updateFragPTSDTS)(U,S,K.startPTS,K.endPTS,K.startDTS,K.endDTS);return w.hls.trigger(L.Events.LEVEL_PTS_UPDATED,{details:U,level:O,drift:F,type:B,frag:S,start:K.startPTS,end:K.endPTS}),!0}return N},!1);k?(this.state=p.PARSED,this.hls.trigger(L.Events.FRAG_PARSED,{frag:S,part:C})):this.resetLoadingState()},c.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},a(f,[{key:"state",get:function(){return this._state},set:function(S){var C=this._state;C!==S&&(this._state=S,this.log(C+"->"+S))}}]),f}(n.default)},"./src/controller/buffer-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return D});var l=t("./src/polyfills/number.ts"),n=t("./src/events.ts"),v=t("./src/utils/logger.ts"),R=t("./src/errors.ts"),T=t("./src/utils/buffer-helper.ts"),L=t("./src/utils/mediasource-helper.ts"),_=t("./src/loader/fragment.ts"),E=t("./src/controller/buffer-operation-queue.ts"),I=Object(L.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,D=function(){function b(u){var r=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=r.hls,i=r.media,a=r.mediaSource;v.logger.log("[buffer-controller]: Media source opened"),i&&(r.updateMediaElementDuration(),s.trigger(n.Events.MEDIA_ATTACHED,{media:i})),a&&a.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){v.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){v.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var A=b.prototype;return A.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},A.destroy=function(){this.unregisterListeners(),this.details=null},A.registerListeners=function(){var r=this.hls;r.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(n.Events.BUFFER_RESET,this.onBufferReset,this),r.on(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(n.Events.BUFFER_EOS,this.onBufferEos,this),r.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(n.Events.FRAG_PARSED,this.onFragParsed,this),r.on(n.Events.FRAG_CHANGED,this.onFragChanged,this)},A.unregisterListeners=function(){var r=this.hls;r.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(n.Events.BUFFER_RESET,this.onBufferReset,this),r.off(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(n.Events.BUFFER_EOS,this.onBufferEos,this),r.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(n.Events.FRAG_PARSED,this.onFragParsed,this),r.off(n.Events.FRAG_CHANGED,this.onFragChanged,this)},A._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},A.onManifestParsed=function(r,s){var i=2;(s.audio&&!s.video||!s.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,v.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},A.onMediaAttaching=function(r,s){var i=this.media=s.media;if(i&&I){var a=this.mediaSource=new I;a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(a),this._objectUrl=i.src}},A.onMediaDetaching=function(){var r=this.media,s=this.mediaSource,i=this._objectUrl;if(s){if(v.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(a){v.logger.warn("[buffer-controller]: onMediaDetaching: "+a.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(i&&self.URL.revokeObjectURL(i),r.src===i?(r.removeAttribute("src"),r.load()):v.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(n.Events.MEDIA_DETACHED,void 0)},A.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(s){var i=r.sourceBuffer[s];try{i&&(r.removeBufferListeners(s),r.mediaSource&&r.mediaSource.removeSourceBuffer(i),r.sourceBuffer[s]=void 0)}catch(a){v.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",a)}}),this._initSourceBuffer()},A.onBufferCodecs=function(r,s){var i=this,a=this.getSourceBufferTypes().length;Object.keys(s).forEach(function(d){if(a){var o=i.tracks[d];if(o&&typeof o.buffer.changeType=="function"){var y=s[d],p=y.codec,m=y.levelCodec,g=y.container,f=(o.levelCodec||o.codec).replace(M,"$1"),c=(m||p).replace(M,"$1");if(f!==c){var x=g+";codecs="+(m||p);i.appendChangeType(d,x)}}}else i.pendingTracks[d]=s[d]}),!a&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},A.appendChangeType=function(r,s){var i=this,a=this.operationQueue,d={execute:function(){var y=i.sourceBuffer[r];y&&(v.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+s),y.changeType(s)),a.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(y){v.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",y)}};a.append(d,r)},A.onBufferAppending=function(r,s){var i=this,a=this.hls,d=this.operationQueue,o=this.tracks,y=s.data,p=s.type,m=s.frag,g=s.part,f=s.chunkMeta,c=f.buffering[p],x=self.performance.now();c.start=x;var S=m.stats.buffering,C=g?g.stats.buffering:null;S.start===0&&(S.start=x),C&&C.start===0&&(C.start=x);var O=o.audio,P=p==="audio"&&f.id===1&&(O==null?void 0:O.container)==="audio/mpeg",w={execute:function(){if(c.executeStart=self.performance.now(),P){var k=i.sourceBuffer[p];if(k){var N=m.start-k.timestampOffset;Math.abs(N)>=.1&&(v.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+N+") sn: "+m.sn+")"),k.timestampOffset=m.start)}}i.appendExecutor(y,p)},onStart:function(){},onComplete:function(){var k=self.performance.now();c.executeEnd=c.end=k,S.first===0&&(S.first=k),C&&C.first===0&&(C.first=k);var N=i.sourceBuffer,B={};for(var K in N)B[K]=T.BufferHelper.getBuffered(N[K]);i.appendError=0,i.hls.trigger(n.Events.BUFFER_APPENDED,{type:p,frag:m,part:g,chunkMeta:f,parent:m.type,timeRanges:B})},onError:function(k){v.logger.error("[buffer-controller]: Error encountered while trying to append to the "+p+" SourceBuffer",k);var N={type:R.ErrorTypes.MEDIA_ERROR,parent:m.type,details:R.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=R.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,N.details=R.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>a.config.appendErrorMaxRetry&&(v.logger.error("[buffer-controller]: Failed "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),a.trigger(n.Events.ERROR,N)}};d.append(w,p)},A.onBufferFlushing=function(r,s){var i=this,a=this.operationQueue,d=function(y){return{execute:i.removeExecutor.bind(i,y,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(n.Events.BUFFER_FLUSHED,{type:y})},onError:function(m){v.logger.warn("[buffer-controller]: Failed to remove from "+y+" SourceBuffer",m)}}};s.type?a.append(d(s.type),s.type):this.getSourceBufferTypes().forEach(function(o){a.append(d(o),o)})},A.onFragParsed=function(r,s){var i=this,a=s.frag,d=s.part,o=[],y=d?d.elementaryStreams:a.elementaryStreams;y[_.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(y[_.ElementaryStreamTypes.AUDIO]&&o.push("audio"),y[_.ElementaryStreamTypes.VIDEO]&&o.push("video"));var p=function(){var g=self.performance.now();a.stats.buffering.end=g,d&&(d.stats.buffering.end=g);var f=d?d.stats:a.stats;i.hls.trigger(n.Events.FRAG_BUFFERED,{frag:a,part:d,stats:f,id:a.type})};o.length===0&&v.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+a.type+" level: "+a.level+" sn: "+a.sn),this.blockBuffers(p,o)},A.onFragChanged=function(r,s){this.flushBackBuffer()},A.onBufferEos=function(r,s){var i=this,a=this.getSourceBufferTypes().reduce(function(d,o){var y=i.sourceBuffer[o];return(!s.type||s.type===o)&&y&&!y.ended&&(y.ended=!0,v.logger.log("[buffer-controller]: "+o+" sourceBuffer now EOS")),d&&!!(!y||y.ended)},!0);a&&this.blockBuffers(function(){var d=i.mediaSource;!d||d.readyState!=="open"||d.endOfStream()})},A.onLevelUpdated=function(r,s){var i=s.details;!i.fragments.length||(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},A.flushBackBuffer=function(){var r=this.hls,s=this.details,i=this.media,a=this.sourceBuffer;if(!(!i||s===null)){var d=this.getSourceBufferTypes();if(!!d.length){var o=s.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!(!Object(l.isFiniteNumber)(o)||o<0)){var y=i.currentTime,p=s.levelTargetDuration,m=Math.max(o,p),g=Math.floor(y/p)*p-m;d.forEach(function(f){var c=a[f];if(c){var x=T.BufferHelper.getBuffered(c);x.length>0&&g>x.start(0)&&(r.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:g}),s.live&&r.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:g}),r.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:g,type:f}))}})}}}},A.updateMediaElementDuration=function(){if(!(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")){var r=this.details,s=this.hls,i=this.media,a=this.mediaSource,d=r.fragments[0].start+r.totalduration,o=i.duration,y=Object(l.isFiniteNumber)(a.duration)?a.duration:0;r.live&&s.config.liveDurationInfinity?(v.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),a.duration=1/0,this.updateSeekableRange(r)):(d>y&&d>o||!Object(l.isFiniteNumber)(o))&&(v.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),a.duration=d)}},A.updateSeekableRange=function(r){var s=this.mediaSource,i=r.fragments,a=i.length;if(a&&r.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var d=Math.max(0,i[0].start),o=Math.max(d,d+r.totalduration);s.setLiveSeekableRange(d,o)}},A.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,s=this.operationQueue,i=this.pendingTracks,a=Object.keys(i).length;if(a&&!r||a===2){this.createSourceBuffers(i),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(n.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(o){s.executeNext(o)})}},A.createSourceBuffers=function(r){var s=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var a=0;for(var d in r)if(!s[d]){var o=r[d];if(!o)throw Error("source buffer exists for track "+d+", however track does not");var y=o.levelCodec||o.codec,p=o.container+";codecs="+y;v.logger.log("[buffer-controller]: creating sourceBuffer("+p+")");try{var m=s[d]=i.addSourceBuffer(p),g=d;this.addBufferListener(g,"updatestart",this._onSBUpdateStart),this.addBufferListener(g,"updateend",this._onSBUpdateEnd),this.addBufferListener(g,"error",this._onSBUpdateError),this.tracks[d]={buffer:m,codec:y,container:o.container,levelCodec:o.levelCodec,id:o.id},a++}catch(f){v.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+f.message),this.hls.trigger(n.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,mimeType:p})}}a&&this.hls.trigger(n.Events.BUFFER_CREATED,{tracks:this.tracks})},A._onSBUpdateStart=function(r){var s=this.operationQueue,i=s.current(r);i.onStart()},A._onSBUpdateEnd=function(r){var s=this.operationQueue,i=s.current(r);i.onComplete(),s.shiftAndExecuteNext(r)},A._onSBUpdateError=function(r,s){v.logger.error("[buffer-controller]: "+r+" SourceBuffer error",s),this.hls.trigger(n.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(r);i&&i.onError(s)},A.removeExecutor=function(r,s,i){var a=this.media,d=this.mediaSource,o=this.operationQueue,y=this.sourceBuffer,p=y[r];if(!a||!d||!p){v.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),o.shiftAndExecuteNext(r);return}var m=Object(l.isFiniteNumber)(a.duration)?a.duration:1/0,g=Object(l.isFiniteNumber)(d.duration)?d.duration:1/0,f=Math.max(0,s),c=Math.min(i,m,g);c>f?(v.logger.log("[buffer-controller]: Removing ["+f+","+c+"] from the "+r+" SourceBuffer"),console.assert(!p.updating,r+" sourceBuffer must not be updating"),p.remove(f,c)):o.shiftAndExecuteNext(r)},A.appendExecutor=function(r,s){var i=this.operationQueue,a=this.sourceBuffer,d=a[s];if(!d){v.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),i.shiftAndExecuteNext(s);return}d.ended=!1,console.assert(!d.updating,s+" sourceBuffer must not be updating"),d.appendBuffer(r)},A.blockBuffers=function(r,s){var i=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){v.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var a=this.operationQueue,d=s.map(function(o){return a.appendBlocker(o)});Promise.all(d).then(function(){r(),s.forEach(function(o){var y=i.sourceBuffer[o];(!y||!y.updating)&&a.shiftAndExecuteNext(o)})})},A.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},A.addBufferListener=function(r,s,i){var a=this.sourceBuffer[r];if(!!a){var d=i.bind(this,r);this.listeners[r].push({event:s,listener:d}),a.addEventListener(s,d)}},A.removeBufferListeners=function(r){var s=this.sourceBuffer[r];!s||this.listeners[r].forEach(function(i){s.removeEventListener(i.event,i.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return n});var l=t("./src/utils/logger.ts"),n=function(){function v(T){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=T}var R=v.prototype;return R.append=function(L,_){var E=this.queues[_];E.push(L),E.length===1&&this.buffers[_]&&this.executeNext(_)},R.insertAbort=function(L,_){var E=this.queues[_];E.unshift(L),this.executeNext(_)},R.appendBlocker=function(L){var _,E=new Promise(function(M){_=M}),I={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(I,L),E},R.executeNext=function(L){var _=this.buffers,E=this.queues,I=_[L],M=E[L];if(M.length){var D=M[0];try{D.execute()}catch(b){l.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),D.onError(b),(!I||!I.updating)&&(M.shift(),this.executeNext(L))}}},R.shiftAndExecuteNext=function(L){this.queues[L].shift(),this.executeNext(L)},R.current=function(L){return this.queues[L][0]},v}()},"./src/controller/cap-level-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts");function n(T,L){for(var _=0;_<L.length;_++){var E=L[_];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function v(T,L,_){return L&&n(T.prototype,L),_&&n(T,_),T}var R=function(){function T(_){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var L=T.prototype;return L.setStreamController=function(E){this.streamController=E},L.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},L.registerListeners=function(){var E=this.hls;E.on(l.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(l.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(l.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},L.unregisterListener=function(){var E=this.hls;E.off(l.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(l.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(l.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},L.onFpsDropLevelCapping=function(E,I){T.isLevelAllowed(I.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(I.droppedLevel)},L.onMediaAttaching=function(E,I){this.media=I.media instanceof HTMLVideoElement?I.media:null},L.onManifestParsed=function(E,I){var M=this.hls;this.restrictedLevels=[],this.firstLevel=I.firstLevel,M.config.capLevelToPlayerSize&&I.video&&this.startCapping()},L.onBufferCodecs=function(E,I){var M=this.hls;M.config.capLevelToPlayerSize&&I.video&&this.startCapping()},L.onMediaDetaching=function(){this.stopCapping()},L.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var I=this.hls;I.autoLevelCapping=this.getMaxLevel(E.length-1),I.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=I.autoLevelCapping}}},L.getMaxLevel=function(E){var I=this,M=this.hls.levels;if(!M.length)return-1;var D=M.filter(function(b,A){return T.isLevelAllowed(A,I.restrictedLevels)&&A<=E});return this.clientRect=null,T.getMaxLevelByMediaSize(D,this.mediaWidth,this.mediaHeight)},L.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},L.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},L.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,I={width:0,height:0};if(E){var M=E.getBoundingClientRect();I.width=M.width,I.height=M.height,!I.width&&!I.height&&(I.width=M.right-M.left||E.width||0,I.height=M.bottom-M.top||E.height||0)}return this.clientRect=I,I},T.isLevelAllowed=function(E,I){return I===void 0&&(I=[]),I.indexOf(E)===-1},T.getMaxLevelByMediaSize=function(E,I,M){if(!E||!E.length)return-1;for(var D=function(s,i){return i?s.width!==i.width||s.height!==i.height:!0},b=E.length-1,A=0;A<E.length;A+=1){var u=E[A];if((u.width>=I||u.height>=M)&&D(u,E[A+1])){b=A;break}}return b},v(T,[{key:"mediaWidth",get:function(){return this.getDimensions().width*T.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*T.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch{}return E}}]),T}();e.default=R},"./src/controller/cmcd-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return D});var l=t("./src/events.ts"),n=t("./src/types/cmcd.ts"),v=t("./src/utils/buffer-helper.ts"),R=t("./src/utils/logger.ts");function T(b,A){for(var u=0;u<A.length;u++){var r=A[u];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(b,r.key,r)}}function L(b,A,u){return A&&T(b.prototype,A),u&&T(b,u),b}function _(b,A){var u=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(u)return(u=u.call(b)).next.bind(u);if(Array.isArray(b)||(u=E(b))||A&&b&&typeof b.length=="number"){u&&(b=u);var r=0;return function(){return r>=b.length?{done:!0}:{done:!1,value:b[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(b,A){if(!!b){if(typeof b=="string")return I(b,A);var u=Object.prototype.toString.call(b).slice(8,-1);if(u==="Object"&&b.constructor&&(u=b.constructor.name),u==="Map"||u==="Set")return Array.from(b);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return I(b,A)}}function I(b,A){(A==null||A>b.length)&&(A=b.length);for(var u=0,r=new Array(A);u<A;u++)r[u]=b[u];return r}function M(){return M=Object.assign||function(b){for(var A=1;A<arguments.length;A++){var u=arguments[A];for(var r in u)Object.prototype.hasOwnProperty.call(u,r)&&(b[r]=u[r])}return b},M.apply(this,arguments)}var D=function(){function b(u){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(a){try{r.apply(a,{ot:n.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(d){R.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(a){try{var d=a.frag,o=r.hls.levels[d.level],y=r.getObjectType(d),p={d:d.duration*1e3,ot:y};(y===n.CMCDObjectType.VIDEO||y===n.CMCDObjectType.AUDIO||y==n.CMCDObjectType.MUXED)&&(p.br=o.bitrate/1e3,p.tb=r.getTopBandwidth(y)/1e3,p.bl=r.getBufferLength(y)),r.apply(a,p)}catch(m){R.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=u;var s=this.config=u.config,i=s.cmcd;i!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||b.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}var A=b.prototype;return A.registerListeners=function(){var r=this.hls;r.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(l.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on(l.Events.BUFFER_CREATED,this.onBufferCreated,this)},A.unregisterListeners=function(){var r=this.hls;r.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(l.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off(l.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},A.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},A.onMediaAttached=function(r,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},A.onMediaDetached=function(){!this.media||(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},A.onBufferCreated=function(r,s){var i,a;this.audioBuffer=(i=s.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(a=s.tracks.video)===null||a===void 0?void 0:a.buffer},A.createData=function(){var r;return{v:n.CMCDVersion,sf:n.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},A.apply=function(r,s){s===void 0&&(s={}),M(s,this.createData());var i=s.ot===n.CMCDObjectType.INIT||s.ot===n.CMCDObjectType.VIDEO||s.ot===n.CMCDObjectType.MUXED;if(this.starved&&i&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var a=b.toHeaders(s);if(!Object.keys(a).length)return;r.headers||(r.headers={}),M(r.headers,a)}else{var d=b.toQuery(s);if(!d)return;r.url=b.appendQueryToUri(r.url,d)}},A.getObjectType=function(r){var s=r.type;if(s==="subtitle")return n.CMCDObjectType.TIMED_TEXT;if(r.sn==="initSegment")return n.CMCDObjectType.INIT;if(s==="audio")return n.CMCDObjectType.AUDIO;if(s==="main")return this.hls.audioTracks.length?n.CMCDObjectType.VIDEO:n.CMCDObjectType.MUXED},A.getTopBandwidth=function(r){var s=0,i,a=this.hls;if(r===n.CMCDObjectType.AUDIO)i=a.audioTracks;else{var d=a.maxAutoLevel,o=d>-1?d+1:a.levels.length;i=a.levels.slice(0,o)}for(var y=_(i),p;!(p=y()).done;){var m=p.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},A.getBufferLength=function(r){var s=this.hls.media,i=r===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!s)return NaN;var a=v.BufferHelper.bufferInfo(i,s.currentTime,this.config.maxBufferHole);return a.len*1e3},A.createPlaylistLoader=function(){var r=this.config.pLoader,s=this.applyPlaylistData,i=r||this.config.loader;return function(){function a(o){this.loader=void 0,this.loader=new i(o)}var d=a.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(y,p,m){s(y),this.loader.load(y,p,m)},L(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},A.createFragmentLoader=function(){var r=this.config.fLoader,s=this.applyFragmentData,i=r||this.config.loader;return function(){function a(o){this.loader=void 0,this.loader=new i(o)}var d=a.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(y,p,m){s(y),this.loader.load(y,p,m)},L(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},b.uuid=function(){var r=URL.createObjectURL(new Blob),s=r.toString();return URL.revokeObjectURL(r),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(r){for(var s=[],i=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},a=function(P){return Math.round(P)},d=function(P){return a(P/100)*100},o=function(P){return encodeURIComponent(P)},y={br:a,d:a,bl:d,dl:d,mtp:d,nor:o,rtp:d,tb:a},p=Object.keys(r||{}).sort(),m=_(p),g;!(g=m()).done;){var f=g.value,c=r[f];if(!!i(c)&&!(f==="v"&&c===1)&&!(f=="pr"&&c===1)){var x=y[f];x&&(c=x(c));var S=typeof c,C=void 0;f==="ot"||f==="sf"||f==="st"?C=f+"="+c:S==="boolean"?C=f:S==="number"?C=f+"="+c:C=f+"="+JSON.stringify(c),s.push(C)}}return s.join(",")},b.toHeaders=function(r){for(var s=Object.keys(r),i={},a=["Object","Request","Session","Status"],d=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},y=0,p=s;y<p.length;y++){var m=p[y],g=o[m]!=null?o[m]:1;d[g][m]=r[m]}for(var f=0;f<d.length;f++){var c=b.serialize(d[f]);c&&(i["CMCD-"+a[f]]=c)}return i},b.toQuery=function(r){return"CMCD="+encodeURIComponent(b.serialize(r))},b.appendQueryToUri=function(r,s){if(!s)return r;var i=r.includes("?")?"&":"?";return""+r+i+s},b}()},"./src/controller/eme-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts"),n=t("./src/errors.ts"),v=t("./src/utils/logger.ts"),R=t("./src/utils/mediakeys-helper.ts");function T(D,b){for(var A=0;A<b.length;A++){var u=b[A];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(D,u.key,u)}}function L(D,b,A){return b&&T(D.prototype,b),A&&T(D,A),D}var _=3,E=function(b,A,u){var r={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(s){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),A.forEach(function(s){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[r]},I=function(b,A,u,r){switch(b){case R.KeySystems.WIDEVINE:return E(A,u,r);default:throw new Error("Unknown key-system: "+b)}},M=function(){function D(A){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=A,this._config=A.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var b=D.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(l.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(l.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(u){switch(u){case R.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},b._attemptKeySystemAccess=function(u,r,s){var i=this,a=I(u,r,s,this._drmSystemOptions);v.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(u,a);this.mediaKeysPromise=d.then(function(o){return i._onMediaKeySystemAccessObtained(u,o)}),d.catch(function(o){v.logger.error('Failed to obtain key-system "'+u+'" access:',o)})},b._onMediaKeySystemAccessObtained=function(u,r){var s=this;v.logger.log('Access for key-system "'+u+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:u};this._mediaKeysList.push(i);var a=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(d){return i.mediaKeys=d,v.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),d});return a.catch(function(d){v.logger.error("Failed to create media-keys:",d)}),a},b._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),u._onNewMediaKeySession(r.mediaKeysSession))})},b._onNewMediaKeySession=function(u){var r=this;v.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){r._onKeySessionMessage(u,s.message)},!1)},b._onKeySessionMessage=function(u,r){v.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(s){v.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},b.onMediaEncrypted=function(u){var r=this;if(v.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){v.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(a){!r._media||(r._attemptSetMediaKeys(a),r._generateRequestWithPreferredKeySession(u.initDataType,u.initData))};this.mediaKeysPromise.then(s).catch(s)},b._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){v.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}v.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(u,r){var s=this,i=this._mediaKeysList[0];if(!i){v.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(i.mediaKeysSessionInitialized){v.logger.warn("Key-Session already initialized but requested again");return}var a=i.mediaKeysSession;if(!a){v.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){v.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}v.logger.log('Generating key-session request for "'+u+'" init data type'),i.mediaKeysSessionInitialized=!0,a.generateRequest(u,r).then(function(){v.logger.debug("Key-session generation succeeded")}).catch(function(d){v.logger.error("Error generating key-session request:",d),s.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(u,r,s){var i=new XMLHttpRequest;i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,u,r,s);var a=this._licenseXhrSetup;if(a)try{a.call(this.hls,i,u),a=void 0}catch(d){v.logger.error(d)}try{i.readyState||i.open("POST",u,!0),a&&a.call(this.hls,i,u)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return i},b._onLicenseRequestReadyStageChange=function(u,r,s,i){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,v.logger.log("License request succeeded");var a=u.response,d=this._licenseResponseCallback;if(d)try{a=d.call(this.hls,u,r)}catch(y){v.logger.error(y)}i(a)}else{if(v.logger.error("License Request XHR failed ("+r+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var o=_-this._requestLicenseFailureCount+1;v.logger.warn("Retrying license request, "+o+" attempts left"),this._requestLicense(s,i)}break}},b._generateLicenseRequestChallenge=function(u,r){switch(u.mediaKeySystemDomain){case R.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},b._requestLicense=function(u,r){v.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){v.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var i=this.getLicenseServerUrl(s.mediaKeySystemDomain),a=this._createLicenseXhr(i,u,r);v.logger.log("Sending license request to URL: "+i);var d=this._generateLicenseRequestChallenge(s,u);a.send(d)}catch(o){v.logger.error("Failure requesting DRM license: "+o),this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(u,r){if(!!this._emeEnabled){var s=r.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)}},b.onMediaDetached=function(){var u=this._media,r=this._mediaKeysList;!u||(u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){}))},b.onManifestParsed=function(u,r){if(!!this._emeEnabled){var s=r.levels.map(function(a){return a.audioCodec}).filter(function(a){return!!a}),i=r.levels.map(function(a){return a.videoCodec}).filter(function(a){return!!a});this._attemptKeySystemAccess(R.KeySystems.WIDEVINE,s,i)}},L(D,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),D}();e.default=M},"./src/controller/fps-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts"),n=t("./src/utils/logger.ts"),v=function(){function R(L){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=L,this.registerListeners()}var T=R.prototype;return T.setStreamController=function(_){this.streamController=_},T.registerListeners=function(){this.hls.on(l.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},T.unregisterListeners=function(){this.hls.off(l.Events.MEDIA_ATTACHING,this.onMediaAttaching)},T.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},T.onMediaAttaching=function(_,E){var I=this.hls.config;if(I.capLevelOnFPSDrop){var M=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),I.fpsDroppedMonitoringPeriod)}},T.checkFPS=function(_,E,I){var M=performance.now();if(E){if(this.lastTime){var D=M-this.lastTime,b=I-this.lastDroppedFrames,A=E-this.lastDecodedFrames,u=1e3*b/D,r=this.hls;if(r.trigger(l.Events.FPS_DROP,{currentDropped:b,currentDecoded:A,totalDroppedFrames:I}),u>0&&b>r.config.fpsDroppedMonitoringThreshold*A){var s=r.currentLevel;n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=s)&&(s=s-1,r.trigger(l.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:r.currentLevel}),r.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=I,this.lastDecodedFrames=E}},T.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var E=_.getVideoPlaybackQuality();this.checkFPS(_,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},R}();e.default=v},"./src/controller/fragment-finders.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"findFragmentByPDT",function(){return v}),t.d(e,"findFragmentByPTS",function(){return R}),t.d(e,"fragmentWithinToleranceTest",function(){return T}),t.d(e,"pdtWithinToleranceTest",function(){return L}),t.d(e,"findFragWithCC",function(){return _});var l=t("./src/polyfills/number.ts"),n=t("./src/utils/binary-search.ts");function v(E,I,M){if(I===null||!Array.isArray(E)||!E.length||!Object(l.isFiniteNumber)(I))return null;var D=E[0].programDateTime;if(I<(D||0))return null;var b=E[E.length-1].endProgramDateTime;if(I>=(b||0))return null;M=M||0;for(var A=0;A<E.length;++A){var u=E[A];if(L(I,M,u))return u}return null}function R(E,I,M,D){M===void 0&&(M=0),D===void 0&&(D=0);var b=null;if(E?b=I[E.sn-I[0].sn+1]||null:M===0&&I[0].start===0&&(b=I[0]),b&&T(M,D,b)===0)return b;var A=n.default.search(I,T.bind(null,M,D));return A||b}function T(E,I,M){E===void 0&&(E=0),I===void 0&&(I=0);var D=Math.min(I,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-D<=E?1:M.start-D>E&&M.start?-1:0}function L(E,I,M){var D=Math.min(I,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,b=M.endProgramDateTime||0;return b-D>E}function _(E,I){return n.default.search(E,function(M){return M.cc<I?1:M.cc>I?-1:0})}},"./src/controller/fragment-tracker.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"FragmentState",function(){return v}),t.d(e,"FragmentTracker",function(){return R});var l=t("./src/events.ts"),n=t("./src/types/loader.ts"),v;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(v||(v={}));var R=function(){function _(I){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=I,this._registerListeners()}var E=_.prototype;return E._registerListeners=function(){var M=this.hls;M.on(l.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(l.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(l.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var M=this.hls;M.off(l.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(l.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(l.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(M,D){if(D===n.PlaylistLevelType.MAIN){var b=this.activeFragment,A=this.activeParts;if(!b)return null;if(A)for(var u=A.length;u--;){var r=A[u],s=r?r.end:b.appendedPTS;if(r.start<=M&&s!==void 0&&M<=s)return u>9&&(this.activeParts=A.slice(u-9)),r}else if(b.start<=M&&b.appendedPTS!==void 0&&M<=b.appendedPTS)return b}return this.getBufferedFrag(M,D)},E.getBufferedFrag=function(M,D){for(var b=this.fragments,A=Object.keys(b),u=A.length;u--;){var r=b[A[u]];if((r==null?void 0:r.body.type)===D&&r.buffered){var s=r.body;if(s.start<=M&&M<=s.end)return s}}return null},E.detectEvictedFragments=function(M,D,b){var A=this;Object.keys(this.fragments).forEach(function(u){var r=A.fragments[u];if(!!r){if(!r.buffered){r.body.type===b&&A.removeFragment(r.body);return}var s=r.range[M];!s||s.time.some(function(i){var a=!A.isTimeBuffered(i.startPTS,i.endPTS,D);return a&&A.removeFragment(r.body),a})}})},E.detectPartialFragments=function(M){var D=this,b=this.timeRanges,A=M.frag,u=M.part;if(!(!b||A.sn==="initSegment")){var r=L(A),s=this.fragments[r];!s||(Object.keys(b).forEach(function(i){var a=A.elementaryStreams[i];if(!!a){var d=b[i],o=u!==null||a.partial===!0;s.range[i]=D.getBufferedTimes(A,u,o,d)}}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},E.fragBuffered=function(M){var D=L(M),b=this.fragments[D];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},E.getBufferedTimes=function(M,D,b,A){for(var u={time:[],partial:b},r=D?D.start:M.start,s=D?D.end:M.end,i=M.minEndPTS||s,a=M.maxStartPTS||r,d=0;d<A.length;d++){var o=A.start(d)-this.bufferPadding,y=A.end(d)+this.bufferPadding;if(a>=o&&i<=y){u.time.push({startPTS:Math.max(r,A.start(d)),endPTS:Math.min(s,A.end(d))});break}else if(r<y&&s>o)u.partial=!0,u.time.push({startPTS:Math.max(r,A.start(d)),endPTS:Math.min(s,A.end(d))});else if(s<=o)break}return u},E.getPartialFragment=function(M){var D=null,b,A,u,r=0,s=this.bufferPadding,i=this.fragments;return Object.keys(i).forEach(function(a){var d=i[a];!d||T(d)&&(A=d.body.start-s,u=d.body.end+s,M>=A&&M<=u&&(b=Math.min(M-A,u-M),r<=b&&(D=d.body,r=b)))}),D},E.getState=function(M){var D=L(M),b=this.fragments[D];return b?b.buffered?T(b)?v.PARTIAL:v.OK:b.backtrack?v.BACKTRACKED:v.APPENDING:v.NOT_LOADED},E.backtrack=function(M,D){var b=L(M),A=this.fragments[b];if(!A||A.backtrack)return null;var u=A.backtrack=D||A.loaded;return A.loaded=null,u},E.getBacktrackData=function(M){var D=L(M),b=this.fragments[D];if(b){var A,u=b.backtrack;if(u!=null&&(A=u.payload)!==null&&A!==void 0&&A.byteLength)return u;this.removeFragment(M)}return null},E.isTimeBuffered=function(M,D,b){for(var A,u,r=0;r<b.length;r++){if(A=b.start(r)-this.bufferPadding,u=b.end(r)+this.bufferPadding,M>=A&&D<=u)return!0;if(D<=A)return!1}return!1},E.onFragLoaded=function(M,D){var b=D.frag,A=D.part;if(!(b.sn==="initSegment"||b.bitrateTest||A)){var u=L(b);this.fragments[u]={body:b,loaded:D,backtrack:null,buffered:!1,range:Object.create(null)}}},E.onBufferAppended=function(M,D){var b=this,A=D.frag,u=D.part,r=D.timeRanges;if(A.type===n.PlaylistLevelType.MAIN)if(this.activeFragment=A,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(i){var a=r[i];if(b.detectEvictedFragments(i,a),!u)for(var d=0;d<a.length;d++)A.appendedPTS=Math.max(a.end(d),A.appendedPTS||0)})},E.onFragBuffered=function(M,D){this.detectPartialFragments(D)},E.hasFragment=function(M){var D=L(M);return!!this.fragments[D]},E.removeFragmentsInRange=function(M,D,b){var A=this;Object.keys(this.fragments).forEach(function(u){var r=A.fragments[u];if(!!r&&r.buffered){var s=r.body;s.type===b&&s.start<D&&s.end>M&&A.removeFragment(s)}})},E.removeFragment=function(M){var D=L(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[D]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function T(_){var E,I;return _.buffered&&(((E=_.range.video)===null||E===void 0?void 0:E.partial)||((I=_.range.audio)===null||I===void 0?void 0:I.partial))}function L(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"STALL_MINIMUM_DURATION_MS",function(){return T}),t.d(e,"MAX_START_GAP_JUMP",function(){return L}),t.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),t.d(e,"SKIP_BUFFER_RANGE_START",function(){return E}),t.d(e,"default",function(){return I});var l=t("./src/utils/buffer-helper.ts"),n=t("./src/errors.ts"),v=t("./src/events.ts"),R=t("./src/utils/logger.ts"),T=250,L=2,_=.1,E=.05,I=function(){function M(b,A,u,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=A,this.fragmentTracker=u,this.hls=r}var D=M.prototype;return D.destroy=function(){this.hls=this.fragmentTracker=this.media=null},D.poll=function(A){var u=this.config,r=this.media,s=this.stalled,i=r.currentTime,a=r.seeking,d=this.seeking&&!a,o=!this.seeking&&a;if(this.seeking=a,i!==A){if(this.moved=!0,s!==null){if(this.stallReported){var y=self.performance.now()-s;R.logger.warn("playback not stuck anymore @"+i+", after "+Math.round(y)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((o||d)&&(this.stalled=null),!(r.paused||r.ended||r.playbackRate===0||!l.BufferHelper.getBuffered(r).length)){var p=l.BufferHelper.bufferInfo(r,i,0),m=p.len>0,g=p.nextStart||0;if(!(!m&&!g)){if(a){var f=p.len>L,c=!g||g-i>L&&!this.fragmentTracker.getPartialFragment(i);if(f||c)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,S=Math.max(g,p.start||0)-i,C=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,O=C==null||(x=C.details)===null||x===void 0?void 0:x.live,P=O?C.details.targetduration*2:L;if(S>0&&S<=P){this._trySkipBufferHole(null);return}}var w=self.performance.now();if(s===null){this.stalled=w;return}var U=w-s;!a&&U>=T&&this._reportStall(p.len);var k=l.BufferHelper.bufferInfo(r,i,u.maxBufferHole);this._tryFixBufferStall(k,U)}}},D._tryFixBufferStall=function(A,u){var r=this.config,s=this.fragmentTracker,i=this.media,a=i.currentTime,d=s.getPartialFragment(a);if(d){var o=this._trySkipBufferHole(d);if(o)return}A.len>r.maxBufferHole&&u>r.highBufferWatchdogPeriod*1e3&&(R.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},D._reportStall=function(A){var u=this.hls,r=this.media,s=this.stallReported;s||(this.stallReported=!0,R.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+A+")"),u.trigger(v.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:A}))},D._trySkipBufferHole=function(A){for(var u=this.config,r=this.hls,s=this.media,i=s.currentTime,a=0,d=l.BufferHelper.getBuffered(s),o=0;o<d.length;o++){var y=d.start(o);if(i+u.maxBufferHole>=a&&i<y){var p=Math.max(y+E,s.currentTime+_);return R.logger.warn("skipping hole, adjusting currentTime from "+i+" to "+p),this.moved=!0,this.stalled=null,s.currentTime=p,A&&r.trigger(v.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+p,frag:A}),p}a=d.end(o)}return 0},D._tryNudgeBuffer=function(){var A=this.config,u=this.hls,r=this.media,s=r.currentTime,i=(this.nudgeRetry||0)+1;if(this.nudgeRetry=i,i<A.nudgeMaxRetry){var a=s+i*A.nudgeOffset;R.logger.warn("Nudging 'currentTime' from "+s+" to "+a),r.currentTime=a,u.trigger(v.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else R.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+A.nudgeMaxRetry+" nudges"),u.trigger(v.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts"),n=t("./src/utils/texttrack-utils.ts"),v=t("./src/demux/id3.ts"),R=.25,T=function(){function L(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var _=L.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var I=this.hls;I.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.on(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.on(l.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),I.on(l.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var I=this.hls;I.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.off(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.off(l.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),I.off(l.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(I,M){this.media=M.media},_.onMediaDetaching=function(){!this.id3Track||(Object(n.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},_.getID3Track=function(I){if(!!this.media){for(var M=0;M<I.length;M++){var D=I[M];if(D.kind==="metadata"&&D.label==="id3")return Object(n.sendAddTrackEvent)(D,this.media),D}return this.media.addTextTrack("metadata","id3")}},_.onFragParsingMetadata=function(I,M){if(!!this.media){var D=M.frag,b=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var A=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<b.length;u++){var r=v.getID3Frames(b[u].data);if(r){var s=b[u].pts,i=u<b.length-1?b[u+1].pts:D.end,a=i-s;a<=0&&(i=s+R);for(var d=0;d<r.length;d++){var o=r[d];if(!v.isTimeStampFrame(o)){var y=new A(s,i,"");y.value=o,this.id3Track.addCue(y)}}}}}},_.onBufferFlushing=function(I,M){var D=M.startOffset,b=M.endOffset,A=M.type;if(!A||A==="audio"){var u=this.id3Track;u&&Object(n.removeCuesInRange)(u,D,b)}},L}();e.default=T},"./src/controller/latency-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return L});var l=t("./src/errors.ts"),n=t("./src/events.ts"),v=t("./src/utils/logger.ts");function R(_,E){for(var I=0;I<E.length;I++){var M=E[I];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}function T(_,E,I){return E&&R(_.prototype,E),I&&R(_,I),_}var L=function(){function _(I){var M=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 M.timeupdate()},this.hls=I,this.config=I.config,this.registerListeners()}var E=_.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(n.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(n.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(n.Events.ERROR,this.onError)},E.onMediaAttached=function(M,D){this.media=D.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(M,D){var b=D.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(M,D){D.details===l.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,v.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},E.timeupdate=function(){var M=this.media,D=this.levelDetails;if(!(!M||!D)){this.currentTime=M.currentTime;var b=this.computeLatency();if(b!==null){this._latency=b;var A=this.config,u=A.lowLatencyMode,r=A.maxLiveSyncPlaybackRate;if(!(!u||r===1)){var s=this.targetLatency;if(s!==null){var i=b-s,a=Math.min(this.maxLatency,s+D.targetduration),d=i<a;if(D.live&&d&&i>.05&&this.forwardBufferLength>1){var o=Math.min(2,Math.max(1,r)),y=Math.round(2/(1+Math.exp(-.75*i-this.edgeStalled))*20)/20;M.playbackRate=Math.min(o,Math.max(1,y))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)}}}}},E.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},E.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},T(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,D=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:D?M.liveMaxLatencyDurationCount*D.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var D=M.holdBack,b=M.partHoldBack,A=M.targetduration,u=this.config,r=u.liveSyncDuration,s=u.liveSyncDurationCount,i=u.lowLatencyMode,a=this.hls.userConfig,d=i&&b||D;(a.liveSyncDuration||a.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:s*A);var o=A,y=1;return d+Math.min(this.stallCount*y,o)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),D=this.targetLatency,b=this.levelDetails;if(M===null||D===null||b===null)return null;var A=b.edge,u=M-D-this.edgeStalled,r=A-b.totalduration,s=A-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(r,u),s)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var D=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-D,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,D=this.levelDetails;if(!M||!D)return 0;var b=M.buffered.length;return b?M.buffered.end(b-1):D.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return u});var l=t("./src/types/level.ts"),n=t("./src/events.ts"),v=t("./src/errors.ts"),R=t("./src/utils/codecs.ts"),T=t("./src/controller/level-helper.ts"),L=t("./src/controller/base-playlist-controller.ts"),_=t("./src/types/loader.ts");function E(){return E=Object.assign||function(r){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])}return r},E.apply(this,arguments)}function I(r,s){for(var i=0;i<s.length;i++){var a=s[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}function M(r,s,i){return s&&I(r.prototype,s),i&&I(r,i),r}function D(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,b(r,s)}function b(r,s){return b=Object.setPrototypeOf||function(a,d){return a.__proto__=d,a},b(r,s)}var A=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(r){D(s,r);function s(a){var d;return d=r.call(this,a,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var i=s.prototype;return i._registerListeners=function(){var d=this.hls;d.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(n.Events.ERROR,this.onError,this)},i._unregisterListeners=function(){var d=this.hls;d.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(n.Events.ERROR,this.onError,this)},i.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},i.startLoad=function(){var d=this._levels;d.forEach(function(o){o.loadError=0}),r.prototype.startLoad.call(this)},i.onManifestLoaded=function(d,o){var y=[],p=[],m=[],g,f={},c,x=!1,S=!1,C=!1;if(o.levels.forEach(function(U){var k=U.attrs;x=x||!!(U.width&&U.height),S=S||!!U.videoCodec,C=C||!!U.audioCodec,A&&U.audioCodec&&U.audioCodec.indexOf("mp4a.40.34")!==-1&&(U.audioCodec=void 0);var N=U.bitrate+"-"+U.attrs.RESOLUTION+"-"+U.attrs.CODECS;c=f[N],c?c.url.push(U.url):(c=new l.Level(U),f[N]=c,y.push(c)),k&&(k.AUDIO&&Object(T.addGroupId)(c,"audio",k.AUDIO),k.SUBTITLES&&Object(T.addGroupId)(c,"text",k.SUBTITLES))}),(x||S)&&C&&(y=y.filter(function(U){var k=U.videoCodec,N=U.width,B=U.height;return!!k||!!(N&&B)})),y=y.filter(function(U){var k=U.audioCodec,N=U.videoCodec;return(!k||Object(R.isCodecSupportedInMp4)(k,"audio"))&&(!N||Object(R.isCodecSupportedInMp4)(N,"video"))}),o.audioTracks&&(p=o.audioTracks.filter(function(U){return!U.audioCodec||Object(R.isCodecSupportedInMp4)(U.audioCodec,"audio")}),Object(T.assignTrackIdsByGroup)(p)),o.subtitles&&(m=o.subtitles,Object(T.assignTrackIdsByGroup)(m)),y.length>0){g=y[0].bitrate,y.sort(function(U,k){return U.bitrate-k.bitrate}),this._levels=y;for(var O=0;O<y.length;O++)if(y[O].bitrate===g){this._firstLevel=O,this.log("manifest loaded, "+y.length+" level(s) found, first bitrate: "+g);break}var P=C&&!S,w={levels:y,audioTracks:p,subtitleTracks:m,firstLevel:this._firstLevel,stats:o.stats,audio:C,video:S,altAudio:!P&&p.some(function(U){return!!U.url})};this.hls.trigger(n.Events.MANIFEST_PARSED,w),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(n.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,reason:"no level with compatible codecs found in manifest"})},i.onError=function(d,o){if(r.prototype.onError.call(this,d,o),!o.fatal){var y=o.context,p=this._levels[this.currentLevelIndex];if(y&&(y.type===_.PlaylistContextType.AUDIO_TRACK&&p.audioGroupIds&&y.groupId===p.audioGroupIds[p.urlId]||y.type===_.PlaylistContextType.SUBTITLE_TRACK&&p.textGroupIds&&y.groupId===p.textGroupIds[p.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,g=!0,f;switch(o.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:if(o.frag){var c=this._levels[o.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(f=o.frag.level)):f=o.frag.level}break;case v.ErrorDetails.LEVEL_LOAD_ERROR:case v.ErrorDetails.LEVEL_LOAD_TIMEOUT:y&&(y.deliveryDirectives&&(g=!1),f=y.level),m=!0;break;case v.ErrorDetails.REMUX_ALLOC_ERROR:f=o.level,m=!0;break}f!==void 0&&this.recoverLevel(o,f,m,g)}},i.recoverLevel=function(d,o,y,p){var m=d.details,g=this._levels[o];if(g.loadError++,y){var f=this.retryLoadingOrFail(d);if(f)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(p){var c=g.url.length;if(c>1&&g.loadError<c)d.levelRetry=!0,this.redundantFailover(o);else if(this.manualLevelIndex===-1){var x=o===0?this._levels.length-1:o-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(m+": switch to "+x),d.levelRetry=!0,this.hls.nextAutoLevel=x)}}},i.redundantFailover=function(d){var o=this._levels[d],y=o.url.length;if(y>1){var p=(o.urlId+1)%y;this.warn("Switching to redundant URL-id "+p),this._levels.forEach(function(m){m.urlId=p}),this.level=d}},i.onFragLoaded=function(d,o){var y=o.frag;if(y!==void 0&&y.type===_.PlaylistLevelType.MAIN){var p=this._levels[y.level];p!==void 0&&(p.fragmentError=0,p.loadError=0)}},i.onLevelLoaded=function(d,o){var y,p=o.level,m=o.details,g=this._levels[p];if(!g){var f;this.warn("Invalid level index "+p),(f=o.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(m.deltaUpdateFailed=!0);return}p===this.currentLevelIndex?(g.fragmentError===0&&(g.loadError=0,this.retryCount=0),this.playlistLoaded(p,o,g.details)):(y=o.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(m.deltaUpdateFailed=!0)},i.onAudioTrackSwitched=function(d,o){var y=this.hls.levels[this.currentLevelIndex];if(!!y&&y.audioGroupIds){for(var p=-1,m=this.hls.audioTracks[o.id].groupId,g=0;g<y.audioGroupIds.length;g++)if(y.audioGroupIds[g]===m){p=g;break}p!==y.urlId&&(y.urlId=p,this.startLoad())}},i.loadPlaylist=function(d){var o=this.currentLevelIndex,y=this._levels[o];if(this.canLoad&&y&&y.url.length>0){var p=y.urlId,m=y.url[p];if(d)try{m=d.addDirectives(m)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Attempt loading level index "+o+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+p+" "+m),this.clearTimer(),this.hls.trigger(n.Events.LEVEL_LOADING,{url:m,level:o,id:p,deliveryDirectives:d||null})}},i.removeLevel=function(d,o){var y=function(g,f){return f!==o},p=this._levels.filter(function(m,g){return g!==d?!0:m.url.length>1&&o!==void 0?(m.url=m.url.filter(y),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(y)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(y)),m.urlId=0,!0):!1}).map(function(m,g){var f=m.details;return f!=null&&f.fragments&&f.fragments.forEach(function(c){c.level=g}),m});this._levels=p,this.hls.trigger(n.Events.LEVELS_UPDATED,{levels:p})},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var o,y=this._levels;if(y.length!==0&&!(this.currentLevelIndex===d&&(o=y[d])!==null&&o!==void 0&&o.details)){if(d<0||d>=y.length){var p=d<0;if(this.hls.trigger(n.Events.ERROR,{type:v.ErrorTypes.OTHER_ERROR,details:v.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:p,reason:"invalid level idx"}),p)return;d=Math.min(d,y.length-1)}this.clearTimer();var m=this.currentLevelIndex,g=y[m],f=y[d];this.log("switching to level "+d+" from "+m),this.currentLevelIndex=d;var c=E({},f,{level:d,maxBitrate:f.maxBitrate,uri:f.uri,urlId:f.urlId});delete c._urlId,this.hls.trigger(n.Events.LEVEL_SWITCHING,c);var x=f.details;if(!x||x.live){var S=this.switchParams(f.uri,g==null?void 0:g.details);this.loadPlaylist(S)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),s}(L.default)},"./src/controller/level-helper.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"addGroupId",function(){return v}),t.d(e,"assignTrackIdsByGroup",function(){return R}),t.d(e,"updatePTS",function(){return T}),t.d(e,"updateFragPTSDTS",function(){return _}),t.d(e,"mergeDetails",function(){return E}),t.d(e,"mapPartIntersection",function(){return I}),t.d(e,"mapFragmentIntersection",function(){return M}),t.d(e,"adjustSliding",function(){return D}),t.d(e,"addSliding",function(){return b}),t.d(e,"computeReloadInterval",function(){return A}),t.d(e,"getFragmentWithSN",function(){return u}),t.d(e,"getPartWith",function(){return r});var l=t("./src/polyfills/number.ts"),n=t("./src/utils/logger.ts");function v(s,i,a){switch(i){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(a);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(a);break}}function R(s){var i={};s.forEach(function(a){var d=a.groupId||"";a.id=i[d]=i[d]||0,i[d]++})}function T(s,i,a){var d=s[i],o=s[a];L(d,o)}function L(s,i){var a=i.startPTS;if(Object(l.isFiniteNumber)(a)){var d=0,o;i.sn>s.sn?(d=a-s.start,o=s):(d=s.start-a,o=i),o.duration!==d&&(o.duration=d)}else if(i.sn>s.sn){var y=s.cc===i.cc;y&&s.minEndPTS?i.start=s.start+(s.minEndPTS-s.start):i.start=s.start+s.duration}else i.start=Math.max(s.start-i.duration,0)}function _(s,i,a,d,o,y){var p=d-a;p<=0&&(n.logger.warn("Fragment should have a positive duration",i),d=a+i.duration,y=o+i.duration);var m=a,g=d,f=i.startPTS,c=i.endPTS;if(Object(l.isFiniteNumber)(f)){var x=Math.abs(f-a);Object(l.isFiniteNumber)(i.deltaPTS)?i.deltaPTS=Math.max(x,i.deltaPTS):i.deltaPTS=x,m=Math.max(a,f),a=Math.min(a,f),o=Math.min(o,i.startDTS),g=Math.min(d,c),d=Math.max(d,c),y=Math.max(y,i.endDTS)}i.duration=d-a;var S=a-i.start;i.appendedPTS=d,i.start=i.startPTS=a,i.maxStartPTS=m,i.startDTS=o,i.endPTS=d,i.minEndPTS=g,i.endDTS=y;var C=i.sn;if(!s||C<s.startSN||C>s.endSN)return 0;var O,P=C-s.startSN,w=s.fragments;for(w[P]=i,O=P;O>0;O--)L(w[O],w[O-1]);for(O=P;O<w.length-1;O++)L(w[O],w[O+1]);return s.fragmentHint&&L(w[w.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function E(s,i){for(var a=null,d=s.fragments,o=d.length-1;o>=0;o--){var y=d[o].initSegment;if(y){a=y;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var p=0,m;if(M(s,i,function(O,P){O.relurl&&(p=O.cc-P.cc),Object(l.isFiniteNumber)(O.startPTS)&&Object(l.isFiniteNumber)(O.endPTS)&&(P.start=P.startPTS=O.startPTS,P.startDTS=O.startDTS,P.appendedPTS=O.appendedPTS,P.maxStartPTS=O.maxStartPTS,P.endPTS=O.endPTS,P.endDTS=O.endDTS,P.minEndPTS=O.minEndPTS,P.duration=O.endPTS-O.startPTS,P.duration&&(m=P),i.PTSKnown=i.alignedSliding=!0),P.elementaryStreams=O.elementaryStreams,P.loader=O.loader,P.stats=O.stats,P.urlId=O.urlId,O.initSegment&&(P.initSegment=O.initSegment,a=O.initSegment)}),a){var g=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;g.forEach(function(O){var P;(!O.initSegment||O.initSegment.relurl===((P=a)===null||P===void 0?void 0:P.relurl))&&(O.initSegment=a)})}if(i.skippedSegments&&(i.deltaUpdateFailed=i.fragments.some(function(O){return!O}),i.deltaUpdateFailed)){n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var f=i.skippedSegments;f--;)i.fragments.shift();i.startSN=i.fragments[0].sn,i.startCC=i.fragments[0].cc}var c=i.fragments;if(p){n.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<c.length;x++)c[x].cc+=p}i.skippedSegments&&(i.startCC=i.fragments[0].cc),I(s.partList,i.partList,function(O,P){P.elementaryStreams=O.elementaryStreams,P.stats=O.stats}),m?_(i,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):D(s,i),c.length&&(i.totalduration=i.edge-c[0].start),i.driftStartTime=s.driftStartTime,i.driftStart=s.driftStart;var S=i.advancedDateTime;if(i.advanced&&S){var C=i.edge;i.driftStart||(i.driftStartTime=S,i.driftStart=C),i.driftEndTime=S,i.driftEnd=C}else i.driftEndTime=s.driftEndTime,i.driftEnd=s.driftEnd,i.advancedDateTime=s.advancedDateTime}function I(s,i,a){if(s&&i)for(var d=0,o=0,y=s.length;o<=y;o++){var p=s[o],m=i[o+d];p&&m&&p.index===m.index&&p.fragment.sn===m.fragment.sn?a(p,m):d--}}function M(s,i,a){for(var d=i.skippedSegments,o=Math.max(s.startSN,i.startSN)-i.startSN,y=(s.fragmentHint?1:0)+(d?i.endSN:Math.min(s.endSN,i.endSN))-i.startSN,p=i.startSN-s.startSN,m=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,g=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,f=o;f<=y;f++){var c=g[p+f],x=m[f];d&&!x&&f<d&&(x=i.fragments[f]=c),c&&x&&a(c,x)}}function D(s,i){var a=i.startSN+i.skippedSegments-s.startSN,d=s.fragments;a<0||a>=d.length||b(i,d[a].start)}function b(s,i){if(i){for(var a=s.fragments,d=s.skippedSegments;d<a.length;d++)a[d].start+=i;s.fragmentHint&&(s.fragmentHint.start+=i)}}function A(s,i){var a=1e3*s.levelTargetDuration,d=a/2,o=s.age,y=o>0&&o<a*3,p=i.loading.end-i.loading.start,m,g=s.availabilityDelay;if(s.updated===!1)if(y){var f=333*s.misses;m=Math.max(Math.min(d,p*2),f),s.availabilityDelay=(s.availabilityDelay||0)+m}else m=d;else y?(g=Math.min(g||a/2,o),s.availabilityDelay=g,m=g+a-o):m=a-p;return Math.round(m)}function u(s,i,a){if(!s||!s.details)return null;var d=s.details,o=d.fragments[i-d.startSN];return o||(o=d.fragmentHint,o&&o.sn===i)?o:i<d.startSN&&a&&a.sn===i?a:null}function r(s,i,a){if(!s||!s.details)return null;var d=s.details.partList;if(d)for(var o=d.length;o--;){var y=d[o];if(y.index===a&&y.fragment.sn===i)return y}return null}},"./src/controller/stream-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return d});var l=t("./src/polyfills/number.ts"),n=t("./src/controller/base-stream-controller.ts"),v=t("./src/is-supported.ts"),R=t("./src/events.ts"),T=t("./src/utils/buffer-helper.ts"),L=t("./src/controller/fragment-tracker.ts"),_=t("./src/types/loader.ts"),E=t("./src/loader/fragment.ts"),I=t("./src/demux/transmuxer-interface.ts"),M=t("./src/types/transmuxer.ts"),D=t("./src/controller/gap-controller.ts"),b=t("./src/errors.ts"),A=t("./src/utils/logger.ts");function u(o,y){for(var p=0;p<y.length;p++){var m=y[p];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(o,m.key,m)}}function r(o,y,p){return y&&u(o.prototype,y),p&&u(o,p),o}function s(o,y){o.prototype=Object.create(y.prototype),o.prototype.constructor=o,i(o,y)}function i(o,y){return i=Object.setPrototypeOf||function(m,g){return m.__proto__=g,m},i(o,y)}var a=100,d=function(o){s(y,o);function y(m,g){var f;return f=o.call(this,m,g,"[stream-controller]")||this,f.audioCodecSwap=!1,f.gapController=null,f.level=-1,f._forceStartLoad=!1,f.altAudio=!1,f.audioOnly=!1,f.fragPlaying=null,f.onvplaying=null,f.onvseeked=null,f.fragLastKbps=0,f.stalled=!1,f.couldBacktrack=!1,f.audioCodecSwitch=!1,f.videoBuffer=null,f._registerListeners(),f}var p=y.prototype;return p._registerListeners=function(){var g=this.hls;g.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(R.Events.LEVEL_LOADING,this.onLevelLoading,this),g.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.on(R.Events.ERROR,this.onError,this),g.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.on(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),g.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.on(R.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var g=this.hls;g.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.off(R.Events.ERROR,this.onError,this),g.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.off(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),g.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.off(R.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},p.startLoad=function(g){if(this.levels){var f=this.lastCurrentTime,c=this.hls;if(this.stopLoad(),this.setInterval(a),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=c.startLevel;x===-1&&(c.config.testBandwidth?(x=0,this.bitrateTest=!0):x=c.nextAutoLevel),this.level=c.nextLoadLevel=x,this.loadedmetadata=!1}f>0&&g===-1&&(this.log("Override startPosition with lastCurrentTime @"+f.toFixed(3)),g=f),this.state=n.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=g,this.tick()}else this._forceStartLoad=!0,this.state=n.State.STOPPED},p.stopLoad=function(){this._forceStartLoad=!1,o.prototype.stopLoad.call(this)},p.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_LEVEL:{var g,f=this.levels,c=this.level,x=f==null||(g=f[c])===null||g===void 0?void 0:g.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=n.State.IDLE;break}break}case n.State.FRAG_LOADING_WAITING_RETRY:{var S,C=self.performance.now(),O=this.retryDate;(!O||C>=O||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=n.State.IDLE)}break;default:break}this.onTickEnd()},p.onTickEnd=function(){o.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},p.doTickIdle=function(){var g,f,c=this.hls,x=this.levelLastLoaded,S=this.levels,C=this.media,O=c.config,P=c.nextLoadLevel;if(!(x===null||!C&&(this.startFragRequested||!O.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)&&!(!S||!S[P])){var w=S[P];this.level=c.nextLoadLevel=P;var U=w.details;if(!U||this.state===n.State.WAITING_LEVEL||U.live&&this.levelLastLoaded!==P){this.state=n.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:C,_.PlaylistLevelType.MAIN);if(k!==null){var N=k.len,B=this.getMaxBufferLength(w.maxBitrate);if(!(N>=B)){if(this._streamEnded(k,U)){var K={};this.altAudio&&(K.type="video"),this.hls.trigger(R.Events.BUFFER_EOS,K),this.state=n.State.ENDED;return}var W=k.end,F=this.getNextFragment(W,U);if(this.couldBacktrack&&!this.fragPrevious&&F&&F.sn!=="initSegment"){var H=F.sn-U.startSN;H>1&&(F=U.fragments[H-1],this.fragmentTracker.removeFragment(F))}if(F&&this.fragmentTracker.getState(F)===L.FragmentState.OK&&this.nextLoadPosition>W){var Y=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(C,Y,_.PlaylistLevelType.MAIN),F=this.getNextFragment(this.nextLoadPosition,U)}!F||(F.initSegment&&!F.initSegment.data&&!this.bitrateTest&&(F=F.initSegment),((g=F.decryptdata)===null||g===void 0?void 0:g.keyFormat)==="identity"&&!((f=F.decryptdata)!==null&&f!==void 0&&f.key)?this.loadKey(F,U):this.loadFragment(F,U,W))}}}},p.loadFragment=function(g,f,c){var x,S=this.fragmentTracker.getState(g);if(this.fragCurrent=g,S===L.FragmentState.BACKTRACKED){var C=this.fragmentTracker.getBacktrackData(g);if(C){this._handleFragmentLoadProgress(C),this._handleFragmentLoadComplete(C);return}else S=L.FragmentState.NOT_LOADED}S===L.FragmentState.NOT_LOADED||S===L.FragmentState.PARTIAL?g.sn==="initSegment"?this._loadInitSegment(g):this.bitrateTest?(g.bitrateTest=!0,this.log("Fragment "+g.sn+" of level "+g.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(g)):(this.startFragRequested=!0,o.prototype.loadFragment.call(this,g,f,c)):S===L.FragmentState.APPENDING?this.reduceMaxBufferLength(g.duration)&&this.fragmentTracker.removeFragment(g):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},p.getAppendedFrag=function(g){var f=this.fragmentTracker.getAppendedFrag(g,_.PlaylistLevelType.MAIN);return f&&"fragment"in f?f.fragment:f},p.getBufferedFrag=function(g){return this.fragmentTracker.getBufferedFrag(g,_.PlaylistLevelType.MAIN)},p.followingBufferedFrag=function(g){return g?this.getBufferedFrag(g.end+.5):null},p.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},p.nextLevelSwitch=function(){var g=this.levels,f=this.media;if(f!=null&&f.readyState){var c,x=this.getAppendedFrag(f.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!f.paused&&g){var S=this.hls.nextLoadLevel,C=g[S],O=this.fragLastKbps;O&&this.fragCurrent?c=this.fragCurrent.duration*C.maxBitrate/(1e3*O)+1:c=0}else c=0;var P=this.getBufferedFrag(f.currentTime+c);if(P){var w=this.followingBufferedFrag(P);if(w){this.abortCurrentFrag();var U=w.maxStartPTS?w.maxStartPTS:w.start,k=w.duration,N=Math.max(P.end,U+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},p.abortCurrentFrag=function(){var g=this.fragCurrent;this.fragCurrent=null,g!=null&&g.loader&&g.loader.abort(),this.state===n.State.KEY_LOADING&&(this.state=n.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},p.flushMainBuffer=function(g,f){o.prototype.flushMainBuffer.call(this,g,f,this.altAudio?"video":null)},p.onMediaAttached=function(g,f){o.prototype.onMediaAttached.call(this,g,f);var c=f.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),c.addEventListener("playing",this.onvplaying),c.addEventListener("seeked",this.onvseeked),this.gapController=new D.default(this.config,c,this.fragmentTracker,this.hls)},p.onMediaDetaching=function(){var g=this.media;g&&(g.removeEventListener("playing",this.onvplaying),g.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),o.prototype.onMediaDetaching.call(this)},p.onMediaPlaying=function(){this.tick()},p.onMediaSeeked=function(){var g=this.media,f=g?g.currentTime:null;Object(l.isFiniteNumber)(f)&&this.log("Media seeked to "+f.toFixed(3)),this.tick()},p.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(R.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},p.onManifestParsed=function(g,f){var c=!1,x=!1,S;f.levels.forEach(function(C){S=C.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(c=!0),S.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=c&&x&&!Object(v.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=f.levels,this.startFragRequested=!1},p.onLevelLoading=function(g,f){var c=this.levels;if(!(!c||this.state!==n.State.IDLE)){var x=c[f.level];(!x.details||x.details.live&&this.levelLastLoaded!==f.level||this.waitForCdnTuneIn(x.details))&&(this.state=n.State.WAITING_LEVEL)}},p.onLevelLoaded=function(g,f){var c,x=this.levels,S=f.level,C=f.details,O=C.totalduration;if(!x){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+C.startSN+","+C.endSN+"], cc ["+C.startCC+", "+C.endCC+"] duration:"+O);var P=this.fragCurrent;P&&(this.state===n.State.FRAG_LOADING||this.state===n.State.FRAG_LOADING_WAITING_RETRY)&&P.level!==f.level&&P.loader&&(this.state=n.State.IDLE,P.loader.abort());var w=x[S],U=0;if(C.live||(c=w.details)!==null&&c!==void 0&&c.live){if(C.fragments[0]||(C.deltaUpdateFailed=!0),C.deltaUpdateFailed)return;U=this.alignPlaylists(C,w.details)}if(w.details=C,this.levelLastLoaded=S,this.hls.trigger(R.Events.LEVEL_UPDATED,{details:C,level:S}),this.state===n.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(C))return;this.state=n.State.IDLE}this.startFragRequested?C.live&&this.synchronizeToLiveEdge(C):this.setStartPosition(C,U),this.tick()},p._handleFragmentLoadProgress=function(g){var f,c=g.frag,x=g.part,S=g.payload,C=this.levels;if(!C){this.warn("Levels were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered");return}var O=C[c.level],P=O.details;if(!P){this.warn("Dropping fragment "+c.sn+" of level "+c.level+" after level details were reset");return}var w=O.videoCodec,U=P.PTSKnown||!P.live,k=(f=c.initSegment)===null||f===void 0?void 0:f.data,N=this._getAudioCodec(O),B=this.transmuxer=this.transmuxer||new I.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),K=x?x.index:-1,W=K!==-1,F=new M.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,S.byteLength,K,W),H=this.initPTS[c.cc];B.push(S,k,N,w,c,x,P.totalduration,U,F,H)},p.onAudioTrackSwitching=function(g,f){var c=this.altAudio,x=!!f.url,S=f.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var C=this.fragCurrent;C!=null&&C.loader&&(this.log("Switching to main audio track, cancel main fragment load"),C.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var O=this.hls;c&&O.trigger(R.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),O.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:S})}},p.onAudioTrackSwitched=function(g,f){var c=f.id,x=!!this.hls.audioTracks[c].url;if(x){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=x,this.tick()},p.onBufferCreated=function(g,f){var c=f.tracks,x,S,C=!1;for(var O in c){var P=c[O];if(P.id==="main"){if(S=O,x=P,O==="video"){var w=c[O];w&&(this.videoBuffer=w.buffer)}}else C=!0}C&&x?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},p.onFragBuffered=function(g,f){var c=f.frag,x=f.part;if(!(c&&c.type!==_.PlaylistLevelType.MAIN)){if(this.fragContextChanged(c)){this.warn("Fragment "+c.sn+(x?" p: "+x.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state),this.state===n.State.PARSED&&(this.state=n.State.IDLE);return}var S=x?x.stats:c.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),c.sn!=="initSegment"&&(this.fragPrevious=c),this.fragBufferedComplete(c,x)}},p.onError=function(g,f){switch(f.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,f);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==n.State.ERROR&&(f.fatal?(this.warn(""+f.details),this.state=n.State.ERROR):!f.levelRetry&&this.state===n.State.WAITING_LEVEL&&(this.state=n.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(f.parent==="main"&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var c=!0,x=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);x&&x.len>.5&&(c=!this.reduceMaxBufferLength(x.len)),c&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},p.checkBuffer=function(){var g=this.media,f=this.gapController;if(!(!g||!f||!g.readyState)){var c=T.BufferHelper.getBuffered(g);!this.loadedmetadata&&c.length?(this.loadedmetadata=!0,this.seekToStartPos()):f.poll(this.lastCurrentTime),this.lastCurrentTime=g.currentTime}},p.onFragLoadEmergencyAborted=function(){this.state=n.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},p.onBufferFlushed=function(g,f){var c=f.type;if(c!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(c===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,c,_.PlaylistLevelType.MAIN)}},p.onLevelsUpdated=function(g,f){this.levels=f.levels},p.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},p.seekToStartPos=function(){var g=this.media,f=g.currentTime,c=this.startPosition;if(c>=0&&f<c){if(g.seeking){A.logger.log("could not seek to "+c+", already seeking at "+f);return}var x=T.BufferHelper.getBuffered(g),S=x.length?x.start(0):0,C=S-c;C>0&&(C<this.config.maxBufferHole||C<this.config.maxFragLookUpTolerance)&&(A.logger.log("adjusting start position by "+C+" to match buffer start"),c+=C,this.startPosition=c),this.log("seek to target start position "+c+" from current time "+f),g.currentTime=c}},p._getAudioCodec=function(g){var f=this.config.defaultAudioCodec||g.audioCodec;return this.audioCodecSwap&&f&&(this.log("Swapping audio codec"),f.indexOf("mp4a.40.5")!==-1?f="mp4a.40.2":f="mp4a.40.5"),f},p._loadBitrateTestFrag=function(g){var f=this;this._doFragLoad(g).then(function(c){var x=f.hls;if(!(!c||x.nextLoadLevel||f.fragContextChanged(g))){f.fragLoadError=0,f.state=n.State.IDLE,f.startFragRequested=!1,f.bitrateTest=!1;var S=g.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),x.trigger(R.Events.FRAG_LOADED,c)}})},p._handleTransmuxComplete=function(g){var f,c="main",x=this.hls,S=g.remuxResult,C=g.chunkMeta,O=this.getCurrentContext(C);if(!O){this.warn("The loading context changed while buffering fragment "+C.sn+" of level "+C.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(C.level);return}var P=O.frag,w=O.part,U=O.level,k=S.video,N=S.text,B=S.id3,K=S.initSegment,W=this.altAudio?void 0:S.audio;if(!this.fragContextChanged(P)){if(this.state=n.State.PARSING,K){K.tracks&&(this._bufferInitSegment(U,K.tracks,P,C),x.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:c,tracks:K.tracks}));var F=K.initPTS,H=K.timescale;Object(l.isFiniteNumber)(F)&&(this.initPTS[P.cc]=F,x.trigger(R.Events.INIT_PTS_FOUND,{frag:P,id:c,initPTS:F,timescale:H}))}if(k&&S.independent!==!1){if(U.details){var Y=k.startPTS,$=k.endPTS,Z=k.startDTS,q=k.endDTS;if(w)w.elementaryStreams[k.type]={startPTS:Y,endPTS:$,startDTS:Z,endDTS:q};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var oe=this.getLoadPosition()+this.config.maxBufferHole;if(oe<Y){this.backtrack(P);return}P.setElementaryStreamInfo(k.type,P.start,$,P.start,q,!0)}P.setElementaryStreamInfo(k.type,Y,$,Z,q),this.bufferFragmentData(k,P,w,C)}}else if(S.independent===!1){this.backtrack(P);return}if(W){var X=W.startPTS,ie=W.endPTS,fe=W.startDTS,ue=W.endDTS;w&&(w.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:ie,startDTS:fe,endDTS:ue}),P.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,X,ie,fe,ue),this.bufferFragmentData(W,P,w,C)}if(B!=null&&(f=B.samples)!==null&&f!==void 0&&f.length){var Se={frag:P,id:c,samples:B.samples};x.trigger(R.Events.FRAG_PARSING_METADATA,Se)}if(N){var re={frag:P,id:c,samples:N.samples};x.trigger(R.Events.FRAG_PARSING_USERDATA,re)}}},p._bufferInitSegment=function(g,f,c,x){var S=this;if(this.state===n.State.PARSING){this.audioOnly=!!f.audio&&!f.video,this.altAudio&&!this.audioOnly&&delete f.audio;var C=f.audio,O=f.video,P=f.audiovideo;if(C){var w=g.audioCodec,U=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(w&&(w.indexOf("mp4a.40.5")!==-1?w="mp4a.40.2":w="mp4a.40.5"),C.metadata.channelCount!==1&&U.indexOf("firefox")===-1&&(w="mp4a.40.5")),U.indexOf("android")!==-1&&C.container!=="audio/mpeg"&&(w="mp4a.40.2",this.log("Android: force audio codec to "+w)),g.audioCodec&&g.audioCodec!==w&&this.log('Swapping manifest audio codec "'+g.audioCodec+'" for "'+w+'"'),C.levelCodec=w,C.id="main",this.log("Init audio buffer, container:"+C.container+", codecs[selected/level/parsed]=["+(w||"")+"/"+(g.audioCodec||"")+"/"+C.codec+"]")}O&&(O.levelCodec=g.videoCodec,O.id="main",this.log("Init video buffer, container:"+O.container+", codecs[level/parsed]=["+(g.videoCodec||"")+"/"+O.codec+"]")),P&&this.log("Init audiovideo buffer, container:"+P.container+", codecs[level/parsed]=["+(g.attrs.CODECS||"")+"/"+P.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,f),Object.keys(f).forEach(function(k){var N=f[k],B=N.initSegment;B!=null&&B.byteLength&&S.hls.trigger(R.Events.BUFFER_APPENDING,{type:k,data:B,frag:c,part:null,chunkMeta:x,parent:c.type})}),this.tick()}},p.backtrack=function(g){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(g);var f=this.fragmentTracker.backtrack(g);this.fragPrevious=null,this.nextLoadPosition=g.start,f?this.resetFragmentLoading(g):this.state=n.State.BACKTRACKING},p.checkFragmentChanged=function(){var g=this.media,f=null;if(g&&g.readyState>1&&g.seeking===!1){var c=g.currentTime;if(T.BufferHelper.isBuffered(g,c)?f=this.getAppendedFrag(c):T.BufferHelper.isBuffered(g,c+.1)&&(f=this.getAppendedFrag(c+.1)),f){var x=this.fragPlaying,S=f.level;(!x||f.sn!==x.sn||x.level!==S||f.urlId!==x.urlId)&&(this.hls.trigger(R.Events.FRAG_CHANGED,{frag:f}),(!x||x.level!==S)&&this.hls.trigger(R.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=f)}}},r(y,[{key:"nextLevel",get:function(){var g=this.nextBufferedFrag;return g?g.level:-1}},{key:"currentLevel",get:function(){var g=this.media;if(g){var f=this.getAppendedFrag(g.currentTime);if(f)return f.level}return-1}},{key:"nextBufferedFrag",get:function(){var g=this.media;if(g){var f=this.getAppendedFrag(g.currentTime);return this.followingBufferedFrag(f)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),y}(n.default)},"./src/controller/subtitle-stream-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"SubtitleStreamController",function(){return r});var l=t("./src/events.ts"),n=t("./src/utils/buffer-helper.ts"),v=t("./src/controller/fragment-finders.ts"),R=t("./src/utils/discontinuities.ts"),T=t("./src/controller/level-helper.ts"),L=t("./src/controller/fragment-tracker.ts"),_=t("./src/controller/base-stream-controller.ts"),E=t("./src/types/loader.ts"),I=t("./src/types/level.ts");function M(s,i){for(var a=0;a<i.length;a++){var d=i[a];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(s,d.key,d)}}function D(s,i,a){return i&&M(s.prototype,i),a&&M(s,a),s}function b(s,i){s.prototype=Object.create(i.prototype),s.prototype.constructor=s,A(s,i)}function A(s,i){return A=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},A(s,i)}var u=500,r=function(s){b(i,s);function i(d,o){var y;return y=s.call(this,d,o,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var a=i.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var o=this.hls;o.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(l.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(l.Events.ERROR,this.onError,this),o.on(l.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(l.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),o.on(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(l.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),o.on(l.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},a._unregisterListeners=function(){var o=this.hls;o.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(l.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(l.Events.ERROR,this.onError,this),o.off(l.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.off(l.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),o.off(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(l.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),o.off(l.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},a.startLoad=function(){this.stopLoad(),this.state=_.State.IDLE,this.setInterval(u),this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},a.onLevelLoaded=function(o,y){this.mainDetails=y.details},a.onSubtitleFragProcessed=function(o,y){var p=y.frag,m=y.success;if(this.fragPrevious=p,this.state=_.State.IDLE,!!m){var g=this.tracksBuffered[this.currentTrackId];if(!!g){for(var f,c=p.start,x=0;x<g.length;x++)if(c>=g[x].start&&c<=g[x].end){f=g[x];break}var S=p.start+p.duration;f?f.end=S:(f={start:c,end:S},g.push(f)),this.fragmentTracker.fragBuffered(p)}}},a.onBufferFlushing=function(o,y){var p=y.startOffset,m=y.endOffset;if(p===0&&m!==Number.POSITIVE_INFINITY){var g=this.currentTrackId,f=this.levels;if(!f.length||!f[g]||!f[g].details)return;var c=f[g].details,x=c.targetduration,S=m-x;if(S<=0)return;y.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(C){for(var O=0;O<C.length;){if(C[O].end<=S){C.shift();continue}else if(C[O].start<S)C[O].start=S;else break;O++}}),this.fragmentTracker.removeFragmentsInRange(p,S,E.PlaylistLevelType.SUBTITLE)}},a.onError=function(o,y){var p,m=y.frag;!m||m.type!==E.PlaylistLevelType.SUBTITLE||((p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=_.State.IDLE)},a.onSubtitleTracksUpdated=function(o,y){var p=this,m=y.subtitleTracks;this.tracksBuffered=[],this.levels=m.map(function(g){return new I.Level(g)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(g){p.tracksBuffered[g.id]=[]}),this.mediaBuffer=null},a.onSubtitleTrackSwitch=function(o,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(u)},a.onSubtitleTrackLoaded=function(o,y){var p,m=y.details,g=y.id,f=this.currentTrackId,c=this.levels;if(!!c.length){var x=c[f];if(!(g>=c.length||g!==f||!x)){if(this.mediaBuffer=this.mediaBufferTimeRanges,m.live||(p=x.details)!==null&&p!==void 0&&p.live){var S=this.mainDetails;if(m.deltaUpdateFailed||!S)return;var C=S.fragments[0];if(!x.details)m.hasProgramDateTime&&S.hasProgramDateTime?Object(R.alignMediaPlaylistByPDT)(m,S):C&&Object(T.addSliding)(m,C.start);else{var O=this.alignPlaylists(m,x.details);O===0&&C&&Object(T.addSliding)(m,C.start)}}if(x.details=m,this.levelLastLoaded=g,this.tick(),m.live&&!this.fragCurrent&&this.media&&this.state===_.State.IDLE){var P=Object(v.findFragmentByPTS)(null,m.fragments,this.media.currentTime,0);P||(this.warn("Subtitle playlist not aligned with playback"),x.details=void 0)}}}},a._handleFragmentLoadComplete=function(o){var y=o.frag,p=o.payload,m=y.decryptdata,g=this.hls;if(!this.fragContextChanged(y)&&p&&p.byteLength>0&&m&&m.key&&m.iv&&m.method==="AES-128"){var f=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),m.key.buffer,m.iv.buffer).then(function(c){var x=performance.now();g.trigger(l.Events.FRAG_DECRYPTED,{frag:y,payload:c,stats:{tstart:f,tdecrypt:x}})})}},a.doTick=function(){if(!this.media){this.state=_.State.IDLE;return}if(this.state===_.State.IDLE){var o,y=this.currentTrackId,p=this.levels;if(!p.length||!p[y]||!p[y].details)return;var m=p[y].details,g=m.targetduration,f=this.config,c=this.media,x=n.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime-g,f.maxBufferHole),S=x.end,C=x.len,O=this.getMaxBufferLength()+g;if(C>O)return;console.assert(m,"Subtitle track details are defined on idle subtitle stream controller tick");var P=m.fragments,w=P.length,U=m.edge,k,N=this.fragPrevious;if(S<U){var B=f.maxFragLookUpTolerance;k=Object(v.findFragmentByPTS)(N,P,S,B),!k&&N&&N.start<P[0].start&&(k=P[0])}else k=P[w-1];(o=k)!==null&&o!==void 0&&o.encrypted?this.loadKey(k,m):k&&this.fragmentTracker.getState(k)===L.FragmentState.NOT_LOADED&&this.loadFragment(k,m,S)}},a.loadFragment=function(o,y,p){this.fragCurrent=o,s.prototype.loadFragment.call(this,o,y,p)},D(i,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),i}(_.default)},"./src/controller/subtitle-track-controller.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/events.ts"),n=t("./src/utils/texttrack-utils.ts"),v=t("./src/controller/base-playlist-controller.ts"),R=t("./src/types/loader.ts");function T(D,b){for(var A=0;A<b.length;A++){var u=b[A];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(D,u.key,u)}}function L(D,b,A){return b&&T(D.prototype,b),A&&T(D,A),D}function _(D,b){D.prototype=Object.create(b.prototype),D.prototype.constructor=D,E(D,b)}function E(D,b){return E=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},E(D,b)}var I=function(D){_(b,D);function b(u){var r;return r=D.call(this,u,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var A=b.prototype;return A.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,D.prototype.destroy.call(this)},A.registerListeners=function(){var r=this.hls;r.on(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(l.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(l.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var r=this.hls;r.off(l.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(l.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(l.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(l.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(l.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(l.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(l.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(l.Events.ERROR,this.onError,this)},A.onMediaAttached=function(r,s){this.media=s.media,!!this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},A.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},A.onMediaDetaching=function(){if(!!this.media){self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var r=M(this.media.textTracks);r.forEach(function(s){Object(n.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null}},A.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},A.onManifestParsed=function(r,s){this.tracks=s.subtitleTracks},A.onSubtitleTrackLoaded=function(r,s){var i=s.id,a=s.details,d=this.trackId,o=this.tracksInGroup[d];if(!o){this.warn("Invalid subtitle track id "+i);return}var y=o.details;o.details=s.details,this.log("subtitle track "+i+" loaded ["+a.startSN+"-"+a.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,s,y))},A.onLevelLoading=function(r,s){this.switchLevel(s.level)},A.onLevelSwitching=function(r,s){this.switchLevel(s.level)},A.switchLevel=function(r){var s=this.hls.levels[r];if(!!(s!=null&&s.textGroupIds)){var i=s.textGroupIds[s.urlId];if(this.groupId!==i){var a=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(p){return!i||p.groupId===i});this.tracksInGroup=d;var o=this.findTrackId(a==null?void 0:a.name)||this.findTrackId();this.groupId=i;var y={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(l.Events.SUBTITLE_TRACKS_UPDATED,y),o!==-1&&this.setSubtitleTrack(o,a)}}},A.findTrackId=function(r){for(var s=this.tracksInGroup,i=0;i<s.length;i++){var a=s[i];if((!this.selectDefaultTrack||a.default)&&(!r||r===a.name))return a.id}return-1},A.onError=function(r,s){D.prototype.onError.call(this,r,s),!(s.fatal||!s.context)&&s.context.type===R.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},A.loadPlaylist=function(r){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var i=s.id,a=s.groupId,d=s.url;if(r)try{d=r.addDirectives(d)}catch(o){this.warn("Could not construct new URL with HLS Delivery Directives: "+o)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(l.Events.SUBTITLE_TRACK_LOADING,{url:d,id:i,groupId:a,deliveryDirectives:r||null})}},A.toggleTrackModes=function(r){var s=this,i=this.media,a=this.subtitleDisplay,d=this.trackId;if(!!i){var o=M(i.textTracks),y=o.filter(function(g){return g.groupId===s.groupId});if(r===-1)[].slice.call(o).forEach(function(g){g.mode="disabled"});else{var p=y[d];p&&(p.mode="disabled")}var m=y[r];m&&(m.mode=a?"showing":"hidden")}},A.setSubtitleTrack=function(r,s){var i,a=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),!(this.trackId===r&&(r===-1||(i=a[r])!==null&&i!==void 0&&i.details)||r<-1||r>=a.length)){this.clearTimer();var d=a[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,d){var o=d.id,y=d.groupId,p=y===void 0?"":y,m=d.name,g=d.type,f=d.url;this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:p,name:m,type:g,url:f});var c=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(c)}else this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:r})}},A.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!(!this.media||!this.hls.config.renderTextTracksNatively)){for(var r=-1,s=M(this.media.textTracks),i=0;i<s.length;i++)if(s[i].mode==="hidden")r=i;else if(s[i].mode==="showing"){r=i;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)}},L(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,s)}}]),b}(v.default);function M(D){for(var b=[],A=0;A<D.length;A++){var u=D[A];u.kind==="subtitles"&&u.label&&b.push(D[A])}return b}e.default=I},"./src/controller/timeline-controller.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"TimelineController",function(){return M});var l=t("./src/polyfills/number.ts"),n=t("./src/events.ts"),v=t("./src/utils/cea-608-parser.ts"),R=t("./src/utils/output-filter.ts"),T=t("./src/utils/webvtt-parser.ts"),L=t("./src/utils/texttrack-utils.ts"),_=t("./src/utils/imsc1-ttml-parser.ts"),E=t("./src/types/loader.ts"),I=t("./src/utils/logger.ts"),M=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=A(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var i=new R.default(this,"textTrack1"),a=new R.default(this,"textTrack2"),d=new R.default(this,"textTrack3"),o=new R.default(this,"textTrack4");this.cea608Parser1=new v.default(1,i,a),this.cea608Parser2=new v.default(3,d,o)}s.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(n.Events.FRAG_LOADING,this.onFragLoading,this),s.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=u.prototype;return r.destroy=function(){var i=this.hls;i.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.off(n.Events.FRAG_LOADING,this.onFragLoading,this),i.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.off(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.off(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.off(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(i,a,d,o,y){for(var p=!1,m=y.length;m--;){var g=y[m],f=b(g[0],g[1],a,d);if(f>=0&&(g[0]=Math.min(g[0],a),g[1]=Math.max(g[1],d),p=!0,f/(d-a)>.5))return}if(p||y.push([a,d]),this.config.renderTextTracksNatively){var c=this.captionsTracks[i];this.Cues.newCue(c,a,d,o)}else{var x=this.Cues.newCue(null,a,d,o);this.hls.trigger(n.Events.CUES_PARSED,{type:"captions",cues:x,track:i})}},r.onInitPtsFound=function(i,a){var d=this,o=a.frag,y=a.id,p=a.initPTS,m=a.timescale,g=this.unparsedVttFrags;y==="main"&&(this.initPTS[o.cc]=p,this.timescale[o.cc]=m),g.length&&(this.unparsedVttFrags=[],g.forEach(function(f){d.onFragLoaded(n.Events.FRAG_LOADED,f)}))},r.getExistingTrack=function(i){var a=this.media;if(a)for(var d=0;d<a.textTracks.length;d++){var o=a.textTracks[d];if(o[i])return o}return null},r.createCaptionsTrack=function(i){this.config.renderTextTracksNatively?this.createNativeTrack(i):this.createNonNativeTrack(i)},r.createNativeTrack=function(i){if(!this.captionsTracks[i]){var a=this.captionsProperties,d=this.captionsTracks,o=this.media,y=a[i],p=y.label,m=y.languageCode,g=this.getExistingTrack(i);if(g)d[i]=g,Object(L.clearCurrentCues)(d[i]),Object(L.sendAddTrackEvent)(d[i],o);else{var f=this.createTextTrack("captions",p,m);f&&(f[i]=!0,d[i]=f)}}},r.createNonNativeTrack=function(i){if(!this.nonNativeCaptionsTracks[i]){var a=this.captionsProperties[i];if(!!a){var d=a.label,o={_id:i,label:d,kind:"captions",default:a.media?!!a.media.default:!1,closedCaptions:a.media};this.nonNativeCaptionsTracks[i]=o,this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[o]})}}},r.createTextTrack=function(i,a,d){var o=this.media;if(!!o)return o.addTextTrack(i,a,d)},r.onMediaAttaching=function(i,a){this.media=a.media,this._cleanTracks()},r.onMediaDetaching=function(){var i=this.captionsTracks;Object.keys(i).forEach(function(a){Object(L.clearCurrentCues)(i[a]),delete i[a]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=A(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},r._cleanTracks=function(){var i=this.media;if(!!i){var a=i.textTracks;if(a)for(var d=0;d<a.length;d++)Object(L.clearCurrentCues)(a[d])}},r.onSubtitleTracksUpdated=function(i,a){var d=this;this.textTracks=[];var o=a.subtitleTracks||[],y=o.some(function(f){return f.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||y&&this.config.enableIMSC1){var p=this.tracks&&o&&this.tracks.length===o.length;if(this.tracks=o||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(f,c){var x;if(c<m.length){for(var S=null,C=0;C<m.length;C++)if(D(m[C],f)){S=m[C];break}S&&(x=S)}x?Object(L.clearCurrentCues)(x):(x=d.createTextTrack("subtitles",f.name,f.lang),x&&(x.mode="disabled")),x&&(x.groupId=f.groupId,d.textTracks.push(x))})}else if(!p&&this.tracks&&this.tracks.length){var g=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:g})}}},r.onManifestLoaded=function(i,a){var d=this;this.config.enableCEA708Captions&&a.captions&&a.captions.forEach(function(o){var y=/(?:CC|SERVICE)([1-4])/.exec(o.instreamId);if(!!y){var p="textTrack"+y[1],m=d.captionsProperties[p];!m||(m.label=o.name,o.lang&&(m.languageCode=o.lang),m.media=o)}})},r.onFragLoading=function(i,a){var d=this.cea608Parser1,o=this.cea608Parser2,y=this.lastSn,p=this.lastPartIndex;if(!(!this.enabled||!(d&&o))&&a.frag.type===E.PlaylistLevelType.MAIN){var m,g,f=a.frag.sn,c=(m=a==null||(g=a.part)===null||g===void 0?void 0:g.index)!=null?m:-1;f===y+1||f===y&&c===p+1||(d.reset(),o.reset()),this.lastSn=f,this.lastPartIndex=c}},r.onFragLoaded=function(i,a){var d=a.frag,o=a.payload,y=this.initPTS,p=this.unparsedVttFrags;if(d.type===E.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!Object(l.isFiniteNumber)(y[d.cc])){p.push(a),y.length&&this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var m=d.decryptdata,g="stats"in a;if(m==null||m.key==null||m.method!=="AES-128"||g){var f=this.tracks[d.level],c=this.vttCCs;c[d.cc]||(c[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),f&&f.textCodec===_.IMSC1_CODEC?this._parseIMSC1(d,o):this._parseVTTs(d,o,c)}}else this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(i,a){var d=this,o=this.hls;Object(_.parseIMSC1)(a,this.initPTS[i.cc],this.timescale[i.cc],function(y){d._appendCues(y,i.level),o.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(y){I.logger.log("Failed to parse IMSC1: "+y),o.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:y})})},r._parseVTTs=function(i,a,d){var o=this,y=this.hls;Object(T.parseWebVTT)(a,this.initPTS[i.cc],this.timescale[i.cc],d,i.cc,i.start,function(p){o._appendCues(p,i.level),y.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(p){o._fallbackToIMSC1(i,a),I.logger.log("Failed to parse VTT cue: "+p),y.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:p})})},r._fallbackToIMSC1=function(i,a){var d=this,o=this.tracks[i.level];o.textCodec||Object(_.parseIMSC1)(a,this.initPTS[i.cc],this.timescale[i.cc],function(){o.textCodec=_.IMSC1_CODEC,d._parseIMSC1(i,a)},function(){o.textCodec="wvtt"})},r._appendCues=function(i,a){var d=this.hls;if(this.config.renderTextTracksNatively){var o=this.textTracks[a];if(o.mode==="disabled")return;i.forEach(function(m){return Object(L.addCueToTrack)(o,m)})}else{var y=this.tracks[a],p=y.default?"default":"subtitles"+a;d.trigger(n.Events.CUES_PARSED,{type:"subtitles",cues:i,track:p})}},r.onFragDecrypted=function(i,a){var d=a.frag;if(d.type===E.PlaylistLevelType.SUBTITLE){if(!Object(l.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(a);return}this.onFragLoaded(n.Events.FRAG_LOADED,a)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(i,a){var d=this.cea608Parser1,o=this.cea608Parser2;if(!(!this.enabled||!(d&&o)))for(var y=0;y<a.samples.length;y++){var p=a.samples[y].bytes;if(p){var m=this.extractCea608Data(p);d.addData(a.samples[y].pts,m[0]),o.addData(a.samples[y].pts,m[1])}}},r.onBufferFlushing=function(i,a){var d=a.startOffset,o=a.endOffset,y=a.endOffsetSubtitles,p=a.type,m=this.media;if(!(!m||m.currentTime<o)){if(!p||p==="video"){var g=this.captionsTracks;Object.keys(g).forEach(function(c){return Object(L.removeCuesInRange)(g[c],d,o)})}if(this.config.renderTextTracksNatively&&d===0&&y!==void 0){var f=this.textTracks;Object.keys(f).forEach(function(c){return Object(L.removeCuesInRange)(f[c],d,y)})}}},r.extractCea608Data=function(i){for(var a=i[0]&31,d=2,o=[[],[]],y=0;y<a;y++){var p=i[d++],m=127&i[d++],g=127&i[d++],f=(4&p)!=0,c=3&p;m===0&&g===0||f&&(c===0||c===1)&&(o[c].push(m),o[c].push(g))}return o},u}();function D(u,r){return u&&u.label===r.name&&!(u.textTrack1||u.textTrack2)}function b(u,r,s,i){return Math.min(r,i)-Math.max(u,s)}function A(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return l});var l=function(){function n(R,T){this.subtle=void 0,this.aesIV=void 0,this.subtle=R,this.aesIV=T}var v=n.prototype;return v.decrypt=function(T,L){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},L,T)},n}()},"./src/crypt/aes-decryptor.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"removePadding",function(){return n}),t.d(e,"default",function(){return v});var l=t("./src/utils/typed-array.ts");function n(R){var T=R.byteLength,L=T&&new DataView(R.buffer).getUint8(T-1);return L?Object(l.sliceUint8)(R,0,T-L):R}var v=function(){function R(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var T=R.prototype;return T.uint8ArrayToUint32Array_=function(_){for(var E=new DataView(_),I=new Uint32Array(4),M=0;M<4;M++)I[M]=E.getUint32(M*4);return I},T.initTable=function(){var _=this.sBox,E=this.invSBox,I=this.subMix,M=I[0],D=I[1],b=I[2],A=I[3],u=this.invSubMix,r=u[0],s=u[1],i=u[2],a=u[3],d=new Uint32Array(256),o=0,y=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){var m=y^y<<1^y<<2^y<<3^y<<4;m=m>>>8^m&255^99,_[o]=m,E[m]=o;var g=d[o],f=d[g],c=d[f],x=d[m]*257^m*16843008;M[o]=x<<24|x>>>8,D[o]=x<<16|x>>>16,b[o]=x<<8|x>>>24,A[o]=x,x=c*16843009^f*65537^g*257^o*16843008,r[m]=x<<24|x>>>8,s[m]=x<<16|x>>>16,i[m]=x<<8|x>>>24,a[m]=x,o?(o=g^d[d[d[c^g]]],y^=d[d[y]]):o=y=1}},T.expandKey=function(_){for(var E=this.uint8ArrayToUint32Array_(_),I=!0,M=0;M<E.length&&I;)I=E[M]===this.key[M],M++;if(!I){this.key=E;var D=this.keySize=E.length;if(D!==4&&D!==6&&D!==8)throw new Error("Invalid aes key size="+D);var b=this.ksRows=(D+6+1)*4,A,u,r=this.keySchedule=new Uint32Array(b),s=this.invKeySchedule=new Uint32Array(b),i=this.sBox,a=this.rcon,d=this.invSubMix,o=d[0],y=d[1],p=d[2],m=d[3],g,f;for(A=0;A<b;A++){if(A<D){g=r[A]=E[A];continue}f=g,A%D==0?(f=f<<8|f>>>24,f=i[f>>>24]<<24|i[f>>>16&255]<<16|i[f>>>8&255]<<8|i[f&255],f^=a[A/D|0]<<24):D>6&&A%D==4&&(f=i[f>>>24]<<24|i[f>>>16&255]<<16|i[f>>>8&255]<<8|i[f&255]),r[A]=g=(r[A-D]^f)>>>0}for(u=0;u<b;u++)A=b-u,u&3?f=r[A]:f=r[A-4],u<4||A<=4?s[u]=f:s[u]=o[i[f>>>24]]^y[i[f>>>16&255]]^p[i[f>>>8&255]]^m[i[f&255]],s[u]=s[u]>>>0}},T.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},T.decrypt=function(_,E,I){for(var M=this.keySize+6,D=this.invKeySchedule,b=this.invSBox,A=this.invSubMix,u=A[0],r=A[1],s=A[2],i=A[3],a=this.uint8ArrayToUint32Array_(I),d=a[0],o=a[1],y=a[2],p=a[3],m=new Int32Array(_),g=new Int32Array(m.length),f,c,x,S,C,O,P,w,U,k,N,B,K,W,F=this.networkToHostOrderSwap;E<m.length;){for(U=F(m[E]),k=F(m[E+1]),N=F(m[E+2]),B=F(m[E+3]),C=U^D[0],O=B^D[1],P=N^D[2],w=k^D[3],K=4,W=1;W<M;W++)f=u[C>>>24]^r[O>>16&255]^s[P>>8&255]^i[w&255]^D[K],c=u[O>>>24]^r[P>>16&255]^s[w>>8&255]^i[C&255]^D[K+1],x=u[P>>>24]^r[w>>16&255]^s[C>>8&255]^i[O&255]^D[K+2],S=u[w>>>24]^r[C>>16&255]^s[O>>8&255]^i[P&255]^D[K+3],C=f,O=c,P=x,w=S,K=K+4;f=b[C>>>24]<<24^b[O>>16&255]<<16^b[P>>8&255]<<8^b[w&255]^D[K],c=b[O>>>24]<<24^b[P>>16&255]<<16^b[w>>8&255]<<8^b[C&255]^D[K+1],x=b[P>>>24]<<24^b[w>>16&255]<<16^b[C>>8&255]<<8^b[O&255]^D[K+2],S=b[w>>>24]<<24^b[C>>16&255]<<16^b[O>>8&255]<<8^b[P&255]^D[K+3],g[E]=F(f^d),g[E+1]=F(S^o),g[E+2]=F(x^y),g[E+3]=F(c^p),d=U,o=k,y=N,p=B,E=E+4}return g.buffer},R}()},"./src/crypt/decrypter.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return E});var l=t("./src/crypt/aes-crypto.ts"),n=t("./src/crypt/fast-aes-key.ts"),v=t("./src/crypt/aes-decryptor.ts"),R=t("./src/utils/logger.ts"),T=t("./src/utils/mp4-tools.ts"),L=t("./src/utils/typed-array.ts"),_=16,E=function(){function I(D,b,A){var u=A===void 0?{}:A,r=u.removePKCS7Padding,s=r===void 0?!0:r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 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.observer=D,this.config=b,this.removePKCS7Padding=s,s)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=I.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var A=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(v.removePadding)(A):A},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(b,A,u,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),A,u);var s=this.flush();s&&r(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),A,u).then(r)},M.softwareDecrypt=function(b,A,u){var r=this.currentIV,s=this.currentResult,i=this.remainderData;this.logOnce("JS AES decrypt"),i&&(b=Object(T.appendUint8Array)(i,b),this.remainderData=null);var a=this.getValidChunk(b);if(!a.length)return null;r&&(u=r);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new v.default),d.expandKey(A);var o=s;return this.currentResult=d.decrypt(a.buffer,0,u),this.currentIV=Object(L.sliceUint8)(a,-16).buffer,o||null},M.webCryptoDecrypt=function(b,A,u){var r=this,s=this.subtle;return(this.key!==A||!this.fastAesKey)&&(this.key=A,this.fastAesKey=new n.default(s,A)),this.fastAesKey.expandKey().then(function(i){if(!s)return Promise.reject(new Error("web crypto not initialized"));var a=new l.default(s,u);return a.decrypt(b.buffer,i)}).catch(function(i){return r.onWebCryptoError(i,b,A,u)})},M.onWebCryptoError=function(b,A,u,r){return R.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(A,u,r)},M.getValidChunk=function(b){var A=b,u=b.length-b.length%_;return u!==b.length&&(A=Object(L.sliceUint8)(b,0,u),this.remainderData=Object(L.sliceUint8)(b,u)),A},M.logOnce=function(b){!this.logEnabled||(R.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1)},I}()},"./src/crypt/fast-aes-key.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return l});var l=function(){function n(R,T){this.subtle=void 0,this.key=void 0,this.subtle=R,this.key=T}var v=n.prototype;return v.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},n}()},"./src/demux/aacdemuxer.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/demux/base-audio-demuxer.ts"),n=t("./src/demux/adts.ts"),v=t("./src/utils/logger.ts"),R=t("./src/demux/id3.ts");function T(E,I){E.prototype=Object.create(I.prototype),E.prototype.constructor=E,L(E,I)}function L(E,I){return L=Object.setPrototypeOf||function(D,b){return D.__proto__=b,D},L(E,I)}var _=function(E){T(I,E);function I(D,b){var A;return A=E.call(this)||this,A.observer=void 0,A.config=void 0,A.observer=D,A.config=b,A}var M=I.prototype;return M.resetInitSegment=function(b,A,u){E.prototype.resetInitSegment.call(this,b,A,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:u,inputTimeScale:9e4,dropped:0}},I.probe=function(b){if(!b)return!1;for(var A=R.getID3Data(b,0)||[],u=A.length,r=b.length;u<r;u++)if(n.probe(b,u))return v.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(b,A){return n.canParse(b,A)},M.appendFrame=function(b,A,u){n.initTrackConfig(b,this.observer,A,u,b.manifestCodec);var r=n.appendFrame(b,A,u,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},I}(l.default);_.minProbeByteLength=9,e.default=_},"./src/demux/adts.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"getAudioConfig",function(){return R}),t.d(e,"isHeaderPattern",function(){return T}),t.d(e,"getHeaderLength",function(){return L}),t.d(e,"getFullFrameLength",function(){return _}),t.d(e,"canGetFrameLength",function(){return E}),t.d(e,"isHeader",function(){return I}),t.d(e,"canParse",function(){return M}),t.d(e,"probe",function(){return D}),t.d(e,"initTrackConfig",function(){return b}),t.d(e,"getFrameDuration",function(){return A}),t.d(e,"parseFrameHeader",function(){return u}),t.d(e,"appendFrame",function(){return r});var l=t("./src/utils/logger.ts"),n=t("./src/errors.ts"),v=t("./src/events.ts");function R(s,i,a,d){var o,y,p,m,g=navigator.userAgent.toLowerCase(),f=d,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=((i[a+2]&192)>>>6)+1;var x=(i[a+2]&60)>>>2;if(x>c.length-1){s.trigger(v.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return p=(i[a+2]&1)<<2,p|=(i[a+3]&192)>>>6,l.logger.log("manifest codec:"+d+", ADTS type:"+o+", samplingIndex:"+x),/firefox/i.test(g)?x>=6?(o=5,m=new Array(4),y=x-3):(o=2,m=new Array(2),y=x):g.indexOf("android")!==-1?(o=2,m=new Array(2),y=x):(o=5,m=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&x>=6?y=x-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(x>=6&&p===1||/vivaldi/i.test(g))||!d&&p===1)&&(o=2,m=new Array(2)),y=x)),m[0]=o<<3,m[0]|=(x&14)>>1,m[1]|=(x&1)<<7,m[1]|=p<<3,o===5&&(m[1]|=(y&14)>>1,m[2]=(y&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:c[x],channelCount:p,codec:"mp4a.40."+o,manifestCodec:f}}function T(s,i){return s[i]===255&&(s[i+1]&246)==240}function L(s,i){return s[i+1]&1?7:9}function _(s,i){return(s[i+3]&3)<<11|s[i+4]<<3|(s[i+5]&224)>>>5}function E(s,i){return i+5<s.length}function I(s,i){return i+1<s.length&&T(s,i)}function M(s,i){return E(s,i)&&T(s,i)&&_(s,i)<=s.length-i}function D(s,i){if(I(s,i)){var a=L(s,i);if(i+a>=s.length)return!1;var d=_(s,i);if(d<=a)return!1;var o=i+d;return o===s.length||I(s,o)}return!1}function b(s,i,a,d,o){if(!s.samplerate){var y=R(i,a,d,o);if(!y)return;s.config=y.config,s.samplerate=y.samplerate,s.channelCount=y.channelCount,s.codec=y.codec,s.manifestCodec=y.manifestCodec,l.logger.log("parsed codec:"+s.codec+", rate:"+y.samplerate+", channels:"+y.channelCount)}}function A(s){return 1024*9e4/s}function u(s,i,a,d,o){var y=L(s,i),p=_(s,i);if(p-=y,p>0){var m=a+d*o;return{headerLength:y,frameLength:p,stamp:m}}}function r(s,i,a,d,o){var y=A(s.samplerate),p=u(i,a,d,o,y);if(p){var m=p.frameLength,g=p.headerLength,f=p.stamp,c=g+m,x=Math.max(0,a+c-i.length),S;x?(S=new Uint8Array(c-g),S.set(i.subarray(a+g,i.length),0)):S=i.subarray(a+g,a+c);var C={unit:S,pts:f};return x||s.samples.push(C),{sample:C,length:c,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"initPTSFn",function(){return _});var l=t("./src/polyfills/number.ts"),n=t("./src/demux/id3.ts"),v=t("./src/demux/dummy-demuxed-track.ts"),R=t("./src/utils/mp4-tools.ts"),T=t("./src/utils/typed-array.ts"),L=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var I=E.prototype;return I.resetInitSegment=function(D,b,A){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},I.resetTimeStamp=function(){},I.resetContiguity=function(){},I.canParse=function(D,b){return!1},I.appendFrame=function(D,b,A){},I.demux=function(D,b){this.cachedData&&(D=Object(R.appendUint8Array)(this.cachedData,D),this.cachedData=null);var A=n.getID3Data(D,0),u=A?A.length:0,r,s,i=this._audioTrack,a=this._id3Track,d=A?n.getTimeStamp(A):void 0,o=D.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(d,b)),A&&A.length>0&&a.samples.push({pts:this.initPTS,dts:this.initPTS,data:A}),s=this.initPTS;u<o;){if(this.canParse(D,u)){var y=this.appendFrame(i,D,u);y?(this.frameIndex++,s=y.sample.pts,u+=y.length,r=u):u=o}else n.canParse(D,u)?(A=n.getID3Data(D,u),a.samples.push({pts:s,dts:s,data:A}),u+=A.length,r=u):u++;if(u===o&&r!==o){var p=Object(T.sliceUint8)(D,r);this.cachedData?this.cachedData=Object(R.appendUint8Array)(this.cachedData,p):this.cachedData=p}}return{audioTrack:i,avcTrack:Object(v.dummyTrack)(),id3Track:a,textTrack:Object(v.dummyTrack)()}},I.demuxSampleAes=function(D,b,A){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},I.flush=function(D){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(v.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(v.dummyTrack)()}},I.destroy=function(){},E}(),_=function(I,M){return Object(l.isFiniteNumber)(I)?I*90:M*9e4};e.default=L},"./src/demux/chunk-cache.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return l});var l=function(){function v(){this.chunks=[],this.dataLength=0}var R=v.prototype;return R.push=function(L){this.chunks.push(L),this.dataLength+=L.length},R.flush=function(){var L=this.chunks,_=this.dataLength,E;if(L.length)L.length===1?E=L[0]:E=n(L,_);else return new Uint8Array(0);return this.reset(),E},R.reset=function(){this.chunks.length=0,this.dataLength=0},v}();function n(v,R){for(var T=new Uint8Array(R),L=0,_=0;_<v.length;_++){var E=v[_];T.set(E,L),L+=E.length}return T}},"./src/demux/dummy-demuxed-track.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"dummyTrack",function(){return l});function l(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/utils/logger.ts"),n=function(){function v(T){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=T,this.bytesAvailable=T.byteLength,this.word=0,this.bitsAvailable=0}var R=v.prototype;return R.loadWord=function(){var L=this.data,_=this.bytesAvailable,E=L.byteLength-_,I=new Uint8Array(4),M=Math.min(4,_);if(M===0)throw new Error("no bytes available");I.set(L.subarray(E,E+M)),this.word=new DataView(I.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},R.skipBits=function(L){var _;this.bitsAvailable>L?(this.word<<=L,this.bitsAvailable-=L):(L-=this.bitsAvailable,_=L>>3,L-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=L,this.bitsAvailable-=L)},R.readBits=function(L){var _=Math.min(this.bitsAvailable,L),E=this.word>>>32-_;return L>32&&l.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=L-_,_>0&&this.bitsAvailable?E<<_|this.readBits(_):E},R.skipLZ=function(){var L;for(L=0;L<this.bitsAvailable;++L)if((this.word&2147483648>>>L)!=0)return this.word<<=L,this.bitsAvailable-=L,L;return this.loadWord(),L+this.skipLZ()},R.skipUEG=function(){this.skipBits(1+this.skipLZ())},R.skipEG=function(){this.skipBits(1+this.skipLZ())},R.readUEG=function(){var L=this.skipLZ();return this.readBits(L+1)-1},R.readEG=function(){var L=this.readUEG();return 1&L?1+L>>>1:-1*(L>>>1)},R.readBoolean=function(){return this.readBits(1)===1},R.readUByte=function(){return this.readBits(8)},R.readUShort=function(){return this.readBits(16)},R.readUInt=function(){return this.readBits(32)},R.skipScalingList=function(L){for(var _=8,E=8,I,M=0;M<L;M++)E!==0&&(I=this.readEG(),E=(_+I+256)%256),_=E===0?_:E},R.readSPS=function(){var L=0,_=0,E=0,I=0,M,D,b,A=this.readUByte.bind(this),u=this.readBits.bind(this),r=this.readUEG.bind(this),s=this.readBoolean.bind(this),i=this.skipBits.bind(this),a=this.skipEG.bind(this),d=this.skipUEG.bind(this),o=this.skipScalingList.bind(this);A();var y=A();if(u(5),i(3),A(),d(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){var p=r();if(p===3&&i(1),d(),d(),i(1),s())for(D=p!==3?8:12,b=0;b<D;b++)s()&&(b<6?o(16):o(64))}d();var m=r();if(m===0)r();else if(m===1)for(i(1),a(),a(),M=r(),b=0;b<M;b++)a();d(),i(1);var g=r(),f=r(),c=u(1);c===0&&i(1),i(1),s()&&(L=r(),_=r(),E=r(),I=r());var x=[1,1];if(s()&&s()){var S=A();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=[A()<<8|A(),A()<<8|A()];break}}}return{width:Math.ceil((g+1)*16-L*2-_*2),height:(2-c)*(f+1)*16-(c?2:4)*(E+I),pixelRatio:x}},R.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},v}();e.default=n},"./src/demux/id3.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"isHeader",function(){return l}),t.d(e,"isFooter",function(){return n}),t.d(e,"getID3Data",function(){return v}),t.d(e,"canParse",function(){return T}),t.d(e,"getTimeStamp",function(){return L}),t.d(e,"isTimeStampFrame",function(){return _}),t.d(e,"getID3Frames",function(){return I}),t.d(e,"decodeFrame",function(){return M}),t.d(e,"utf8ArrayToStr",function(){return r}),t.d(e,"testables",function(){return s});var l=function(o,y){return y+10<=o.length&&o[y]===73&&o[y+1]===68&&o[y+2]===51&&o[y+3]<255&&o[y+4]<255&&o[y+6]<128&&o[y+7]<128&&o[y+8]<128&&o[y+9]<128},n=function(o,y){return y+10<=o.length&&o[y]===51&&o[y+1]===68&&o[y+2]===73&&o[y+3]<255&&o[y+4]<255&&o[y+6]<128&&o[y+7]<128&&o[y+8]<128&&o[y+9]<128},v=function(o,y){for(var p=y,m=0;l(o,y);){m+=10;var g=R(o,y+6);m+=g,n(o,y+10)&&(m+=10),y+=m}if(m>0)return o.subarray(p,p+m)},R=function(o,y){var p=0;return p=(o[y]&127)<<21,p|=(o[y+1]&127)<<14,p|=(o[y+2]&127)<<7,p|=o[y+3]&127,p},T=function(o,y){return l(o,y)&&R(o,y+6)+10<=o.length-y},L=function(o){for(var y=I(o),p=0;p<y.length;p++){var m=y[p];if(_(m))return u(m)}},_=function(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"},E=function(o){var y=String.fromCharCode(o[0],o[1],o[2],o[3]),p=R(o,4),m=10;return{type:y,size:p,data:o.subarray(m,m+p)}},I=function(o){for(var y=0,p=[];l(o,y);){var m=R(o,y+6);y+=10;for(var g=y+m;y+8<g;){var f=E(o.subarray(y)),c=M(f);c&&p.push(c),y+=f.size+10}n(o,y)&&(y+=10)}return p},M=function(o){return o.type==="PRIV"?D(o):o.type[0]==="W"?A(o):b(o)},D=function(o){if(!(o.size<2)){var y=r(o.data,!0),p=new Uint8Array(o.data.subarray(y.length+1));return{key:o.type,info:y,data:p.buffer}}},b=function(o){if(!(o.size<2)){if(o.type==="TXXX"){var y=1,p=r(o.data.subarray(y),!0);y+=p.length+1;var m=r(o.data.subarray(y));return{key:o.type,info:p,data:m}}var g=r(o.data.subarray(1));return{key:o.type,data:g}}},A=function(o){if(o.type==="WXXX"){if(o.size<2)return;var y=1,p=r(o.data.subarray(y),!0);y+=p.length+1;var m=r(o.data.subarray(y));return{key:o.type,info:p,data:m}}var g=r(o.data);return{key:o.type,data:g}},u=function(o){if(o.data.byteLength===8){var y=new Uint8Array(o.data),p=y[3]&1,m=(y[4]<<23)+(y[5]<<15)+(y[6]<<7)+y[7];return m/=45,p&&(m+=4772185884e-2),Math.round(m)}},r=function(o,y){y===void 0&&(y=!1);var p=a();if(p){var m=p.decode(o);if(y){var g=m.indexOf("\0");return g!==-1?m.substring(0,g):m}return m.replace(/\0/g,"")}for(var f=o.length,c,x,S,C="",O=0;O<f;){if(c=o[O++],c===0&&y)return C;if(c===0||c===3)continue;switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:C+=String.fromCharCode(c);break;case 12:case 13:x=o[O++],C+=String.fromCharCode((c&31)<<6|x&63);break;case 14:x=o[O++],S=o[O++],C+=String.fromCharCode((c&15)<<12|(x&63)<<6|(S&63)<<0);break;default:}}return C},s={decodeTextFrame:b},i;function a(){return!i&&typeof self.TextDecoder!="undefined"&&(i=new self.TextDecoder("utf-8")),i}},"./src/demux/mp3demuxer.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/demux/base-audio-demuxer.ts"),n=t("./src/demux/id3.ts"),v=t("./src/utils/logger.ts"),R=t("./src/demux/mpegaudio.ts");function T(E,I){E.prototype=Object.create(I.prototype),E.prototype.constructor=E,L(E,I)}function L(E,I){return L=Object.setPrototypeOf||function(D,b){return D.__proto__=b,D},L(E,I)}var _=function(E){T(I,E);function I(){return E.apply(this,arguments)||this}var M=I.prototype;return M.resetInitSegment=function(b,A,u){E.prototype.resetInitSegment.call(this,b,A,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:u,inputTimeScale:9e4,dropped:0}},I.probe=function(b){if(!b)return!1;for(var A=n.getID3Data(b,0)||[],u=A.length,r=b.length;u<r;u++)if(R.probe(b,u))return v.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(b,A){return R.canParse(b,A)},M.appendFrame=function(b,A,u){if(this.initPTS!==null)return R.appendFrame(b,A,u,this.initPTS,this.frameIndex)},I}(l.default);_.minProbeByteLength=4,e.default=_},"./src/demux/mp4demuxer.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/utils/mp4-tools.ts"),n=t("./src/demux/dummy-demuxed-track.ts"),v=function(){function R(L,_){this.remainderData=null,this.config=void 0,this.config=_}var T=R.prototype;return T.resetTimeStamp=function(){},T.resetInitSegment=function(){},T.resetContiguity=function(){},R.probe=function(_){return Object(l.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},T.demux=function(_){var E=_,I=Object(n.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(l.appendUint8Array)(this.remainderData,_));var M=Object(l.segmentValidRange)(E);this.remainderData=M.remainder,I.samples=M.valid||new Uint8Array}else I.samples=E;return{audioTrack:Object(n.dummyTrack)(),avcTrack:I,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},T.flush=function(){var _=Object(n.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(n.dummyTrack)(),avcTrack:_,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},T.demuxSampleAes=function(_,E,I){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},T.destroy=function(){},R}();v.minProbeByteLength=1024,e.default=v},"./src/demux/mpegaudio.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"appendFrame",function(){return L}),t.d(e,"parseHeader",function(){return _}),t.d(e,"isHeaderPattern",function(){return E}),t.d(e,"isHeader",function(){return I}),t.d(e,"canParse",function(){return M}),t.d(e,"probe",function(){return D});var l=null,n=[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],v=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],R=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],T=[0,1,1,4];function L(b,A,u,r,s){if(!(u+24>A.length)){var i=_(A,u);if(i&&u+i.frameLength<=A.length){var a=i.samplesPerFrame*9e4/i.sampleRate,d=r+s*a,o={unit:A.subarray(u,u+i.frameLength),pts:d,dts:d};return b.config=[],b.channelCount=i.channelCount,b.samplerate=i.sampleRate,b.samples.push(o),{sample:o,length:i.frameLength,missing:0}}}}function _(b,A){var u=b[A+1]>>3&3,r=b[A+1]>>1&3,s=b[A+2]>>4&15,i=b[A+2]>>2&3;if(u!==1&&s!==0&&s!==15&&i!==3){var a=b[A+2]>>1&1,d=b[A+3]>>6,o=u===3?3-r:r===3?3:4,y=n[o*14+s-1]*1e3,p=u===3?0:u===2?1:2,m=v[p*3+i],g=d===3?1:2,f=R[u][r],c=T[r],x=f*8*c,S=Math.floor(f*y/m+a)*c;if(l===null){var C=navigator.userAgent||"",O=C.match(/Chrome\/(\d+)/i);l=O?parseInt(O[1]):0}var P=!!l&&l<=87;return P&&r===2&&y>=224e3&&d===0&&(b[A+3]=b[A+3]|128),{sampleRate:m,channelCount:g,frameLength:S,samplesPerFrame:x}}}function E(b,A){return b[A]===255&&(b[A+1]&224)==224&&(b[A+1]&6)!=0}function I(b,A){return A+1<b.length&&E(b,A)}function M(b,A){var u=4;return E(b,A)&&u<=b.length-A}function D(b,A){if(A+1<b.length&&E(b,A)){var u=4,r=_(b,A),s=u;r!=null&&r.frameLength&&(s=r.frameLength);var i=A+s;return i===b.length||I(b,i)}return!1}},"./src/demux/sample-aes.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/crypt/decrypter.ts"),n=t("./src/demux/tsdemuxer.ts"),v=function(){function R(L,_,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new l.default(L,_,{removePKCS7Padding:!1})}var T=R.prototype;return T.decryptBuffer=function(_,E){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,E)},T.decryptAacSample=function(_,E,I,M){var D=_[E].unit,b=D.subarray(16,D.length-D.length%16),A=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),u=this;this.decryptBuffer(A,function(r){var s=new Uint8Array(r);D.set(s,16),M||u.decryptAacSamples(_,E+1,I)})},T.decryptAacSamples=function(_,E,I){for(;;E++){if(E>=_.length){I();return}if(!(_[E].unit.length<32)){var M=this.decrypter.isSync();if(this.decryptAacSample(_,E,I,M),!M)return}}},T.getAvcEncryptedData=function(_){for(var E=Math.floor((_.length-48)/160)*16+16,I=new Int8Array(E),M=0,D=32;D<_.length-16;D+=160,M+=16)I.set(_.subarray(D,D+16),M);return I},T.getAvcDecryptedUnit=function(_,E){for(var I=new Uint8Array(E),M=0,D=32;D<_.length-16;D+=160,M+=16)_.set(I.subarray(M,M+16),D);return _},T.decryptAvcSample=function(_,E,I,M,D,b){var A=Object(n.discardEPB)(D.data),u=this.getAvcEncryptedData(A),r=this;this.decryptBuffer(u.buffer,function(s){D.data=r.getAvcDecryptedUnit(A,s),b||r.decryptAvcSamples(_,E,I+1,M)})},T.decryptAvcSamples=function(_,E,I,M){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,I=0){if(E>=_.length){M();return}for(var D=_[E].units;!(I>=D.length);I++){var b=D[I];if(!(b.data.length<=48||b.type!==1&&b.type!==5)){var A=this.decrypter.isSync();if(this.decryptAvcSample(_,E,I,M,b,A),!A)return}}}},R}();e.default=v},"./src/demux/transmuxer-interface.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return D});var l=t("./node_modules/webworkify-webpack/index.js"),n=t.n(l),v=t("./src/events.ts"),R=t("./src/demux/transmuxer.ts"),T=t("./src/utils/logger.ts"),L=t("./src/errors.ts"),_=t("./src/utils/mediasource-helper.ts"),E=t("./node_modules/eventemitter3/index.js"),I=t.n(E),M=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},D=function(){function b(u,r,s,i){var a=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=r,this.onTransmuxComplete=s,this.onFlush=i;var d=u.config,o=function(f,c){c=c||{},c.frag=a.frag,c.id=a.id,u.trigger(f,c)};this.observer=new E.EventEmitter,this.observer.on(v.Events.FRAG_DECRYPTED,o),this.observer.on(v.Events.ERROR,o);var y={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},p=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){T.logger.log("demuxing in webworker");var m;try{m=this.worker=l("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(g){u.trigger(v.Events.ERROR,{type:L.ErrorTypes.OTHER_ERROR,details:L.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(g.message+" ("+g.filename+":"+g.lineno+")")})},m.postMessage({cmd:"init",typeSupported:y,vendor:p,id:r,config:JSON.stringify(d)})}catch(g){T.logger.warn("Error in worker:",g),T.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new R.default(this.observer,y,d,p,r),this.worker=null}}else this.transmuxer=new R.default(this.observer,y,d,p,r)}var A=b.prototype;return A.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.observer=null},A.push=function(r,s,i,a,d,o,y,p,m,g){var f,c,x=this;m.transmuxing.start=self.performance.now();var S=this.transmuxer,C=this.worker,O=o?o.start:d.start,P=d.decryptdata,w=this.frag,U=!(w&&d.cc===w.cc),k=!(w&&m.level===w.level),N=w?m.sn-w.sn:-1,B=this.part?m.part-this.part.index:1,K=!k&&(N===1||N===0&&B===1),W=self.performance.now();(k||N||d.stats.parsing.start===0)&&(d.stats.parsing.start=W),o&&(B||!K)&&(o.stats.parsing.start=W);var F=!(w&&((f=d.initSegment)===null||f===void 0?void 0:f.url)===((c=w.initSegment)===null||c===void 0?void 0:c.url)),H=new R.TransmuxState(U,K,p,k,O,F);if(!K||U||F){T.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
13
+ discontinuity: `+U+`
14
+ trackSwitch: `+k+`
15
+ contiguous: `+K+`
16
+ accurateTimeOffset: `+p+`
17
+ timeOffset: `+O+`
18
+ initSegmentChange: `+F);var Y=new R.TransmuxConfig(i,a,s,y,g);this.configureTransmuxer(Y)}if(this.frag=d,this.part=o,C)C.postMessage({cmd:"demux",data:r,decryptdata:P,chunkMeta:m,state:H},r instanceof ArrayBuffer?[r]:[]);else if(S){var $=S.push(r,P,m,H);Object(R.isPromise)($)?$.then(function(Z){x.handleTransmuxComplete(Z)}):this.handleTransmuxComplete($)}},A.flush=function(r){var s=this;r.transmuxing.start=self.performance.now();var i=this.transmuxer,a=this.worker;if(a)a.postMessage({cmd:"flush",chunkMeta:r});else if(i){var d=i.flush(r);Object(R.isPromise)(d)?d.then(function(o){s.handleFlushResult(o,r)}):this.handleFlushResult(d,r)}},A.handleFlushResult=function(r,s){var i=this;r.forEach(function(a){i.handleTransmuxComplete(a)}),this.onFlush(s)},A.onWorkerMessage=function(r){var s=r.data,i=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,i.trigger(s.event,s.data);break}}},A.configureTransmuxer=function(r){var s=this.worker,i=this.transmuxer;s?s.postMessage({cmd:"configure",config:r}):i&&i.configure(r)},A.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},b}()},"./src/demux/transmuxer-worker.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return L});var l=t("./src/demux/transmuxer.ts"),n=t("./src/events.ts"),v=t("./src/utils/logger.ts"),R=t("./node_modules/eventemitter3/index.js"),T=t.n(R);function L(D){var b=new R.EventEmitter,A=function(r,s){D.postMessage({event:r,data:s})};b.on(n.Events.FRAG_DECRYPTED,A),b.on(n.Events.ERROR,A),D.addEventListener("message",function(u){var r=u.data;switch(r.cmd){case"init":{var s=JSON.parse(r.config);D.transmuxer=new l.default(b,r.typeSupported,s,r.vendor,r.id),Object(v.enableLogs)(s.debug),A("init",null);break}case"configure":{D.transmuxer.configure(r.config);break}case"demux":{var i=D.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object(l.isPromise)(i)?i.then(function(o){_(D,o)}):_(D,i);break}case"flush":{var a=r.chunkMeta,d=D.transmuxer.flush(a);Object(l.isPromise)(d)?d.then(function(o){I(D,o,a)}):I(D,d,a);break}default:break}})}function _(D,b){if(!M(b.remuxResult)){var A=[],u=b.remuxResult,r=u.audio,s=u.video;r&&E(A,r),s&&E(A,s),D.postMessage({event:"transmuxComplete",data:b},A)}}function E(D,b){b.data1&&D.push(b.data1.buffer),b.data2&&D.push(b.data2.buffer)}function I(D,b,A){b.forEach(function(u){_(D,u)}),D.postMessage({event:"flush",data:A})}function M(D){return!D.audio&&!D.video&&!D.text&&!D.id3&&!D.initSegment}},"./src/demux/transmuxer.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return s}),t.d(e,"isPromise",function(){return d}),t.d(e,"TransmuxConfig",function(){return o}),t.d(e,"TransmuxState",function(){return y});var l=t("./src/events.ts"),n=t("./src/errors.ts"),v=t("./src/crypt/decrypter.ts"),R=t("./src/demux/aacdemuxer.ts"),T=t("./src/demux/mp4demuxer.ts"),L=t("./src/demux/tsdemuxer.ts"),_=t("./src/demux/mp3demuxer.ts"),E=t("./src/remux/mp4-remuxer.ts"),I=t("./src/remux/passthrough-remuxer.ts"),M=t("./src/demux/chunk-cache.ts"),D=t("./src/utils/mp4-tools.ts"),b=t("./src/utils/logger.ts"),A;try{A=self.performance.now.bind(self.performance)}catch{b.logger.debug("Unable to use Performance API on this environment"),A=self.Date.now}var u=[{demux:L.default,remux:E.default},{demux:T.default,remux:I.default},{demux:R.default,remux:E.default},{demux:_.default,remux:E.default}],r=1024;u.forEach(function(p){var m=p.demux;r=Math.max(r,m.minProbeByteLength)});var s=function(){function p(g,f,c,x,S){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.cache=new M.default,this.observer=g,this.typeSupported=f,this.config=c,this.vendor=x,this.id=S}var m=p.prototype;return m.configure=function(f){this.transmuxConfig=f,this.decrypter&&this.decrypter.reset()},m.push=function(f,c,x,S){var C=this,O=x.transmuxing;O.executeStart=A();var P=new Uint8Array(f),w=this.cache,U=this.config,k=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var B=i(P,c);if(B&&B.method==="AES-128"){var K=this.getDecrypter();if(U.enableSoftwareAES){var W=K.softwareDecrypt(P,B.key.buffer,B.iv.buffer);if(!W)return O.executeEnd=A(),a(x);P=new Uint8Array(W)}else return this.decryptionPromise=K.webCryptoDecrypt(P,B.key.buffer,B.iv.buffer).then(function(ee){var he=C.push(ee,null,x);return C.decryptionPromise=null,he}),this.decryptionPromise}var F=S||k,H=F.contiguous,Y=F.discontinuity,$=F.trackSwitch,Z=F.accurateTimeOffset,q=F.timeOffset,oe=F.initSegmentChange,X=N.audioCodec,ie=N.videoCodec,fe=N.defaultInitPts,ue=N.duration,Se=N.initSegmentData;if((Y||$||oe)&&this.resetInitSegment(Se,X,ie,ue),(Y||oe)&&this.resetInitialTimestamp(fe),H||this.resetContiguity(),this.needsProbing(P,Y,$)){if(w.dataLength){var re=w.flush();P=Object(D.appendUint8Array)(re,P)}this.configureTransmuxer(P,N)}var Q=this.transmux(P,B,q,Z,x),te=this.currentTransmuxState;return te.contiguous=!0,te.discontinuity=!1,te.trackSwitch=!1,O.executeEnd=A(),Q},m.flush=function(f){var c=this,x=f.transmuxing;x.executeStart=A();var S=this.decrypter,C=this.cache,O=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return c.flush(f)});var w=[],U=O.timeOffset;if(S){var k=S.flush();k&&w.push(this.push(k,null,f))}var N=C.dataLength;C.reset();var B=this.demuxer,K=this.remuxer;if(!B||!K)return N>=r&&this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=A(),[a(f)];var W=B.flush(U);return d(W)?W.then(function(F){return c.flushRemux(w,F,f),w}):(this.flushRemux(w,W,f),w)},m.flushRemux=function(f,c,x){var S=c.audioTrack,C=c.avcTrack,O=c.id3Track,P=c.textTrack,w=this.currentTransmuxState,U=w.accurateTimeOffset,k=w.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var N=this.remuxer.remux(S,C,O,P,k,U,!0,this.id);f.push({remuxResult:N,chunkMeta:x}),x.transmuxing.executeEnd=A()},m.resetInitialTimestamp=function(f){var c=this.demuxer,x=this.remuxer;!c||!x||(c.resetTimeStamp(f),x.resetTimeStamp(f))},m.resetContiguity=function(){var f=this.demuxer,c=this.remuxer;!f||!c||(f.resetContiguity(),c.resetNextTimestamp())},m.resetInitSegment=function(f,c,x,S){var C=this.demuxer,O=this.remuxer;!C||!O||(C.resetInitSegment(c,x,S),O.resetInitSegment(f,c,x))},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(f,c,x,S,C){var O;return c&&c.method==="SAMPLE-AES"?O=this.transmuxSampleAes(f,c,x,S,C):O=this.transmuxUnencrypted(f,x,S,C),O},m.transmuxUnencrypted=function(f,c,x,S){var C=this.demuxer.demux(f,c,!1,!this.config.progressive),O=C.audioTrack,P=C.avcTrack,w=C.id3Track,U=C.textTrack,k=this.remuxer.remux(O,P,w,U,c,x,!1,this.id);return{remuxResult:k,chunkMeta:S}},m.transmuxSampleAes=function(f,c,x,S,C){var O=this;return this.demuxer.demuxSampleAes(f,c,x).then(function(P){var w=O.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,x,S,!1,O.id);return{remuxResult:w,chunkMeta:C}})},m.configureTransmuxer=function(f,c){for(var x=this.config,S=this.observer,C=this.typeSupported,O=this.vendor,P=c.audioCodec,w=c.defaultInitPts,U=c.duration,k=c.initSegmentData,N=c.videoCodec,B,K=0,W=u.length;K<W;K++)if(u[K].demux.probe(f)){B=u[K];break}B||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:T.default,remux:I.default});var F=this.demuxer,H=this.remuxer,Y=B.remux,$=B.demux;(!H||!(H instanceof Y))&&(this.remuxer=new Y(S,x,C,O)),(!F||!(F instanceof $))&&(this.demuxer=new $(S,x,C),this.probe=$.probe),this.resetInitSegment(k,P,N,U),this.resetInitialTimestamp(w)},m.needsProbing=function(f,c,x){return!this.demuxer||!this.remuxer||c||x},m.getDecrypter=function(){var f=this.decrypter;return f||(f=this.decrypter=new v.default(this.observer,this.config)),f},p}();function i(p,m){var g=null;return p.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(g=m),g}var a=function(m){return{remuxResult:{},chunkMeta:m}};function d(p){return"then"in p&&p.then instanceof Function}var o=function(m,g,f,c,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=g,this.initSegmentData=f,this.duration=c,this.defaultInitPts=x},y=function(m,g,f,c,x,S){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=m,this.contiguous=g,this.accurateTimeOffset=f,this.trackSwitch=c,this.timeOffset=x,this.initSegmentChange=S}},"./src/demux/tsdemuxer.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"discardEPB",function(){return a});var l=t("./src/demux/adts.ts"),n=t("./src/demux/mpegaudio.ts"),v=t("./src/demux/exp-golomb.ts"),R=t("./src/demux/id3.ts"),T=t("./src/demux/sample-aes.ts"),L=t("./src/events.ts"),_=t("./src/utils/mp4-tools.ts"),E=t("./src/utils/logger.ts"),I=t("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},D=function(){function d(y,p,m){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.aacLastPTS=null,this._initPTS=null,this._initDTS=null,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=y,this.config=p,this.typeSupported=m}d.probe=function(p){var m=d.syncOffset(p);return m<0?!1:(m&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},d.syncOffset=function(p){for(var m=Math.min(1e3,p.length-3*188),g=0;g<m;){if(p[g]===71&&p[g+188]===71&&p[g+2*188]===71)return g;g++}return-1},d.createTrack=function(p,m){return{container:p==="video"||p==="audio"?"video/mp2t":void 0,type:p,id:M[p],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:p==="audio"?m:void 0}};var o=d.prototype;return o.resetInitSegment=function(p,m,g){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",g),this._audioTrack=d.createTrack("audio",g),this._id3Track=d.createTrack("id3",g),this._txtTrack=d.createTrack("text",g),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=p,this.videoCodec=m,this._duration=g},o.resetTimeStamp=function(){},o.resetContiguity=function(){var p=this._audioTrack,m=this._avcTrack,g=this._id3Track;p&&(p.pesData=null),m&&(m.pesData=null),g&&(g.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},o.demux=function(p,m,g,f){g===void 0&&(g=!1),f===void 0&&(f=!1),g||(this.sampleAes=null);var c,x=this._avcTrack,S=this._audioTrack,C=this._id3Track,O=x.pid,P=x.pesData,w=S.pid,U=C.pid,k=S.pesData,N=C.pesData,B=!1,K=this.pmtParsed,W=this._pmtId,F=p.length;if(this.remainderData&&(p=Object(_.appendUint8Array)(this.remainderData,p),F=p.length,this.remainderData=null),F<188&&!f)return this.remainderData=p,{audioTrack:S,avcTrack:x,id3Track:C,textTrack:this._txtTrack};var H=Math.max(0,d.syncOffset(p));F-=(F+H)%188,F<p.byteLength&&!f&&(this.remainderData=new Uint8Array(p.buffer,F,p.buffer.byteLength-F));for(var Y=0,$=H;$<F;$+=188)if(p[$]===71){var Z=!!(p[$+1]&64),q=((p[$+1]&31)<<8)+p[$+2],oe=(p[$+3]&48)>>4,X=void 0;if(oe>1){if(X=$+5+p[$+4],X===$+188)continue}else X=$+4;switch(q){case O:Z&&(P&&(c=r(P))&&this.parseAVCPES(c,!1),P={data:[],size:0}),P&&(P.data.push(p.subarray(X,$+188)),P.size+=$+188-X);break;case w:Z&&(k&&(c=r(k))&&(S.isAAC?this.parseAACPES(c):this.parseMPEGPES(c)),k={data:[],size:0}),k&&(k.data.push(p.subarray(X,$+188)),k.size+=$+188-X);break;case U:Z&&(N&&(c=r(N))&&this.parseID3PES(c),N={data:[],size:0}),N&&(N.data.push(p.subarray(X,$+188)),N.size+=$+188-X);break;case 0:Z&&(X+=p[X]+1),W=this._pmtId=A(p,X);break;case W:{Z&&(X+=p[X]+1);var ie=u(p,X,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,g);O=ie.avc,O>0&&(x.pid=O),w=ie.audio,w>0&&(S.pid=w,S.isAAC=ie.isAAC),U=ie.id3,U>0&&(C.pid=U),B&&!K&&(E.logger.log("reparse from beginning"),B=!1,$=H-188),K=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=!0;break}}else Y++;Y>0&&this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Y+" TS packet/s that do not start with 0x47"}),x.pesData=P,S.pesData=k,C.pesData=N;var fe={audioTrack:S,avcTrack:x,id3Track:C,textTrack:this._txtTrack};return f&&this.extractRemainingSamples(fe),fe},o.flush=function(){var p=this.remainderData;this.remainderData=null;var m;return p?m=this.demux(p,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},o.extractRemainingSamples=function(p){var m=p.audioTrack,g=p.avcTrack,f=p.id3Track,c=g.pesData,x=m.pesData,S=f.pesData,C;c&&(C=r(c))?(this.parseAVCPES(C,!0),g.pesData=null):g.pesData=c,x&&(C=r(x))?(m.isAAC?this.parseAACPES(C):this.parseMPEGPES(C),m.pesData=null):(x!=null&&x.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=x),S&&(C=r(S))?(this.parseID3PES(C),f.pesData=null):f.pesData=S},o.demuxSampleAes=function(p,m,g){var f=this.demux(p,g,!0,!this.config.progressive),c=this.sampleAes=new T.default(this.observer,this.config,m);return this.decrypt(f,c)},o.decrypt=function(p,m){return new Promise(function(g){var f=p.audioTrack,c=p.avcTrack;f.samples&&f.isAAC?m.decryptAacSamples(f.samples,0,function(){c.samples?m.decryptAvcSamples(c.samples,0,0,function(){g(p)}):g(p)}):c.samples&&m.decryptAvcSamples(c.samples,0,0,function(){g(p)})})},o.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},o.parseAVCPES=function(p,m){var g=this,f=this._avcTrack,c=this.parseAVCNALu(p.data),x=!1,S=this.avcSample,C,O=!1;p.data=null,S&&c.length&&!f.audFound&&(s(S,f),S=this.avcSample=b(!1,p.pts,p.dts,"")),c.forEach(function(P){switch(P.type){case 1:{C=!0,S||(S=g.avcSample=b(!0,p.pts,p.dts,"")),x&&(S.debug+="NDR "),S.frame=!0;var w=P.data;if(O&&w.length>4){var U=new v.default(w).readSliceType();(U===2||U===4||U===7||U===9)&&(S.key=!0)}break}case 5:C=!0,S||(S=g.avcSample=b(!0,p.pts,p.dts,"")),x&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{C=!0,x&&S&&(S.debug+="SEI ");var k=new v.default(a(P.data));k.readUByte();for(var N=0,B=0,K=!1,W=0;!K&&k.bytesAvailable>1;){N=0;do W=k.readUByte(),N+=W;while(W===255);B=0;do W=k.readUByte(),B+=W;while(W===255);if(N===4&&k.bytesAvailable!==0){K=!0;var F=k.readUByte();if(F===181){var H=k.readUShort();if(H===49){var Y=k.readUInt();if(Y===1195456820){var $=k.readUByte();if($===3){for(var Z=k.readUByte(),q=k.readUByte(),oe=31&Z,X=[Z,q],ie=0;ie<oe;ie++)X.push(k.readUByte()),X.push(k.readUByte()),X.push(k.readUByte());i(g._txtTrack.samples,{type:3,pts:p.pts,bytes:X})}}}}}else if(N===5&&k.bytesAvailable!==0){if(K=!0,B>16){for(var fe=[],ue=0;ue<16;ue++)fe.push(k.readUByte().toString(16)),(ue===3||ue===5||ue===7||ue===9)&&fe.push("-");for(var Se=B-16,re=new Uint8Array(Se),Q=0;Q<Se;Q++)re[Q]=k.readUByte();i(g._txtTrack.samples,{pts:p.pts,payloadType:N,uuid:fe.join(""),userData:Object(R.utf8ArrayToStr)(re),userDataBytes:re})}}else if(B<k.bytesAvailable)for(var te=0;te<B;te++)k.readUByte()}break}case 7:if(C=!0,O=!0,x&&S&&(S.debug+="SPS "),!f.sps){var ee=new v.default(P.data),he=ee.readSPS();f.width=he.width,f.height=he.height,f.pixelRatio=he.pixelRatio,f.sps=[P.data],f.duration=g._duration;for(var _e=P.data.subarray(1,4),Ee="avc1.",be=0;be<3;be++){var Ie=_e[be].toString(16);Ie.length<2&&(Ie="0"+Ie),Ee+=Ie}f.codec=Ee}break;case 8:C=!0,x&&S&&(S.debug+="PPS "),f.pps||(f.pps=[P.data]);break;case 9:C=!1,f.audFound=!0,S&&s(S,f),S=g.avcSample=b(!1,p.pts,p.dts,x?"AUD ":"");break;case 12:C=!1;break;default:C=!1,S&&(S.debug+="unknown NAL "+P.type+" ");break}if(S&&C){var Ne=S.units;Ne.push(P)}}),m&&S&&(s(S,f),this.avcSample=null)},o.getLastNalUnit=function(){var p,m=this.avcSample,g;if(!m||m.units.length===0){var f=this._avcTrack.samples;m=f[f.length-1]}if((p=m)!==null&&p!==void 0&&p.units){var c=m.units;g=c[c.length-1]}return g},o.parseAVCNALu=function(p){var m=p.byteLength,g=this._avcTrack,f=g.naluState||0,c=f,x=[],S=0,C,O,P,w=-1,U=0;for(f===-1&&(w=0,U=p[0]&31,f=0,S=1);S<m;){if(C=p[S++],!f){f=C?0:1;continue}if(f===1){f=C?0:2;continue}if(!C)f=3;else if(C===1){if(w>=0){var k={data:p.subarray(w,S-f-1),type:U};x.push(k)}else{var N=this.getLastNalUnit();if(N&&(c&&S<=4-c&&N.state&&(N.data=N.data.subarray(0,N.data.byteLength-c)),O=S-f-1,O>0)){var B=new Uint8Array(N.data.byteLength+O);B.set(N.data,0),B.set(p.subarray(0,O),N.data.byteLength),N.data=B,N.state=0}}S<m?(P=p[S]&31,w=S,U=P,f=0):f=-1}else f=0}if(w>=0&&f>=0){var K={data:p.subarray(w,m),type:U,state:f};x.push(K)}if(x.length===0){var W=this.getLastNalUnit();if(W){var F=new Uint8Array(W.data.byteLength+p.byteLength);F.set(W.data,0),F.set(p,W.data.byteLength),W.data=F}}return g.naluState=f,x},o.parseAACPES=function(p){var m=0,g=this._audioTrack,f=this.aacOverFlow,c=p.data;if(f){this.aacOverFlow=null;var x=f.sample.unit.byteLength,S=Math.min(f.missing,x),C=x-S;f.sample.unit.set(c.subarray(0,S),C),g.samples.push(f.sample),m=f.missing}var O,P;for(O=m,P=c.length;O<P-1&&!l.isHeader(c,O);O++);if(O!==m){var w,U;if(O<P-1?(w="AAC PES did not start with ADTS header,offset:"+O,U=!1):(w="no ADTS header found in AAC PES",U=!0),E.logger.warn("parsing error:"+w),this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:U,reason:w}),U)return}l.initTrackConfig(g,this.observer,c,O,this.audioCodec);var k;if(p.pts!==void 0)k=p.pts;else if(f){var N=l.getFrameDuration(g.samplerate);k=f.sample.pts+N}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var B=0;O<P;)if(l.isHeader(c,O)){if(O+5<P){var K=l.appendFrame(g,c,O,k,B);if(K)if(K.missing)this.aacOverFlow=K;else{O+=K.length,B++;continue}}break}else O++},o.parseMPEGPES=function(p){var m=p.data,g=m.length,f=0,c=0,x=p.pts;if(x===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;c<g;)if(n.isHeader(m,c)){var S=n.appendFrame(this._audioTrack,m,c,x,f);if(S)c+=S.length,f++;else break}else c++},o.parseID3PES=function(p){if(p.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(p)},d}();D.minProbeByteLength=188;function b(d,o,y,p){return{key:d,frame:!1,pts:o,dts:y,units:[],debug:p,length:0}}function A(d,o){return(d[o+10]&31)<<8|d[o+11]}function u(d,o,y,p){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},g=(d[o+1]&15)<<8|d[o+2],f=o+3+g-4,c=(d[o+10]&15)<<8|d[o+11];for(o+=12+c;o<f;){var x=(d[o+1]&31)<<8|d[o+2];switch(d[o]){case 207:if(!p){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=x);break;case 21:m.id3===-1&&(m.id3=x);break;case 219:if(!p){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=x);break;case 3:case 4:y?m.audio===-1&&(m.audio=x,m.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}o+=((d[o+3]&15)<<8|d[o+4])+5}return m}function r(d){var o=0,y,p,m,g,f,c=d.data;if(!d||d.size===0)return null;for(;c[0].length<19&&c.length>1;){var x=new Uint8Array(c[0].length+c[1].length);x.set(c[0]),x.set(c[1],c[0].length),c[0]=x,c.splice(1,1)}y=c[0];var S=(y[0]<<16)+(y[1]<<8)+y[2];if(S===1){if(p=(y[4]<<8)+y[5],p&&p>d.size-6)return null;var C=y[7];C&192&&(g=(y[9]&14)*536870912+(y[10]&255)*4194304+(y[11]&254)*16384+(y[12]&255)*128+(y[13]&254)/2,C&64?(f=(y[14]&14)*536870912+(y[15]&255)*4194304+(y[16]&254)*16384+(y[17]&255)*128+(y[18]&254)/2,g-f>60*9e4&&(E.logger.warn(Math.round((g-f)/9e4)+"s delta between PTS and DTS, align them"),g=f)):f=g),m=y[8];var O=m+9;if(d.size<=O)return null;d.size-=O;for(var P=new Uint8Array(d.size),w=0,U=c.length;w<U;w++){y=c[w];var k=y.byteLength;if(O)if(O>k){O-=k;continue}else y=y.subarray(O),k-=O,O=0;P.set(y,o),o+=k}return p&&(p-=m+3),{data:P,pts:g,dts:f,len:p}}return null}function s(d,o){if(d.units.length&&d.frame){if(d.pts===void 0){var y=o.samples,p=y.length;if(p){var m=y[p-1];d.pts=m.pts,d.dts=m.dts}else{o.dropped++;return}}o.samples.push(d)}d.debug.length&&E.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function i(d,o){var y=d.length;if(y>0){if(o.pts>=d[y-1].pts)d.push(o);else for(var p=y-1;p>=0;p--)if(o.pts<d[p].pts){d.splice(p,0,o);break}}else d.push(o)}function a(d){for(var o=d.byteLength,y=[],p=1;p<o-2;)d[p]===0&&d[p+1]===0&&d[p+2]===3?(y.push(p+2),p+=2):p++;if(y.length===0)return d;var m=o-y.length,g=new Uint8Array(m),f=0;for(p=0;p<m;f++,p++)f===y[0]&&(f++,y.shift()),g[p]=d[f];return g}e.default=D},"./src/errors.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"ErrorTypes",function(){return l}),t.d(e,"ErrorDetails",function(){return n});var l;(function(v){v.NETWORK_ERROR="networkError",v.MEDIA_ERROR="mediaError",v.KEY_SYSTEM_ERROR="keySystemError",v.MUX_ERROR="muxError",v.OTHER_ERROR="otherError"})(l||(l={}));var n;(function(v){v.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",v.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",v.KEY_SYSTEM_NO_SESSION="keySystemNoSession",v.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",v.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",v.MANIFEST_LOAD_ERROR="manifestLoadError",v.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",v.MANIFEST_PARSING_ERROR="manifestParsingError",v.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",v.LEVEL_EMPTY_ERROR="levelEmptyError",v.LEVEL_LOAD_ERROR="levelLoadError",v.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",v.LEVEL_SWITCH_ERROR="levelSwitchError",v.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",v.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",v.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",v.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",v.FRAG_LOAD_ERROR="fragLoadError",v.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",v.FRAG_DECRYPT_ERROR="fragDecryptError",v.FRAG_PARSING_ERROR="fragParsingError",v.REMUX_ALLOC_ERROR="remuxAllocError",v.KEY_LOAD_ERROR="keyLoadError",v.KEY_LOAD_TIMEOUT="keyLoadTimeOut",v.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",v.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",v.BUFFER_APPEND_ERROR="bufferAppendError",v.BUFFER_APPENDING_ERROR="bufferAppendingError",v.BUFFER_STALLED_ERROR="bufferStalledError",v.BUFFER_FULL_ERROR="bufferFullError",v.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",v.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",v.INTERNAL_EXCEPTION="internalException",v.INTERNAL_ABORTED="aborted",v.UNKNOWN="unknown"})(n||(n={}))},"./src/events.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"Events",function(){return l});var l;(function(n){n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached"})(l||(l={}))},"./src/hls.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return d});var l=t("./node_modules/url-toolkit/src/url-toolkit.js"),n=t.n(l),v=t("./src/loader/playlist-loader.ts"),R=t("./src/loader/key-loader.ts"),T=t("./src/controller/id3-track-controller.ts"),L=t("./src/controller/latency-controller.ts"),_=t("./src/controller/level-controller.ts"),E=t("./src/controller/fragment-tracker.ts"),I=t("./src/controller/stream-controller.ts"),M=t("./src/is-supported.ts"),D=t("./src/utils/logger.ts"),b=t("./src/config.ts"),A=t("./node_modules/eventemitter3/index.js"),u=t.n(A),r=t("./src/events.ts"),s=t("./src/errors.ts");function i(o,y){for(var p=0;p<y.length;p++){var m=y[p];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(o,m.key,m)}}function a(o,y,p){return y&&i(o.prototype,y),p&&i(o,p),o}var d=function(){o.isSupported=function(){return Object(M.isSupported)()};function o(p){p===void 0&&(p={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new A.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var m=this.config=Object(b.mergeConfig)(o.DefaultConfig,p);this.userConfig=p,Object(D.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(b.enableStreamingMode)(m);var g=m.abrController,f=m.bufferController,c=m.capLevelController,x=m.fpsController,S=this.abrController=new g(this),C=this.bufferController=new f(this),O=this.capLevelController=new c(this),P=new x(this),w=new v.default(this),U=new R.default(this),k=new T.default(this),N=this.levelController=new _.default(this),B=new E.FragmentTracker(this),K=this.streamController=new I.default(this,B);O.setStreamController(K),P.setStreamController(K);var W=[N,K];this.networkControllers=W;var F=[w,U,S,C,O,P,k,B];this.audioTrackController=this.createController(m.audioTrackController,null,W),this.createController(m.audioStreamController,B,W),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,W),this.createController(m.subtitleStreamController,B,W),this.createController(m.timelineController,null,F),this.emeController=this.createController(m.emeController,null,F),this.cmcdController=this.createController(m.cmcdController,null,F),this.latencyController=this.createController(L.default,null,F),this.coreComponents=F}var y=o.prototype;return y.createController=function(m,g,f){if(m){var c=g?new m(this,g):new m(this);return f&&f.push(c),c}return null},y.on=function(m,g,f){f===void 0&&(f=this),this._emitter.on(m,g,f)},y.once=function(m,g,f){f===void 0&&(f=this),this._emitter.once(m,g,f)},y.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},y.off=function(m,g,f,c){f===void 0&&(f=this),this._emitter.off(m,g,f,c)},y.listeners=function(m){return this._emitter.listeners(m)},y.emit=function(m,g,f){return this._emitter.emit(m,g,f)},y.trigger=function(m,g){if(this.config.debug)return this.emit(m,m,g);try{return this.emit(m,m,g)}catch(f){D.logger.error("An internal error happened while handling event "+m+'. Error message: "'+f.message+'". Here is a stacktrace:',f),this.trigger(r.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:f})}return!1},y.listenerCount=function(m){return this._emitter.listenerCount(m)},y.destroy=function(){D.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},y.attachMedia=function(m){D.logger.log("attachMedia"),this._media=m,this.trigger(r.Events.MEDIA_ATTACHING,{media:m})},y.detachMedia=function(){D.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},y.loadSource=function(m){this.stopLoad();var g=this.media,f=this.url,c=this.url=l.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});D.logger.log("loadSource:"+c),g&&f&&f!==c&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(g)),this.trigger(r.Events.MANIFEST_LOADING,{url:m})},y.startLoad=function(m){m===void 0&&(m=-1),D.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(g){g.startLoad(m)})},y.stopLoad=function(){D.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},y.swapAudioCodec=function(){D.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},y.recoverMediaError=function(){D.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},y.removeLevel=function(m,g){g===void 0&&(g=0),this.levelController.removeLevel(m,g)},a(o,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){D.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){D.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){D.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){D.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){D.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var g=!!m;g!==this.config.capLevelToPlayerSize&&(g?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=g)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(m){this._autoLevelCapping!==m&&(D.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,g=this.config.minAutoBitrate;if(!m)return 0;for(var f=m.length,c=0;c<f;c++)if(m[c].maxBitrate>g)return c;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,g=this.autoLevelCapping,f;return g===-1&&m&&m.length?f=m.length-1:f=g,f}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var g=this.audioTrackController;g&&(g.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var g=this.subtitleTrackController;g&&(g.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var g=this.subtitleTrackController;g&&(g.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.5"}},{key:"Events",get:function(){return r.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return o.defaultConfig?o.defaultConfig:b.hlsDefaultConfig},set:function(m){o.defaultConfig=m}}]),o}();d.defaultConfig=void 0},"./src/is-supported.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"isSupported",function(){return v}),t.d(e,"changeTypeSupported",function(){return R});var l=t("./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function v(){var T=Object(l.getMediaSource)();if(!T)return!1;var L=n(),_=T&&typeof T.isTypeSupported=="function"&&T.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!L||L.prototype&&typeof L.prototype.appendBuffer=="function"&&typeof L.prototype.remove=="function";return!!_&&!!E}function R(){var T,L=n();return typeof(L==null||(T=L.prototype)===null||T===void 0?void 0:T.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return D}),t.d(e,"LoadError",function(){return A});var l=t("./src/polyfills/number.ts"),n=t("./src/errors.ts");function v(u,r){u.prototype=Object.create(r.prototype),u.prototype.constructor=u,E(u,r)}function R(u){var r=typeof Map=="function"?new Map:void 0;return R=function(i){if(i===null||!_(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(i))return r.get(i);r.set(i,a)}function a(){return T(i,arguments,I(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),E(a,i)},R(u)}function T(u,r,s){return L()?T=Reflect.construct:T=function(a,d,o){var y=[null];y.push.apply(y,d);var p=Function.bind.apply(a,y),m=new p;return o&&E(m,o.prototype),m},T.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function E(u,r){return E=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},E(u,r)}function I(u){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},I(u)}var M=Math.pow(2,17),D=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var r=u.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(i,a){var d=this,o=i.url;if(!o)return Promise.reject(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,networkDetails:null},"Fragment does not have a "+(o?"part list":"url")));this.abort();var y=this.config,p=y.fLoader,m=y.loader;return new Promise(function(g,f){d.loader&&d.loader.destroy();var c=d.loader=i.loader=p?new p(y):new m(y),x=b(i),S={timeout:y.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:y.fragLoadingMaxRetryTimeout,highWaterMark:M};i.stats=c.stats,c.load(x,S,{onSuccess:function(O,P,w,U){d.resetLoader(i,c),g({frag:i,part:null,payload:O.data,networkDetails:U})},onError:function(O,P,w){d.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,response:O,networkDetails:w}))},onAbort:function(O,P,w){d.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,networkDetails:w}))},onTimeout:function(O,P,w){d.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,networkDetails:w}))},onProgress:function(O,P,w,U){a&&a({frag:i,part:null,payload:w,networkDetails:U})}})})},r.loadPart=function(i,a,d){var o=this;this.abort();var y=this.config,p=y.fLoader,m=y.loader;return new Promise(function(g,f){o.loader&&o.loader.destroy();var c=o.loader=i.loader=p?new p(y):new m(y),x=b(i,a),S={timeout:y.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:y.fragLoadingMaxRetryTimeout,highWaterMark:M};a.stats=c.stats,c.load(x,S,{onSuccess:function(O,P,w,U){o.resetLoader(i,c),o.updateStatsFromPart(i,a);var k={frag:i,part:a,payload:O.data,networkDetails:U};d(k),g(k)},onError:function(O,P,w){o.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,part:a,response:O,networkDetails:w}))},onAbort:function(O,P,w){i.stats.aborted=a.stats.aborted,o.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,part:a,networkDetails:w}))},onTimeout:function(O,P,w){o.resetLoader(i,c),f(new A({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,part:a,networkDetails:w}))}})})},r.updateStatsFromPart=function(i,a){var d=i.stats,o=a.stats,y=o.total;if(d.loaded+=o.loaded,y){var p=Math.round(i.duration/a.duration),m=Math.min(Math.round(d.loaded/y),p),g=p-m,f=g*Math.round(d.loaded/m);d.total=d.loaded+f}else d.total=Math.max(d.loaded,d.total);var c=d.loading,x=o.loading;c.start?c.first+=x.first-x.start:(c.start=x.start,c.first=x.first),c.end=x.end},r.resetLoader=function(i,a){i.loader=null,this.loader===a&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),a.destroy()},u}();function b(u,r){r===void 0&&(r=null);var s=r||u,i={frag:u,part:r,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},a=s.byteRangeStartOffset,d=s.byteRangeEndOffset;return Object(l.isFiniteNumber)(a)&&Object(l.isFiniteNumber)(d)&&(i.rangeStart=a,i.rangeEnd=d),i}var A=function(u){v(r,u);function r(s){for(var i,a=arguments.length,d=new Array(a>1?a-1:0),o=1;o<a;o++)d[o-1]=arguments[o];return i=u.call.apply(u,[this].concat(d))||this,i.data=void 0,i.data=s,i}return r}(R(Error))},"./src/loader/fragment.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"ElementaryStreamTypes",function(){return D}),t.d(e,"BaseSegment",function(){return b}),t.d(e,"Fragment",function(){return A}),t.d(e,"Part",function(){return u});var l=t("./src/polyfills/number.ts"),n=t("./node_modules/url-toolkit/src/url-toolkit.js"),v=t.n(n),R=t("./src/utils/logger.ts"),T=t("./src/loader/level-key.ts"),L=t("./src/loader/load-stats.ts");function _(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,E(r,s)}function E(r,s){return E=Object.setPrototypeOf||function(a,d){return a.__proto__=d,a},E(r,s)}function I(r,s){for(var i=0;i<s.length;i++){var a=s[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}function M(r,s,i){return s&&I(r.prototype,s),i&&I(r,i),r}var D;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(D||(D={}));var b=function(){function r(i){var a;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(a={},a[D.AUDIO]=null,a[D.VIDEO]=null,a[D.AUDIOVIDEO]=null,a),this.baseurl=i}var s=r.prototype;return s.setByteRange=function(a,d){var o=a.split("@",2),y=[];o.length===1?y[0]=d?d.byteRangeEndOffset:0:y[0]=parseInt(o[1]),y[1]=parseInt(o[0])+y[0],this._byteRange=y},M(r,[{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=Object(n.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(a){this._url=a}}]),r}(),A=function(r){_(s,r);function s(a,d){var o;return o=r.call(this,d)||this,o._decryptdata=null,o.rawProgramDateTime=null,o.programDateTime=null,o.tagList=[],o.duration=0,o.sn=0,o.levelkey=void 0,o.type=void 0,o.loader=null,o.level=-1,o.cc=0,o.startPTS=void 0,o.endPTS=void 0,o.appendedPTS=void 0,o.startDTS=void 0,o.endDTS=void 0,o.start=0,o.deltaPTS=void 0,o.maxStartPTS=void 0,o.minEndPTS=void 0,o.stats=new L.LoadStats,o.urlId=0,o.data=void 0,o.bitrateTest=!1,o.title=null,o.initSegment=null,o.type=a,o}var i=s.prototype;return i.createInitializationVector=function(d){for(var o=new Uint8Array(16),y=12;y<16;y++)o[y]=d>>8*(15-y)&255;return o},i.setDecryptDataFromLevelKey=function(d,o){var y=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(y=T.LevelKey.fromURI(d.uri),y.method=d.method,y.iv=this.createInitializationVector(o),y.keyFormat="identity"),y},i.setElementaryStreamInfo=function(d,o,y,p,m,g){g===void 0&&(g=!1);var f=this.elementaryStreams,c=f[d];if(!c){f[d]={startPTS:o,endPTS:y,startDTS:p,endDTS:m,partial:g};return}c.startPTS=Math.min(c.startPTS,o),c.endPTS=Math.max(c.endPTS,y),c.startDTS=Math.min(c.startDTS,p),c.endDTS=Math.max(c.endDTS,m)},i.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[D.AUDIO]=null,d[D.VIDEO]=null,d[D.AUDIOVIDEO]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&R.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!Object(l.isFiniteNumber)(this.programDateTime))return null;var d=Object(l.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),s}(b),u=function(r){_(s,r);function s(i,a,d,o,y){var p;p=r.call(this,d)||this,p.fragOffset=0,p.duration=0,p.gap=!1,p.independent=!1,p.relurl=void 0,p.fragment=void 0,p.index=void 0,p.stats=new L.LoadStats,p.duration=i.decimalFloatingPoint("DURATION"),p.gap=i.bool("GAP"),p.independent=i.bool("INDEPENDENT"),p.relurl=i.enumeratedString("URI"),p.fragment=a,p.index=o;var m=i.enumeratedString("BYTERANGE");return m&&p.setByteRange(m,y),y&&(p.fragOffset=y.fragOffset+y.duration),p}return M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var a=this.elementaryStreams;return!!(a.audio||a.video||a.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return R});var l=t("./src/events.ts"),n=t("./src/errors.ts"),v=t("./src/utils/logger.ts"),R=function(){function T(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var L=T.prototype;return L._registerListeners=function(){this.hls.on(l.Events.KEY_LOADING,this.onKeyLoading,this)},L._unregisterListeners=function(){this.hls.off(l.Events.KEY_LOADING,this.onKeyLoading)},L.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var I=this.loaders[E];I&&I.destroy()}this.loaders={}},L.onKeyLoading=function(E,I){var M=I.frag,D=M.type,b=this.loaders[D];if(!M.decryptdata){v.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var A=M.decryptdata.uri;if(A!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(b&&(v.logger.warn("abort previous key loader for type:"+D),b.abort()),!A){v.logger.warn("key uri is falsy");return}var r=u.loader,s=M.loader=this.loaders[D]=new r(u);this.decrypturl=A,this.decryptkey=null;var i={url:A,frag:M,responseType:"arraybuffer"},a={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(i,a,d)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(l.Events.KEY_LOADED,{frag:M}))},L.loadsuccess=function(E,I,M){var D=M.frag;if(!D.decryptdata){v.logger.error("after key load, decryptdata unset");return}this.decryptkey=D.decryptdata.key=new Uint8Array(E.data),D.loader=null,delete this.loaders[D.type],this.hls.trigger(l.Events.KEY_LOADED,{frag:D})},L.loaderror=function(E,I){var M=I.frag,D=M.loader;D&&D.abort(),delete this.loaders[M.type],this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:E})},L.loadtimeout=function(E,I){var M=I.frag,D=M.loader;D&&D.abort(),delete this.loaders[M.type],this.hls.trigger(l.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},T}()},"./src/loader/level-details.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"LevelDetails",function(){return T});var l=t("./src/polyfills/number.ts");function n(L,_){for(var E=0;E<_.length;E++){var I=_[E];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(L,I.key,I)}}function v(L,_,E){return _&&n(L.prototype,_),E&&n(L,E),L}var R=10,T=function(){function L(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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,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.fragments=[],this.url=E}var _=L.prototype;return _.reloaded=function(I){if(!I){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-I.lastPartSn,D=this.lastPartIndex-I.lastPartIndex;this.updated=this.endSN!==I.endSN||!!D||!!M,this.advanced=this.endSN>I.endSN||M>0||M===0&&D>0,this.updated||this.advanced?this.misses=Math.floor(I.misses*.6):this.misses=I.misses+1,this.availabilityDelay=I.availabilityDelay},v(L,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(l.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||R}},{key:"drift",get:function(){var I=this.driftEndTime-this.driftStartTime;if(I>0){var M=this.driftEnd-this.driftStart;return M*1e3/I}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var I;return(I=this.partList)!==null&&I!==void 0&&I.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var I;return(I=this.fragments)!==null&&I!==void 0&&I.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 I;return(I=this.partList)!==null&&I!==void 0&&I.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var I;return(I=this.partList)!==null&&I!==void 0&&I.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),L}()},"./src/loader/level-key.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"LevelKey",function(){return T});var l=t("./node_modules/url-toolkit/src/url-toolkit.js"),n=t.n(l);function v(L,_){for(var E=0;E<_.length;E++){var I=_[E];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(L,I.key,I)}}function R(L,_,E){return _&&v(L.prototype,_),E&&v(L,E),L}var T=function(){L.fromURL=function(E,I){return new L(E,I)},L.fromURI=function(E){return new L(E)};function L(_,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(l.buildAbsoluteURL)(_,E,{alwaysNormalize:!0}):this._uri=_}return R(L,[{key:"uri",get:function(){return this._uri}}]),L}()},"./src/loader/load-stats.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"LoadStats",function(){return l});var l=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}}},"./src/loader/m3u8-parser.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return s});var l=t("./src/polyfills/number.ts"),n=t("./node_modules/url-toolkit/src/url-toolkit.js"),v=t.n(n),R=t("./src/loader/fragment.ts"),T=t("./src/loader/level-details.ts"),L=t("./src/loader/level-key.ts"),_=t("./src/utils/attr-list.ts"),E=t("./src/utils/logger.ts"),I=t("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,D=/#EXT-X-MEDIA:(.*)/g,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),A=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function r(y){var p,m;return u.test((p=(m=n.parseURL(y))===null||m===void 0?void 0:m.path)!=null?p:"")}var s=function(){function y(){}return y.findGroup=function(m,g){for(var f=0;f<m.length;f++){var c=m[f];if(c.id===g)return c}},y.convertAVC1ToAVCOTI=function(m){var g=m.split(".");if(g.length>2){var f=g.shift()+".";return f+=parseInt(g.shift()).toString(16),f+=("000"+parseInt(g.shift()).toString(16)).substr(-4),f}return m},y.resolve=function(m,g){return n.buildAbsoluteURL(g,m,{alwaysNormalize:!0})},y.parseMasterPlaylist=function(m,g){var f=[],c={},x=!1;M.lastIndex=0;for(var S;(S=M.exec(m))!=null;)if(S[1]){var C=new _.AttrList(S[1]),O={attrs:C,bitrate:C.decimalInteger("AVERAGE-BANDWIDTH")||C.decimalInteger("BANDWIDTH"),name:C.NAME,url:y.resolve(S[2],g)},P=C.decimalResolution("RESOLUTION");P&&(O.width=P.width,O.height=P.height),i((C.CODECS||"").split(/[ ,]+/).filter(function(U){return U}),O),O.videoCodec&&O.videoCodec.indexOf("avc1")!==-1&&(O.videoCodec=y.convertAVC1ToAVCOTI(O.videoCodec)),f.push(O)}else if(S[3]){var w=new _.AttrList(S[3]);w["DATA-ID"]&&(x=!0,c[w["DATA-ID"]]=w)}return{levels:f,sessionData:x?c:null}},y.parseMasterPlaylistMedia=function(m,g,f,c){c===void 0&&(c=[]);var x,S=[],C=0;for(D.lastIndex=0;(x=D.exec(m))!==null;){var O=new _.AttrList(x[1]);if(O.TYPE===f){var P={attrs:O,bitrate:0,id:C++,groupId:O["GROUP-ID"],instreamId:O["INSTREAM-ID"],name:O.NAME||O.LANGUAGE||"",type:f,default:O.bool("DEFAULT"),autoselect:O.bool("AUTOSELECT"),forced:O.bool("FORCED"),lang:O.LANGUAGE,url:O.URI?y.resolve(O.URI,g):""};if(c.length){var w=y.findGroup(c,P.groupId)||c[0];a(P,w,"audioCodec"),a(P,w,"textCodec")}S.push(P)}}return S},y.parseLevelPlaylist=function(m,g,f,c,x){var S=new T.LevelDetails(g),C=S.fragments,O=null,P=0,w=0,U=0,k=0,N=null,B=new R.Fragment(c,g),K,W,F,H=-1,Y=!1;for(b.lastIndex=0,S.m3u8=m;(K=b.exec(m))!==null;){Y&&(Y=!1,B=new R.Fragment(c,g),B.start=U,B.sn=P,B.cc=k,B.level=f,O&&(B.initSegment=O,B.rawProgramDateTime=O.rawProgramDateTime));var $=K[1];if($){B.duration=parseFloat($);var Z=(" "+K[2]).slice(1);B.title=Z||null,B.tagList.push(Z?["INF",$,Z]:["INF",$])}else if(K[3])Object(l.isFiniteNumber)(B.duration)&&(B.start=U,F&&(B.levelkey=F),B.sn=P,B.level=f,B.cc=k,B.urlId=x,C.push(B),B.relurl=(" "+K[3]).slice(1),o(B,N),N=B,U+=B.duration,P++,w=0,Y=!0);else if(K[4]){var q=(" "+K[4]).slice(1);N?B.setByteRange(q,N):B.setByteRange(q)}else if(K[5])B.rawProgramDateTime=(" "+K[5]).slice(1),B.tagList.push(["PROGRAM-DATE-TIME",B.rawProgramDateTime]),H===-1&&(H=C.length);else{if(K=K[0].match(A),!K){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(W=1;W<K.length&&typeof K[W]=="undefined";W++);var oe=(" "+K[W]).slice(1),X=(" "+K[W+1]).slice(1),ie=K[W+2]?(" "+K[W+2]).slice(1):"";switch(oe){case"PLAYLIST-TYPE":S.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":P=S.startSN=parseInt(X);break;case"SKIP":{var fe=new _.AttrList(X),ue=fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(l.isFiniteNumber)(ue)){S.skippedSegments=ue;for(var Se=ue;Se--;)C.unshift(null);P+=ue}var re=fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");re&&(S.recentlyRemovedDateranges=re.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(X);break;case"VERSION":S.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(X||ie)&&B.tagList.push(ie?[X,ie]:[X]);break;case"DIS":k++;case"GAP":B.tagList.push([oe]);break;case"BITRATE":B.tagList.push([oe,X]);break;case"DISCONTINUITY-SEQ":k=parseInt(X);break;case"KEY":{var Q,te=new _.AttrList(X),ee=te.enumeratedString("METHOD"),he=te.URI,_e=te.hexadecimalInteger("IV"),Ee=te.enumeratedString("KEYFORMATVERSIONS"),be=te.enumeratedString("KEYID"),Ie=(Q=te.enumeratedString("KEYFORMAT"))!=null?Q:"identity",Ne=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ne.indexOf(Ie)>-1){E.logger.warn("Keyformat "+Ie+" is not supported from the manifest");continue}else if(Ie!=="identity")continue;ee&&(F=L.LevelKey.fromURL(g,he),he&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ee)>=0&&(F.method=ee,F.keyFormat=Ie,be&&(F.keyID=be),Ee&&(F.keyFormatVersions=Ee),F.iv=_e));break}case"START":{var ye=new _.AttrList(X),Te=ye.decimalFloatingPoint("TIME-OFFSET");Object(l.isFiniteNumber)(Te)&&(S.startTimeOffset=Te);break}case"MAP":{var Be=new _.AttrList(X);B.relurl=Be.URI,Be.BYTERANGE&&B.setByteRange(Be.BYTERANGE),B.level=f,B.sn="initSegment",F&&(B.levelkey=F),B.initSegment=null,O=B,Y=!0;break}case"SERVER-CONTROL":{var Ae=new _.AttrList(X);S.canBlockReload=Ae.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=Ae.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&Ae.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=Ae.optionalFloat("PART-HOLD-BACK",0),S.holdBack=Ae.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new _.AttrList(X);S.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ue=S.partList;Ue||(Ue=S.partList=[]);var $e=w>0?Ue[Ue.length-1]:void 0,qe=w++,et=new R.Part(new _.AttrList(X),B,g,qe,$e);Ue.push(et),B.duration+=et.duration;break}case"PRELOAD-HINT":{var G=new _.AttrList(X);S.preloadHint=G;break}case"RENDITION-REPORT":{var V=new _.AttrList(X);S.renditionReports=S.renditionReports||[],S.renditionReports.push(V);break}default:E.logger.warn("line parsed but not handled: "+K);break}}}N&&!N.relurl?(C.pop(),U-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(o(B,N),B.cc=k,S.fragmentHint=B);var de=C.length,ce=C[0],Me=C[de-1];if(U+=S.skippedSegments*S.targetduration,U>0&&de&&Me){S.averagetargetduration=U/de;var Re=Me.sn;S.endSN=Re!=="initSegment"?Re:0,ce&&(S.startCC=ce.cc,ce.initSegment||S.fragments.every(function(le){return le.relurl&&r(le.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),B=new R.Fragment(c,g),B.relurl=Me.relurl,B.level=f,B.sn="initSegment",ce.initSegment=B,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(U+=S.fragmentHint.duration),S.totalduration=U,S.endCC=k,H>0&&d(C,H),S},y}();function i(y,p){["video","audio","text"].forEach(function(m){var g=y.filter(function(c){return Object(I.isCodecType)(c,m)});if(g.length){var f=g.filter(function(c){return c.lastIndexOf("avc1",0)===0||c.lastIndexOf("mp4a",0)===0});p[m+"Codec"]=f.length>0?f[0]:g[0],y=y.filter(function(c){return g.indexOf(c)===-1})}}),p.unknownCodecs=y}function a(y,p,m){var g=p[m];g&&(y[m]=g)}function d(y,p){for(var m=y[p],g=p;g--;){var f=y[g];if(!f)return;f.programDateTime=m.programDateTime-f.duration*1e3,m=f}}function o(y,p){y.rawProgramDateTime?y.programDateTime=Date.parse(y.rawProgramDateTime):p!=null&&p.programDateTime&&(y.programDateTime=p.endProgramDateTime),Object(l.isFiniteNumber)(y.programDateTime)||(y.programDateTime=null,y.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/polyfills/number.ts"),n=t("./src/events.ts"),v=t("./src/errors.ts"),R=t("./src/utils/logger.ts"),T=t("./src/utils/mp4-tools.ts"),L=t("./src/loader/m3u8-parser.ts"),_=t("./src/types/loader.ts"),E=t("./src/utils/attr-list.ts");function I(b){var A=b.type;switch(A){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function M(b,A){var u=b.url;return(u===void 0||u.indexOf("data:")===0)&&(u=A.url),u}var D=function(){function b(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var A=b.prototype;return A.registerListeners=function(){var r=this.hls;r.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},A.unregisterListeners=function(){var r=this.hls;r.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},A.createInternalLoader=function(r){var s=this.hls.config,i=s.pLoader,a=s.loader,d=i||a,o=new d(s);return r.loader=o,this.loaders[r.type]=o,o},A.getInternalLoader=function(r){return this.loaders[r.type]},A.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},A.destroyInternalLoaders=function(){for(var r in this.loaders){var s=this.loaders[r];s&&s.destroy(),this.resetInternalLoader(r)}},A.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},A.onManifestLoading=function(r,s){var i=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},A.onLevelLoading=function(r,s){var i=s.id,a=s.level,d=s.url,o=s.deliveryDirectives;this.load({id:i,groupId:null,level:a,responseType:"text",type:_.PlaylistContextType.LEVEL,url:d,deliveryDirectives:o})},A.onAudioTrackLoading=function(r,s){var i=s.id,a=s.groupId,d=s.url,o=s.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:o})},A.onSubtitleTrackLoading=function(r,s){var i=s.id,a=s.groupId,d=s.url,o=s.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:o})},A.load=function(r){var s,i=this.hls.config,a=this.getInternalLoader(r);if(a){var d=a.context;if(d&&d.url===r.url){R.logger.trace("[playlist-loader]: playlist request ongoing");return}R.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),a.abort()}var o,y,p,m;switch(r.type){case _.PlaylistContextType.MANIFEST:o=i.manifestLoadingMaxRetry,y=i.manifestLoadingTimeOut,p=i.manifestLoadingRetryDelay,m=i.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:o=0,y=i.levelLoadingTimeOut;break;default:o=i.levelLoadingMaxRetry,y=i.levelLoadingTimeOut,p=i.levelLoadingRetryDelay,m=i.levelLoadingMaxRetryTimeout;break}if(a=this.createInternalLoader(r),(s=r.deliveryDirectives)!==null&&s!==void 0&&s.part){var g;if(r.type===_.PlaylistContextType.LEVEL&&r.level!==null?g=this.hls.levels[r.level].details:r.type===_.PlaylistContextType.AUDIO_TRACK&&r.id!==null?g=this.hls.audioTracks[r.id].details:r.type===_.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(g=this.hls.subtitleTracks[r.id].details),g){var f=g.partTarget,c=g.targetduration;f&&c&&(y=Math.min(Math.max(f*3,c*.8)*1e3,y))}}var x={timeout:y,maxRetry:o,retryDelay:p,maxRetryDelay:m,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};a.load(r,x,S)},A.loadsuccess=function(r,s,i,a){if(a===void 0&&(a=null),i.isSidxRequest){this.handleSidxRequest(r,i),this.handlePlaylistLoaded(r,s,i,a);return}this.resetInternalLoader(i.type);var d=r.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,i,"no EXTM3U delimiter",a);return}s.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,s,i,a):this.handleMasterPlaylist(r,s,i,a)},A.loaderror=function(r,s,i){i===void 0&&(i=null),this.handleNetworkError(s,i,!1,r)},A.loadtimeout=function(r,s,i){i===void 0&&(i=null),this.handleNetworkError(s,i,!0)},A.handleMasterPlaylist=function(r,s,i,a){var d=this.hls,o=r.data,y=M(r,i),p=L.default.parseMasterPlaylist(o,y),m=p.levels,g=p.sessionData;if(!m.length){this.handleManifestParsingError(r,i,"no level found in manifest",a);return}var f=m.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),c=m.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),x=L.default.parseMasterPlaylistMedia(o,y,"AUDIO",f),S=L.default.parseMasterPlaylistMedia(o,y,"SUBTITLES",c),C=L.default.parseMasterPlaylistMedia(o,y,"CLOSED-CAPTIONS");if(x.length){var O=x.some(function(P){return!P.url});!O&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(R.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}d.trigger(n.Events.MANIFEST_LOADED,{levels:m,audioTracks:x,subtitles:S,captions:C,url:y,stats:s,networkDetails:a,sessionData:g})},A.handleTrackOrLevelPlaylist=function(r,s,i,a){var d=this.hls,o=i.id,y=i.level,p=i.type,m=M(r,i),g=Object(l.isFiniteNumber)(o)?o:0,f=Object(l.isFiniteNumber)(y)?y:g,c=I(i),x=L.default.parseLevelPlaylist(r.data,m,f,c,g);if(!x.fragments.length){d.trigger(n.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof i.level=="number"?i.level:void 0});return}if(p===_.PlaylistContextType.MANIFEST){var S={attrs:new E.AttrList({}),bitrate:0,details:x,name:"",url:m};d.trigger(n.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:m,stats:s,networkDetails:a,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var C,O=(C=x.fragments[0].initSegment)===null||C===void 0?void 0:C.url;this.load({url:O,isSidxRequest:!0,type:p,level:y,levelDetails:x,id:o,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}i.levelDetails=x,this.handlePlaylistLoaded(r,s,i,a)},A.handleSidxRequest=function(r,s){var i=Object(T.parseSegmentIndex)(new Uint8Array(r.data));if(!!i){var a=i.references,d=s.levelDetails;a.forEach(function(o,y){var p=o.info,m=d.fragments[y];m.byteRange.length===0&&m.setByteRange(String(1+p.end-p.start)+"@"+String(p.start)),m.initSegment&&m.initSegment.setByteRange(String(i.moovEndOffset)+"@0")})}},A.handleManifestParsingError=function(r,s,i,a){this.hls.trigger(n.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:r.url,reason:i,response:r,context:s,networkDetails:a})},A.handleNetworkError=function(r,s,i,a){i===void 0&&(i=!1),R.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var d=v.ErrorDetails.UNKNOWN,o=!1,y=this.getInternalLoader(r);switch(r.type){case _.PlaylistContextType.MANIFEST:d=i?v.ErrorDetails.MANIFEST_LOAD_TIMEOUT:v.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case _.PlaylistContextType.LEVEL:d=i?v.ErrorDetails.LEVEL_LOAD_TIMEOUT:v.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case _.PlaylistContextType.AUDIO_TRACK:d=i?v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:d=i?v.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:v.ErrorDetails.SUBTITLE_LOAD_ERROR,o=!1;break}y&&this.resetInternalLoader(r.type);var p={type:v.ErrorTypes.NETWORK_ERROR,details:d,fatal:o,url:r.url,loader:y,context:r,networkDetails:s};a&&(p.response=a),this.hls.trigger(n.Events.ERROR,p)},A.handlePlaylistLoaded=function(r,s,i,a){var d=i.type,o=i.level,y=i.id,p=i.groupId,m=i.loader,g=i.levelDetails,f=i.deliveryDirectives;if(!(g!=null&&g.targetduration)){this.handleManifestParsingError(r,i,"invalid target duration",a);return}if(!!m)switch(g.live&&(m.getCacheAge&&(g.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(g.ageHeader))&&(g.ageHeader=0)),d){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(n.Events.LEVEL_LOADED,{details:g,level:o||0,id:y||0,stats:s,networkDetails:a,deliveryDirectives:f});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(n.Events.AUDIO_TRACK_LOADED,{details:g,id:y||0,groupId:p||"",stats:s,networkDetails:a,deliveryDirectives:f});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED,{details:g,id:y||0,groupId:p||"",stats:s,networkDetails:a,deliveryDirectives:f});break}},b}();e.default=D},"./src/polyfills/number.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"isFiniteNumber",function(){return l}),t.d(e,"MAX_SAFE_INTEGER",function(){return n});var l=Number.isFinite||function(v){return typeof v=="number"&&isFinite(v)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(h,e,t){"use strict";t.r(e);var l=function(){function n(){}return n.getSilentFrame=function(R,T){switch(R){case"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]);break;default: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)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(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]);break}},n}();e.default=l},"./src/remux/mp4-generator.ts":function(h,e,t){"use strict";t.r(e);var l=Math.pow(2,32)-1,n=function(){function v(){}return v.init=function(){v.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:[]};var T;for(T in v.types)v.types.hasOwnProperty(T)&&(v.types[T]=[T.charCodeAt(0),T.charCodeAt(1),T.charCodeAt(2),T.charCodeAt(3)]);var L=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]),_=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]);v.HDLR_TYPES={video:L,audio:_};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),I=new Uint8Array([0,0,0,0,0,0,0,0]);v.STTS=v.STSC=v.STCO=I,v.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),v.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),v.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),v.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),D=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);v.FTYP=v.box(v.types.ftyp,M,b,M,D),v.DINF=v.box(v.types.dinf,v.box(v.types.dref,E))},v.box=function(T){for(var L=8,_=arguments.length,E=new Array(_>1?_-1:0),I=1;I<_;I++)E[I-1]=arguments[I];for(var M=E.length,D=M;M--;)L+=E[M].byteLength;var b=new Uint8Array(L);for(b[0]=L>>24&255,b[1]=L>>16&255,b[2]=L>>8&255,b[3]=L&255,b.set(T,4),M=0,L=8;M<D;M++)b.set(E[M],L),L+=E[M].byteLength;return b},v.hdlr=function(T){return v.box(v.types.hdlr,v.HDLR_TYPES[T])},v.mdat=function(T){return v.box(v.types.mdat,T)},v.mdhd=function(T,L){L*=T;var _=Math.floor(L/(l+1)),E=Math.floor(L%(l+1));return v.box(v.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,T&255,_>>24,_>>16&255,_>>8&255,_&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},v.mdia=function(T){return v.box(v.types.mdia,v.mdhd(T.timescale,T.duration),v.hdlr(T.type),v.minf(T))},v.mfhd=function(T){return v.box(v.types.mfhd,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255]))},v.minf=function(T){return T.type==="audio"?v.box(v.types.minf,v.box(v.types.smhd,v.SMHD),v.DINF,v.stbl(T)):v.box(v.types.minf,v.box(v.types.vmhd,v.VMHD),v.DINF,v.stbl(T))},v.moof=function(T,L,_){return v.box(v.types.moof,v.mfhd(T),v.traf(_,L))},v.moov=function(T){for(var L=T.length,_=[];L--;)_[L]=v.trak(T[L]);return v.box.apply(null,[v.types.moov,v.mvhd(T[0].timescale,T[0].duration)].concat(_).concat(v.mvex(T)))},v.mvex=function(T){for(var L=T.length,_=[];L--;)_[L]=v.trex(T[L]);return v.box.apply(null,[v.types.mvex].concat(_))},v.mvhd=function(T,L){L*=T;var _=Math.floor(L/(l+1)),E=Math.floor(L%(l+1)),I=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,T&255,_>>24,_>>16&255,_>>8&255,_&255,E>>24,E>>16&255,E>>8&255,E&255,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 v.box(v.types.mvhd,I)},v.sdtp=function(T){var L=T.samples||[],_=new Uint8Array(4+L.length),E,I;for(E=0;E<L.length;E++)I=L[E].flags,_[E+4]=I.dependsOn<<4|I.isDependedOn<<2|I.hasRedundancy;return v.box(v.types.sdtp,_)},v.stbl=function(T){return v.box(v.types.stbl,v.stsd(T),v.box(v.types.stts,v.STTS),v.box(v.types.stsc,v.STSC),v.box(v.types.stsz,v.STSZ),v.box(v.types.stco,v.STCO))},v.avc1=function(T){var L=[],_=[],E,I,M;for(E=0;E<T.sps.length;E++)I=T.sps[E],M=I.byteLength,L.push(M>>>8&255),L.push(M&255),L=L.concat(Array.prototype.slice.call(I));for(E=0;E<T.pps.length;E++)I=T.pps[E],M=I.byteLength,_.push(M>>>8&255),_.push(M&255),_=_.concat(Array.prototype.slice.call(I));var D=v.box(v.types.avcC,new Uint8Array([1,L[3],L[4],L[5],252|3,224|T.sps.length].concat(L).concat([T.pps.length]).concat(_))),b=T.width,A=T.height,u=T.pixelRatio[0],r=T.pixelRatio[1];return v.box(v.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,b>>8&255,b&255,A>>8&255,A&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),D,v.box(v.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),v.box(v.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,r>>24,r>>16&255,r>>8&255,r&255])))},v.esds=function(T){var L=T.config.length;return new Uint8Array([0,0,0,0,3,23+L,0,1,0,4,15+L,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([L]).concat(T.config).concat([6,1,2]))},v.mp4a=function(T){var L=T.samplerate;return v.box(v.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,L>>8&255,L&255,0,0]),v.box(v.types.esds,v.esds(T)))},v.mp3=function(T){var L=T.samplerate;return v.box(v.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,L>>8&255,L&255,0,0]))},v.stsd=function(T){return T.type==="audio"?!T.isAAC&&T.codec==="mp3"?v.box(v.types.stsd,v.STSD,v.mp3(T)):v.box(v.types.stsd,v.STSD,v.mp4a(T)):v.box(v.types.stsd,v.STSD,v.avc1(T))},v.tkhd=function(T){var L=T.id,_=T.duration*T.timescale,E=T.width,I=T.height,M=Math.floor(_/(l+1)),D=Math.floor(_%(l+1));return v.box(v.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,L>>24&255,L>>16&255,L>>8&255,L&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,D>>24,D>>16&255,D>>8&255,D&255,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,E>>8&255,E&255,0,0,I>>8&255,I&255,0,0]))},v.traf=function(T,L){var _=v.sdtp(T),E=T.id,I=Math.floor(L/(l+1)),M=Math.floor(L%(l+1));return v.box(v.types.traf,v.box(v.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),v.box(v.types.tfdt,new Uint8Array([1,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,M>>24,M>>16&255,M>>8&255,M&255])),v.trun(T,_.length+16+20+8+16+8+8),_)},v.trak=function(T){return T.duration=T.duration||4294967295,v.box(v.types.trak,v.tkhd(T),v.mdia(T))},v.trex=function(T){var L=T.id;return v.box(v.types.trex,new Uint8Array([0,0,0,0,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},v.trun=function(T,L){var _=T.samples||[],E=_.length,I=12+16*E,M=new Uint8Array(I),D,b,A,u,r,s;for(L+=8+I,M.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,L>>>24&255,L>>>16&255,L>>>8&255,L&255],0),D=0;D<E;D++)b=_[D],A=b.duration,u=b.size,r=b.flags,s=b.cts,M.set([A>>>24&255,A>>>16&255,A>>>8&255,A&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*D);return v.box(v.types.trun,M)},v.initSegment=function(T){v.types||v.init();var L=v.moov(T),_=new Uint8Array(v.FTYP.byteLength+L.byteLength);return _.set(v.FTYP),_.set(L,v.FTYP.byteLength),_},v}();n.types=void 0,n.HDLR_TYPES=void 0,n.STTS=void 0,n.STSC=void 0,n.STCO=void 0,n.STSZ=void 0,n.VMHD=void 0,n.SMHD=void 0,n.STSD=void 0,n.FTYP=void 0,n.DINF=void 0,e.default=n},"./src/remux/mp4-remuxer.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return s}),t.d(e,"normalizePts",function(){return i});var l=t("./src/polyfills/number.ts"),n=t("./src/remux/aac-helper.ts"),v=t("./src/remux/mp4-generator.ts"),R=t("./src/events.ts"),T=t("./src/errors.ts"),L=t("./src/utils/logger.ts"),_=t("./src/types/loader.ts"),E=t("./src/utils/timescale-conversion.ts");function I(){return I=Object.assign||function(y){for(var p=1;p<arguments.length;p++){var m=arguments[p];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(y[g]=m[g])}return y},I.apply(this,arguments)}var M=10*1e3,D=1024,b=1152,A=null,u=null,r=!1,s=function(){function y(m,g,f,c){if(c===void 0&&(c=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=m,this.config=g,this.typeSupported=f,this.ISGenerated=!1,A===null){var x=navigator.userAgent||"",S=x.match(/Chrome\/(\d+)/i);A=S?parseInt(S[1]):0}if(u===null){var C=navigator.userAgent.match(/Safari\/(\d+)/i);u=C?parseInt(C[1]):0}r=!!A&&A<75||!!u&&u<600}var p=y.prototype;return p.destroy=function(){},p.resetTimeStamp=function(g){L.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=g},p.resetNextTimestamp=function(){L.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},p.resetInitSegment=function(){L.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},p.getVideoStartPts=function(g){var f=!1,c=g.reduce(function(x,S){var C=S.pts-x;return C<-4294967296?(f=!0,i(x,S.pts)):C>0?x:S.pts},g[0].pts);return f&&L.logger.debug("PTS rollover detected"),c},p.remux=function(g,f,c,x,S,C,O,P){var w,U,k,N,B,K,W=S,F=S,H=g.pid>-1,Y=f.pid>-1,$=f.samples.length,Z=g.samples.length>0,q=$>1,oe=(!H||Z)&&(!Y||q)||this.ISGenerated||O;if(oe){this.ISGenerated||(k=this.generateIS(g,f,S));var X=this.isVideoContiguous,ie=-1;if(q&&(ie=a(f.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,ie>0){L.logger.warn("[mp4-remuxer]: Dropped "+ie+" out of "+$+" video samples due to a missing keyframe");var fe=this.getVideoStartPts(f.samples);f.samples=f.samples.slice(ie),f.dropped+=ie,F+=(f.samples[0].pts-fe)/(f.timescale||9e4)}else ie===-1&&(L.logger.warn("[mp4-remuxer]: No keyframe found out of "+$+" video samples"),K=!1);if(this.ISGenerated){if(Z&&q){var ue=this.getVideoStartPts(f.samples),Se=i(g.samples[0].pts,ue)-ue,re=Se/f.inputTimeScale;W+=Math.max(0,re),F+=Math.max(0,-re)}if(Z){if(g.samplerate||(L.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(g,f,S)),U=this.remuxAudio(g,W,this.isAudioContiguous,C,Y||q||P===_.PlaylistLevelType.AUDIO?F:void 0),q){var Q=U?U.endPTS-U.startPTS:0;f.inputTimeScale||(L.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(g,f,S)),w=this.remuxVideo(f,F,X,Q)}}else q&&(w=this.remuxVideo(f,F,X,0));w&&(w.firstKeyFrame=ie,w.independent=ie!==-1)}}return this.ISGenerated&&(c.samples.length&&(B=this.remuxID3(c,S)),x.samples.length&&(N=this.remuxText(x,S))),{audio:U,video:w,initSegment:k,independent:K,text:N,id3:B}},p.generateIS=function(g,f,c){var x=g.samples,S=f.samples,C=this.typeSupported,O={},P=!Object(l.isFiniteNumber)(this._initPTS),w="audio/mp4",U,k,N;if(P&&(U=k=1/0),g.config&&x.length&&(g.timescale=g.samplerate,g.isAAC||(C.mpeg?(w="audio/mpeg",g.codec=""):C.mp3&&(g.codec="mp3")),O.audio={id:"audio",container:w,codec:g.codec,initSegment:!g.isAAC&&C.mpeg?new Uint8Array(0):v.default.initSegment([g]),metadata:{channelCount:g.channelCount}},P&&(N=g.inputTimeScale,U=k=x[0].pts-Math.round(N*c))),f.sps&&f.pps&&S.length&&(f.timescale=f.inputTimeScale,O.video={id:"main",container:"video/mp4",codec:f.codec,initSegment:v.default.initSegment([f]),metadata:{width:f.width,height:f.height}},P)){N=f.inputTimeScale;var B=this.getVideoStartPts(S),K=Math.round(N*c);k=Math.min(k,i(S[0].dts,B)-K),U=Math.min(U,B-K)}if(Object.keys(O).length)return this.ISGenerated=!0,P&&(this._initPTS=U,this._initDTS=k),{tracks:O,initPTS:U,timescale:N}},p.remuxVideo=function(g,f,c,x){var S=g.inputTimeScale,C=g.samples,O=[],P=C.length,w=this._initPTS,U=this.nextAvcDts,k=8,N,B,K,W=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY,H=0,Y=!1;if(!c||U===null){var $=f*S,Z=C[0].pts-i(C[0].dts,C[0].pts);U=$-Z}for(var q=0;q<P;q++){var oe=C[q];if(oe.pts=i(oe.pts-w,U),oe.dts=i(oe.dts-w,U),oe.dts>oe.pts){var X=9e4*.2;H=Math.max(Math.min(H,oe.pts-oe.dts),-1*X)}oe.dts<C[q>0?q-1:q].dts&&(Y=!0)}Y&&C.sort(function(Rt,Vt){var Ct=Rt.dts-Vt.dts,$t=Rt.pts-Vt.pts;return Ct||$t}),B=C[0].dts,K=C[C.length-1].dts;var ie=Math.round((K-B)/(P-1));if(H<0){if(H<ie*-2){L.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-ie,!0)+" ms");for(var fe=H,ue=0;ue<P;ue++)C[ue].dts=fe=Math.max(fe,C[ue].pts-ie),C[ue].pts=Math.max(fe,C[ue].pts)}else{L.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(H,!0)+" ms to overcome this issue");for(var Se=0;Se<P;Se++)C[Se].dts=C[Se].dts+H}B=C[0].dts}if(c){var re=B-U,Q=re>ie,te=re<-1;if(Q||te){Q?L.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(re,!0)+" ms ("+re+"dts) hole between fragments detected, filling it"):L.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-re,!0)+" ms ("+re+"dts) overlapping between fragments detected"),B=U;var ee=C[0].pts-re;C[0].dts=B,C[0].pts=ee,L.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(ee,!0)+"/"+Object(E.toMsFromMpegTsClock)(B,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(re,!0)+" ms")}}r&&(B=Math.max(0,B));for(var he=0,_e=0,Ee=0;Ee<P;Ee++){for(var be=C[Ee],Ie=be.units,Ne=Ie.length,ye=0,Te=0;Te<Ne;Te++)ye+=Ie[Te].data.length;_e+=ye,he+=Ne,be.length=ye,be.dts=Math.max(be.dts,B),be.pts=Math.max(be.pts,be.dts,0),W=Math.min(be.pts,W),F=Math.max(be.pts,F)}K=C[P-1].dts;var Be=_e+4*he+8,Ae;try{Ae=new Uint8Array(Be)}catch{this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MUX_ERROR,details:T.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Be,reason:"fail allocating video mdat "+Be});return}var Ze=new DataView(Ae.buffer);Ze.setUint32(0,Be),Ae.set(v.default.types.mdat,4);for(var Ue=0;Ue<P;Ue++){for(var $e=C[Ue],qe=$e.units,et=0,G=0,V=qe.length;G<V;G++){var de=qe[G],ce=de.data,Me=de.data.byteLength;Ze.setUint32(k,Me),k+=4,Ae.set(ce,k),k+=Me,et+=4+Me}if(Ue<P-1)N=C[Ue+1].dts-$e.dts;else{var Re=this.config,le=$e.dts-C[Ue>0?Ue-1:Ue].dts;if(Re.stretchShortVideoTrack&&this.nextAudioPts!==null){var Qe=Math.floor(Re.maxBufferHole*S),Ke=(x?W+x*S:this.nextAudioPts)-$e.pts;Ke>Qe?(N=Ke-le,N<0&&(N=le),L.logger.log("[mp4-remuxer]: It is approximately "+Ke/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var tt=Math.round($e.pts-$e.dts);O.push(new d($e.key,N,et,tt))}if(O.length&&A&&A<70){var Gt=O[0].flags;Gt.dependsOn=2,Gt.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=U=K+N,this.isVideoContiguous=!0;var cr=v.default.moof(g.sequenceNumber++,B,I({},g,{samples:O})),ct="video",fr={data1:cr,data2:Ae,startPTS:W/S,endPTS:(F+N)/S,startDTS:B/S,endDTS:U/S,type:ct,hasAudio:!1,hasVideo:!0,nb:O.length,dropped:g.dropped};return g.samples=[],g.dropped=0,console.assert(Ae.length,"MDAT length must not be zero"),fr},p.remuxAudio=function(g,f,c,x,S){var C=g.inputTimeScale,O=g.samplerate?g.samplerate:C,P=C/O,w=g.isAAC?D:b,U=w*P,k=this._initPTS,N=!g.isAAC&&this.typeSupported.mpeg,B=[],K=g.samples,W=N?0:8,F=this.nextAudioPts||-1,H=f*C;if(this.isAudioContiguous=c=c||K.length&&F>0&&(x&&Math.abs(H-F)<9e3||Math.abs(i(K[0].pts-k,H)-F)<20*U),K.forEach(function(ce){ce.pts=i(ce.pts-k,H)}),!c||F<0){if(K=K.filter(function(ce){return ce.pts>=0}),!K.length)return;S===0?F=0:x?F=Math.max(0,H):F=K[0].pts}if(g.isAAC)for(var Y=S!==void 0,$=this.config.maxAudioFramesDrift,Z=0,q=F;Z<K.length;Z++){var oe=K[Z],X=oe.pts,ie=X-q,fe=Math.abs(1e3*ie/C);if(ie<=-$*U&&Y)Z===0&&(L.logger.warn("Audio frame @ "+(X/C).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ie/C)+" ms."),this.nextAudioPts=F=q=X);else if(ie>=$*U&&fe<M&&Y){var ue=Math.round(ie/U);q=X-ue*U,q<0&&(ue--,q+=U),Z===0&&(this.nextAudioPts=F=q),L.logger.warn("[mp4-remuxer]: Injecting "+ue+" audio frame @ "+(q/C).toFixed(3)+"s due to "+Math.round(1e3*ie/C)+" ms gap.");for(var Se=0;Se<ue;Se++){var re=Math.max(q,0),Q=n.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);Q||(L.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Q=oe.unit.subarray()),K.splice(Z,0,{unit:Q,pts:re}),q+=U,Z++}}oe.pts=q,q+=U}for(var te=null,ee=null,he,_e=0,Ee=K.length;Ee--;)_e+=K[Ee].unit.byteLength;for(var be=0,Ie=K.length;be<Ie;be++){var Ne=K[be],ye=Ne.unit,Te=Ne.pts;if(ee!==null){var Be=B[be-1];Be.duration=Math.round((Te-ee)/P)}else if(c&&g.isAAC&&(Te=F),te=Te,_e>0){_e+=W;try{he=new Uint8Array(_e)}catch{this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MUX_ERROR,details:T.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!N){var Ae=new DataView(he.buffer);Ae.setUint32(0,_e),he.set(v.default.types.mdat,4)}}else return;he.set(ye,W);var Ze=ye.byteLength;W+=Ze,B.push(new d(!0,w,Ze,0)),ee=Te}var Ue=B.length;if(!!Ue){var $e=B[B.length-1];this.nextAudioPts=F=ee+P*$e.duration;var qe=N?new Uint8Array(0):v.default.moof(g.sequenceNumber++,te/P,I({},g,{samples:B}));g.samples=[];var et=te/C,G=F/C,V="audio",de={data1:qe,data2:he,startPTS:et,endPTS:G,startDTS:et,endDTS:G,type:V,hasAudio:!0,hasVideo:!1,nb:Ue};return this.isAudioContiguous=!0,console.assert(he.length,"MDAT length must not be zero"),de}},p.remuxEmptyAudio=function(g,f,c,x){var S=g.inputTimeScale,C=g.samplerate?g.samplerate:S,O=S/C,P=this.nextAudioPts,w=(P!==null?P:x.startDTS*S)+this._initDTS,U=x.endDTS*S+this._initDTS,k=O*D,N=Math.ceil((U-w)/k),B=n.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);if(L.logger.warn("[mp4-remuxer]: remux empty Audio"),!B){L.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var K=[],W=0;W<N;W++){var F=w+W*k;K.push({unit:B,pts:F,dts:F})}return g.samples=K,this.remuxAudio(g,f,c,!1)},p.remuxID3=function(g,f){var c=g.samples.length;if(!!c){for(var x=g.inputTimeScale,S=this._initPTS,C=this._initDTS,O=0;O<c;O++){var P=g.samples[O];P.pts=i(P.pts-S,f*x)/x,P.dts=i(P.dts-C,f*x)/x}var w=g.samples;return g.samples=[],{samples:w}}},p.remuxText=function(g,f){var c=g.samples.length;if(!!c){for(var x=g.inputTimeScale,S=this._initPTS,C=0;C<c;C++){var O=g.samples[C];O.pts=i(O.pts-S,f*x)/x}g.samples.sort(function(w,U){return w.pts-U.pts});var P=g.samples;return g.samples=[],{samples:P}}},y}();function i(y,p){var m;if(p===null)return y;for(p<y?m=-8589934592:m=8589934592;Math.abs(y-p)>4294967296;)y+=m;return y}function a(y){for(var p=0;p<y.length;p++)if(y[p].key)return p;return-1}var d=function(p,m,g,f){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=g,this.cts=f,this.flags=new o(p)},o=function(p){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=p?2:1,this.isNonSync=p?0:1}},"./src/remux/passthrough-remuxer.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/polyfills/number.ts"),n=t("./src/utils/mp4-tools.ts"),v=t("./src/loader/fragment.ts"),R=t("./src/utils/logger.ts"),T=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var I=E.prototype;return I.destroy=function(){},I.resetTimeStamp=function(D){this.initPTS=D,this.lastEndDTS=null},I.resetNextTimestamp=function(){this.lastEndDTS=null},I.resetInitSegment=function(D,b,A){this.audioCodec=b,this.videoCodec=A,this.generateInitSegment(D),this.emitInitSegment=!0},I.generateInitSegment=function(D){var b=this.audioCodec,A=this.videoCodec;if(!D||!D.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(n.parseInitSegment)(D);b||(b=_(u.audio,v.ElementaryStreamTypes.AUDIO)),A||(A=_(u.video,v.ElementaryStreamTypes.VIDEO));var r={};u.audio&&u.video?r.audiovideo={container:"video/mp4",codec:b+","+A,initSegment:D,id:"main"}:u.audio?r.audio={container:"audio/mp4",codec:b,initSegment:D,id:"audio"}:u.video?r.video={container:"video/mp4",codec:A,initSegment:D,id:"main"}:R.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},I.remux=function(D,b,A,u,r){var s=this.initPTS,i=this.lastEndDTS,a={audio:void 0,video:void 0,text:u,id3:A,initSegment:void 0};Object(l.isFiniteNumber)(i)||(i=this.lastEndDTS=r||0);var d=b.samples;if(!d||!d.length)return a;var o={initPTS:void 0,timescale:1},y=this.initData;if((!y||!y.length)&&(this.generateInitSegment(d),y=this.initData),!y||!y.length)return R.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),a;this.emitInitSegment&&(o.tracks=this.initTracks,this.emitInitSegment=!1),Object(l.isFiniteNumber)(s)||(this.initPTS=o.initPTS=s=L(y,d,i));var p=Object(n.getDuration)(d,y),m=i,g=p+m;Object(n.offsetStartDTS)(y,d,s),p>0?this.lastEndDTS=g:(R.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var f=!!y.audio,c=!!y.video,x="";f&&(x+="audio"),c&&(x+="video");var S={data1:d,startPTS:m,startDTS:m,endPTS:g,endDTS:g,type:x,hasAudio:f,hasVideo:c,nb:1,dropped:0};return a.audio=S.type==="audio"?S:void 0,a.video=S.type!=="audio"?S:void 0,a.text=u,a.id3=A,a.initSegment=o,a},E}(),L=function(I,M,D){return Object(n.getStartDTS)(I,M)-D};function _(E,I){var M=E==null?void 0:E.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||I===v.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=T},"./src/task-loop.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return l});var l=function(){function n(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var v=n.prototype;return v.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},v.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},v.onHandlerDestroyed=function(){},v.hasInterval=function(){return!!this._tickInterval},v.hasNextTick=function(){return!!this._tickTimer},v.setInterval=function(T){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,T),!0)},v.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},v.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},v.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},v.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},v.doTick=function(){},n}()},"./src/types/cmcd.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"CMCDVersion",function(){return l}),t.d(e,"CMCDObjectType",function(){return n}),t.d(e,"CMCDStreamingFormat",function(){return v}),t.d(e,"CMCDStreamType",function(){return R});var l=1,n;(function(T){T.MANIFEST="m",T.AUDIO="a",T.VIDEO="v",T.MUXED="av",T.INIT="i",T.CAPTION="c",T.TIMED_TEXT="tt",T.KEY="k",T.OTHER="o"})(n||(n={}));var v;(function(T){T.DASH="d",T.HLS="h",T.SMOOTH="s",T.OTHER="o"})(v||(v={}));var R;(function(T){T.VOD="v",T.LIVE="l"})(R||(R={}))},"./src/types/level.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"HlsSkip",function(){return v}),t.d(e,"getSkipValue",function(){return R}),t.d(e,"HlsUrlParameters",function(){return T}),t.d(e,"Level",function(){return L});function l(_,E){for(var I=0;I<E.length;I++){var M=E[I];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}function n(_,E,I){return E&&l(_.prototype,E),I&&l(_,I),_}var v;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(v||(v={}));function R(_,E){var I=_.canSkipUntil,M=_.canSkipDateRanges,D=_.endSN,b=E!==void 0?E-D:0;return I&&b<I?M?v.v2:v.Yes:v.No}var T=function(){function _(I,M,D){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=I,this.part=M,this.skip=D}var E=_.prototype;return E.addDirectives=function(M){var D=new self.URL(M);return this.msn!==void 0&&D.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&D.searchParams.set("_HLS_part",this.part.toString()),this.skip&&D.searchParams.set("_HLS_skip",this.skip),D.toString()},_}(),L=function(){function _(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(I){return I}).join(",").replace(/\.[^.,]+/g,"")}return n(_,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(I){var M=I%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),_}()},"./src/types/loader.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"PlaylistContextType",function(){return l}),t.d(e,"PlaylistLevelType",function(){return n});var l;(function(v){v.MANIFEST="manifest",v.LEVEL="level",v.AUDIO_TRACK="audioTrack",v.SUBTITLE_TRACK="subtitleTrack"})(l||(l={}));var n;(function(v){v.MAIN="main",v.AUDIO="audio",v.SUBTITLE="subtitle"})(n||(n={}))},"./src/types/transmuxer.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"ChunkMetadata",function(){return l});var l=function(R,T,L,_,E,I){_===void 0&&(_=0),E===void 0&&(E=-1),I===void 0&&(I=!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=n(),this.buffering={audio:n(),video:n(),audiovideo:n()},this.level=R,this.sn=T,this.id=L,this.size=_,this.part=E,this.partial=I};function n(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"AttrList",function(){return v});var l=/^(\d+)x(\d+)$/,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,v=function(){function R(L){typeof L=="string"&&(L=R.parseAttrList(L));for(var _ in L)L.hasOwnProperty(_)&&(this[_]=L[_])}var T=R.prototype;return T.decimalInteger=function(_){var E=parseInt(this[_],10);return E>Number.MAX_SAFE_INTEGER?1/0:E},T.hexadecimalInteger=function(_){if(this[_]){var E=(this[_]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var I=new Uint8Array(E.length/2),M=0;M<E.length/2;M++)I[M]=parseInt(E.slice(M*2,M*2+2),16);return I}else return null},T.hexadecimalIntegerAsNumber=function(_){var E=parseInt(this[_],16);return E>Number.MAX_SAFE_INTEGER?1/0:E},T.decimalFloatingPoint=function(_){return parseFloat(this[_])},T.optionalFloat=function(_,E){var I=this[_];return I?parseFloat(I):E},T.enumeratedString=function(_){return this[_]},T.bool=function(_){return this[_]==="YES"},T.decimalResolution=function(_){var E=l.exec(this[_]);if(E!==null)return{width:parseInt(E[1],10),height:parseInt(E[2],10)}},R.parseAttrList=function(_){var E,I={},M='"';for(n.lastIndex=0;(E=n.exec(_))!==null;){var D=E[2];D.indexOf(M)===0&&D.lastIndexOf(M)===D.length-1&&(D=D.slice(1,-1)),I[E[1]]=D}return I},R}()},"./src/utils/binary-search.ts":function(h,e,t){"use strict";t.r(e);var l={search:function(v,R){for(var T=0,L=v.length-1,_=null,E=null;T<=L;){_=(T+L)/2|0,E=v[_];var I=R(E);if(I>0)T=_+1;else if(I<0)L=_-1;else return E}return null}};e.default=l},"./src/utils/buffer-helper.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"BufferHelper",function(){return v});var l=t("./src/utils/logger.ts"),n={length:0,start:function(){return 0},end:function(){return 0}},v=function(){function R(){}return R.isBuffered=function(L,_){try{if(L){for(var E=R.getBuffered(L),I=0;I<E.length;I++)if(_>=E.start(I)&&_<=E.end(I))return!0}}catch{}return!1},R.bufferInfo=function(L,_,E){try{if(L){var I=R.getBuffered(L),M=[],D;for(D=0;D<I.length;D++)M.push({start:I.start(D),end:I.end(D)});return this.bufferedInfo(M,_,E)}}catch{}return{len:0,start:_,end:_,nextStart:void 0}},R.bufferedInfo=function(L,_,E){_=Math.max(0,_),L.sort(function(o,y){var p=o.start-y.start;return p||y.end-o.end});var I=[];if(E)for(var M=0;M<L.length;M++){var D=I.length;if(D){var b=I[D-1].end;L[M].start-b<E?L[M].end>b&&(I[D-1].end=L[M].end):I.push(L[M])}else I.push(L[M])}else I=L;for(var A=0,u,r=_,s=_,i=0;i<I.length;i++){var a=I[i].start,d=I[i].end;if(_+E>=a&&_<d)r=a,s=d,A=s-_;else if(_+E<a){u=a;break}}return{len:A,start:r||0,end:s||0,nextStart:u}},R.getBuffered=function(L){try{return L.buffered}catch(_){return l.logger.log("failed to get media.buffered",_),n}},R}()},"./src/utils/cea-608-parser.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"Row",function(){return s}),t.d(e,"CaptionScreen",function(){return i});var l=t("./src/utils/logger.ts"),n={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},v=function(g){var f=g;return n.hasOwnProperty(g)&&(f=n[g]),String.fromCharCode(f)},R=15,T=100,L={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},I={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],D;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(D||(D={}));var b=function(){function m(){this.time=null,this.verboseLevel=D.ERROR}var g=m.prototype;return g.log=function(c,x){this.verboseLevel>=c&&l.logger.log(this.time+" ["+c+"] "+x)},m}(),A=function(g){for(var f=[],c=0;c<g.length;c++)f.push(g[c].toString(16));return f},u=function(){function m(f,c,x,S,C){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=f||"white",this.underline=c||!1,this.italics=x||!1,this.background=S||"black",this.flash=C||!1}var g=m.prototype;return g.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},g.setStyles=function(c){for(var x=["foreground","underline","italics","background","flash"],S=0;S<x.length;S++){var C=x[S];c.hasOwnProperty(C)&&(this[C]=c[C])}},g.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},g.equals=function(c){return this.foreground===c.foreground&&this.underline===c.underline&&this.italics===c.italics&&this.background===c.background&&this.flash===c.flash},g.copy=function(c){this.foreground=c.foreground,this.underline=c.underline,this.italics=c.italics,this.background=c.background,this.flash=c.flash},g.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),r=function(){function m(f,c,x,S,C,O){this.uchar=void 0,this.penState=void 0,this.uchar=f||" ",this.penState=new u(c,x,S,C,O)}var g=m.prototype;return g.reset=function(){this.uchar=" ",this.penState.reset()},g.setChar=function(c,x){this.uchar=c,this.penState.copy(x)},g.setPenState=function(c){this.penState.copy(c)},g.equals=function(c){return this.uchar===c.uchar&&this.penState.equals(c.penState)},g.copy=function(c){this.uchar=c.uchar,this.penState.copy(c.penState)},g.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),s=function(){function m(f){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var c=0;c<T;c++)this.chars.push(new r);this.logger=f,this.pos=0,this.currPenState=new u}var g=m.prototype;return g.equals=function(c){for(var x=!0,S=0;S<T;S++)if(!this.chars[S].equals(c.chars[S])){x=!1;break}return x},g.copy=function(c){for(var x=0;x<T;x++)this.chars[x].copy(c.chars[x])},g.isEmpty=function(){for(var c=!0,x=0;x<T;x++)if(!this.chars[x].isEmpty()){c=!1;break}return c},g.setCursor=function(c){this.pos!==c&&(this.pos=c),this.pos<0?(this.logger.log(D.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>T&&(this.logger.log(D.DEBUG,"Too large cursor position "+this.pos),this.pos=T)},g.moveCursor=function(c){var x=this.pos+c;if(c>1)for(var S=this.pos+1;S<x+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(x)},g.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},g.insertChar=function(c){c>=144&&this.backSpace();var x=v(c);if(this.pos>=T){this.logger.log(D.ERROR,"Cannot insert "+c.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},g.clearFromPos=function(c){var x;for(x=c;x<T;x++)this.chars[x].reset()},g.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},g.clearToEndOfRow=function(){this.clearFromPos(this.pos)},g.getTextString=function(){for(var c=[],x=!0,S=0;S<T;S++){var C=this.chars[S].uchar;C!==" "&&(x=!1),c.push(C)}return x?"":c.join("")},g.setPenStyles=function(c){this.currPenState.setStyles(c);var x=this.chars[this.pos];x.setPenState(this.currPenState)},m}(),i=function(){function m(f){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var c=0;c<R;c++)this.rows.push(new s(f));this.logger=f,this.currRow=R-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var g=m.prototype;return g.reset=function(){for(var c=0;c<R;c++)this.rows[c].clear();this.currRow=R-1},g.equals=function(c){for(var x=!0,S=0;S<R;S++)if(!this.rows[S].equals(c.rows[S])){x=!1;break}return x},g.copy=function(c){for(var x=0;x<R;x++)this.rows[x].copy(c.rows[x])},g.isEmpty=function(){for(var c=!0,x=0;x<R;x++)if(!this.rows[x].isEmpty()){c=!1;break}return c},g.backSpace=function(){var c=this.rows[this.currRow];c.backSpace()},g.clearToEndOfRow=function(){var c=this.rows[this.currRow];c.clearToEndOfRow()},g.insertChar=function(c){var x=this.rows[this.currRow];x.insertChar(c)},g.setPen=function(c){var x=this.rows[this.currRow];x.setPenStyles(c)},g.moveCursor=function(c){var x=this.rows[this.currRow];x.moveCursor(c)},g.setCursor=function(c){this.logger.log(D.INFO,"setCursor: "+c);var x=this.rows[this.currRow];x.setCursor(c)},g.setPAC=function(c){this.logger.log(D.INFO,"pacData = "+JSON.stringify(c));var x=c.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var S=0;S<R;S++)this.rows[S].clear();var C=this.currRow+1-this.nrRollUpRows,O=this.lastOutputScreen;if(O){var P=O.rows[C].cueStartTime,w=this.logger.time;if(P&&w!==null&&P<w)for(var U=0;U<this.nrRollUpRows;U++)this.rows[x-this.nrRollUpRows+U+1].copy(O.rows[C+U])}}this.currRow=x;var k=this.rows[this.currRow];if(c.indent!==null){var N=c.indent,B=Math.max(N-1,0);k.setCursor(c.indent),c.color=k.chars[B].penState.foreground}var K={foreground:c.color,underline:c.underline,italics:c.italics,background:"black",flash:!1};this.setPen(K)},g.setBkgData=function(c){this.logger.log(D.INFO,"bkgData = "+JSON.stringify(c)),this.backSpace(),this.setPen(c),this.insertChar(32)},g.setRollUpRows=function(c){this.nrRollUpRows=c},g.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(D.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(D.TEXT,this.getDisplayText());var c=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(c,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(D.INFO,"Rolling up")},g.getDisplayText=function(c){c=c||!1;for(var x=[],S="",C=-1,O=0;O<R;O++){var P=this.rows[O].getTextString();P&&(C=O+1,c?x.push("Row "+C+": '"+P+"'"):x.push(P.trim()))}return x.length>0&&(c?S="["+x.join(" | ")+"]":S=x.join(`
19
+ `)),S},g.getTextAndFormat=function(){return this.rows},m}(),a=function(){function m(f,c,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=f,this.outputFilter=c,this.mode=null,this.verbose=0,this.displayedMemory=new i(x),this.nonDisplayedMemory=new i(x),this.lastOutputScreen=new i(x),this.currRollUpRow=this.displayedMemory.rows[R-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var g=m.prototype;return g.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[R-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},g.getHandler=function(){return this.outputFilter},g.setHandler=function(c){this.outputFilter=c},g.setPAC=function(c){this.writeScreen.setPAC(c)},g.setBkgData=function(c){this.writeScreen.setBkgData(c)},g.setMode=function(c){c!==this.mode&&(this.mode=c,this.logger.log(D.INFO,"MODE="+c),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=c)},g.insertChars=function(c){for(var x=0;x<c.length;x++)this.writeScreen.insertChar(c[x]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(D.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(D.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},g.ccRCL=function(){this.logger.log(D.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},g.ccBS=function(){this.logger.log(D.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},g.ccAOF=function(){},g.ccAON=function(){},g.ccDER=function(){this.logger.log(D.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},g.ccRU=function(c){this.logger.log(D.INFO,"RU("+c+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(c)},g.ccFON=function(){this.logger.log(D.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},g.ccRDC=function(){this.logger.log(D.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},g.ccTR=function(){this.logger.log(D.INFO,"TR"),this.setMode("MODE_TEXT")},g.ccRTD=function(){this.logger.log(D.INFO,"RTD"),this.setMode("MODE_TEXT")},g.ccEDM=function(){this.logger.log(D.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},g.ccCR=function(){this.logger.log(D.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},g.ccENM=function(){this.logger.log(D.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},g.ccEOC=function(){if(this.logger.log(D.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var c=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=c,this.writeScreen=this.nonDisplayedMemory,this.logger.log(D.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},g.ccTO=function(c){this.logger.log(D.INFO,"TO("+c+") - Tab Offset"),this.writeScreen.moveCursor(c)},g.ccMIDROW=function(c){var x={flash:!1};if(x.underline=c%2==1,x.italics=c>=46,x.italics)x.foreground="white";else{var S=Math.floor(c/2)-16,C=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=C[S]}this.logger.log(D.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},g.outputDataUpdate=function(c){c===void 0&&(c=!1);var x=this.logger.time;x!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),c&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},g.cueSplitAtTime=function(c){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,c,this.displayedMemory),this.cueStartTime=c))},m}(),d=function(){function m(f,c,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new b;this.channels=[null,new a(f,c,S),new a(f+1,x,S)],this.cmdHistory=p(),this.logger=S}var g=m.prototype;return g.getHandler=function(c){return this.channels[c].getHandler()},g.setHandler=function(c,x){this.channels[c].setHandler(x)},g.addData=function(c,x){var S,C,O,P=!1;this.logger.time=c;for(var w=0;w<x.length;w+=2)if(C=x[w]&127,O=x[w+1]&127,!(C===0&&O===0)){if(this.logger.log(D.DATA,"["+A([x[w],x[w+1]])+"] -> ("+A([C,O])+")"),S=this.parseCmd(C,O),S||(S=this.parseMidrow(C,O)),S||(S=this.parsePAC(C,O)),S||(S=this.parseBackgroundAttributes(C,O)),!S&&(P=this.parseChars(C,O),P)){var U=this.currentChannel;if(U&&U>0){var k=this.channels[U];k.insertChars(P)}else this.logger.log(D.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!P&&this.logger.log(D.WARNING,"Couldn't parse cleaned data "+A([C,O])+" orig: "+A([x[w],x[w+1]]))}},g.parseCmd=function(c,x){var S=this.cmdHistory,C=(c===20||c===28||c===21||c===29)&&x>=32&&x<=47,O=(c===23||c===31)&&x>=33&&x<=35;if(!(C||O))return!1;if(y(c,x,S))return o(null,null,S),this.logger.log(D.DEBUG,"Repeated command ("+A([c,x])+") is dropped"),!0;var P=c===20||c===21||c===23?1:2,w=this.channels[P];return c===20||c===21||c===28||c===29?x===32?w.ccRCL():x===33?w.ccBS():x===34?w.ccAOF():x===35?w.ccAON():x===36?w.ccDER():x===37?w.ccRU(2):x===38?w.ccRU(3):x===39?w.ccRU(4):x===40?w.ccFON():x===41?w.ccRDC():x===42?w.ccTR():x===43?w.ccRTD():x===44?w.ccEDM():x===45?w.ccCR():x===46?w.ccENM():x===47&&w.ccEOC():w.ccTO(x-32),o(c,x,S),this.currentChannel=P,!0},g.parseMidrow=function(c,x){var S=0;if((c===17||c===25)&&x>=32&&x<=47){if(c===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(D.ERROR,"Mismatch channel in midrow parsing"),!1;var C=this.channels[S];return C?(C.ccMIDROW(x),this.logger.log(D.DEBUG,"MIDROW ("+A([c,x])+")"),!0):!1}return!1},g.parsePAC=function(c,x){var S,C=this.cmdHistory,O=(c>=17&&c<=23||c>=25&&c<=31)&&x>=64&&x<=127,P=(c===16||c===24)&&x>=64&&x<=95;if(!(O||P))return!1;if(y(c,x,C))return o(null,null,C),!0;var w=c<=23?1:2;x>=64&&x<=95?S=w===1?L[c]:E[c]:S=w===1?_[c]:I[c];var U=this.channels[w];return U?(U.setPAC(this.interpretPAC(S,x)),o(c,x,C),this.currentChannel=w,!0):!1},g.interpretPAC=function(c,x){var S,C={color:null,italics:!1,indent:null,underline:!1,row:c};return x>95?S=x-96:S=x-64,C.underline=(S&1)==1,S<=13?C.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(C.italics=!0,C.color="white"):C.indent=Math.floor((S-16)/2)*4,C},g.parseChars=function(c,x){var S,C=null,O=null;if(c>=25?(S=2,O=c-8):(S=1,O=c),O>=17&&O<=19){var P;O===17?P=x+80:O===18?P=x+112:P=x+144,this.logger.log(D.INFO,"Special char '"+v(P)+"' in channel "+S),C=[P]}else c>=32&&c<=127&&(C=x===0?[c]:[c,x]);if(C){var w=A(C);this.logger.log(D.DEBUG,"Char codes = "+w.join(",")),o(c,x,this.cmdHistory)}return C},g.parseBackgroundAttributes=function(c,x){var S=(c===16||c===24)&&x>=32&&x<=47,C=(c===23||c===31)&&x>=45&&x<=47;if(!(S||C))return!1;var O,P={};c===16||c===24?(O=Math.floor((x-32)/2),P.background=M[O],x%2==1&&(P.background=P.background+"_semi")):x===45?P.background="transparent":(P.foreground="black",x===47&&(P.underline=!0));var w=c<=23?1:2,U=this.channels[w];return U.setBkgData(P),o(c,x,this.cmdHistory),!0},g.reset=function(){for(var c=0;c<Object.keys(this.channels).length;c++){var x=this.channels[c];x&&x.reset()}this.cmdHistory=p()},g.cueSplitAtTime=function(c){for(var x=0;x<this.channels.length;x++){var S=this.channels[x];S&&S.cueSplitAtTime(c)}},m}();function o(m,g,f){f.a=m,f.b=g}function y(m,g,f){return f.a===m&&f.b===g}function p(){return{a:null,b:null}}e.default=d},"./src/utils/codecs.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"isCodecType",function(){return n}),t.d(e,"isCodecSupportedInMp4",function(){return v});var l={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,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,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function n(R,T){var L=l[T];return!!L&&L[R.slice(0,4)]===!0}function v(R,T){return MediaSource.isTypeSupported((T||"video")+'/mp4;codecs="'+R+'"')}},"./src/utils/cues.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/utils/vttparser.ts"),n=t("./src/utils/webvtt-parser.ts"),v=t("./src/utils/texttrack-utils.ts"),R=/\s/,T={newCue:function(_,E,I,M){for(var D=[],b,A,u,r,s,i=self.VTTCue||self.TextTrackCue,a=0;a<M.rows.length;a++)if(b=M.rows[a],u=!0,r=0,s="",!b.isEmpty()){for(var d=0;d<b.chars.length;d++)R.test(b.chars[d].uchar)&&u?r++:(s+=b.chars[d].uchar,u=!1);b.cueStartTime=E,E===I&&(I+=1e-4),r>=16?r--:r++;var o=Object(l.fixLineBreaks)(s.trim()),y=Object(n.generateCueId)(E,I,o);(!_||!_.cues||!_.cues.getCueById(y))&&(A=new i(E,I,o),A.id=y,A.line=a+1,A.align="left",A.position=10+Math.min(80,Math.floor(r*8/32)*10),D.push(A))}return _&&D.length&&(D.sort(function(p,m){return p.line==="auto"||m.line==="auto"?0:p.line>8&&m.line>8?m.line-p.line:p.line-m.line}),D.forEach(function(p){return Object(v.addCueToTrack)(_,p)})),D}};e.default=T},"./src/utils/discontinuities.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"findFirstFragWithCC",function(){return R}),t.d(e,"shouldAlignOnDiscontinuities",function(){return T}),t.d(e,"findDiscontinuousReferenceFrag",function(){return L}),t.d(e,"adjustSlidingStart",function(){return E}),t.d(e,"alignStream",function(){return I}),t.d(e,"alignPDT",function(){return D}),t.d(e,"alignFragmentByPDTDelta",function(){return b}),t.d(e,"alignMediaPlaylistByPDT",function(){return A});var l=t("./src/polyfills/number.ts"),n=t("./src/utils/logger.ts"),v=t("./src/controller/level-helper.ts");function R(u,r){for(var s=null,i=0,a=u.length;i<a;i++){var d=u[i];if(d&&d.cc===r){s=d;break}}return s}function T(u,r,s){return!!(r.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function L(u,r){var s=u.fragments,i=r.fragments;if(!i.length||!s.length){n.logger.log("No fragments to align");return}var a=R(s,i[0].cc);if(!a||a&&!a.startPTS){n.logger.log("No frag in previous level to align on");return}return a}function _(u,r){if(u){var s=u.start+r;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function E(u,r){for(var s=r.fragments,i=0,a=s.length;i<a;i++)_(s[i],u);r.fragmentHint&&_(r.fragmentHint,u),r.alignedSliding=!0}function I(u,r,s){!r||(M(u,s,r),!s.alignedSliding&&r.details&&D(s,r.details),!s.alignedSliding&&r.details&&!s.skippedSegments&&Object(v.adjustSliding)(r.details,s))}function M(u,r,s){if(T(u,s,r)){var i=L(s.details,r);i&&Object(l.isFiniteNumber)(i.start)&&(n.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),E(i.start,r))}}function D(u,r){if(!(!r.fragments.length||!u.hasProgramDateTime||!r.hasProgramDateTime)){var s=r.fragments[0].programDateTime,i=u.fragments[0].programDateTime,a=(i-s)/1e3+r.fragments[0].start;a&&Object(l.isFiniteNumber)(a)&&(n.logger.log("Adjusting PTS using programDateTime delta "+(i-s)+"ms, sliding:"+a.toFixed(3)+" "+u.url+" "),E(a,u))}}function b(u,r){var s=u.programDateTime;if(!!s){var i=(s-r)/1e3;u.start=u.startPTS=i,u.endPTS=i+u.duration}}function A(u,r){if(!(!r.fragments.length||!u.hasProgramDateTime||!r.hasProgramDateTime)){var s=r.fragments[0].programDateTime,i=r.fragments[0].start,a=s-i*1e3;u.fragments.forEach(function(d){b(d,a)}),u.fragmentHint&&b(u.fragmentHint,a),u.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/utils/ewma.ts"),n=function(){function v(T,L,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l.default(T),this.fast_=new l.default(L)}var R=v.prototype;return R.update=function(L,_){var E=this.slow_,I=this.fast_;this.slow_.halfLife!==L&&(this.slow_=new l.default(L,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new l.default(_,I.getEstimate(),I.getTotalWeight()))},R.sample=function(L,_){L=Math.max(L,this.minDelayMs_);var E=8*_,I=L/1e3,M=E/I;this.fast_.sample(I,M),this.slow_.sample(I,M)},R.canEstimate=function(){var L=this.fast_;return L&&L.getTotalWeight()>=this.minWeight_},R.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},R.destroy=function(){},v}();e.default=n},"./src/utils/ewma.ts":function(h,e,t){"use strict";t.r(e);var l=function(){function n(R,T,L){T===void 0&&(T=0),L===void 0&&(L=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=R,this.alpha_=R?Math.exp(Math.log(.5)/R):0,this.estimate_=T,this.totalWeight_=L}var v=n.prototype;return v.sample=function(T,L){var _=Math.pow(this.alpha_,T);this.estimate_=L*(1-_)+_*this.estimate_,this.totalWeight_+=T},v.getTotalWeight=function(){return this.totalWeight_},v.getEstimate=function(){if(this.alpha_){var T=1-Math.pow(this.alpha_,this.totalWeight_);if(T)return this.estimate_/T}return this.estimate_},n}();e.default=l},"./src/utils/fetch-loader.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"fetchSupported",function(){return b});var l=t("./src/polyfills/number.ts"),n=t("./src/loader/load-stats.ts"),v=t("./src/demux/chunk-cache.ts");function R(i,a){i.prototype=Object.create(a.prototype),i.prototype.constructor=i,I(i,a)}function T(i){var a=typeof Map=="function"?new Map:void 0;return T=function(o){if(o===null||!E(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(o))return a.get(o);a.set(o,y)}function y(){return L(o,arguments,M(this).constructor)}return y.prototype=Object.create(o.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),I(y,o)},T(i)}function L(i,a,d){return _()?L=Reflect.construct:L=function(y,p,m){var g=[null];g.push.apply(g,p);var f=Function.bind.apply(y,g),c=new f;return m&&I(c,m.prototype),c},L.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function E(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function I(i,a){return I=Object.setPrototypeOf||function(o,y){return o.__proto__=y,o},I(i,a)}function M(i){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},M(i)}function D(){return D=Object.assign||function(i){for(var a=1;a<arguments.length;a++){var d=arguments[a];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(i[o]=d[o])}return i},D.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var A=function(){function i(d){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=d.fetchSetup||r,this.controller=new self.AbortController,this.stats=new n.LoadStats}var a=i.prototype;return a.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},a.abortInternal=function(){var o=this.response;(!o||!o.ok)&&(this.stats.aborted=!0,this.controller.abort())},a.abort=function(){var o;this.abortInternal(),(o=this.callbacks)!==null&&o!==void 0&&o.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},a.load=function(o,y,p){var m=this,g=this.stats;if(g.loading.start)throw new Error("Loader can only be used once.");g.loading.start=self.performance.now();var f=u(o,this.controller.signal),c=p.onProgress,x=o.responseType==="arraybuffer",S=x?"byteLength":"length";this.context=o,this.config=y,this.callbacks=p,this.request=this.fetchSetup(o,f),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),p.onTimeout(g,o,m.response)},y.timeout),self.fetch(this.request).then(function(C){if(m.response=m.loader=C,!C.ok){var O=C.status,P=C.statusText;throw new s(P||"fetch, bad network response",O,C)}return g.loading.first=Math.max(self.performance.now(),g.loading.start),g.total=parseInt(C.headers.get("Content-Length")||"0"),c&&Object(l.isFiniteNumber)(y.highWaterMark)?m.loadProgressively(C,g,o,y.highWaterMark,c):x?C.arrayBuffer():C.text()}).then(function(C){var O=m.response;self.clearTimeout(m.requestTimeout),g.loading.end=Math.max(self.performance.now(),g.loading.first),g.loaded=g.total=C[S];var P={url:O.url,data:C};c&&!Object(l.isFiniteNumber)(y.highWaterMark)&&c(g,o,C,O),p.onSuccess(P,g,o,O)}).catch(function(C){if(self.clearTimeout(m.requestTimeout),!g.aborted){var O=C.code||0;p.onError({code:O,text:C.message},o,C.details)}})},a.getCacheAge=function(){var o=null;if(this.response){var y=this.response.headers.get("age");o=y?parseFloat(y):null}return o},a.loadProgressively=function(o,y,p,m,g){m===void 0&&(m=0);var f=new v.default,c=o.body.getReader(),x=function S(){return c.read().then(function(C){if(C.done)return f.dataLength&&g(y,p,f.flush(),o),Promise.resolve(new ArrayBuffer(0));var O=C.value,P=O.length;return y.loaded+=P,P<m||f.dataLength?(f.push(O),f.dataLength>=m&&g(y,p,f.flush(),o)):g(y,p,O,o),S()}).catch(function(){return Promise.reject()})};return x()},i}();function u(i,a){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:a,headers:new self.Headers(D({},i.headers))};return i.rangeEnd&&d.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),d}function r(i,a){return new self.Request(i.url,a)}var s=function(i){R(a,i);function a(d,o,y){var p;return p=i.call(this,d)||this,p.code=void 0,p.details=void 0,p.code=o,p.details=y,p}return a}(T(Error));e.default=A},"./src/utils/imsc1-ttml-parser.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"IMSC1_CODEC",function(){return E}),t.d(e,"parseIMSC1",function(){return b});var l=t("./src/utils/mp4-tools.ts"),n=t("./src/utils/vttparser.ts"),v=t("./src/utils/vttcue.ts"),R=t("./src/demux/id3.ts"),T=t("./src/utils/timescale-conversion.ts"),L=t("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(m){for(var g=1;g<arguments.length;g++){var f=arguments[g];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(m[c]=f[c])}return m},_.apply(this,arguments)}var E="stpp.ttml.im1t",I=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,D={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(m,g,f,c,x){var S=Object(l.findBox)(new Uint8Array(m),["mdat"]);if(S.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var C=S[0],O=Object(R.utf8ArrayToStr)(new Uint8Array(m,C.start,C.end-C.start)),P=Object(T.toTimescaleFromScale)(g,1,f);try{c(A(O,P))}catch(w){x(w)}}function A(m,g){var f=new DOMParser,c=f.parseFromString(m,"text/xml"),x=c.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},C=Object.keys(S).reduce(function(k,N){return k[N]=x.getAttribute("ttp:"+N)||S[N],k},{}),O=x.getAttribute("xml:space")!=="preserve",P=r(u(x,"styling","style")),w=r(u(x,"layout","region")),U=u(x,"body","[begin]");return[].map.call(U,function(k){var N=s(k,O);if(!N||!k.hasAttribute("begin"))return null;var B=o(k.getAttribute("begin"),C),K=o(k.getAttribute("dur"),C),W=o(k.getAttribute("end"),C);if(B===null)throw d(k);if(W===null){if(K===null)throw d(k);W=B+K}var F=new v.default(B-g,W-g,N);F.id=Object(L.generateCueId)(F.startTime,F.endTime,F.text);var H=w[k.getAttribute("region")],Y=P[k.getAttribute("style")];F.position=10,F.size=80;var $=i(H,Y),Z=$.textAlign;if(Z){var q=D[Z];q&&(F.lineAlign=q),F.align=Z}return _(F,$),F}).filter(function(k){return k!==null})}function u(m,g,f){var c=m.getElementsByTagName(g)[0];return c?[].slice.call(c.querySelectorAll(f)):[]}function r(m){return m.reduce(function(g,f){var c=f.getAttribute("xml:id");return c&&(g[c]=f),g},{})}function s(m,g){return[].slice.call(m.childNodes).reduce(function(f,c,x){var S;return c.nodeName==="br"&&x?f+`
20
+ `:(S=c.childNodes)!==null&&S!==void 0&&S.length?s(c,g):g?f+c.textContent.trim().replace(/\s+/g," "):f+c.textContent},"")}function i(m,g){var f="http://www.w3.org/ns/ttml#styling",c=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return c.reduce(function(x,S){var C=a(g,f,S)||a(m,f,S);return C&&(x[S]=C),x},{})}function a(m,g,f){return m.hasAttributeNS(g,f)?m.getAttributeNS(g,f):null}function d(m){return new Error("Could not parse ttml timestamp "+m)}function o(m,g){if(!m)return null;var f=Object(n.parseTimeStamp)(m);return f===null&&(I.test(m)?f=y(m,g):M.test(m)&&(f=p(m,g))),f}function y(m,g){var f=I.exec(m),c=(f[4]|0)+(f[5]|0)/g.subFrameRate;return(f[1]|0)*3600+(f[2]|0)*60+(f[3]|0)+c/g.frameRate}function p(m,g){var f=M.exec(m),c=Number(f[1]),x=f[2];switch(x){case"h":return c*3600;case"m":return c*60;case"ms":return c*1e3;case"f":return c/g.frameRate;case"t":return c/g.tickRate}return c}},"./src/utils/logger.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"enableLogs",function(){return L}),t.d(e,"logger",function(){return _});var l=function(){},n={trace:l,debug:l,log:l,warn:l,info:l,error:l},v=n;function R(E){var I=self.console[E];return I?I.bind(self.console,"["+E+"] >"):l}function T(E){for(var I=arguments.length,M=new Array(I>1?I-1:0),D=1;D<I;D++)M[D-1]=arguments[D];M.forEach(function(b){v[b]=E[b]?E[b].bind(E):R(b)})}function L(E){if(self.console&&E===!0||typeof E=="object"){T(E,"debug","log","info","warn","error");try{v.log()}catch{v=n}}else v=n}var _=v},"./src/utils/mediakeys-helper.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"KeySystems",function(){return l}),t.d(e,"requestMediaKeySystemAccess",function(){return n});var l;(function(v){v.WIDEVINE="com.widevine.alpha",v.PLAYREADY="com.microsoft.playready"})(l||(l={}));var n=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"getMediaSource",function(){return l});function l(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"bin2str",function(){return T}),t.d(e,"readUint16",function(){return L}),t.d(e,"readUint32",function(){return _}),t.d(e,"writeUint32",function(){return E}),t.d(e,"findBox",function(){return I}),t.d(e,"parseSegmentIndex",function(){return M}),t.d(e,"parseInitSegment",function(){return D}),t.d(e,"getStartDTS",function(){return b}),t.d(e,"getDuration",function(){return A}),t.d(e,"computeRawDurationFromSamples",function(){return u}),t.d(e,"offsetStartDTS",function(){return r}),t.d(e,"segmentValidRange",function(){return s}),t.d(e,"appendUint8Array",function(){return i});var l=t("./src/utils/typed-array.ts"),n=t("./src/loader/fragment.ts"),v=Math.pow(2,32)-1,R=[].push;function T(a){return String.fromCharCode.apply(null,a)}function L(a,d){"data"in a&&(d+=a.start,a=a.data);var o=a[d]<<8|a[d+1];return o<0?65536+o:o}function _(a,d){"data"in a&&(d+=a.start,a=a.data);var o=a[d]<<24|a[d+1]<<16|a[d+2]<<8|a[d+3];return o<0?4294967296+o:o}function E(a,d,o){"data"in a&&(d+=a.start,a=a.data),a[d]=o>>24,a[d+1]=o>>16&255,a[d+2]=o>>8&255,a[d+3]=o&255}function I(a,d){var o=[];if(!d.length)return o;var y,p,m;"data"in a?(y=a.data,p=a.start,m=a.end):(y=a,p=0,m=y.byteLength);for(var g=p;g<m;){var f=_(y,g),c=T(y.subarray(g+4,g+8)),x=f>1?g+f:m;if(c===d[0])if(d.length===1)o.push({data:y,start:g+8,end:x});else{var S=I({data:y,start:g+8,end:x},d.slice(1));S.length&&R.apply(o,S)}g=x}return o}function M(a){var d=I(a,["moov"]),o=d[0],y=o?o.end:null,p=I(a,["sidx"]);if(!p||!p[0])return null;var m=[],g=p[0],f=g.data[0],c=f===0?8:16,x=_(g,c);c+=4;var S=0,C=0;f===0?c+=8:c+=16,c+=2;var O=g.end+C,P=L(g,c);c+=2;for(var w=0;w<P;w++){var U=c,k=_(g,U);U+=4;var N=k&2147483647,B=(k&2147483648)>>>31;if(B===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var K=_(g,U);U+=4,m.push({referenceSize:N,subsegmentDuration:K,info:{duration:K/x,start:O,end:O+N-1}}),O+=N,U+=4,c=U}return{earliestPresentationTime:S,timescale:x,version:f,referencesCount:P,references:m,moovEndOffset:y}}function D(a){for(var d=[],o=I(a,["moov","trak"]),y=0;y<o.length;y++){var p=o[y],m=I(p,["tkhd"])[0];if(m){var g=m.data[m.start],f=g===0?12:20,c=_(m,f),x=I(p,["mdia","mdhd"])[0];if(x){g=x.data[x.start],f=g===0?12:20;var S=_(x,f),C=I(p,["mdia","hdlr"])[0];if(C){var O=T(C.data.subarray(C.start+8,C.start+12)),P={soun:n.ElementaryStreamTypes.AUDIO,vide:n.ElementaryStreamTypes.VIDEO}[O];if(P){var w=I(p,["mdia","minf","stbl","stsd"])[0],U=void 0;w&&(U=T(w.data.subarray(w.start+12,w.start+16))),d[c]={timescale:S,type:P},d[P]={timescale:S,id:c,codec:U}}}}}}var k=I(a,["moov","mvex","trex"]);return k.forEach(function(N){var B=_(N,4),K=d[B];K&&(K.default={duration:_(N,12),flags:_(N,20)})}),d}function b(a,d){return I(d,["moof","traf"]).reduce(function(o,y){var p=I(y,["tfdt"])[0],m=p.data[p.start],g=I(y,["tfhd"]).reduce(function(f,c){var x=_(c,4),S=a[x];if(S){var C=_(p,4);m===1&&(C*=Math.pow(2,32),C+=_(p,8));var O=S.timescale||9e4,P=C/O;if(isFinite(P)&&(f===null||P<f))return P}return f},null);return g!==null&&isFinite(g)&&(o===null||g<o)?g:o},null)||0}function A(a,d){for(var o=0,y=0,p=0,m=I(a,["moof","traf"]),g=0;g<m.length;g++){var f=m[g],c=I(f,["tfhd"])[0],x=_(c,4),S=d[x];if(!!S){var C=S.default,O=_(c,0)|(C==null?void 0:C.flags),P=C==null?void 0:C.duration;O&8&&(O&2?P=_(c,12):P=_(c,8));for(var w=S.timescale||9e4,U=I(f,["trun"]),k=0;k<U.length;k++){if(o=u(U[k]),!o&&P){var N=_(U[k],4);o=P*N}S.type===n.ElementaryStreamTypes.VIDEO?y+=o/w:S.type===n.ElementaryStreamTypes.AUDIO&&(p+=o/w)}}}if(y===0&&p===0){var B=M(a);if(B!=null&&B.references)return B.references.reduce(function(K,W){return K+W.info.duration||0},0)}return y||p}function u(a){var d=_(a,0),o=8;d&1&&(o+=4),d&4&&(o+=4);for(var y=0,p=_(a,4),m=0;m<p;m++){if(d&256){var g=_(a,o);y+=g,o+=4}d&512&&(o+=4),d&1024&&(o+=4),d&2048&&(o+=4)}return y}function r(a,d,o){I(d,["moof","traf"]).forEach(function(y){I(y,["tfhd"]).forEach(function(p){var m=_(p,4),g=a[m];if(!!g){var f=g.timescale||9e4;I(y,["tfdt"]).forEach(function(c){var x=c.data[c.start],S=_(c,4);if(x===0)E(c,4,S-o*f);else{S*=Math.pow(2,32),S+=_(c,8),S-=o*f,S=Math.max(S,0);var C=Math.floor(S/(v+1)),O=Math.floor(S%(v+1));E(c,4,C),E(c,8,O)}})}})})}function s(a){var d={valid:null,remainder:null},o=I(a,["moof"]);if(o){if(o.length<2)return d.remainder=a,d}else return d;var y=o[o.length-1];return d.valid=Object(l.sliceUint8)(a,0,y.start-8),d.remainder=Object(l.sliceUint8)(a,y.start-8),d}function i(a,d){var o=new Uint8Array(a.length+d.length);return o.set(a),o.set(d,a.length),o}},"./src/utils/output-filter.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"default",function(){return l});var l=function(){function n(R,T){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=R,this.trackName=T}var v=n.prototype;return v.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},v.newCue=function(T,L,_){(this.startTime===null||this.startTime>T)&&(this.startTime=T),this.endTime=L,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},v.reset=function(){this.cueRanges=[],this.startTime=null},n}()},"./src/utils/texttrack-utils.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"sendAddTrackEvent",function(){return n}),t.d(e,"addCueToTrack",function(){return v}),t.d(e,"clearCurrentCues",function(){return R}),t.d(e,"removeCuesInRange",function(){return T}),t.d(e,"getCuesInRange",function(){return _});var l=t("./src/utils/logger.ts");function n(E,I){var M;try{M=new Event("addtrack")}catch{M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=E,I.dispatchEvent(M)}function v(E,I){var M=E.mode;if(M==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(I.id))try{if(E.addCue(I),!E.cues.getCueById(I.id))throw new Error("addCue is failed for: "+I)}catch(b){l.logger.debug("[texttrack-utils]: "+b);var D=new self.TextTrackCue(I.startTime,I.endTime,I.text);D.id=I.id,E.addCue(D)}M==="disabled"&&(E.mode=M)}function R(E){var I=E.mode;if(I==="disabled"&&(E.mode="hidden"),E.cues)for(var M=E.cues.length;M--;)E.removeCue(E.cues[M]);I==="disabled"&&(E.mode=I)}function T(E,I,M){var D=E.mode;if(D==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var b=_(E.cues,I,M),A=0;A<b.length;A++)E.removeCue(b[A]);D==="disabled"&&(E.mode=D)}function L(E,I){if(I<E[0].startTime)return 0;var M=E.length-1;if(I>E[M].endTime)return-1;for(var D=0,b=M;D<=b;){var A=Math.floor((b+D)/2);if(I<E[A].startTime)b=A-1;else if(I>E[A].startTime&&D<M)D=A+1;else return A}return E[D].startTime-I<I-E[b].startTime?D:b}function _(E,I,M){var D=[],b=L(E,I);if(b>-1)for(var A=b,u=E.length;A<u;A++){var r=E[A];if(r.startTime>=I&&r.endTime<=M)D.push(r);else if(r.startTime>M)return D}return D}},"./src/utils/time-ranges.ts":function(h,e,t){"use strict";t.r(e);var l={toString:function(v){for(var R="",T=v.length,L=0;L<T;L++)R+="["+v.start(L).toFixed(3)+","+v.end(L).toFixed(3)+"]";return R}};e.default=l},"./src/utils/timescale-conversion.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"toTimescaleFromBase",function(){return n}),t.d(e,"toTimescaleFromScale",function(){return v}),t.d(e,"toMsFromMpegTsClock",function(){return R}),t.d(e,"toMpegTsClockFromTimescale",function(){return T});var l=9e4;function n(L,_,E,I){E===void 0&&(E=1),I===void 0&&(I=!1);var M=L*_*E;return I?Math.round(M):M}function v(L,_,E,I){return E===void 0&&(E=1),I===void 0&&(I=!1),n(L,_,1/E,I)}function R(L,_){return _===void 0&&(_=!1),n(L,1e3,1/l,_)}function T(L,_){return _===void 0&&(_=1),n(L,l,1/_)}},"./src/utils/typed-array.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"sliceUint8",function(){return l});function l(n,v,R){return Uint8Array.prototype.slice?n.slice(v,R):new Uint8Array(Array.prototype.slice.call(n,v,R))}},"./src/utils/vttcue.ts":function(h,e,t){"use strict";t.r(e),e.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var l=["","lr","rl"],n=["start","middle","end","left","right"];function v(E,I){if(typeof I!="string"||!Array.isArray(E))return!1;var M=I.toLowerCase();return~E.indexOf(M)?M:!1}function R(E){return v(l,E)}function T(E){return v(n,E)}function L(E){for(var I=arguments.length,M=new Array(I>1?I-1:0),D=1;D<I;D++)M[D-1]=arguments[D];for(var b=1;b<arguments.length;b++){var A=arguments[b];for(var u in A)E[u]=A[u]}return E}function _(E,I,M){var D=this,b={enumerable:!0};D.hasBeenReset=!1;var A="",u=!1,r=E,s=I,i=M,a=null,d="",o=!0,y="auto",p="start",m=50,g="middle",f=50,c="middle";Object.defineProperty(D,"id",L({},b,{get:function(){return A},set:function(S){A=""+S}})),Object.defineProperty(D,"pauseOnExit",L({},b,{get:function(){return u},set:function(S){u=!!S}})),Object.defineProperty(D,"startTime",L({},b,{get:function(){return r},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");r=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"endTime",L({},b,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"text",L({},b,{get:function(){return i},set:function(S){i=""+S,this.hasBeenReset=!0}})),Object.defineProperty(D,"region",L({},b,{get:function(){return a},set:function(S){a=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"vertical",L({},b,{get:function(){return d},set:function(S){var C=R(S);if(C===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=C,this.hasBeenReset=!0}})),Object.defineProperty(D,"snapToLines",L({},b,{get:function(){return o},set:function(S){o=!!S,this.hasBeenReset=!0}})),Object.defineProperty(D,"line",L({},b,{get:function(){return y},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");y=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"lineAlign",L({},b,{get:function(){return p},set:function(S){var C=T(S);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");p=C,this.hasBeenReset=!0}})),Object.defineProperty(D,"position",L({},b,{get:function(){return m},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"positionAlign",L({},b,{get:function(){return g},set:function(S){var C=T(S);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");g=C,this.hasBeenReset=!0}})),Object.defineProperty(D,"size",L({},b,{get:function(){return f},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");f=S,this.hasBeenReset=!0}})),Object.defineProperty(D,"align",L({},b,{get:function(){return c},set:function(S){var C=T(S);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");c=C,this.hasBeenReset=!0}})),D.displayState=void 0}return _.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"parseTimeStamp",function(){return v}),t.d(e,"fixLineBreaks",function(){return I}),t.d(e,"VTTParser",function(){return M});var l=t("./src/utils/vttcue.ts"),n=function(){function D(){}var b=D.prototype;return b.decode=function(u,r){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},D}();function v(D){function b(u,r,s,i){return(u|0)*3600+(r|0)*60+(s|0)+parseFloat(i||0)}var A=D.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return A?parseFloat(A[2])>59?b(A[2],A[3],0,A[4]):b(A[1],A[2],A[3],A[4]):null}var R=function(){function D(){this.values=Object.create(null)}var b=D.prototype;return b.set=function(u,r){!this.get(u)&&r!==""&&(this.values[u]=r)},b.get=function(u,r,s){return s?this.has(u)?this.values[u]:r[s]:this.has(u)?this.values[u]:r},b.has=function(u){return u in this.values},b.alt=function(u,r,s){for(var i=0;i<s.length;++i)if(r===s[i]){this.set(u,r);break}},b.integer=function(u,r){/^-?\d+$/.test(r)&&this.set(u,parseInt(r,10))},b.percent=function(u,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var s=parseFloat(r);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},D}();function T(D,b,A,u){var r=u?D.split(u):[D];for(var s in r)if(typeof r[s]=="string"){var i=r[s].split(A);if(i.length===2){var a=i[0],d=i[1];b(a,d)}}}var L=new l.default(0,0,""),_=L.align==="middle"?"middle":"center";function E(D,b,A){var u=D;function r(){var a=v(D);if(a===null)throw new Error("Malformed timestamp: "+u);return D=D.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,d){var o=new R;T(a,function(m,g){var f;switch(m){case"region":for(var c=A.length-1;c>=0;c--)if(A[c].id===g){o.set(m,A[c].region);break}break;case"vertical":o.alt(m,g,["rl","lr"]);break;case"line":f=g.split(","),o.integer(m,f[0]),o.percent(m,f[0])&&o.set("snapToLines",!1),o.alt(m,f[0],["auto"]),f.length===2&&o.alt("lineAlign",f[1],["start",_,"end"]);break;case"position":f=g.split(","),o.percent(m,f[0]),f.length===2&&o.alt("positionAlign",f[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":o.percent(m,g);break;case"align":o.alt(m,g,["start",_,"end","left","right"]);break}},/:/,/\s/),d.region=o.get("region",null),d.vertical=o.get("vertical","");var y=o.get("line","auto");y==="auto"&&L.line===-1&&(y=-1),d.line=y,d.lineAlign=o.get("lineAlign","start"),d.snapToLines=o.get("snapToLines",!0),d.size=o.get("size",100),d.align=o.get("align",_);var p=o.get("position","auto");p==="auto"&&L.position===50&&(p=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=p}function i(){D=D.replace(/^\s+/,"")}if(i(),b.startTime=r(),i(),D.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);D=D.substr(3),i(),b.endTime=r(),i(),s(D,b)}function I(D){return D.replace(/<br(?: \/)?>/gi,`
21
+ `)}var M=function(){function D(){this.state="INITIAL",this.buffer="",this.decoder=new n,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=D.prototype;return b.parse=function(u){var r=this;u&&(r.buffer+=r.decoder.decode(u,{stream:!0}));function s(){var p=r.buffer,m=0;for(p=I(p);m<p.length&&p[m]!=="\r"&&p[m]!==`
22
+ `;)++m;var g=p.substr(0,m);return p[m]==="\r"&&++m,p[m]===`
23
+ `&&++m,r.buffer=p.substr(m),g}function i(p){T(p,function(m,g){},/:/)}try{var a="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;a=s();var d=a.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var o=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(o?o=!1:a=s(),r.state){case"HEADER":/:/.test(a)?i(a):a||(r.state="ID");continue;case"NOTE":a||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){r.state="NOTE";break}if(!a)continue;if(r.cue=new l.default(0,0,""),r.state="CUE",a.indexOf("-->")===-1){r.cue.id=a;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{E(a,r.cue,r.regionList)}catch{r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var y=a.indexOf("-->")!==-1;if(!a||y&&(o=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
24
+ `),r.cue.text+=a}continue;case"BADCUE":a||(r.state="ID")}}}catch{r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
25
+
26
+ `,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){u.onparsingerror&&u.onparsingerror(r)}return u.onflush&&u.onflush(),this},D}()},"./src/utils/webvtt-parser.ts":function(h,e,t){"use strict";t.r(e),t.d(e,"generateCueId",function(){return M}),t.d(e,"parseWebVTT",function(){return b});var l=t("./src/polyfills/number.ts"),n=t("./src/utils/vttparser.ts"),v=t("./src/demux/id3.ts"),R=t("./src/utils/timescale-conversion.ts"),T=t("./src/remux/mp4-remuxer.ts"),L=/\r\n|\n\r|\n|\r/g,_=function(u,r,s){return s===void 0&&(s=0),u.substr(s,r.length)===r},E=function(u){var r=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),i=parseInt(u.substr(-9,2)),a=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(l.isFiniteNumber)(r)||!Object(l.isFiniteNumber)(s)||!Object(l.isFiniteNumber)(i)||!Object(l.isFiniteNumber)(a))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return r+=1e3*s,r+=60*1e3*i,r+=60*60*1e3*a,r},I=function(u){for(var r=5381,s=u.length;s;)r=r*33^u.charCodeAt(--s);return(r>>>0).toString()};function M(A,u,r){return I(A.toString())+I(u.toString())+I(r)}var D=function(u,r,s){var i=u[r],a=u[i.prevCC];if(!a||!a.new&&i.new){u.ccOffset=u.presentationOffset=i.start,i.new=!1;return}for(;(d=a)!==null&&d!==void 0&&d.new;){var d;u.ccOffset+=i.start-a.start,i.new=!1,i=a,a=u[i.prevCC]}u.presentationOffset=s};function b(A,u,r,s,i,a,d,o){var y=new n.VTTParser,p=Object(v.utf8ArrayToStr)(new Uint8Array(A)).trim().replace(L,`
27
+ `).split(`
28
+ `),m=[],g=Object(R.toMpegTsClockFromTimescale)(u,r),f="00:00.000",c=0,x=0,S,C=!0,O=!1;y.oncue=function(P){var w=s[i],U=s.ccOffset,k=(c-g)/9e4;if(w!=null&&w.new&&(x!==void 0?U=s.ccOffset=w.start:D(s,i,k)),k&&(U=k-s.presentationOffset),O){var N=P.endTime-P.startTime,B=Object(T.normalizePts)((P.startTime+U-x)*9e4,a*9e4)/9e4;P.startTime=B,P.endTime=B+N}var K=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(K)),P.id||(P.id=M(P.startTime,P.endTime,K)),P.endTime>0&&m.push(P)},y.onparsingerror=function(P){S=P},y.onflush=function(){if(S){o(S);return}d(m)},p.forEach(function(P){if(C)if(_(P,"X-TIMESTAMP-MAP=")){C=!1,O=!0,P.substr(16).split(",").forEach(function(w){_(w,"LOCAL:")?f=w.substr(6):_(w,"MPEGTS:")&&(c=parseInt(w.substr(7)))});try{x=E(f)/1e3}catch(w){O=!1,S=w}return}else P===""&&(C=!1);y.parse(P+`
29
+ `)}),y.flush()}},"./src/utils/xhr-loader.ts":function(h,e,t){"use strict";t.r(e);var l=t("./src/utils/logger.ts"),n=t("./src/loader/load-stats.ts"),v=/^age:\s*[\d.]+\s*$/m,R=function(){function T(_){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=_?_.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var L=T.prototype;return L.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},L.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},L.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},L.load=function(E,I,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=I,this.callbacks=M,this.retryDelay=I.retryDelay,this.loadInternal()},L.loadInternal=function(){var E=this.config,I=this.context;if(!!E){var M=this.loader=new self.XMLHttpRequest,D=this.stats;D.loading.first=0,D.loaded=0;var b=this.xhrSetup;try{if(b)try{b(M,I.url)}catch{M.open("GET",I.url,!0),b(M,I.url)}M.readyState||M.open("GET",I.url,!0);var A=this.context.headers;if(A)for(var u in A)M.setRequestHeader(u,A[u])}catch(r){this.callbacks.onError({code:M.status,text:r.message},I,M);return}I.rangeEnd&&M.setRequestHeader("Range","bytes="+I.rangeStart+"-"+(I.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=I.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),M.send()}},L.readystatechange=function(){var E=this.context,I=this.loader,M=this.stats;if(!(!E||!I)){var D=I.readyState,b=this.config;if(!M.aborted&&D>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),D===4){I.onreadystatechange=null,I.onprogress=null;var A=I.status;if(A>=200&&A<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var u,r;if(E.responseType==="arraybuffer"?(u=I.response,r=u.byteLength):(u=I.responseText,r=u.length),M.loaded=M.total=r,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(M,E,u,I),!this.callbacks)return;var i={url:I.responseURL,data:u};this.callbacks.onSuccess(i,M,E,I)}else M.retry>=b.maxRetry||A>=400&&A<499?(l.logger.error(A+" while loading "+E.url),this.callbacks.onError({code:A,text:I.statusText},E,I)):(l.logger.warn(A+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,b.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)}},L.loadtimeout=function(){l.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},L.loadprogress=function(E){var I=this.stats;I.loaded=E.loaded,E.lengthComputable&&(I.total=E.total)},L.getCacheAge=function(){var E=null;if(this.loader&&v.test(this.loader.getAllResponseHeaders())){var I=this.loader.getResponseHeader("age");E=I?parseFloat(I):null}return E},T}();e.default=R}}).default})});var di=mr(on()),ft=mr(pr()),ci=mr(pr()),Pt=mr(pr()),ln=(h,e,t)=>{if(!e.has(h))throw TypeError("Cannot "+t)},yo=(h,e,t)=>(ln(h,e,"read from private field"),t?t.call(h):e.get(h)),To=(h,e,t)=>{if(e.has(h))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(h):e.set(h,t)},bo=(h,e,t,l)=>(ln(h,e,"write to private field"),l?l.call(h,t):e.set(h,t),t);if(typeof DocumentFragment=="undefined"){class h{}globalThis.DocumentFragment=h}globalThis.customElements||(globalThis.customElements={get(h){},define(h,e,t){},upgrade(h){},whenDefined(h){return Promise.resolve(globalThis.HTMLElement)}});var Er;if(!globalThis.CustomEvent){class h{constructor(t,l={}){To(this,Er,void 0),bo(this,Er,l==null?void 0:l.detail)}get detail(){yo(this,Er)}initCustomEvent(t,l,n,v){}}Er=new WeakMap,globalThis.CustomEvent=h}if(!globalThis.EventTarget){class h{addEventListener(){}removeEventListener(){}dispatchEvent(t){return!0}}globalThis.EventTarget=h}if(!globalThis.HTMLElement){class h extends EventTarget{}globalThis.HTMLElement=h}if(!globalThis.HTMLVideoElement){class h extends EventTarget{}globalThis.HTMLVideoElement=h}var un,dn;if(!((un=globalThis.document)==null?void 0:un.createElement)){let h=(dn=globalThis.document)!=null?dn:{};h.createElement=function(e,t){return new HTMLElement},globalThis.document=h}var fi={ANY:"any",MUTED:"muted"},Ao=Object.values(fi),cn=h=>typeof h=="boolean"||typeof h=="string"&&Ao.includes(h),fn=(h,e,t)=>{let l=!1,n=!1,v=cn(e)?e:!!e,R=()=>{h.addEventListener("playing",()=>{l=!0},{once:!0})};if(R(),h.addEventListener("loadstart",()=>{l=!1,R(),hi(h,v)},{once:!0}),h.addEventListener("loadedmetadata",()=>{t||(n=!Number.isFinite(h.duration)),hi(h,v)},{once:!0}),t&&t.once(ci.default.Events.LEVEL_LOADED,(T,L)=>{var _;n=(_=L.details.live)!=null?_:!1}),!v){let T=()=>{!n||((t==null?void 0:t.liveSyncPosition)?h.currentTime=t.liveSyncPosition:Number.isFinite(h.seekable.end(0))&&(h.currentTime=h.seekable.end(0)))};h.addEventListener("play",()=>{t&&h.preload==="metadata"?t.once(ci.default.Events.LEVEL_UPDATED,T):t&&T()},{once:!0})}return T=>{l||(v=cn(T)?T:!!T,hi(h,v))}},hi=(h,e)=>{if(!e)return;let t=h.muted,l=()=>h.muted=t;switch(e){case fi.ANY:h.play().catch(n=>{h.muted=!0,h.play().catch(l)});break;case fi.MUTED:h.muted=!0,h.play().catch(l);break;default:h.play().catch(()=>{});break}},zt=class extends Error{constructor(h,e=zt.MEDIA_ERR_CUSTOM,t){super(h);var l;this.name="MediaError",this.code=e,this.fatal=t!=null?t:e>=zt.MEDIA_ERR_NETWORK&&e<=zt.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(l=zt.defaultMessages[this.code])!=null?l:"")}},Oe=zt;Oe.MEDIA_ERR_ABORTED=1,Oe.MEDIA_ERR_NETWORK=2,Oe.MEDIA_ERR_DECODE=3,Oe.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Oe.MEDIA_ERR_ENCRYPTED=5,Oe.MEDIA_ERR_CUSTOM=100,Oe.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};function So(h,e){e.on(Pt.default.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(n,{tracks:v})=>{v.forEach(R=>{var T;let L=(T=R.subtitleTrack)!=null?T:R.closedCaptions,_=e.subtitleTracks.findIndex(({lang:E,name:I,type:M})=>E==(L==null?void 0:L.lang)&&I===R.label&&M.toLowerCase()===R.kind);_o(h,R.kind,R.label,L==null?void 0:L.lang,`${R.kind}${_}`)})});let t=()=>{var n;if(!e.subtitleTracks.length)return;let v=Array.from(h.textTracks).find(T=>T.id&&T.mode==="showing"&&["subtitles","captions"].includes(T.kind)),R=`${(n=e.subtitleTracks[e.subtitleTrack])==null?void 0:n.type.toLowerCase()}${e.subtitleTrack}`;if(v&&(e.subtitleTrack<0||(v==null?void 0:v.id)!==R)){let T=e.subtitleTracks.findIndex(({lang:L,name:_,type:E})=>L==v.language&&_===v.label&&E.toLowerCase()===v.kind);e.subtitleTrack=T}v&&(v==null?void 0:v.id)===R&&v.cues&&Array.from(v.cues).forEach(T=>{v.addCue(T)})};h.textTracks.addEventListener("change",t),e.on(Pt.default.Events.CUES_PARSED,(n,{track:v,type:R,cues:T})=>{let L=h.textTracks.getTrackById(v);if(!L)return;let _=L.mode==="disabled";_&&(L.mode="hidden"),T.forEach(E=>{var I;((I=L.cues)==null?void 0:I.getCueById(E.id))||L.addCue(E)}),_&&(L.mode="disabled")}),e.on(Pt.default.Events.DESTROYING,()=>{h.textTracks.removeEventListener("change",t),h.querySelectorAll("track").forEach(n=>{!(n.id&&["subtitles","captions"].includes(n.kind))||!e.subtitleTracks.some(({type:v},R)=>n.id===`${v.toLowerCase()}${R}`)||h.removeChild(n)})});let l=()=>{Array.from(h.textTracks).forEach(n=>{var v,R;if(!["subtitles","caption"].includes(n.kind)&&n.label==="thumbnails"){if(!((v=n.cues)==null?void 0:v.length)){let T=h.querySelector('track[label="thumbnails"]'),L=(R=T==null?void 0:T.getAttribute("src"))!=null?R:"";T==null||T.removeAttribute("src"),setTimeout(()=>{T==null||T.setAttribute("src",L)},0)}n.mode!=="hidden"&&(n.mode="hidden")}})};e.once(Pt.default.Events.MANIFEST_LOADED,l),e.once(Pt.default.Events.MEDIA_ATTACHED,l)}function _o(h,e,t,l,n){let v=document.createElement("track");return v.kind=e,v.label=t,l&&(v.srclang=l),n&&(v.id=n),v.track.mode="disabled",h.appendChild(v),v.track}var hn=(h,e)=>h in e,vn="mux.com",mn=()=>di.default.utils.now(),ve={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},kt={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},vi={HLS:kt.M3U8},nd=Object.keys(vi),ad=[...Object.values(kt),"hls","HLS"],xo=h=>{let e=h.indexOf("?");if(e<0)return[h];let t=h.slice(0,e),l=h.slice(e);return[t,l]},gn=(h,{domain:e=vn}={})=>{if(!h)return;let[t,l=""]=xo(h);return`https://stream.${e}/${t}.m3u8${l}`},Lo=h=>{let e="";try{e=new URL(h).pathname}catch{console.error("invalid url")}let t=e.lastIndexOf(".");if(t<0)return"";let l=e.slice(t+1).toUpperCase();return hn(l,kt)?kt[l]:""},pn=h=>{let e=h.type;if(e){let l=e.toUpperCase();return hn(l,vi)?vi[l]:e}let{src:t}=h;return t?Lo(t):""},Do=h=>{if([ve.LIVE,ve.LL_LIVE].includes(h)){let e={backBufferLength:12};return h===ve.LL_LIVE?{...e,maxFragLookUpTolerance:.001}:e}return{}},yr=new WeakMap,En=h=>{var e;return(e=yr.get(h))==null?void 0:e.error},mi=(h,e)=>{e&&(e.detachMedia(),e.destroy()),(h==null?void 0:h.mux)&&!h.mux.deleted&&(h.mux.destroy(),h.mux),h&&(h.removeEventListener("error",yn),h.removeEventListener("error",gi),yr.delete(h))},Io=(h,e)=>{var t,l,n;let{debug:v,preferMse:R,streamType:T,startTime:L=-1}=h,_=pn(h),E=_===kt.M3U8,I=!_||((t=e==null?void 0:e.canPlayType(_))!=null?t:!0),M=ft.default.isSupported(),D=((n=(l=window==null?void 0:window.navigator)==null?void 0:l.userAgent)!=null?n:"").toLowerCase().indexOf("android")!==-1&&T===ve.LL_LIVE;if(E&&!(!E||I&&!((R||D)&&M))&&M){let b={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},A=Do(T);return new ft.default({debug:v,startPosition:L,...b,...A})}},Mo=({playbackId:h,src:e,customDomain:t})=>{if(h)return!0;if(typeof e!="string")return!1;let l=new URL(e).hostname.toLocaleLowerCase();return l.includes(vn)||!!t&&l.includes(t.toLocaleLowerCase())},Ro=(h,e,t)=>{let{envKey:l}=h,n=Mo(h);if((l||n)&&e){let{playerInitTime:v,playerSoftwareName:R,playerSoftwareVersion:T,beaconCollectionDomain:L,metadata:_,debug:E}=h,I=M=>typeof M.player_error_code=="string"?!1:typeof h.errorTranslator=="function"?h.errorTranslator(M):M;di.default.monitor(e,{debug:E,beaconCollectionDomain:L,hlsjs:t,Hls:t?ft.default:void 0,automaticErrorTracking:!1,errorTranslator:I,data:{...l?{env_key:l}:{},player_software_name:R,player_software_version:T,player_init_time:v,..._}})}},Co=(h,e,t)=>{var l,n,v;if(!e){console.warn("attempting to load media before mediaEl exists");return}let{preferMse:R,streamType:T}=h,L=pn(h),_=L===kt.M3U8,E=!L||((l=e==null?void 0:e.canPlayType(L))!=null?l:!0),I=ft.default.isSupported(),M=((v=(n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)!=null?v:"").toLowerCase().indexOf("android")!==-1&&T===ve.LL_LIVE,D=!_||E&&!((R||M)&&I),{src:b}=h;if(e&&E&&D){if(typeof b=="string"){let{startTime:A}=h;if(e.setAttribute("src",b),A){let u=({target:r})=>{r.currentTime=A,r.removeEventListener("loadedmetadata",u)};e.addEventListener("loadedmetadata",u)}}else e.removeAttribute("src");e.addEventListener("error",yn),e.addEventListener("error",gi)}else if(t&&b){switch(t.on(ft.default.Events.ERROR,(A,u)=>{let r={[ft.default.ErrorTypes.NETWORK_ERROR]:Oe.MEDIA_ERR_NETWORK,[ft.default.ErrorTypes.MEDIA_ERROR]:Oe.MEDIA_ERR_DECODE},s=new Oe("",r[u.type]);s.fatal=u.fatal,s.data=u,e.dispatchEvent(new CustomEvent("error",{detail:s}))}),e.addEventListener("error",gi),So(e,t),e.preload){case"none":e.addEventListener("play",()=>t.loadSource(b),{once:!0});break;case"metadata":let A=t.config.maxBufferLength,u=t.config.maxBufferSize;t.config.maxBufferLength=1,t.config.maxBufferSize=1,e.addEventListener("play",()=>{t.config.maxBufferLength=A,t.config.maxBufferSize=u},{once:!0}),t.loadSource(b);break;default:t.loadSource(b)}t.attachMedia(e)}else console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};async function yn(h){if(!h.isTrusted)return;h.stopImmediatePropagation();let e=h.target;if(!(e==null?void 0:e.error))return;let{message:t,code:l}=e.error,n=new Oe(t,l);if(e.src&&(l!==Oe.MEDIA_ERR_DECODE||l!==void 0)){let{status:v}=await fetch(e.src);n.data={response:{code:v}}}e.dispatchEvent(new CustomEvent("error",{detail:n}))}function gi(h){var e;if(!(h instanceof CustomEvent)||!(h.detail instanceof Oe))return;let t=h.target,l=h.detail;if(!l||!l.fatal)return;let n=yr.get(t);n&&(n.error=l),(e=t.mux)==null||e.emit("error",{player_error_code:l.code,player_error_message:l.message})}var Tn=(h,e,t)=>{mi(e,t),yr.set(e,{});let l=Io(h,e);return Ro(h,e,l),Co(h,e,l),l};var se={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Xt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},j={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered"},od=Object.entries(Xt).reduce((h,[e,t])=>{let l=j[e];return l&&(h[t]=l),h},{userinactivechange:"user-inactive"}),bn=Object.entries(j).reduce((h,[e,t])=>{let l=Xt[e];return l&&(h[t]=l),h},{"user-inactive":"userinactivechange"}),wt={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},yt={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var pi={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},rt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"};var Ge={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:h=1}={})=>`current playback rate ${h}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},Pe={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:h=30}={})=>`seek forward ${h} seconds`,SEEK_BACK_N_SECS:({seekOffset:h=30}={})=>`seek back ${h} seconds`},Po={...Ge,...Pe};var ko=h=>typeof h=="number"&&!Number.isNaN(h)&&Number.isFinite(h),An=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],wo=(h,e)=>{let t=h===1?An[e].singular:An[e].plural;return`${h} ${t}`},Tt=h=>{if(!ko(h))return"";let e=Math.abs(h),t=e!==h,l=new Date(0,0,0,0,0,e,0);return`${[l.getHours(),l.getMinutes(),l.getSeconds()].map((n,v)=>n&&wo(n,v)).filter(n=>n).join(", ")}${t?" remaining":""}`};function ht(h,e){let t=!1;h<0&&(t=!0,h=0-h),h=h<0?0:h;let l=Math.floor(h%60),n=Math.floor(h/60%60),v=Math.floor(h/3600),R=Math.floor(e/60%60),T=Math.floor(e/3600);return(isNaN(h)||h===1/0)&&(v=n=l="-"),v=v>0||T>0?v+":":"",n=((v||R>=10)&&n<10?"0"+n:n)+":",l=l<10?"0"+l:l,(t?"-":"")+v+n+l}var Sn={HTMLElement:function(){this.addEventListener=()=>{},this.removeEventListener=()=>{},this.dispatchEvent=()=>{}},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},No={createElement:function(){return new Sn.HTMLElement}},_n=typeof window=="undefined"||typeof window.customElements=="undefined",J=_n?Sn:window,z=_n?No:window.document;function ne(h,e){J.customElements.get(h)||(J.customElements.define(h,e),J[e.name]=e)}var xn=z.createElement("template");xn.innerHTML=`
30
+ <style>
31
+ :host {
32
+ display: inline-block;
33
+ width: auto;
34
+ height: auto;
35
+ vertical-align: middle;
36
+ box-sizing: border-box;
37
+ background: var(--media-control-background, rgba(20,20,30, 0.7));
38
+
39
+ padding: 10px;
40
+
41
+ /* Vertically center any text */
42
+ font-size: 14px;
43
+ font-weight: bold;
44
+ color: #ffffff;
45
+ text-align: center;
46
+
47
+ transition: background 0.15s linear;
48
+
49
+ pointer-events: auto;
50
+ cursor: pointer;
51
+ font-family: Arial, sans-serif;
52
+ vertical-align: middle;
53
+ }
54
+
55
+ /*
56
+ Only show outline when keyboard focusing.
57
+ https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
58
+ */
59
+ :host(:focus-visible) {
60
+ box-shadow: inset 0 0 0 2px rgba(27, 127, 204, 0.9);
61
+ outline: 0;
62
+ }
63
+ /*
64
+ * hide default focus ring, particularly when using mouse
65
+ */
66
+ :host(:where(:focus)) {
67
+ box-shadow: none;
68
+ outline: 0;
69
+ }
70
+
71
+ :host(:hover) {
72
+ background: var(--media-control-hover-background, rgba(50,50,70, 0.7));
73
+ }
74
+
75
+ svg, img, ::slotted(svg), ::slotted(img) {
76
+ width: var(--media-button-icon-width, 24px);
77
+ height: var(--media-button-icon-height);
78
+ transform: var(--media-button-icon-transform);
79
+ transition: var(--media-button-icon-transition);
80
+ fill: var(--media-icon-color, #eee);
81
+ vertical-align: middle;
82
+ max-width: 100%;
83
+ max-height: 100%;
84
+ min-width: 100%;
85
+ min-height: 100%;
86
+ }
87
+
88
+ ::slotted(div), ::slotted(span) {
89
+ height: 24px;
90
+ }
91
+ </style>
92
+ `;var Ln=["Enter"," "],Ei=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER]}constructor(e={}){super();let t=this.attachShadow({mode:"open"}),l=xn.content.cloneNode(!0);this.nativeEl=l;let n=e.slotTemplate;n||(n=z.createElement("template"),n.innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(n.content.cloneNode(!0)),t.appendChild(l),this.addEventListener("click",R=>{this.handleClick(R)});let v=R=>{let{key:T}=R;if(!Ln.includes(T)){this.removeEventListener("keyup",v);return}this.handleClick(R)};this.addEventListener("keydown",R=>{let{metaKey:T,altKey:L,key:_}=R;if(T||L||!Ln.includes(_)){this.removeEventListener("keyup",v);return}this.addEventListener("keyup",v)})}attributeChangedCallback(e,t,l){var n,v;if(e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}connectedCallback(){var e;this.setAttribute("role","button"),this.setAttribute("tabindex",0);let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}handleClick(){}};ne("media-chrome-button",Ei);var we=Ei;var Bo='<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 18"><defs><style>.cls-1{fill:var(--media-icon-color, #eee);}</style></defs><title>Mux Player SVG Icons_v2</title><path class="cls-1" d="M10.19,11.22a.25.25,0,0,0-.38,0L4.35,17.59a.25.25,0,0,0,.19.41H15.46a.25.25,0,0,0,.19-.41Z"/><path class="cls-1" d="M19,0H1A1,1,0,0,0,0,1V14a1,1,0,0,0,1,1H3.94L5,13.75H1.25V1.25h17.5v12.5H15L16.06,15H19a1,1,0,0,0,1-1V1A1,1,0,0,0,19,0Z"/></svg>',Dn=z.createElement("template");Dn.innerHTML=`
93
+ <style>
94
+ </style>
95
+
96
+ <slot name="airplay">${Bo}</slot>
97
+ `;var In=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(e={}){super({slotTemplate:Dn,...e})}connectedCallback(){this.setAttribute("aria-label",Pe.AIRPLAY()),super.connectedCallback()}handleClick(e){let t=new J.CustomEvent(se.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(t)}};ne("media-airplay-button",In);var Fo='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',jo='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',Mn=z.createElement("template");Mn.innerHTML=`
98
+ <style>
99
+ :host([${j.MEDIA_IS_CASTING}]) slot:not([name=exit]) > *,
100
+ :host([${j.MEDIA_IS_CASTING}]) ::slotted(:not([slot=exit])) {
101
+ display: none;
102
+ }
103
+
104
+ /* Double negative, but safer if display doesn't equal 'block' */
105
+ :host(:not([${j.MEDIA_IS_CASTING}])) slot:not([name=enter]) > *,
106
+ :host(:not([${j.MEDIA_IS_CASTING}])) ::slotted(:not([slot=enter])) {
107
+ display: none;
108
+ }
109
+ </style>
110
+
111
+ <slot name="enter">${Fo}</slot>
112
+ <slot name="exit">${jo}</slot>
113
+ `;var Rn=h=>{let e=h.getAttribute(j.MEDIA_IS_CASTING)!=null?Pe.EXIT_CAST():Pe.ENTER_CAST();h.setAttribute("aria-label",e)},Cn=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_IS_CASTING,j.MEDIA_CAST_UNAVAILABLE]}constructor(e={}){super({slotTemplate:Mn,...e})}connectedCallback(){Rn(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e===j.MEDIA_IS_CASTING&&Rn(this),super.attributeChangedCallback(e,t,l)}handleClick(e){let t=this.getAttribute(j.MEDIA_IS_CASTING)!=null?se.MEDIA_EXIT_CAST_REQUEST:se.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-cast-button",Cn);var On=z.createElement("template");On.innerHTML=`
114
+ <style>
115
+ :host {
116
+ display: inline-block;
117
+ width: auto;
118
+ height: auto;
119
+ box-sizing: border-box;
120
+
121
+ pointer-events: auto;
122
+ }
123
+ </style>
124
+ `;var Pn=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER,j.MEDIA_PAUSED]}constructor(e={}){super();let t=this.attachShadow({mode:"open"}),l=On.content.cloneNode(!0);this.nativeEl=l;let n=e.slotTemplate;n||(n=z.createElement("template"),n.innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(n.content.cloneNode(!0)),t.appendChild(l),this._pointerType=void 0;let v=R=>{this._pointerType=R.pointerType};this.addEventListener("pointerdown",v),this.addEventListener("click",R=>{let{pointerType:T=this._pointerType}=R;if(this._pointerType=void 0,T===pi.TOUCH){this.handleTap(R);return}else if(T===pi.MOUSE){this.handleMouseClick(R);return}})}attributeChangedCallback(e,t,l){var n,v;if(e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}connectedCallback(){var e;this.setAttribute("tabindex",-1),this.setAttribute("aria-hidden",!0);let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}handleTap(e){}handleMouseClick(e){let t=this.getAttribute(j.MEDIA_PAUSED)!=null?se.MEDIA_PLAY_REQUEST:se.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-gesture-receiver",Pn);var Tr=(h,e,t=".value")=>{let l=h.querySelector(t);!l||(l.textContent=e)},Ko=(h,e)=>{let t=`slot[name="${e}"]`,l=h.shadowRoot.querySelector(t);return l?l.children:[]},br=(h,e)=>Ko(h,e)[0],bt=(h,e)=>!h||!e?!1:h.contains(e)?!0:bt(h,e.getRootNode().host);var kn=z.createElement("template");kn.innerHTML=`
125
+ <style>
126
+ :host {
127
+ box-sizing: border-box;
128
+ position: relative;
129
+ display: inline-block;
130
+ line-height: 0;
131
+ background-color: #000;
132
+ }
133
+
134
+ :host(:not([audio])) [part~=layer]:not([part~=media-layer]) {
135
+ position: absolute;
136
+ top: 0;
137
+ left: 0;
138
+ bottom: 0;
139
+ right: 0;
140
+ display: flex;
141
+ flex-flow: column nowrap;
142
+ align-items: start;
143
+ pointer-events: none;
144
+ background: none;
145
+ }
146
+
147
+ /*
148
+ * when in audio mode, hide the gesture-layer which causes media-controller to be taller than the control bar
149
+ *
150
+ */
151
+ :host([audio]) [part~=layer][part~=gesture-layer] {
152
+ height: 0;
153
+ display: block;
154
+ }
155
+
156
+ /*
157
+ * if gestures are disabled, don't accept pointer-events
158
+ */
159
+ :host(:not([audio])[gestures-disabled]) ::slotted([slot=gestures-chrome]),
160
+ :host(:not([audio])[gestures-disabled]) media-gesture-receiver[slot=gestures-chrome] {
161
+ pointer-events: none;
162
+ }
163
+
164
+ /*
165
+ * any slotted element that isn't a poster or media slot should be pointer-events auto
166
+ * we'll want to add here any slotted elements that shouldn't get pointer-events by default when slotted
167
+ */
168
+ ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator)) {
169
+ pointer-events: auto;
170
+ }
171
+
172
+ :host(:not([audio])) *[part~=layer][part~=centered-layer] {
173
+ align-items: center;
174
+ justify-content: center;
175
+ }
176
+
177
+ :host(:not([audio])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
178
+ :host(:not([audio])) media-gesture-receiver[slot=gestures-chrome] {
179
+ align-self: stretch;
180
+ flex-grow: 1;
181
+ }
182
+
183
+ .spacer {
184
+ pointer-events: none;
185
+ background: none;
186
+ }
187
+
188
+ /* Position the media and poster elements to fill the container */
189
+ ::slotted([slot=media]),
190
+ ::slotted([slot=poster]) {
191
+ width: 100%;
192
+ height: 100%;
193
+ }
194
+
195
+ /* Video specific styles */
196
+ :host(:not([audio])) .spacer {
197
+ flex-grow: 1;
198
+ }
199
+
200
+ /* Safari needs this to actually make the element fill the window */
201
+ :host(:-webkit-full-screen) {
202
+ /* Needs to use !important otherwise easy to break */
203
+ width: 100% !important;
204
+ height: 100% !important;
205
+ }
206
+
207
+ /* Only add these if auto hide is not disabled */
208
+ ::slotted(:not([slot=media]):not([no-auto-hide])) {
209
+ opacity: 1;
210
+ transition: opacity 0.25s;
211
+ }
212
+
213
+ /* Hide controls when inactive, not paused, not audio and auto hide not disabled */
214
+ :host([user-inactive]:not([${j.MEDIA_PAUSED}]):not([${j.MEDIA_IS_CASTING}]):not([audio])) ::slotted(:not([slot=media]):not([no-auto-hide])) {
215
+ opacity: 0;
216
+ transition: opacity 1s;
217
+ }
218
+
219
+ ::slotted(media-control-bar) {
220
+ align-self: stretch;
221
+ }
222
+ </style>
223
+
224
+ <span part="layer media-layer">
225
+ <slot name="media"></slot>
226
+ </span>
227
+ <span part="layer poster-layer">
228
+ <slot name="poster"></slot>
229
+ </span>
230
+ <span part="layer gesture-layer">
231
+ <slot name="gestures-chrome">
232
+ <media-gesture-receiver slot="gestures-chrome"></media-gesture-receiver>
233
+ </slot>
234
+ </span>
235
+ <span part="layer vertical-layer">
236
+ <slot name="top-chrome"></slot>
237
+ <span class="spacer"><slot name="middle-chrome"></slot></span>
238
+ <!-- default, effectively "bottom-chrome" -->
239
+ <slot></slot>
240
+ </span>
241
+ <span part="layer centered-layer">
242
+ <slot name="centered-chrome"></slot>
243
+ </span>
244
+ `;var Wo=Object.values(j),yi=class extends J.HTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"});this.shadowRoot.appendChild(kn.content.cloneNode(!0));let t=(v,R)=>{let T=this.media;for(let L of v)L.type==="childList"&&(L.removedNodes.forEach(_=>{if(_.slot=="media"&&L.target==this){let E=L.previousSibling&&L.previousSibling.previousElementSibling;if(!E||!T)this.mediaUnsetCallback(_);else{let I=E.slot!=="media";for(;(E=E.previousSibling)!==null;)E.slot=="media"&&(I=!1);I&&this.mediaUnsetCallback(_)}}}),T&&L.addedNodes.forEach(_=>{_==T&&this.handleMediaUpdated(T).then(E=>this.mediaSetCallback(E))}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0});let l=this.media,n=this.querySelector(":scope > slot[slot=media]");n&&n.addEventListener("slotchange",()=>{if(!n.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(l);return}this.media&&(l=this.media,this.handleMediaUpdated(this.media).then(v=>this.mediaSetCallback(v)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(Wo)}attributeChangedCallback(e,t,l){e.toLowerCase()=="autohide"&&(this.autohide=l)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}mediaSetCallback(e){this._mediaClickPlayToggle=t=>{let l=e.paused?se.MEDIA_PLAY_REQUEST:se.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new J.CustomEvent(l,{composed:!0,bubbles:!0}))}}handleMediaUpdated(e){let t=v=>Promise.resolve(v),l=v=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',v),Promise.reject(v));if(!e)return l(e);let n=e.nodeName.toLowerCase();return n.includes("-")?J.customElements.whenDefined(n).then(()=>t(e)):t(e)}mediaUnsetCallback(e){}connectedCallback(){let e=this.getAttribute("audio")!=null?Ge.AUDIO_PLAYER():Ge.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",e),this.media&&this.handleMediaUpdated(this.media).then(v=>this.mediaSetCallback(v)),this.setAttribute("user-inactive","user-inactive");let t=()=>{if(this.autohide<0)return;this.setAttribute("user-inactive","user-inactive");let v=new J.CustomEvent(Xt.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(v)},l=()=>{this.removeAttribute("user-inactive");let v=new J.CustomEvent(Xt.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(v)},n=()=>{l(),J.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=J.setTimeout(()=>{t()},this.autohide*1e3))};this.addEventListener("keyup",v=>{n()}),this.addEventListener("pointerup",v=>{v.pointerType==="touch"&&([this,this.media].includes(v.target)&&!this.hasAttribute("user-inactive")?t():n())}),this.addEventListener("pointermove",v=>{v.pointerType==="mouse"&&(!bt(this,v.target)||(l(),J.clearTimeout(this._inactiveTimeout),[this,this.media].includes(v.target)&&n()))}),this.addEventListener("mouseleave",v=>{t()}),this.addEventListener("keyup",v=>{this.setAttribute("media-keyboard-control","")}),this.addEventListener("mouseup",v=>{this.removeAttribute("media-keyboard-control")})}set autohide(e){e=Number(e),this._autohide=isNaN(e)?0:e}get autohide(){return this._autohide===void 0?2:this._autohide}};ne("media-container-temp",yi);var wn=yi;var We={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror"};z.fullscreenElement===void 0&&(We.enter="webkitRequestFullScreen",We.exit=z.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",We.event="webkitfullscreenchange",We.element="webkitFullscreenElement",We.error="webkitfullscreenerror");function Ar(h,e=!1){return h.split("_").map(function(t,l){return(l||e?t[0].toUpperCase():t[0].toLowerCase())+t.slice(1).toLowerCase()}).join("")}var Sr=(h="")=>h.split(/\s+/),Un=(h="")=>{let[e,t]=h.split(":"),l=t?decodeURIComponent(t):void 0;return{language:e,label:l}},Ho=(h="",e={})=>Sr(h).map(t=>{let l=Un(t);return{...e,...l}}),Go=h=>Array.isArray(h)?h.map(e=>typeof e=="string"?Un(e):e):typeof h=="string"?Ho(h):[h],Vo=({label:h,language:e}={})=>h?`${e}:${encodeURIComponent(h)}`:e,Je=(h=[])=>Array.prototype.map.call(h,Vo).join(" "),$o=(h,e)=>t=>t[h]===e,Nn=h=>{let e=Object.entries(h).map(([t,l])=>$o(t,l));return t=>e.every(l=>l(t))},Qt=(h,e=[],t=[])=>{let l=Go(t).map(Nn),n=v=>l.some(R=>R(v));Array.from(e).filter(n).forEach(v=>{v.mode=h})},Ut=(h,e=()=>!0)=>{if(!(h==null?void 0:h.textTracks))return[];let t=typeof e=="function"?e:Nn(e);return Array.from(h.textTracks).filter(t)};var Ti=class extends wn{constructor(){super();tl||(this._airplayUnavailable=rt.UNSUPPORTED),rl||(this._castUnavailable=rt.UNSUPPORTED),qo||(this._pipUnavailable=rt.UNSUPPORTED),Zt!==void 0?Zt||(this._volumeUnavailable=rt.UNSUPPORTED):el.then(()=>{Zt||(this._volumeUnavailable=rt.UNSUPPORTED,this.propagateMediaState(j.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associatedElements=[],this.associateElement(this);let e={MEDIA_PLAY_REQUEST:()=>this.media.play(),MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{let t=this.media;t.muted=!1,t.volume===0&&(t.volume=.25)},MEDIA_VOLUME_REQUEST:t=>{let l=this.media,n=t.detail;l.volume=n,n>0&&l.muted&&(l.muted=!1);try{J.localStorage.setItem("media-chrome-pref-volume",n.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{let t=this.media;z.pictureInPictureElement&&z.exitPictureInPicture(),super[We.enter]?super[We.enter]():t.webkitEnterFullscreen?t.webkitEnterFullscreen():t.requestFullscreen?t.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{z[We.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{let t=this.media;!z.pictureInPictureEnabled||(z[We.element]&&z[We.exit](),t.requestPictureInPicture())},MEDIA_EXIT_PIP_REQUEST:()=>{z.pictureInPictureElement&&z.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:()=>{var t;let l=this.media;!((t=globalThis.CastableVideoElement)==null?void 0:t.castEnabled)||(z[We.element]&&z[We.exit](),l.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var t;((t=globalThis.CastableVideoElement)==null?void 0:t.castElement)&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:t=>{let l=this.media,n=t.detail;(l.readyState>0||l.readyState===void 0)&&(l.currentTime=n)},MEDIA_PLAYBACK_RATE_REQUEST:t=>{this.media.playbackRate=t.detail},MEDIA_PREVIEW_REQUEST:t=>{var l;let n=this.media;if(!n)return;let[v]=Ut(n,{kind:wt.METADATA,label:"thumbnails"});if(!(v&&v.cues))return;let R=t.detail;if(R===null){this.propagateMediaState(j.MEDIA_PREVIEW_IMAGE,void 0),this.propagateMediaState(j.MEDIA_PREVIEW_COORDS,void 0);return}let T=Array.prototype.find.call(v.cues,I=>I.startTime>=R);if(!T)return;let L=/'^(?:[a-z]+:)?\/\//i.test(T.text)||(l=n.querySelector('track[label="thumbnails"]'))==null?void 0:l.src,_=new URL(T.text,L),E=new URLSearchParams(_.hash).get("#xywh");this.propagateMediaState(j.MEDIA_PREVIEW_IMAGE,_.href),this.propagateMediaState(j.MEDIA_PREVIEW_COORDS,E.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:t=>{let l=xr(this),{detail:n=[]}=t;Qt(yt.SHOWING,l,n)},MEDIA_DISABLE_CAPTIONS_REQUEST:t=>{let l=xr(this),{detail:n=[]}=t;Qt(yt.DISABLED,l,n)},MEDIA_SHOW_SUBTITLES_REQUEST:t=>{let l=_r(this),{detail:n=[]}=t;Qt(yt.SHOWING,l,n)},MEDIA_DISABLE_SUBTITLES_REQUEST:t=>{let l=_r(this),{detail:n=[]}=t;Qt(yt.DISABLED,l,n)},MEDIA_AIRPLAY_REQUEST:t=>{let{media:l}=this;if(l){if(!(l.webkitShowPlaybackTargetPicker&&J.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}l.webkitShowPlaybackTargetPicker()}}};if(Object.keys(e).forEach(t=>{let l=`_handle${Ar(t,!0)}`;this[l]=n=>{if(n.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}e[t](n,this.media)},this.addEventListener(se[t],this[l])}),this._mediaStatePropagators={"play,pause,emptied":()=>{this.propagateMediaState(j.MEDIA_PAUSED,Bn(this))},"playing,emptied":()=>{var t;this.propagateMediaState(j.MEDIA_HAS_PLAYED,!((t=this.media)==null?void 0:t.paused))},volumechange:()=>{this.propagateMediaState(j.MEDIA_MUTED,Fn(this)),this.propagateMediaState(j.MEDIA_VOLUME,jn(this)),this.propagateMediaState(j.MEDIA_VOLUME_LEVEL,Kn(this))},[We.event]:t=>{let l=!!z[We.element]&&(t==null?void 0:t.target),n=bt(this,l);this.propagateMediaState(j.MEDIA_IS_FULLSCREEN,n)},"enterpictureinpicture,leavepictureinpicture":t=>{var l;let n;if(t)n=t.type=="enterpictureinpicture";else{let v=(l=this.getRootNode().pictureInPictureElement)!=null?l:z.pictureInPictureElement;n=this.media&&bt(this.media,v)}this.propagateMediaState(j.MEDIA_IS_PIP,n)},"entercast,leavecast,castchange":t=>{var l;let n=(l=globalThis.CastableVideoElement)==null?void 0:l.castElement,v=this.media&&bt(this.media,n);(t==null?void 0:t.type)==="castchange"&&(t==null?void 0:t.detail)==="CONNECTING"&&(v="connecting"),this.propagateMediaState(j.MEDIA_IS_CASTING,v)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(j.MEDIA_CURRENT_TIME,Wn(this))},"durationchange,loadedmetadata,emptied":()=>{this.propagateMediaState(j.MEDIA_DURATION,Hn(this))},"loadedmetadata,emptied,progress":()=>{var t;this.propagateMediaState(j.MEDIA_SEEKABLE,(t=Gn(this))==null?void 0:t.join(":"))},"progress,emptied":()=>{var t;this.propagateMediaState(j.MEDIA_BUFFERED,il((t=this.media)==null?void 0:t.buffered))},"ratechange,loadstart":()=>{this.propagateMediaState(j.MEDIA_PLAYBACK_RATE,Vn(this))},"waiting,playing,emptied":()=>{var t;let l=((t=this.media)==null?void 0:t.readyState)<3;this.propagateMediaState(j.MEDIA_LOADING,l)}},this._airplayUnavailable!==rt.UNSUPPORTED){let t=l=>{(l==null?void 0:l.availability)==="available"?this._airplayUnavailable=void 0:(l==null?void 0:l.availability)==="not-available"&&(this._airplayUnavailable=rt.UNAVAILABLE),this.propagateMediaState(j.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=t}if(this._castUnavailable!==rt.UNSUPPORTED){let t=()=>{var l;let n=(l=globalThis.CastableVideoElement)==null?void 0:l.castState;(n==null?void 0:n.includes("CONNECT"))?this._castUnavailable=void 0:this._castUnavailable=rt.UNAVAILABLE,this.propagateMediaState(j.MEDIA_CAST_UNAVAILABLE,this._castUnavailable)};this._mediaStatePropagators.castchange=t}this._textTrackMediaStatePropagators={"addtrack,removetrack,loadstart":()=>{this.propagateMediaState(j.MEDIA_CAPTIONS_LIST,Je(xr(this))||void 0),this.propagateMediaState(j.MEDIA_SUBTITLES_LIST,Je(_r(this))||void 0),this.propagateMediaState(j.MEDIA_CAPTIONS_SHOWING,Je(Ai(this))||void 0),this.propagateMediaState(j.MEDIA_SUBTITLES_SHOWING,Je(bi(this))||void 0)},change:()=>{this.propagateMediaState(j.MEDIA_CAPTIONS_SHOWING,Je(Ai(this))||void 0),this.propagateMediaState(j.MEDIA_SUBTITLES_SHOWING,Je(bi(this))||void 0)}}}mediaSetCallback(e){super.mediaSetCallback(e),Object.keys(this._mediaStatePropagators).forEach(t=>{let l=t.split(","),n=this._mediaStatePropagators[t];l.forEach(v=>{(v==We.event?this.getRootNode():e).addEventListener(v,n)}),n()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([t,l])=>{t.split(",").forEach(n=>{e.textTracks&&e.textTracks.addEventListener(n,l)}),l()});try{let t=J.localStorage.getItem("media-chrome-pref-volume");t!==null&&(e.volume=t)}catch(t){console.debug("Error getting volume pref",t)}}mediaUnsetCallback(e){super.mediaUnsetCallback(e),Object.keys(this._mediaStatePropagators).forEach(t=>{let l=t.split(","),n=this._mediaStatePropagators[t];l.forEach(v=>{(v==We.event?this.getRootNode():e).removeEventListener(v,n)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([t,l])=>{t.split(",").forEach(n=>{e.textTracks&&e.textTracks.removeEventListener(n,l)}),l()}),this.propagateMediaState(j.MEDIA_PAUSED,!0)}propagateMediaState(e,t){Fe(this.mediaStateReceivers,e,t);let l=new J.CustomEvent(bn[e],{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(l)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;if(t.has(e))return;let l=this.registerMediaStateReceiver.bind(this),n=this.unregisterMediaStateReceiver.bind(this),v=Qo(e,l,n);Object.keys(se).forEach(R=>{e.addEventListener(se[R],this[`_handle${Ar(R,!0)}`])}),t.set(e,v)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;!t.has(e)||(t.get(e)(),t.delete(e),Object.keys(se).forEach(l=>{e.removeEventListener(se[l],this[`_handle${Ar(l,!0)}`])}))}registerMediaStateReceiver(e){var t;if(!e)return;let l=this.mediaStateReceivers;l.indexOf(e)>-1||(l.push(e),Fe([e],j.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable),Fe([e],j.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable),Fe([e],j.MEDIA_CAST_UNAVAILABLE,this._castUnavailable),Fe([e],j.MEDIA_PIP_UNAVAILABLE,this._pipUnavailable),this.media&&(Fe([e],j.MEDIA_CAPTIONS_LIST,Je(xr(this))||void 0),Fe([e],j.MEDIA_SUBTITLES_LIST,Je(_r(this))||void 0),Fe([e],j.MEDIA_CAPTIONS_SHOWING,Je(Ai(this))||void 0),Fe([e],j.MEDIA_SUBTITLES_SHOWING,Je(bi(this))||void 0),Fe([e],j.MEDIA_PAUSED,Bn(this)),Fe([e],j.MEDIA_MUTED,Fn(this)),Fe([e],j.MEDIA_VOLUME,jn(this)),Fe([e],j.MEDIA_VOLUME_LEVEL,Kn(this)),Fe([e],j.MEDIA_IS_FULLSCREEN,this.hasAttribute(j.MEDIA_IS_FULLSCREEN)),Fe([e],j.MEDIA_IS_CASTING,this.hasAttribute(j.MEDIA_IS_CASTING)),Fe([e],j.MEDIA_CURRENT_TIME,Wn(this)),Fe([e],j.MEDIA_DURATION,Hn(this)),Fe([e],j.MEDIA_SEEKABLE,(t=Gn(this))==null?void 0:t.join(":")),Fe([e],j.MEDIA_PLAYBACK_RATE,Vn(this))))}unregisterMediaStateReceiver(e){let t=this.mediaStateReceivers,l=t.indexOf(e);l<0||t.splice(l,1)}},Bn=h=>h.media?h.media.paused:!0,Fn=h=>!!(h.media&&h.media.muted),jn=h=>{let e=h.media;return e?e.volume:1},Kn=h=>{let e="high";if(!h.media)return e;let{muted:t,volume:l}=h.media;return l===0||t?e="off":l<.5?e="low":l<.75&&(e="medium"),e},Wn=h=>{let e=h.media;return e?e.currentTime:0},Hn=h=>{let e=h==null?void 0:h.media;return Number.isFinite(e==null?void 0:e.duration)?e.duration:NaN},Gn=h=>{var e;let t=h==null?void 0:h.media;if(!((e=t==null?void 0:t.seekable)==null?void 0:e.length))return;let l=t.seekable.start(0),n=t.seekable.end(t.seekable.length-1);if(!(!l&&!n))return[Number(l.toFixed(3)),Number(n.toFixed(3))]},Vn=h=>{let e=h.media;return e?e.playbackRate:1},_r=h=>Ut(h.media,{kind:wt.SUBTITLES}),xr=h=>Ut(h.media,{kind:wt.CAPTIONS}),bi=h=>Ut(h.media,{kind:wt.SUBTITLES,mode:yt.SHOWING}),Ai=h=>Ut(h.media,{kind:wt.CAPTIONS,mode:yt.SHOWING}),Yo=Object.values(j),$n=h=>{var e,t,l,n;let{observedAttributes:v}=h.constructor;!v&&((e=h.nodeName)==null?void 0:e.includes("-"))&&(J.customElements.upgrade(h),{observedAttributes:v}=h.constructor);let R=(n=(l=(t=h==null?void 0:h.getAttribute)==null?void 0:t.call(h,j.MEDIA_CHROME_ATTRIBUTES))==null?void 0:l.split)==null?void 0:n.call(l,/\s+/);return Array.isArray(v||R)?(v||R).filter(T=>Yo.includes(T)):[]},Si=h=>!!$n(h).length,zo=async(h,e,t)=>(h.isConnected||await zn(0),t==null?h.removeAttribute(e):typeof t=="boolean"?t?h.setAttribute(e,""):h.removeAttribute(e):Number.isNaN(t)?h.removeAttribute(e):h.setAttribute(e,t)),Xo=h=>{var e;return!!((e=h.closest)==null?void 0:e.call(h,'*[slot="media"]'))},Jt=(h,e)=>{if(Xo(h))return;let t=(n,v)=>{var R,T;Si(n)&&v(n);let{children:L=[]}=n!=null?n:{},_=(T=(R=n==null?void 0:n.shadowRoot)==null?void 0:R.children)!=null?T:[];[...L,..._].forEach(E=>Jt(E,v))},l=h==null?void 0:h.nodeName.toLowerCase();if(l.includes("-")&&!Si(h)){J.customElements.whenDefined(l).then(()=>{t(h,e)});return}t(h,e)},Fe=(h,e,t)=>{h.forEach(l=>{!$n(l).includes(e)||zo(l,e,t)})},Qo=(h,e,t)=>{Jt(h,e);let l=T=>{var L;let _=(L=T==null?void 0:T.composedPath()[0])!=null?L:T.target;e(_)},n=T=>{var L;let _=(L=T==null?void 0:T.composedPath()[0])!=null?L:T.target;t(_)};h.addEventListener(se.REGISTER_MEDIA_STATE_RECEIVER,l),h.addEventListener(se.UNREGISTER_MEDIA_STATE_RECEIVER,n);let v=(T,L)=>{T.forEach(_=>{let{addedNodes:E=[],removedNodes:I=[],type:M,target:D,attributeName:b}=_;M==="childList"?(Array.prototype.forEach.call(E,A=>Jt(A,e)),Array.prototype.forEach.call(I,A=>Jt(A,t))):M==="attributes"&&b===j.MEDIA_CHROME_ATTRIBUTES&&(Si(D)?e(D):t(D))})},R=new MutationObserver(v);return R.observe(h,{childList:!0,attributes:!0,subtree:!0}),()=>{Jt(h,t),R.disconnect(),h.removeEventListener(se.REGISTER_MEDIA_STATE_RECEIVER,l),h.removeEventListener(se.UNREGISTER_MEDIA_STATE_RECEIVER,n)}},_i,Yn=()=>{var h,e;return _i||(_i=(e=(h=z)==null?void 0:h.createElement)==null?void 0:e.call(h,"video"),_i)},Jo=async(h=Yn())=>{if(!h)return!1;let e=h.volume;return h.volume=e/2+.1,await zn(0),h.volume!==e},zn=h=>new Promise((e,t)=>setTimeout(e,h)),Zo=(h=Yn())=>typeof(h==null?void 0:h.requestPictureInPicture)=="function",qo=Zo(),Zt,el=Jo().then(h=>(Zt=h,Zt)),tl=!!J.WebKitPlaybackTargetAvailabilityEvent,rl=!!J.chrome;function il(h=[]){return Array.from(h).map((e,t)=>[Number(h.start(t).toFixed(3)),Number(h.end(t).toFixed(3))].join(":")).join(" ")}ne("media-controller",Ti);var qt=Ti;var Xn=z.createElement("template"),Qn=`
245
+ height: var(--thumb-height);
246
+ width: var(--media-range-thumb-width, 10px);
247
+ border: var(--media-range-thumb-border, none);
248
+ border-radius: var(--media-range-thumb-border-radius, 10px);
249
+ background: var(--media-range-thumb-background, #fff);
250
+ box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
251
+ cursor: pointer;
252
+ transition: var(--media-range-thumb-transition, none);
253
+ transform: var(--media-range-thumb-transform, none);
254
+ opacity: var(--media-range-thumb-opacity, 1);
255
+ `,xi=`
256
+ width: var(--media-range-track-width, 100%);
257
+ min-width: 40px;
258
+ height: var(--track-height);
259
+ border: var(--media-range-track-border, none);
260
+ border-radius: var(--media-range-track-border-radius, 0);
261
+ background: var(--media-range-track-background-internal, var(--media-range-track-background, #eee));
262
+
263
+ box-shadow: var(--media-range-track-box-shadow, none);
264
+ transition: var(--media-range-track-transition, none);
265
+ transform: translate(var(--media-range-track-translate-x, 0), var(--media-range-track-translate-y, 0));
266
+ cursor: pointer;
267
+ `;Xn.innerHTML=`
268
+ <style>
269
+ :host {
270
+ --thumb-height: var(--media-range-thumb-height, 10px);
271
+ --track-height: var(--media-range-track-height, 4px);
272
+
273
+ position: relative;
274
+ display: inline-block;
275
+ vertical-align: middle;
276
+ box-sizing: border-box;
277
+ background: var(--media-control-background, rgba(20,20,30, 0.7));
278
+ transition: background 0.15s linear;
279
+ height: 44px;
280
+ width: 100px;
281
+ padding: 0 10px;
282
+
283
+ pointer-events: auto;
284
+ }
285
+
286
+ :host(:hover) {
287
+ background: var(--media-control-hover-background, rgba(50,50,60, 0.7));
288
+ }
289
+
290
+ input[type=range] {
291
+ /* Reset */
292
+ -webkit-appearance: none; /* Hides the slider so that custom slider can be made */
293
+ background: transparent; /* Otherwise white in Chrome */
294
+
295
+ /* Fill host with the range */
296
+ min-height: 100%;
297
+ width: var(--media-range-track-width, 100%); /* Specific width is required for Firefox. */
298
+
299
+ box-sizing: border-box;
300
+ padding: 0;
301
+ margin: 0;
302
+ }
303
+
304
+ /* Special styling for WebKit/Blink */
305
+ input[type=range]::-webkit-slider-thumb {
306
+ -webkit-appearance: none;
307
+ ${Qn}
308
+ /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
309
+ margin-top: calc(calc(0px - var(--thumb-height) + var(--track-height)) / 2);
310
+ }
311
+
312
+ /* The thumb is not positioned relative to the track in Firefox */
313
+ input[type=range]::-moz-range-thumb {
314
+ ${Qn}
315
+ translate: var(--media-range-track-translate-x, 0) var(--media-range-track-translate-y, 0);
316
+ }
317
+
318
+ input[type=range]::-webkit-slider-runnable-track { ${xi} }
319
+ input[type=range]::-moz-range-track { ${xi} }
320
+ input[type=range]::-ms-track {
321
+ /* Reset */
322
+ width: 100%;
323
+ cursor: pointer;
324
+ /* Hides the slider so custom styles can be added */
325
+ background: transparent;
326
+ border-color: transparent;
327
+ color: transparent;
328
+
329
+ ${xi}
330
+ }
331
+
332
+ /*
333
+ * set input to focus-visible, unless host-context is available (in chrome)
334
+ * in which case we can have the focus ring be on the host itself
335
+ */
336
+ :host-context([media-keyboard-control]):host(:focus),
337
+ :host-context([media-keyboard-control]):host(:focus-within) {
338
+ box-shadow: inset 0 0 0 2px rgba(27, 127, 204, 0.9);
339
+ }
340
+ :host-context([media-keyboard-control]) input[type=range]:focus-visible {
341
+ box-shadow: none;
342
+ }
343
+ input[type=range]:focus-visible {
344
+ box-shadow: inset 0 0 0 2px rgba(27, 127, 204, 0.9);
345
+ }
346
+ input[type=range]:focus {
347
+ outline: 0;
348
+ }
349
+ input[type=range]:focus::-webkit-slider-runnable-track {
350
+ outline: 0;
351
+ }
352
+
353
+ input[type=range]:disabled::-webkit-slider-thumb {
354
+ background-color: #777;
355
+ }
356
+
357
+ input[type=range]:disabled::-webkit-slider-runnable-track {
358
+ background-color: #777;
359
+ }
360
+ </style>
361
+ <input id="range" type="range" min="0" max="1000" step="1" value="0">
362
+ `;var Li=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Xn.content.cloneNode(!0)),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this))}attributeChangedCallback(e,t,l){var n,v;if(e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}connectedCallback(){var e;let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}this.updateBar()}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}updateBar(){let e=this.getBarColors(),t="linear-gradient(to right, ",l=0;e.forEach(n=>{n[1]<l||(t=t+`${n[0]} ${l}%, ${n[0]} ${n[1]}%,`,l=n[1])}),t=t.slice(0,t.length-1)+")",this.style.setProperty("--media-range-track-background-internal",t)}getBarColors(){let e=this.range,t=e.value-e.min,l=e.max-e.min,n=t/l*100;return[["var(--media-range-bar-color, #fff)",n],["var(--media-range-track-background, #333)",100]]}};ne("media-chrome-range",Li);var er=Li;var Jn=z.createElement("template");Jn.innerHTML=`
363
+ <style>
364
+ :host {
365
+ /* Need position to display above video for some reason */
366
+ box-sizing: border-box;
367
+ display: inline-flex;
368
+ color: var(--media-icon-color, #eee);
369
+ --media-loading-icon-width: 44px;
370
+ }
371
+
372
+ media-time-range,
373
+ ::slotted(media-time-range),
374
+ ::slotted(media-progress-range),
375
+ ::slotted(media-clip-selector) {
376
+ flex-grow: 1;
377
+ }
378
+ </style>
379
+
380
+ <slot></slot>
381
+ `;var Zn=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Jn.content.cloneNode(!0))}attributeChangedCallback(e,t,l){var n,v;if(e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}connectedCallback(){var e;let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}};ne("media-control-bar",Zn);var qn=z.createElement("template");qn.innerHTML=`
382
+ <style>
383
+ :host {
384
+ display: inline-flex;
385
+ justify-content: center;
386
+ align-items: center;
387
+ box-sizing: border-box;
388
+ background: var(--media-control-background, rgba(20,20,30, 0.7));
389
+
390
+ padding: 10px;
391
+
392
+ font-size: 14px;
393
+ line-height: 24px;
394
+ font-family: Arial, sans-serif;
395
+ text-align: center;
396
+ color: #ffffff;
397
+ pointer-events: auto;
398
+ }
399
+
400
+ /*
401
+ Only show outline when keyboard focusing.
402
+ https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
403
+ */
404
+ :host(:focus-visible) {
405
+ box-shadow: inset 0 0 0 2px rgba(27, 127, 204, 0.9);
406
+ outline: 0;
407
+ }
408
+ /*
409
+ * hide default focus ring, particularly when using mouse
410
+ */
411
+ :host(:where(:focus)) {
412
+ box-shadow: none;
413
+ outline: 0;
414
+ }
415
+
416
+ #container {
417
+ /* NOTE: We don't currently have more generic sizing vars */
418
+ height: var(--media-text-content-height, auto);
419
+ }
420
+ </style>
421
+ <span id="container">
422
+ <slot></slot>
423
+ </span>
424
+ `;var Di=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(qn.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container")}attributeChangedCallback(e,t,l){var n,v;if(e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}connectedCallback(){var e;let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}};ne("media-text-display",Di);var Nt=Di;var ea=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_CURRENT_TIME]}attributeChangedCallback(e,t,l){e===j.MEDIA_CURRENT_TIME&&(this.container.innerHTML=ht(l)),super.attributeChangedCallback(e,t,l)}};ne("media-current-time-display",ea);var ta=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_DURATION]}attributeChangedCallback(e,t,l){e===j.MEDIA_DURATION&&(this.container.innerHTML=ht(l)),super.attributeChangedCallback(e,t,l)}};ne("media-duration-display",ta);var nl="&nbsp;/&nbsp;",al=(h,{timesSep:e=nl}={})=>{var t,l,n;let v=h.getAttribute("remaining")!=null,R=h.getAttribute("show-duration")!=null,T=(t=h.mediaCurrentTime)!=null?t:0,L=(n=(l=h.mediaDuration)!=null?l:h.mediaSeekableEnd)!=null?n:0,_=v?ht(0-(L-T)):ht(T);return R?`${_}${e}${ht(L)}`:_},sl="video not loaded, unknown time.",ol=h=>{let e=h.mediaCurrentTime,t=h.mediaDuration||h.mediaSeekableEnd;if(e==null||t==null){h.setAttribute("aria-valuetext",sl);return}let l=h.hasAttribute("remaining"),n=h.hasAttribute("show-duration"),v=l?Tt(0-(t-e)):Tt(e);if(!n){h.setAttribute("aria-valuetext",v);return}let R=Tt(t),T=`${v} of ${R}`;h.setAttribute("aria-valuetext",T)},ra=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_CURRENT_TIME,j.MEDIA_DURATION,j.MEDIA_SEEKABLE,"remaining","show-duration"]}connectedCallback(){this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Ge.PLAYBACK_TIME()),this.setAttribute("tabindex",0),super.connectedCallback()}attributeChangedCallback(e,t,l){if([j.MEDIA_CURRENT_TIME,j.MEDIA_DURATION,j.MEDIA_SEEKABLE,"remaining","show-duration"].includes(e)){let n=al(this);ol(this),this.container.innerHTML=n}super.attributeChangedCallback(e,t,l)}get mediaDuration(){let e=this.getAttribute(j.MEDIA_DURATION);return e!=null?+e:void 0}get mediaCurrentTime(){let e=this.getAttribute(j.MEDIA_CURRENT_TIME);return e!=null?+e:void 0}get mediaSeekable(){let e=this.getAttribute(j.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}get mediaSeekableEnd(){var e;let[,t]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;let[t]=(e=this.mediaSeekable)!=null?e:[];return t}};ne("media-time-display",ra);var ll=`
425
+ <svg
426
+ aria-hidden="true"
427
+ xmlns:svg="http://www.w3.org/2000/svg"
428
+ xmlns="http://www.w3.org/2000/svg"
429
+ version="1.0"
430
+ viewbox="0 0 153 125.71389"
431
+ width="auto"
432
+ height="24">
433
+ <g
434
+ transform="scale(6.3080558,6.3080558)"
435
+ id="g12">
436
+ <path
437
+ class="icon"
438
+ d="M 21.9806,9.0135 C 21.9505,5.8358 21.8299,4.4502 21.077,3.4712 C 20.9415,3.2605 20.6854,3.14 20.4746,2.9895 C 19.7366,2.4472 16.2577,2.2515 12.2215,2.2515 C 8.1853,2.2515 4.54077,2.4472 3.81787,2.9895 C 3.59192,3.14 3.33581,3.2605 3.1853,3.4712 C 2.44726,4.4502 2.34192,5.8358 2.29675,9.0135 C 2.34192,12.1914 2.44726,13.5769 3.1853,14.5558 C 3.33581,14.7817 3.59192,14.8871 3.81787,15.0377 C 4.54077,15.595 8.1853,15.7757 12.2215,15.8058 C 16.2577,15.7757 19.7366,15.595 20.4746,15.0377 C 20.6854,14.8871 20.9415,14.7817 21.077,14.5558 C 21.8299,13.5769 21.9505,12.1914 21.9806,9.0135 z "
439
+ style="fill-rule:evenodd;stroke:none"
440
+ id="path16" />
441
+ <path
442
+ class="icon"
443
+ d="M 11.6896,8.1906 C 11.4853,5.704 10.1628,4.239 7.79723,4.239 C 5.63596,4.239 3.93706,6.1879 3.93706,9.31964 C 3.93706,12.4648 5.48544,14.4271 8.04452,14.4271 C 10.0875,14.4271 11.5176,12.9218 11.7434,10.4217 L 9.30256,10.4217 C 9.20579,11.3492 8.81871,12.0616 8.00151,12.0616 C 6.71121,12.0616 6.47467,10.7847 6.47467,9.42716 C 6.47467,7.5588 7.0123,6.6046 7.90474,6.6046 C 8.70045,6.6046 9.20579,7.1825 9.28106,8.1906 L 11.6896,8.1906 z "
444
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
445
+ id="path20" />
446
+ <path
447
+ class="icon"
448
+ d="M 20.1199,8.1906 C 19.9156,5.704 18.5931,4.239 16.2275,4.239 C 14.0662,4.239 12.3674,6.1879 12.3674,9.31964 C 12.3674,12.4648 13.9157,14.4271 16.4748,14.4271 C 18.5178,14.4271 19.9479,12.9218 20.1736,10.4217 L 17.7328,10.4217 C 17.6361,11.3492 17.249,12.0616 16.4318,12.0616 C 15.1415,12.0616 14.9049,10.7847 14.9049,9.42716 C 14.9049,7.5588 15.4426,6.6046 16.335,6.6046 C 17.1307,6.6046 17.6361,7.1825 17.7113,8.1906 L 20.1199,8.1906 z "
449
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
450
+ id="path22" />
451
+ <path class="icon" d="M 2,20 L 22,20" stroke-width="4" stroke="var(--media-icon-color, #eee)" id="path24"/>
452
+ </g>
453
+ </svg>
454
+ `,ul=`
455
+ <svg
456
+ aria-hidden="true"
457
+ xmlns:svg="http://www.w3.org/2000/svg"
458
+ xmlns="http://www.w3.org/2000/svg"
459
+ version="1.0"
460
+ viewbox="0 0 153 125.71389"
461
+ width="auto"
462
+ height="24">
463
+ <g
464
+ transform="scale(6.3080558,6.3080558)"
465
+ id="g12">
466
+ <path
467
+ class="icon"
468
+ d="M 21.9806,9.0135 C 21.9505,5.8358 21.8299,4.4502 21.077,3.4712 C 20.9415,3.2605 20.6854,3.14 20.4746,2.9895 C 19.7366,2.4472 16.2577,2.2515 12.2215,2.2515 C 8.1853,2.2515 4.54077,2.4472 3.81787,2.9895 C 3.59192,3.14 3.33581,3.2605 3.1853,3.4712 C 2.44726,4.4502 2.34192,5.8358 2.29675,9.0135 C 2.34192,12.1914 2.44726,13.5769 3.1853,14.5558 C 3.33581,14.7817 3.59192,14.8871 3.81787,15.0377 C 4.54077,15.595 8.1853,15.7757 12.2215,15.8058 C 16.2577,15.7757 19.7366,15.595 20.4746,15.0377 C 20.6854,14.8871 20.9415,14.7817 21.077,14.5558 C 21.8299,13.5769 21.9505,12.1914 21.9806,9.0135 z "
469
+ style="fill-rule:evenodd;stroke:none"
470
+ id="path16" />
471
+ <path
472
+ class="icon"
473
+ d="M 11.6896,8.1906 C 11.4853,5.704 10.1628,4.239 7.79723,4.239 C 5.63596,4.239 3.93706,6.1879 3.93706,9.31964 C 3.93706,12.4648 5.48544,14.4271 8.04452,14.4271 C 10.0875,14.4271 11.5176,12.9218 11.7434,10.4217 L 9.30256,10.4217 C 9.20579,11.3492 8.81871,12.0616 8.00151,12.0616 C 6.71121,12.0616 6.47467,10.7847 6.47467,9.42716 C 6.47467,7.5588 7.0123,6.6046 7.90474,6.6046 C 8.70045,6.6046 9.20579,7.1825 9.28106,8.1906 L 11.6896,8.1906 z "
474
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
475
+ id="path20" />
476
+ <path
477
+ class="icon"
478
+ d="M 20.1199,8.1906 C 19.9156,5.704 18.5931,4.239 16.2275,4.239 C 14.0662,4.239 12.3674,6.1879 12.3674,9.31964 C 12.3674,12.4648 13.9157,14.4271 16.4748,14.4271 C 18.5178,14.4271 19.9479,12.9218 20.1736,10.4217 L 17.7328,10.4217 C 17.6361,11.3492 17.249,12.0616 16.4318,12.0616 C 15.1415,12.0616 14.9049,10.7847 14.9049,9.42716 C 14.9049,7.5588 15.4426,6.6046 16.335,6.6046 C 17.1307,6.6046 17.6361,7.1825 17.7113,8.1906 L 20.1199,8.1906 z "
479
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
480
+ id="path22" />
481
+ </g>
482
+ </svg>
483
+ `,ia=z.createElement("template");ia.innerHTML=`
484
+ <style>
485
+ :host([aria-checked="true"]) slot:not([name=on]) > *,
486
+ :host([aria-checked="true"]) ::slotted(:not([slot=on])) {
487
+ display: none;
488
+ }
489
+
490
+ /* Double negative, but safer if display doesn't equal 'block' */
491
+ :host(:not([aria-checked="true"])) slot:not([name=off]) > *,
492
+ :host(:not([aria-checked="true"])) ::slotted(:not([slot=off])) {
493
+ display: none;
494
+ }
495
+ </style>
496
+
497
+ <slot name="on">${ll}</slot>
498
+ <slot name="off">${ul}</slot>
499
+ `;var na=h=>{h.setAttribute("aria-checked",aa(h))},aa=h=>{let e=!!h.getAttribute(j.MEDIA_CAPTIONS_SHOWING),t=!h.hasAttribute("no-subtitles-fallback")&&!!h.getAttribute(j.MEDIA_SUBTITLES_SHOWING);return e||t},sa=class extends we{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",j.MEDIA_CAPTIONS_LIST,j.MEDIA_CAPTIONS_SHOWING,j.MEDIA_SUBTITLES_LIST,j.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:ia,...e});this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Ge.CLOSED_CAPTIONS()),na(this)}attributeChangedCallback(e,t,l){if([j.MEDIA_CAPTIONS_SHOWING,j.MEDIA_SUBTITLES_SHOWING].includes(e)&&na(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){let n=!this.hasAttribute("no-subtitles-fallback");if((n?[j.MEDIA_CAPTIONS_LIST,j.MEDIA_SUBTITLES_LIST]:[j.MEDIA_CAPTIONS_LIST]).includes(e)){let v=!!this.getAttribute(j.MEDIA_CAPTIONS_LIST)||!!(n&&this.getAttribute(j.MEDIA_SUBTITLES_LIST));this._captionsReady!==v&&(this._captionsReady=v,this._captionsReady&&this.handleClick())}}super.attributeChangedCallback(e,t,l)}handleClick(e){var t,l,n,v;if(aa(this)){let R=this.getAttribute(j.MEDIA_CAPTIONS_SHOWING);if(R){let L=new J.CustomEvent(se.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:R});this.dispatchEvent(L)}let T=this.getAttribute(j.MEDIA_SUBTITLES_SHOWING);if(T&&!this.hasAttribute("no-subtitles-fallback")){let L=new J.CustomEvent(se.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:T});this.dispatchEvent(L)}}else{let[R]=(l=Sr((t=this.getAttribute(j.MEDIA_CAPTIONS_LIST))!=null?t:""))!=null?l:[];if(R){let T=new J.CustomEvent(se.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:R});this.dispatchEvent(T)}else if(this.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{let[T]=(v=Sr((n=this.getAttribute(j.MEDIA_SUBTITLES_LIST))!=null?n:""))!=null?v:[];if(T){let L=new J.CustomEvent(se.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:T});this.dispatchEvent(L)}}}}};ne("media-captions-button",sa);var Ii=30,dl=`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(7.4 17.6)">${Ii}</text><path d="M8.52,3V0l5.61,4-5.61,4V5A5.54,5.54,0,0,0,6.6,15.48V17.6A7.5,7.5,0,0,1,8.52,3Z"/></svg>`,oa=z.createElement("template");oa.innerHTML=`
500
+ <slot name="forward">${dl}</slot>
501
+ `;var cl=0,la=h=>{let e=Math.abs(+h.getAttribute("seek-offset")),t=Pe.SEEK_FORWARD_N_SECS({seekOffset:e});h.setAttribute("aria-label",t)},ua=h=>{let e=br(h,"forward"),t=h.getAttribute("seek-offset");Tr(e,t)},da=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(e={}){super({slotTemplate:oa,...e})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Ii),la(this),ua(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e==="seek-offset"&&(l==null&&this.setAttribute("seek-offset",Ii),ua(this),la(this))}handleClick(){let e=this.getAttribute(j.MEDIA_CURRENT_TIME),t=+this.getAttribute("seek-offset"),l=(e&&!Number.isNaN(+e)?+e:cl)+t,n=new J.CustomEvent(se.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(n)}};ne("media-seek-forward-button",da);var fl=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
502
+ <path d="M0 0h24v24H0z" fill="none"/>
503
+ <path class="icon" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>
504
+ </svg>`,hl=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
505
+ <path d="M0 0h24v24H0z" fill="none"/>
506
+ <path class="icon" d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>
507
+ </svg>`,ca=z.createElement("template");ca.innerHTML=`
508
+ <style>
509
+ :host([${j.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]) > *,
510
+ :host([${j.MEDIA_IS_FULLSCREEN}]) ::slotted(:not([slot=exit])) {
511
+ display: none;
512
+ }
513
+
514
+ /* Double negative, but safer if display doesn't equal 'block' */
515
+ :host(:not([${j.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]) > *,
516
+ :host(:not([${j.MEDIA_IS_FULLSCREEN}])) ::slotted(:not([slot=enter])) {
517
+ display: none;
518
+ }
519
+ </style>
520
+
521
+ <slot name="enter">${fl}</slot>
522
+ <slot name="exit">${hl}</slot>
523
+ `;var fa=h=>{let e=h.getAttribute(j.MEDIA_IS_FULLSCREEN)!=null?Pe.EXIT_FULLSCREEN():Pe.ENTER_FULLSCREEN();h.setAttribute("aria-label",e)},ha=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_IS_FULLSCREEN]}constructor(e={}){super({slotTemplate:ca,...e})}connectedCallback(){fa(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e===j.MEDIA_IS_FULLSCREEN&&fa(this),super.attributeChangedCallback(e,t,l)}handleClick(e){let t=this.getAttribute(j.MEDIA_IS_FULLSCREEN)!=null?se.MEDIA_EXIT_FULLSCREEN_REQUEST:se.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-fullscreen-button",ha);var vl='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',va='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',ml='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',ma=z.createElement("template");ma.innerHTML=`
524
+ <style>
525
+ /* Default to High slot/icon. */
526
+ :host(:not([${j.MEDIA_VOLUME_LEVEL}])) slot:not([name=high]) > *,
527
+ :host(:not([${j.MEDIA_VOLUME_LEVEL}])) ::slotted(:not([slot=high])),
528
+ :host([${j.MEDIA_VOLUME_LEVEL}=high]) slot:not([name=high]) > *,
529
+ :host([${j.MEDIA_VOLUME_LEVEL}=high]) ::slotted(:not([slot=high])) {
530
+ display: none;
531
+ }
532
+
533
+ :host([${j.MEDIA_VOLUME_LEVEL}=off]) slot:not([name=off]) > *,
534
+ :host([${j.MEDIA_VOLUME_LEVEL}=off]) ::slotted(:not([slot=off])) {
535
+ display: none;
536
+ }
537
+
538
+ :host([${j.MEDIA_VOLUME_LEVEL}=low]) slot:not([name=low]) > *,
539
+ :host([${j.MEDIA_VOLUME_LEVEL}=low]) ::slotted(:not([slot=low])) {
540
+ display: none;
541
+ }
542
+
543
+ :host([${j.MEDIA_VOLUME_LEVEL}=medium]) slot:not([name=medium]) > *,
544
+ :host([${j.MEDIA_VOLUME_LEVEL}=medium]) ::slotted(:not([slot=medium])) {
545
+ display: none;
546
+ }
547
+ </style>
548
+
549
+ <slot name="off">${vl}</slot>
550
+ <slot name="low">${va}</slot>
551
+ <slot name="medium">${va}</slot>
552
+ <slot name="high">${ml}</slot>
553
+ `;var ga=h=>{let e=h.getAttribute(j.MEDIA_VOLUME_LEVEL)==="off"?Pe.UNMUTE():Pe.MUTE();h.setAttribute("aria-label",e)},pa=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_VOLUME_LEVEL]}constructor(e={}){super({slotTemplate:ma,...e})}connectedCallback(){ga(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e===j.MEDIA_VOLUME_LEVEL&&ga(this),super.attributeChangedCallback(e,t,l)}handleClick(e){let t=this.getAttribute(j.MEDIA_VOLUME_LEVEL)==="off"?se.MEDIA_UNMUTE_REQUEST:se.MEDIA_MUTE_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-mute-button",pa);var Ea='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',ya=z.createElement("template");ya.innerHTML=`
554
+ <style>
555
+ :host([${j.MEDIA_IS_PIP}]) slot:not([name=exit]) > *,
556
+ :host([${j.MEDIA_IS_PIP}]) ::slotted(:not([slot=exit])) {
557
+ display: none;
558
+ }
559
+
560
+ /* Double negative, but safer if display doesn't equal 'block' */
561
+ :host(:not([${j.MEDIA_IS_PIP}])) slot:not([name=enter]) > *,
562
+ :host(:not([${j.MEDIA_IS_PIP}])) ::slotted(:not([slot=enter])) {
563
+ display: none;
564
+ }
565
+ </style>
566
+
567
+ <slot name="enter">${Ea}</slot>
568
+ <slot name="exit">${Ea}</slot>
569
+ `;var Ta=h=>{let e=h.getAttribute(j.MEDIA_IS_PIP)!=null?Pe.EXIT_PIP():Pe.ENTER_PIP();h.setAttribute("aria-label",e)},ba=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_IS_PIP,j.MEDIA_PIP_UNAVAILABLE]}constructor(e={}){super({slotTemplate:ya,...e})}connectedCallback(){Ta(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e===j.MEDIA_IS_PIP&&Ta(this),super.attributeChangedCallback(e,t,l)}handleClick(e){let t=this.getAttribute(j.MEDIA_IS_PIP)!=null?se.MEDIA_EXIT_PIP_REQUEST:se.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-pip-button",ba);var gl='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M8 5v14l11-7z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',pl='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',Aa=z.createElement("template");Aa.innerHTML=`
570
+ <style>
571
+ :host([${j.MEDIA_PAUSED}]) slot[name=pause] > *,
572
+ :host([${j.MEDIA_PAUSED}]) ::slotted([slot=pause]) {
573
+ display: none;
574
+ }
575
+
576
+ :host(:not([${j.MEDIA_PAUSED}])) slot[name=play] > *,
577
+ :host(:not([${j.MEDIA_PAUSED}])) ::slotted([slot=play]) {
578
+ display: none;
579
+ }
580
+ </style>
581
+
582
+ <slot name="play">${gl}</slot>
583
+ <slot name="pause">${pl}</slot>
584
+ `;var Sa=h=>{let e=h.getAttribute(j.MEDIA_PAUSED)!=null?Pe.PLAY():Pe.PAUSE();h.setAttribute("aria-label",e)},_a=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_PAUSED]}constructor(e={}){super({slotTemplate:Aa,...e})}connectedCallback(){Sa(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e===j.MEDIA_PAUSED&&Sa(this),super.attributeChangedCallback(e,t,l)}handleClick(e){let t=this.getAttribute(j.MEDIA_PAUSED)!=null?se.MEDIA_PLAY_REQUEST:se.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new J.CustomEvent(t,{composed:!0,bubbles:!0}))}};ne("media-play-button",_a);var xa=[1,1.25,1.5,1.75,2],Lr=1,La=z.createElement("template");La.innerHTML=`
585
+ <style>
586
+ :host {
587
+ font-size: 14px;
588
+ line-height: 24px;
589
+ font-weight: bold;
590
+ }
591
+
592
+ #container {
593
+ height: var(--media-text-content-height, 24px);
594
+ }
595
+ </style>
596
+
597
+ <span id="container"></span>
598
+ `;var Da=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_PLAYBACK_RATE,"rates"]}constructor(e={}){super({slotTemplate:La,...e});this._rates=xa,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${Lr}x`}attributeChangedCallback(e,t,l){if(e==="rates"){let n=(l!=null?l:"").trim().split(/\s*,?\s+/).map(v=>Number(v)).filter(v=>!Number.isNaN(v)).sort((v,R)=>v-R);this._rates=n.length?n:xa;return}if(e===j.MEDIA_PLAYBACK_RATE){let n=l?+l:Number.NaN,v=Number.isNaN(n)?Lr:n;this.container.innerHTML=`${v}x`,this.setAttribute("aria-label",Ge.PLAYBACK_RATE({playbackRate:v}));return}super.attributeChangedCallback(e,t,l)}handleClick(e){var t,l;let n=+this.getAttribute(j.MEDIA_PLAYBACK_RATE)||Lr,v=(l=(t=this._rates.find(T=>T>n))!=null?t:this._rates[0])!=null?l:Lr,R=new J.CustomEvent(se.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(R)}};ne("media-playback-rate-button",Da);var Ia=z.createElement("template");Ia.innerHTML=`
599
+ <style>
600
+ :host {
601
+ pointer-events: none;
602
+ display: inline-block;
603
+ box-sizing: border-box;
604
+
605
+ width: auto;
606
+ height: auto;
607
+ }
608
+
609
+ img {
610
+ max-width: 100%;
611
+ max-height: 100%;
612
+ min-width: 100%;
613
+ min-height: 100%;
614
+ background-size: cover;
615
+ background-repeat: no-repeat;
616
+ }
617
+
618
+ :host([${j.MEDIA_HAS_PLAYED}]) img {
619
+ display: none;
620
+ }
621
+ </style>
622
+
623
+ <img aria-hidden="true" id="image"/>
624
+ `;var El=(h,e)=>{h.style["background-image"]=`url('${e}')`},Ma=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_HAS_PLAYED,"placeholder-src","src"]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ia.content.cloneNode(!0)),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,l){e==="src"&&this.image.setAttribute("src",l),e==="placeholder-src"&&El(this.image,l)}};ne("media-poster-image",Ma);var yl="video not loaded, unknown time.",Mi=h=>{let e=h.range,t=Tt(+e.value),l=Tt(+e.max),n=t&&l?`${t} of ${l}`:yl;e.setAttribute("aria-valuetext",n)},Ra=z.createElement("template");Ra.innerHTML=`
625
+ <style>
626
+ #thumbnailContainer {
627
+ position: absolute;
628
+ left: 0;
629
+ top: 0;
630
+ transition: visibility .25s, opacity .25s;
631
+ visibility: hidden;
632
+ opacity: 0;
633
+ }
634
+
635
+ media-thumbnail-preview {
636
+ --thumb-preview-min-width: var(--media-thumbnail-preview-min-width, 120px);
637
+ --thumb-preview-max-width: var(--media-thumbnail-preview-max-width, 180px);
638
+ --thumb-preview-min-height: var(--media-thumbnail-preview-min-height, 80px);
639
+ --thumb-preview-max-height: var(--media-thumbnail-preview-max-height, 160px);
640
+ --thumb-preview-border: 2px solid #fff;
641
+ transform-origin: 50% 100%;
642
+ position: absolute;
643
+ bottom: calc(100% + 5px);
644
+ border: var(--media-thumbnail-preview-border, var(--thumb-preview-border, 2px solid #fff));
645
+ border-radius: var(--media-thumbnail-preview-border-radius, 2px);
646
+ background-color: #000;
647
+ }
648
+
649
+ /*
650
+ This is a downward triangle. Commented out for now because it would also
651
+ require scaling the px properties below in JS; bottom and border-width.
652
+ */
653
+ /* media-thumbnail-preview::after {
654
+ content: "";
655
+ display: block;
656
+ width: 0;
657
+ height: 0;
658
+ position: absolute;
659
+ left: 50%;
660
+ transform: translateX(-50%);
661
+ bottom: -10px;
662
+ border-left: 10px solid transparent;
663
+ border-right: 10px solid transparent;
664
+ border-top: 10px solid #fff;
665
+ } */
666
+
667
+ :host([${j.MEDIA_PREVIEW_IMAGE}]:hover) #thumbnailContainer {
668
+ transition: visibility .5s, opacity .5s;
669
+ visibility: visible;
670
+ opacity: 1;
671
+ }
672
+ </style>
673
+ <div id="thumbnailContainer">
674
+ <media-thumbnail-preview></media-thumbnail-preview>
675
+ </div>
676
+ `;var Ri=class extends er{static get observedAttributes(){return[...super.observedAttributes,"thumbnails",j.MEDIA_DURATION,j.MEDIA_SEEKABLE,j.MEDIA_CURRENT_TIME,j.MEDIA_PREVIEW_IMAGE,j.MEDIA_BUFFERED]}constructor(){super();this.shadowRoot.appendChild(Ra.content.cloneNode(!0)),this.range.addEventListener("input",()=>{let e=this.range.value,t=new J.CustomEvent(se.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}),this.enableThumbnails()}connectedCallback(){this.range.setAttribute("aria-label",Ge.SEEK()),super.connectedCallback()}attributeChangedCallback(e,t,l){var n,v,R,T,L;e===j.MEDIA_CURRENT_TIME&&(this.range.value=this.mediaCurrentTime,Mi(this),this.updateBar()),e===j.MEDIA_DURATION&&(this.range.max=Math.floor((v=(n=this.mediaSeekableEnd)!=null?n:this.mediaDuration)!=null?v:1e3),Mi(this),this.updateBar()),e===j.MEDIA_SEEKABLE&&(this.range.min=(R=this.mediaSeekableStart)!=null?R:0,this.range.max=Math.floor((L=(T=this.mediaSeekableEnd)!=null?T:this.mediaDuration)!=null?L:1e3),Mi(this),this.updateBar()),e===j.MEDIA_BUFFERED&&this.updateBar(),super.attributeChangedCallback(e,t,l)}get mediaDuration(){let e=this.getAttribute(j.MEDIA_DURATION);return e!=null?+e:void 0}get mediaCurrentTime(){let e=this.getAttribute(j.MEDIA_CURRENT_TIME);return e!=null?+e:void 0}get mediaBuffered(){let e=this.getAttribute(j.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(l=>+l)):[]}get mediaSeekable(){let e=this.getAttribute(j.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}get mediaSeekableEnd(){var e;let[,t]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;let[t]=(e=this.mediaSeekable)!=null?e:[];return t}getBarColors(){var e;let t=super.getBarColors(),{range:l}=this,n=this.mediaCurrentTime,v=l.max-l.min,R=this.mediaBuffered;if(!R.length||!Number.isFinite(v)||v<=0)return t;let[,T=l.min]=(e=R.find(([_,E])=>_<=n&&n<=E))!=null?e:[],L=(T-l.min)/v*100;return t.splice(1,0,["var(--media-time-buffered-color, #777)",L]),t}enableThumbnails(){this.thumbnailPreview=this.shadowRoot.querySelector("media-thumbnail-preview"),this.shadowRoot.querySelector("#thumbnailContainer").classList.add("enabled");let e,t=()=>{e=R=>{let T=+this.getAttribute(j.MEDIA_DURATION);if(!T)return;let L=this.range.getBoundingClientRect(),_=(R.clientX-L.left)/L.width;_=Math.max(0,Math.min(1,_));let E=L.left-this.getBoundingClientRect().left+_*L.width,I=getComputedStyle(this.thumbnailPreview),M=parseInt(I.getPropertyValue("--thumb-preview-min-width")),D=parseInt(I.getPropertyValue("--thumb-preview-max-width")),b=parseInt(I.getPropertyValue("--thumb-preview-min-height")),A=parseInt(I.getPropertyValue("--thumb-preview-max-height")),{clientWidth:u,clientHeight:r}=this.thumbnailPreview,s=Math.min(D/u,A/r),i=Math.max(M/u,b/r),a=E-u/2,d=s<1?s:i>1?i:1;this.thumbnailPreview.style.transform=`translateX(${a}px) scale(${d})`;let o=parseInt(I.getPropertyValue("--media-thumbnail-preview-border"));Number.isNaN(o)&&(o=parseInt(I.getPropertyValue("--thumb-preview-border"))),this.thumbnailPreview.style.borderWidth=`${Math.round(o/d)}px`,this.thumbnailPreview.style.borderRadius=`${Math.round(o/d)}px`;let y=_*T,p=new J.CustomEvent(se.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:y});this.dispatchEvent(p)},J.addEventListener("pointermove",e,!1)},l=()=>{J.removeEventListener("pointermove",e);let R=new J.CustomEvent(se.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(R)},n=!1,v=R=>{let T=this.getAttribute(j.MEDIA_DURATION);if(!n&&T){n=!0,t();let L=_=>{_.composedPath().includes(this)||(J.removeEventListener("pointermove",L),n=!1,l())};J.addEventListener("pointermove",L,!1)}};this.addEventListener("pointermove",v,!1)}};ne("media-time-range",Ri);var Ci=Ri;var Ca=class extends Ci{constructor(){super();console.warn("MediaChrome: <media-progress-range> is deprecated. Use <media-time-range> instead.")}};ne("media-progress-range",Ca);var Oi=30,Tl=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(1.68 17.6)">${Oi}</text><path d="M9.48,3V0L3.87,4l5.61,4V5a5.54,5.54,0,0,1,1.92,10.5V17.6A7.5,7.5,0,0,0,9.48,3Z"/></svg>`,Oa=z.createElement("template");Oa.innerHTML=`
677
+ <slot name="backward">${Tl}</slot>
678
+ `;var bl=0,Pa=h=>{let e=Math.abs(+h.getAttribute("seek-offset")),t=Pe.SEEK_BACK_N_SECS({seekOffset:e});h.setAttribute("aria-label",t)},ka=h=>{let e=br(h,"backward"),t=h.getAttribute("seek-offset");Tr(e,t)},wa=class extends we{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_CURRENT_TIME]}constructor(e={}){super({slotTemplate:Oa,...e})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Oi),Pa(this),ka(this),super.connectedCallback()}attributeChangedCallback(e,t,l){e==="seek-offset"&&(l==null&&this.setAttribute("seek-offset",Oi),ka(this),Pa(this))}handleClick(){let e=this.getAttribute(j.MEDIA_CURRENT_TIME),t=+this.getAttribute("seek-offset"),l=e&&!Number.isNaN(+e)?+e:bl,n=Math.max(l-t,0),v=new J.CustomEvent(se.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:n});this.dispatchEvent(v)}};ne("media-seek-backward-button",wa);var Ua=z.createElement("template");Ua.innerHTML=`
679
+ <style>
680
+ :host {
681
+ background-color: #000;
682
+ height: auto;
683
+ width: auto;
684
+ }
685
+
686
+ img {
687
+ display: block;
688
+ object-fit: none;
689
+ }
690
+ </style>
691
+ <img crossorigin loading="eager" decoding="async" />
692
+ `;var Na=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER,"time",j.MEDIA_PREVIEW_IMAGE,j.MEDIA_PREVIEW_COORDS]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ua.content.cloneNode(!0))}connectedCallback(){var e;let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}attributeChangedCallback(e,t,l){var n,v;if(["time",j.MEDIA_PREVIEW_IMAGE,j.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===j.MEDIA_CONTROLLER){if(t){let R=z.getElementById(t);(n=R==null?void 0:R.unassociateElement)==null||n.call(R,this)}if(l){let R=z.getElementById(l);(v=R==null?void 0:R.associateElement)==null||v.call(R,this)}}}update(){let e=this.getAttribute(j.MEDIA_PREVIEW_COORDS),t=this.getAttribute(j.MEDIA_PREVIEW_IMAGE);if(!(e&&t))return;let l=this.shadowRoot.querySelector("img"),[n,v,R,T]=e.split(/\s+/).map(E=>+E),L=t,_=()=>{l.style.height=`${T}px`,l.style["aspect-ratio"]=`${R} / ${T}`};l.src!==L&&(l.onload=_,l.src=L,_()),_(),l.style["object-position"]=`-${n}px -${v}px`}};ne("media-thumbnail-preview",Na);var Ba=z.createElement("template"),Al=`
693
+ <svg aria-hidden="true" viewBox="0 0 100 100">
694
+ <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
695
+ <animateTransform
696
+ attributeName="transform"
697
+ attributeType="XML"
698
+ type="rotate"
699
+ dur="1s"
700
+ from="0 50 50"
701
+ to="360 50 50"
702
+ repeatCount="indefinite" />
703
+ </path>
704
+ </svg>
705
+ `;Ba.innerHTML=`
706
+ <style>
707
+ :host {
708
+ display: inline-block;
709
+ vertical-align: middle;
710
+ box-sizing: border-box;
711
+ }
712
+
713
+ #status {
714
+ color: rgba(0,0,0,0);
715
+ width: 0px;
716
+ height: 0px;
717
+ }
718
+
719
+ :host slot[name=loading] > *,
720
+ :host ::slotted([slot=loading]) {
721
+ opacity: 1;
722
+ transition: opacity 0.15s;
723
+ }
724
+
725
+ :host(:not([is-loading])) slot[name=loading] > *,
726
+ :host(:not([is-loading])) ::slotted([slot=loading]) {
727
+ opacity: 0;
728
+ }
729
+
730
+ :host(:not([is-loading])) #status {
731
+ display: none;
732
+ }
733
+
734
+ svg, img, ::slotted(svg), ::slotted(img) {
735
+ width: var(--media-loading-icon-width, 100px);
736
+ height: var(--media-loading-icon-height);
737
+ fill: var(--media-icon-color, #fff);
738
+ vertical-align: middle;
739
+ }
740
+ </style>
741
+
742
+ <slot name="loading">${Al}</slot>
743
+ <div id="status" role="status" aria-live="polite">${Ge.MEDIA_LOADING()}</div>
744
+ `;var Sl=500,Fa=class extends J.HTMLElement{static get observedAttributes(){return[j.MEDIA_CONTROLLER,j.MEDIA_PAUSED,j.MEDIA_LOADING,"loading-delay"]}constructor(){super();let e=this.attachShadow({mode:"open"}),t=Ba.content.cloneNode(!0);e.appendChild(t)}attributeChangedCallback(e,t,l){var n,v,R;if(e===j.MEDIA_LOADING||e===j.MEDIA_PAUSED){let T=this.getAttribute(j.MEDIA_PAUSED)!=null,L=this.getAttribute(j.MEDIA_LOADING)!=null,_=!T&&L;if(!_)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&_){let E=+((n=this.getAttribute("loading-delay"))!=null?n:Sl);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},E)}}else if(e===j.MEDIA_CONTROLLER){if(t){let T=z.getElementById(t);(v=T==null?void 0:T.unassociateElement)==null||v.call(T,this)}if(l){let T=z.getElementById(l);(R=T==null?void 0:T.associateElement)==null||R.call(T,this)}}}connectedCallback(){var e;let t=this.getAttribute(j.MEDIA_CONTROLLER);if(t){let l=z.getElementById(t);(e=l==null?void 0:l.associateElement)==null||e.call(l,this)}}disconnectedCallback(){var e;if(this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.getAttribute(j.MEDIA_CONTROLLER)){let t=z.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}};ne("media-loading-indicator",Fa);var ja=z.createElement("template");ja.innerHTML=`
745
+ <style>
746
+ :host {
747
+
748
+ }
749
+ </style>
750
+
751
+ <slot></slot>
752
+ `;var Ka=class extends J.HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(ja.content.cloneNode(!0))}};ne("media-title-bar",Ka);var _l=100,xl=h=>{var e;if(h.getAttribute(j.MEDIA_MUTED)!=null)return 0;let t=+((e=h.getAttribute(j.MEDIA_VOLUME))!=null?e:1);return Math.round(t*h.range.max)},Ll=({value:h,max:e})=>`${Math.round(h/e*100)}%`,Wa=class extends er{static get observedAttributes(){return[...super.observedAttributes,j.MEDIA_VOLUME,j.MEDIA_MUTED,j.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super();this.range.max=_l,this.range.addEventListener("input",()=>{let e=this.range.value/this.range.max,t=new J.CustomEvent(se.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){this.range.setAttribute("aria-label",Ge.VOLUME()),super.connectedCallback()}attributeChangedCallback(e,t,l){if(e===j.MEDIA_VOLUME||e===j.MEDIA_MUTED){let n=xl(this);this.range.value=n,this.range.setAttribute("aria-valuetext",Ll(this.range)),this.updateBar()}super.attributeChangedCallback(e,t,l)}};ne("media-volume-range",Wa);var Dl=Object.defineProperty,Il=(h,e,t)=>e in h?Dl(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,Ml=(h,e,t)=>(Il(h,typeof e!="symbol"?e+"":e,t),t),Pi=class extends J.HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){this.shadowRoot.textContent="";let e=z.createElement("template");e.innerHTML=this.constructor.template,this.shadowRoot.append(e.content.cloneNode(!0))}get mediaController(){return this.shadowRoot.querySelector("media-controller")}};Ml(Pi,"template",""),ne("media-theme",Pi);var Ha=class extends qt{};J.customElements.get("media-chrome")||J.customElements.define("media-chrome",Ha);var Ga=class extends qt{constructor(){super();console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};J.customElements.get("media-container")||J.customElements.define("media-container",Ga);var Dr=new Map;function Ir(h){if(Dr.has(h))return Dr.get(h);let e=h.length,t=0,l=0,n=0,v=[];for(let R=0;R<e;R+=1){let T=h[R],L=h[R+1],_=h[R-1];T==="{"&&L==="{"&&_!=="\\"?(n+=1,n===1&&(l=R),R+=1):T==="}"&&L==="}"&&_!=="\\"&&n&&(n-=1,n===0&&(l>t&&(v.push(Object.freeze({type:"string",start:t,end:l,value:h.slice(t,l)})),t=l),v.push(Object.freeze({type:"part",start:l,end:R+2,value:h.slice(t+2,R).trim()})),R+=1,t=R+1))}return t<e&&v.push(Object.freeze({type:"string",start:t,end:e,value:h.slice(t,e)})),Dr.set(h,Object.freeze(v)),Dr.get(h)}var At=new WeakMap,Va=new WeakMap,it=class{constructor(e,t){this.expression=t,At.set(this,e),e.updateParent("")}get attributeName(){return At.get(this).attr.name}get attributeNamespace(){return At.get(this).attr.namespaceURI}get value(){return Va.get(this)}set value(e){Va.set(this,e||""),At.get(this).updateParent(e)}get element(){return At.get(this).element}get booleanValue(){return At.get(this).booleanValue}set booleanValue(e){At.get(this).booleanValue=e}},Mr=class{constructor(e,t){this.element=e,this.attr=t,this.partList=[]}get booleanValue(){return this.element.hasAttributeNS(this.attr.namespaceURI,this.attr.name)}set booleanValue(e){if(this.partList.length!==1)throw new DOMException("Operation not supported","NotSupportedError");this.partList[0].value=e?"":null}append(e){this.partList.push(e)}updateParent(e){if(this.partList.length===1&&e===null)this.element.removeAttributeNS(this.attr.namespaceURI,this.attr.name);else{let t=this.partList.map(l=>typeof l=="string"?l:l.value).join("");this.element.setAttributeNS(this.attr.namespaceURI,this.attr.name,t)}}};var vt=new WeakMap,ut=class{constructor(e,t){this.expression=t,vt.set(this,[e]),e.textContent=""}get value(){return vt.get(this).map(e=>e.textContent).join("")}set value(e){this.replace(e)}get previousSibling(){return vt.get(this)[0].previousSibling}get nextSibling(){return vt.get(this)[vt.get(this).length-1].nextSibling}replace(...e){let t=e.map(l=>typeof l=="string"?new Text(l):l);t.length||t.push(new Text("")),vt.get(this)[0].before(...t);for(let l of vt.get(this))l.remove();vt.set(this,t)}};function tr(h){return{processCallback(e,t,l){var n;if(!(typeof l!="object"||!l)){for(let v of t)if(v.expression in l){let R=(n=l[v.expression])!==null&&n!==void 0?n:"";h(v,R)}}}}}function ki(h,e){h.value=String(e)}function $a(h,e){return typeof e=="boolean"&&h instanceof it&&typeof h.element[h.attributeName]=="boolean"?(h.booleanValue=e,!0):!1}var wi=tr(ki),Rl=tr((h,e)=>{$a(h,e)||ki(h,e)});function*Cl(h){let e=h.ownerDocument.createTreeWalker(h,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,!1),t;for(;t=e.nextNode();)if(t instanceof Element&&t.hasAttributes())for(let l=0;l<t.attributes.length;l+=1){let n=t.attributes.item(l);if(n&&n.value.includes("{{")){let v=new Mr(t,n);for(let R of Ir(n.value))if(R.type==="string")v.append(R.value);else{let T=new it(v,R.value);v.append(T),yield T}}}else if(t instanceof Text&&t.textContent&&t.textContent.includes("{{")){let l=Ir(t.textContent);for(let n=0;n<l.length;n+=1){let v=l[n];v.end<t.textContent.length&&t.splitText(v.end),v.type==="part"&&(yield new ut(t,v.value));break}}}var Rr=new WeakMap,Cr=new WeakMap,mt=class extends DocumentFragment{constructor(e,t,l=wi){var n,v;super();Object.getPrototypeOf(this)!==mt.prototype&&Object.setPrototypeOf(this,mt.prototype),this.appendChild(e.content.cloneNode(!0)),Cr.set(this,Array.from(Cl(this))),Rr.set(this,l),(v=(n=Rr.get(this)).createCallback)===null||v===void 0||v.call(n,this,Cr.get(this),t),Rr.get(this).processCallback(this,Cr.get(this),t)}update(e){Rr.get(this).processCallback(this,Cr.get(this),e)}};var rr=new WeakMap,Or=class{constructor(e,t){this.element=e;this.type=t;this.element.addEventListener(this.type,this);let l=rr.get(this.element);l&&l.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=rr.get(this.element);t&&t.delete(this.type)}}static for(e){rr.has(e.element)||rr.set(e.element,new Map);let t=e.attributeName.slice(2),l=rr.get(e.element);return l&&l.has(t)?l.get(t):new Or(e.element,t)}};function Ol(h,e){return h instanceof it&&h.attributeName.startsWith("on")?(Or.for(h).set(e),h.element.removeAttributeNS(h.attributeNamespace,h.attributeName),!0):!1}function Pl(h,e){return e instanceof Ni&&h instanceof ut?(e.renderInto(h),!0):!1}function kl(h,e){return e instanceof DocumentFragment&&h instanceof ut?(e.childNodes.length&&h.replace(...e.childNodes),!0):!1}function wl(h,e){if(h instanceof it){let t=h.attributeNamespace,l=h.element.getAttributeNS(t,h.attributeName);return String(e)!==l&&(h.value=String(e)),!0}return h.value=String(e),!0}function Ul(h,e){if(typeof e=="boolean"&&h instanceof it){let t=h.attributeNamespace,l=h.element.hasAttributeNS(t,h.attributeName);return e!==l&&(h.booleanValue=e),!0}return!1}function Nl(h,e){return e===!1&&h instanceof ut?(h.replace(""),!0):!1}function Bl(h,e){Ul(h,e)||Ol(h,e)||Nl(h,e)||Pl(h,e)||kl(h,e)||wl(h,e)}var Ui=new WeakMap,Ya=new WeakMap,za=new WeakMap,Ni=class{constructor(e,t,l){this.strings=e;this.values=t;this.processor=l}get template(){if(Ui.has(this.strings))return Ui.get(this.strings);{let e=document.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((l,n,v)=>l+n+(v<t?`{{ ${v} }}`:""),""),Ui.set(this.strings,e),e}}renderInto(e){let t=this.template;if(Ya.get(e)!==t){Ya.set(e,t);let n=new mt(t,this.values,this.processor);za.set(e,n),e instanceof ut?e.replace(...n.children):e.appendChild(n);return}let l=za.get(e);l&&l.update(this.values)}},Fl=tr(Bl);function me(h,...e){return new Ni(h,e,Fl)}function ir(h,e){h.renderInto(e)}function Ve(h,e){let t=document.createElement("template");return t.innerHTML=h,new mt(t,e)}var Xa=`
753
+ :host {
754
+ cursor: pointer;
755
+ }
756
+ media-time-display {
757
+ color: inherit;
758
+ }
759
+ `,Qa=document.createElement("template");Qa.innerHTML=`
760
+ <style>
761
+ ${Xa}
762
+ </style>
763
+ <media-time-display show-duration></media-time-display>
764
+ `;var Ja=["Enter"," "],nr=class extends HTMLElement{constructor(){super();var e,t;this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(t=this.shadowRoot)==null?void 0:t.querySelector("media-time-display")}toggleTimeDisplay(){var e,t,l;((e=this.timeDisplayEl)==null?void 0:e.hasAttribute("remaining"))?(t=this.timeDisplayEl)==null||t.removeAttribute("remaining"):(l=this.timeDisplayEl)==null||l.setAttribute("remaining","")}connectedCallback(){let e=t=>{let{key:l}=t;if(!Ja.includes(l)){this.removeEventListener("keyup",e);return}this.toggleTimeDisplay()};this.addEventListener("keydown",t=>{let{metaKey:l,altKey:n,key:v}=t;if(l||n||!Ja.includes(v)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)}),this.addEventListener("click",this.toggleTimeDisplay)}};nr.styles=Xa,nr.template=Qa;globalThis.customElements.get("mxp-time-display")||(globalThis.customElements.define("mxp-time-display",nr),globalThis.MxpTimeDisplay=nr);var Za=`:host(:not([audio])) {
765
+ --secondary-color: transparent;
766
+ }
767
+
768
+ :host {
769
+ color: var(--primary-color);
770
+ --media-icon-color: var(--primary-color);
771
+ --media-range-thumb-background: var(--primary-color);
772
+ --media-range-bar-color: var(--primary-color);
773
+ --media-control-background: var(--secondary-color);
774
+ --media-control-hover-background: var(--secondary-color);
775
+ --media-time-buffered-color: rgba(255, 255, 255, 0.7);
776
+ --media-range-track-background: rgba(255, 255, 255, 0.5);
777
+ --media-range-track-border-radius: 3px;
778
+ display: inline-block;
779
+ width: 100%;
780
+ height: 100%;
781
+ }
782
+
783
+ :host([audio]) ::slotted([slot='media']) {
784
+ height: 0px;
785
+ }
786
+
787
+ :host([audio]) media-controller {
788
+ background: transparent;
789
+ }
790
+
791
+ :host([audio]) media-controller::part(vertical-layer) {
792
+ background: transparent;
793
+ }
794
+
795
+ :host([audio]) media-control-bar {
796
+ width: 100%;
797
+ }
798
+
799
+ media-airplay-button[media-airplay-unavailable],
800
+ media-cast-button[media-cast-unavailable],
801
+ media-volume-range[media-volume-unavailable],
802
+ media-airplay-button[media-airplay-unavailable] {
803
+ display: none;
804
+ }
805
+
806
+ media-volume-range[media-volume-unavailable] {
807
+ display: none;
808
+ }
809
+
810
+ media-pip-button[media-pip-unavailable] {
811
+ display: none;
812
+ }
813
+
814
+ media-controller {
815
+ width: 100%;
816
+ height: 100%;
817
+ }
818
+
819
+ :host(:not([audio])) media-time-range {
820
+ padding: var(--mux-time-range-padding, 0 10px);
821
+ z-index: 10;
822
+ width: 100%;
823
+ height: 22px;
824
+ --media-range-track-translate-y: 6px;
825
+ background: linear-gradient(180deg, transparent, transparent 15px, var(--media-control-background) 15px);
826
+ }
827
+
828
+ media-control-bar {
829
+ --media-button-icon-width: 18px;
830
+ }
831
+
832
+ media-control-bar :is([role='button'], [role='switch'], button) {
833
+ height: 44px;
834
+ }
835
+
836
+ media-cast-button {
837
+ width: 40px;
838
+ }
839
+
840
+ .size-extra-small media-control-bar [role='button'],
841
+ .size-extra-small media-control-bar [role='switch'] {
842
+ height: auto;
843
+ padding: 4.4% 3.2%;
844
+ }
845
+
846
+ .mxp-spacer {
847
+ flex-grow: 1;
848
+ height: 100%;
849
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
850
+ }
851
+
852
+ /* Add a small space on the right to have the play button and
853
+ * fullscreen button aligned in relation to the progress bar. */
854
+ .size-large .mxp-padding-2 {
855
+ width: 2px;
856
+ height: 100%;
857
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
858
+ }
859
+
860
+ media-controller::part(vertical-layer) {
861
+ transition: background-color 1s;
862
+ }
863
+
864
+ media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
865
+ background-color: rgba(0, 0, 0, 0.6);
866
+ transition: background-color 0.25s;
867
+ }
868
+
869
+ .mxp-center-controls {
870
+ --media-button-icon-width: 100%;
871
+ --media-button-icon-height: auto;
872
+ pointer-events: none;
873
+ width: 100%;
874
+ display: flex;
875
+ flex-flow: row;
876
+ align-items: center;
877
+ justify-content: center;
878
+ }
879
+
880
+ .mxp-center-controls media-play-button {
881
+ --media-control-background: transparent;
882
+ --media-control-hover-background: transparent;
883
+ padding: 0;
884
+ width: max(27px, min(9%, 90px));
885
+ }
886
+
887
+ .mxp-center-controls media-seek-backward-button,
888
+ .mxp-center-controls media-seek-forward-button {
889
+ --media-control-background: transparent;
890
+ --media-control-hover-background: transparent;
891
+ padding: 0;
892
+ margin: 0 10%;
893
+ width: min(7%, 70px);
894
+ }
895
+
896
+ media-loading-indicator {
897
+ --media-loading-icon-width: 100%;
898
+ --media-button-icon-height: auto;
899
+ pointer-events: none;
900
+ position: absolute;
901
+ width: min(15%, 150px);
902
+ display: flex;
903
+ flex-flow: row;
904
+ align-items: center;
905
+ justify-content: center;
906
+ }
907
+
908
+ /* Intentionally don't target the div for transition but the children
909
+ of the div. Prevents messing with media-chrome's autohide feature. */
910
+ media-loading-indicator + div * {
911
+ transition: opacity 0.15s;
912
+ opacity: 1;
913
+ }
914
+
915
+ media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
916
+ opacity: 0;
917
+ transition-delay: 400ms;
918
+ }
919
+
920
+ media-volume-range {
921
+ width: min(100%, 100px);
922
+ }
923
+
924
+ media-time-display {
925
+ white-space: nowrap;
926
+ }
927
+
928
+ :is(media-time-display, media-text-display, media-playback-rate-button) {
929
+ color: inherit;
930
+ }
931
+ `;var qa=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="airplay">
932
+ <path
933
+ d="M10.19 11.22a.25.25 0 0 0-.38 0l-5.46 6.37a.25.25 0 0 0 .19.41h10.92a.25.25 0 0 0 .19-.41Z"
934
+ />
935
+ <path
936
+ d="M19 0H1a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h2.94L5 13.75H1.25V1.25h17.5v12.5H15L16.06 15H19a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1Z"
937
+ />
938
+ </svg>
939
+ `;var es=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="off">
940
+ <path
941
+ d="M19.83 2.68a2.58 2.58 0 0 0-2.3-2.5C15.72.06 12.86 0 10 0S4.28.06 2.47.18a2.58 2.58 0 0 0-2.3 2.5 115.86 115.86 0 0 0 0 12.64 2.58 2.58 0 0 0 2.3 2.5c1.81.12 4.67.18 7.53.18s5.72-.06 7.53-.18a2.58 2.58 0 0 0 2.3-2.5 115.86 115.86 0 0 0 0-12.64Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18s-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11 122.5 122.5 0 0 1 0-12.42 1.11 1.11 0 0 1 .91-1.11C4.24 1.57 7 1.5 10 1.5s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11 122.5 122.5 0 0 1 0 12.42ZM7.84 11a1.55 1.55 0 0 1-.76.18 1.57 1.57 0 0 1-.71-.18 1.69 1.69 0 0 1-.57-.42 2.1 2.1 0 0 1-.38-.58 2.47 2.47 0 0 1 0-1.64 2 2 0 0 1 .39-.66 1.73 1.73 0 0 1 .58-.42 1.81 1.81 0 0 1 .73-.16 1.68 1.68 0 0 1 .7.14 1.39 1.39 0 0 1 .51.39l1.08-.89a2.18 2.18 0 0 0-.47-.44A2.81 2.81 0 0 0 8.4 6a2.91 2.91 0 0 0-.58-.15 2.71 2.71 0 0 0-.56 0A4.08 4.08 0 0 0 5.88 6a3.27 3.27 0 0 0-1.09.67 3.14 3.14 0 0 0-.71 1.06 3.62 3.62 0 0 0-.26 1.39 3.57 3.57 0 0 0 .26 1.38 3 3 0 0 0 .71 1.06 3.27 3.27 0 0 0 1.09.67 3.85 3.85 0 0 0 1.38.23 3.2 3.2 0 0 0 1.28-.27 2.49 2.49 0 0 0 1-.83l-1.17-.88a1.42 1.42 0 0 1-.53.52Zm6.62 0a1.58 1.58 0 0 1-.76.18A1.54 1.54 0 0 1 13 11a1.69 1.69 0 0 1-.57-.42A2.12 2.12 0 0 1 12 10a2.29 2.29 0 0 1 .39-2.3 1.84 1.84 0 0 1 1.32-.58 1.71 1.71 0 0 1 .7.14 1.39 1.39 0 0 1 .51.39L16 6.73a2.43 2.43 0 0 0-.47-.44A3.22 3.22 0 0 0 15 6a3 3 0 0 0-.57-.15 2.87 2.87 0 0 0-.57 0A4.06 4.06 0 0 0 12.5 6a3.17 3.17 0 0 0-1.09.67 3 3 0 0 0-.72 1.06 3.62 3.62 0 0 0-.25 1.39 3.57 3.57 0 0 0 .25 1.38 2.93 2.93 0 0 0 .72 1.06 3.17 3.17 0 0 0 1.09.67 3.83 3.83 0 0 0 1.37.23 3.16 3.16 0 0 0 1.28-.27 2.45 2.45 0 0 0 1-.83L15 10.51a1.49 1.49 0 0 1-.54.49Z"
942
+ />
943
+ </svg>
944
+ `;var ts=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="on">
945
+ <path
946
+ d="M19.83 2.68a2.58 2.58 0 0 0-2.3-2.5C13.91-.06 6.09-.06 2.47.18a2.58 2.58 0 0 0-2.3 2.5 115.86 115.86 0 0 0 0 12.64 2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5 115.86 115.86 0 0 0 0-12.64ZM8.42 12.78a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27A4 4 0 0 1 4 12a3.67 3.67 0 0 1-.84-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64A3.53 3.53 0 0 1 4 6.26a3.89 3.89 0 0 1 1.29-.8 4.76 4.76 0 0 1 1.63-.27 4.06 4.06 0 0 1 .67.06 4.57 4.57 0 0 1 .68.18 3.59 3.59 0 0 1 .64.34 2.7 2.7 0 0 1 .55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.35 2.35 0 0 0-.46.77 2.78 2.78 0 0 0-.16 1 2.74 2.74 0 0 0 .16 1 2.39 2.39 0 0 0 .46.77 2.07 2.07 0 0 0 .67.5 2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.88 2.88 0 0 1-1.22 1.01Zm7.52 0a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27 3.89 3.89 0 0 1-1.28-.83 3.55 3.55 0 0 1-.85-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64 3.43 3.43 0 0 1 .85-1.25 3.75 3.75 0 0 1 1.28-.8 4.76 4.76 0 0 1 1.63-.27 4 4 0 0 1 .67.06 4.27 4.27 0 0 1 .68.18 3.59 3.59 0 0 1 .64.34 2.46 2.46 0 0 1 .55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.35 2.35 0 0 0-.46.77 3 3 0 0 0-.16 1 3 3 0 0 0 .16 1 2.58 2.58 0 0 0 .46.77 2.07 2.07 0 0 0 .67.5 2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.82 2.82 0 0 1-1.21 1.05Z"
947
+ />
948
+ </svg>
949
+ `;var rs=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="enter">
950
+ <path
951
+ d="M17.25 11.5a.76.76 0 0 0-.75.75v4.25h-4.25a.75.75 0 0 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5a.76.76 0 0 0-.75-.75Zm0-11.5h-5a.76.76 0 0 0-.75.75.76.76 0 0 0 .75.75h4.25v4.25a.75.75 0 0 0 1.5 0v-5a.76.76 0 0 0-.75-.75ZM5.75 16.5H1.5v-4.25a.76.76 0 0 0-.75-.75.76.76 0 0 0-.75.75v5a.76.76 0 0 0 .75.75h5a.75.75 0 0 0 0-1.5Zm0-16.5h-5A.76.76 0 0 0 0 .75v5a.76.76 0 0 0 .75.75.76.76 0 0 0 .75-.75V1.5h4.25A.76.76 0 0 0 6.5.75.76.76 0 0 0 5.75 0Z"
952
+ />
953
+ </svg>
954
+ `;var is=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="exit">
955
+ <path
956
+ d="M17.25 11.5h-5a.76.76 0 0 0-.75.75v5a.75.75 0 0 0 1.5 0V13h4.25a.75.75 0 0 0 0-1.5Zm-5-5h5a.75.75 0 0 0 0-1.5H13V.75a.75.75 0 0 0-1.5 0v5a.76.76 0 0 0 .75.75Zm-6.5 5h-5a.75.75 0 0 0 0 1.5H5v4.25a.75.75 0 0 0 1.5 0v-5a.76.76 0 0 0-.75-.75Zm0-11.5A.76.76 0 0 0 5 .75V5H.75a.75.75 0 0 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5A.76.76 0 0 0 5.75 0Z"
957
+ />
958
+ </svg>
959
+ `;var ns=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="pause">
960
+ <path
961
+ d="M3 16.5a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v15ZM11.5 1a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3Z"
962
+ />
963
+ </svg>
964
+ `;var as=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="enter">
965
+ <path
966
+ d="M19 0H1a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V1.25h17.5v6.5H20V1a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7Z"
967
+ />
968
+ </svg>
969
+ `;var ss=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="exit">
970
+ <path
971
+ d="M19 0H1a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V1.25h17.5v6.5H20V1a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7Z"
972
+ />
973
+ </svg>
974
+ `;var os=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="play">
975
+ <path
976
+ d="m3.73 17.93 14.05-8.54a.46.46 0 0 0 0-.78L3.73.07A.48.48 0 0 0 3 .46v17.07a.48.48 0 0 0 .73.4Z"
977
+ />
978
+ </svg>
979
+ `;var ls=`<svg aria-hidden="true" viewBox="0 0 16 18" slot="backward">
980
+ <path
981
+ d="M8.75 3.42H4.68l2.14-2.14A.75.75 0 0 0 5.76.22L2.22 3.75a.77.77 0 0 0 0 1.07l3.54 3.53a.75.75 0 0 0 1.06 0 .75.75 0 0 0 0-1.06L4.45 4.92h4.3A5.75 5.75 0 0 1 11 16a.75.75 0 0 0 .29 1.44.72.72 0 0 0 .29-.06A7.25 7.25 0 0 0 8.75 3.42Z"
982
+ />
983
+ <text
984
+ class="value"
985
+ transform="translate(.6 17.8)"
986
+ style="font-size: 8px; font-family: 'ArialMT', 'Arial'"
987
+ >
988
+ {{value}}
989
+ </text>
990
+ <path style="fill: none" d="M0 0h16v18H0z" />
991
+ </svg>
992
+ `;var us=`<svg aria-hidden="true" viewBox="0 0 16 18" slot="forward">
993
+ <path
994
+ d="M7.25 3.42h4.07L9.18 1.28A.75.75 0 0 1 10.24.22l3.54 3.53a.77.77 0 0 1 0 1.07l-3.54 3.53a.75.75 0 0 1-1.06 0 .75.75 0 0 1 0-1.06l2.37-2.37h-4.3A5.75 5.75 0 0 0 5 16a.75.75 0 0 1-.29 1.44.72.72 0 0 1-.29-.06A7.25 7.25 0 0 1 7.25 3.42Z"
995
+ />
996
+ <text
997
+ class="value"
998
+ transform="translate(6.5 17.8)"
999
+ style="font-size: 8px; font-family: 'ArialMT', 'Arial'"
1000
+ >
1001
+ {{value}}
1002
+ </text>
1003
+ <path style="fill: none" d="M0 0h16v18H0z" />
1004
+ </svg>
1005
+ `;var ds=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="high">
1006
+ <path
1007
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM10.88.3v1.52A7.52 7.52 0 0 1 16.47 9a7.52 7.52 0 0 1-5.59 7.18v1.52A9 9 0 0 0 18 9 9 9 0 0 0 10.88.3ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
1008
+ />
1009
+ <path style="fill: none" d="M0 0h18v18H0z" />
1010
+ </svg>
1011
+ `;var cs=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="low">
1012
+ <path
1013
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
1014
+ />
1015
+ <path style="fill: none" d="M0 0h18v18H0z" />
1016
+ </svg>
1017
+ `;var fs=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="medium">
1018
+ <path
1019
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
1020
+ />
1021
+ <path style="fill: none" d="M0 0h18v18H0z" />
1022
+ </svg>
1023
+ `;var hs=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="off">
1024
+ <path
1025
+ d="m0 1.05 4.48 4.47-.33.33a.49.49 0 0 1-.36.15H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.48.48 0 0 0 .36.15.5.5 0 0 0 .5-.5v-5.75l4.67 4.66a7.71 7.71 0 0 1-2.79 1.47v1.52a9.32 9.32 0 0 0 3.87-1.91L17 18l1-1L1.06 0Zm5.36 5.36L7.75 8.8V14L5 11.26a1.74 1.74 0 0 0-1.24-.51H1.25v-3.5h2.54A1.74 1.74 0 0 0 5 6.74ZM16.47 9a7.19 7.19 0 0 1-.89 3.47l1.11 1.1A8.64 8.64 0 0 0 18 9 9 9 0 0 0 10.88.3v1.52A7.52 7.52 0 0 1 16.47 9ZM9 5.88V2.21a.5.5 0 0 0-.5-.5.48.48 0 0 0-.36.15L6.56 3.44ZM12.91 9a4.28 4.28 0 0 1-.07.72l1.22 1.22A5.2 5.2 0 0 0 14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66A4 4 0 0 1 12.91 9Z"
1026
+ />
1027
+ <path style="fill: none" d="M0 0h18v18H0z" />
1028
+ </svg>
1029
+ `;var vs=()=>Ve(qa),ms=()=>Ve(es),gs=()=>Ve(ts),ps=()=>Ve(rs),Es=()=>Ve(is),ys=()=>Ve(ns),Ts=()=>Ve(as),bs=()=>Ve(ss),As=()=>Ve(os),Ss=h=>Ve(ls,h),_s=h=>Ve(us,h),xs=()=>Ve(ds),Ls=()=>Ve(cs),Ds=()=>Ve(fs),Is=()=>Ve(hs);var dt={LG:"large",SM:"small",XS:"extra-small"},Ms=h=>me`
1030
+ <style>
1031
+ ${Za}
1032
+ </style>
1033
+
1034
+ <media-controller audio="${h.audio||!1}" class="size-${h.playerSize}">
1035
+ <slot name="media" slot="media"></slot>
1036
+ <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
1037
+ ${ru(h)}
1038
+ <slot></slot>
1039
+ </media-controller>
1040
+ `,ru=h=>{let{streamType:e,playerSize:t,audio:l}=h;if(l)switch(e){case ve.LIVE:case ve.LL_LIVE:return au(h);case ve.DVR:case ve.LL_DVR:return nu(h);case ve.ON_DEMAND:default:return iu(h)}switch(e){case ve.LIVE:case ve.LL_LIVE:switch(t){case dt.LG:return du(h);case dt.SM:return uu(h);case dt.XS:return lu(h)}case ve.DVR:case ve.LL_DVR:switch(t){case dt.LG:return hu(h);case dt.SM:return fu(h);case dt.XS:return cu(h)}case ve.ON_DEMAND:default:switch(t){case dt.LG:return ou(h);case dt.SM:return su(h);case dt.XS:return Bi(h)}}},Xe=()=>me`
1041
+ <media-play-button>
1042
+ ${As()}
1043
+ ${ys()}
1044
+ </media-play-button>
1045
+ `,Bt=h=>me`
1046
+ <media-seek-backward-button seek-offset="${h.backwardSeekOffset}">
1047
+ ${Ss({value:h.backwardSeekOffset})}
1048
+ </media-seek-backward-button>
1049
+ `,Ft=h=>me`
1050
+ <media-seek-forward-button seek-offset="${h.forwardSeekOffset}">
1051
+ ${_s({value:h.forwardSeekOffset})}
1052
+ </media-seek-forward-button>
1053
+ `,nt=()=>me`
1054
+ <media-mute-button>
1055
+ ${xs()}
1056
+ ${Ds()}
1057
+ ${Ls()}
1058
+ ${Is()}
1059
+ </media-mute-button>
1060
+ `,St=h=>me`
1061
+ <media-captions-button default-showing="${!h.defaultHiddenCaptions}" >
1062
+ ${ms()}
1063
+ ${gs()}
1064
+ </media-captions-button>`,at=()=>me`
1065
+ <media-airplay-button>
1066
+ ${vs()}
1067
+ </media-airplay-button>`,_t=()=>me`
1068
+ <media-pip-button>
1069
+ ${Ts()}
1070
+ ${bs()}
1071
+ </media-pip-button>`,xt=()=>me`
1072
+ <media-fullscreen-button>
1073
+ ${ps()}
1074
+ ${Es()}
1075
+ </media-fullscreen-button>`,iu=h=>me`
1076
+ <media-control-bar>
1077
+ ${Xe()} ${Bt(h)} ${Ft(h)}
1078
+ <mxp-time-display></mxp-time-display>
1079
+ <media-time-range></media-time-range>
1080
+ ${nt()}
1081
+ <media-volume-range></media-volume-range>
1082
+ <media-playback-rate-button></media-playback-rate-button>
1083
+ ${at()}
1084
+ <media-cast-button></media-cast-button>
1085
+ </media-control-bar>
1086
+ `,nu=h=>me`
1087
+ <media-control-bar>
1088
+ ${Xe()}
1089
+ <slot name="seek-to-live-button"></slot>
1090
+ ${Bt(h)} ${Ft(h)}
1091
+ <mxp-time-display></mxp-time-display>
1092
+ <media-time-range></media-time-range>
1093
+ ${nt()}
1094
+ <media-volume-range></media-volume-range>
1095
+ <media-playback-rate-button></media-playback-rate-button>
1096
+ ${at()}
1097
+ <media-cast-button></media-cast-button>
1098
+ </media-control-bar>
1099
+ `,au=h=>me`
1100
+ <media-control-bar>
1101
+ ${Xe()}
1102
+ <slot name="seek-to-live-button"></slot>
1103
+ ${nt()}
1104
+ <media-volume-range></media-volume-range>
1105
+ ${at()}
1106
+ <media-cast-button></media-cast-button>
1107
+ </media-control-bar>
1108
+ `,Bi=h=>me`
1109
+ <media-control-bar slot="top-chrome">
1110
+ ${h.hasCaptions?St(h):me``}
1111
+ <div class="mxp-spacer"></div>
1112
+ ${at()}
1113
+ <media-cast-button></media-cast-button>
1114
+ ${_t()}
1115
+ </media-control-bar>
1116
+ <div slot="centered-chrome" class="mxp-center-controls">
1117
+ ${Xe()}
1118
+ </div>
1119
+ <media-control-bar>
1120
+ ${nt()}
1121
+ <div class="mxp-spacer"></div>
1122
+ ${xt()}
1123
+ </media-control-bar>
1124
+ `,su=h=>me`
1125
+ <media-control-bar slot="top-chrome" style="justify-content: flex-end;">
1126
+ ${h.hasCaptions?St(h):me``}
1127
+ ${at()}
1128
+ <media-cast-button></media-cast-button>
1129
+ ${_t()}
1130
+ </media-control-bar>
1131
+ <div slot="centered-chrome" class="mxp-center-controls">
1132
+ ${Bt(h)}
1133
+ ${Xe()}
1134
+ ${Ft(h)}
1135
+ </div>
1136
+ <media-time-range></media-time-range>
1137
+ <media-control-bar>
1138
+ <mxp-time-display></mxp-time-display>
1139
+ ${nt()}
1140
+ <media-volume-range></media-volume-range>
1141
+ <div class="mxp-spacer"></div>
1142
+ <media-playback-rate-button></media-playback-rate-button>
1143
+ ${xt()}
1144
+ <div class="mxp-padding-2"></div>
1145
+ </media-control-bar>
1146
+ `,ou=h=>me`
1147
+ <div slot="centered-chrome" class="mxp-center-controls">
1148
+ ${Xe()}
1149
+ </div>
1150
+ <media-time-range></media-time-range>
1151
+ <media-control-bar>
1152
+ ${Xe()}
1153
+ ${Bt(h)}
1154
+ ${Ft(h)}
1155
+ <mxp-time-display></mxp-time-display>
1156
+ ${nt()}
1157
+ <media-volume-range></media-volume-range>
1158
+ <div class="mxp-spacer"></div>
1159
+ <media-playback-rate-button></media-playback-rate-button>
1160
+ ${h.hasCaptions?St(h):me``}
1161
+ ${at()}
1162
+ <media-cast-button></media-cast-button>
1163
+ ${_t()}
1164
+ ${xt()}
1165
+ <div class="mxp-padding-2"></div>
1166
+ </media-control-bar>
1167
+ `,lu=Bi,uu=h=>me`
1168
+ <media-control-bar slot="top-chrome">
1169
+ <slot name="seek-to-live-button"></slot>
1170
+ <div class="mxp-spacer"></div>
1171
+ ${h.hasCaptions?St(h):me``}
1172
+ ${at()}
1173
+ <media-cast-button></media-cast-button>
1174
+ ${_t()}
1175
+ </media-control-bar>
1176
+ <div slot="centered-chrome" class="mxp-center-controls">
1177
+ ${Xe()}
1178
+ </div>
1179
+ <media-control-bar>
1180
+ ${nt()}
1181
+ <media-volume-range></media-volume-range>
1182
+ <div class="mxp-spacer"></div>
1183
+ ${xt()}
1184
+ </media-control-bar>
1185
+ `,du=h=>me`
1186
+ <media-control-bar slot="top-chrome">
1187
+ <slot name="seek-to-live-button"></slot>
1188
+ </media-control-bar>
1189
+ <div slot="centered-chrome" class="mxp-center-controls">
1190
+ ${Xe()}
1191
+ </div>
1192
+ <media-control-bar>
1193
+ ${nt()}
1194
+ <media-volume-range></media-volume-range>
1195
+ <div class="mxp-spacer"></div>
1196
+ ${h.hasCaptions?St(h):me``}
1197
+ ${at()}
1198
+ <media-cast-button></media-cast-button>
1199
+ ${_t()}
1200
+ ${xt()}
1201
+ </media-control-bar>
1202
+ `,cu=Bi,fu=h=>me`
1203
+ <media-control-bar slot="top-chrome" style="justify-content: flex-end;">
1204
+ ${h.hasCaptions?St(h):me``}
1205
+ ${at()}
1206
+ <media-cast-button></media-cast-button>
1207
+ ${_t()}
1208
+ </media-control-bar>
1209
+ <div slot="centered-chrome" class="mxp-center-controls">
1210
+ ${Bt(h)}
1211
+ ${Xe()}
1212
+ ${Ft(h)}
1213
+ </div>
1214
+ <media-time-range></media-time-range>
1215
+ <media-control-bar>
1216
+ ${nt()}
1217
+ <media-volume-range></media-volume-range>
1218
+ <slot name="seek-to-live-button"></slot>
1219
+ <div class="mxp-spacer"></div>
1220
+ ${xt()}
1221
+ <div class="mxp-padding-2"></div>
1222
+ </media-control-bar>
1223
+ `,hu=h=>me`
1224
+ <div slot="centered-chrome" class="mxp-center-controls">
1225
+ ${Xe()}
1226
+ </div>
1227
+ <media-time-range></media-time-range>
1228
+ <media-control-bar>
1229
+ ${Xe()}
1230
+ ${Bt(h)}
1231
+ ${Ft(h)}
1232
+ ${nt()}
1233
+ <media-volume-range></media-volume-range>
1234
+ <slot name="seek-to-live-button"></slot>
1235
+ <div class="mxp-spacer"></div>
1236
+ ${h.hasCaptions?St(h):me``}
1237
+ ${at()}
1238
+ <media-cast-button></media-cast-button>
1239
+ ${_t()}
1240
+ ${xt()}
1241
+ <div class="mxp-padding-2"></div>
1242
+ </media-control-bar>
1243
+ `;function Rs(h,e){return{audio:h.hasAttribute("audio"),streamType:h.getAttribute("stream-type"),playerSize:h.getAttribute("player-size"),defaultHiddenCaptions:h.hasAttribute("default-hidden-captions"),hasCaptions:h.hasAttribute("has-captions"),forwardSeekOffset:h.getAttribute("forward-seek-offset"),backwardSeekOffset:h.getAttribute("backward-seek-offset"),...e}}var Fi=class extends HTMLElement{static get observedAttributes(){return["audio","stream-type","player-size","default-hidden-captions","has-captions","forward-seek-offset","backward-seek-offset"]}constructor(){super();this.attachShadow({mode:"open"}),ir(Ms(Rs(this)),this.shadowRoot)}attributeChangedCallback(){ir(Ms(Rs(this)),this.shadowRoot)}};customElements.get("media-theme-mux")||customElements.define("media-theme-mux",Fi);var Cs=Fi;var vu=Object.defineProperty,mu=(h,e,t)=>e in h?vu(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,Pr=(h,e,t)=>(mu(h,typeof e!="symbol"?e+"":e,t),t),ji=(h,e,t)=>{if(!e.has(h))throw TypeError("Cannot "+t)},ae=(h,e,t)=>(ji(h,e,"read from private field"),t?t.call(h):e.get(h)),Le=(h,e,t)=>{if(e.has(h))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(h):e.set(h,t)},ze=(h,e,t,l)=>(ji(h,e,"write to private field"),l?l.call(h,t):e.set(h,t),t),He=(h,e,t)=>(ji(h,e,"access private method"),t),gu=()=>{try{return"0.8.0"}catch{}return"UNKNOWN"},pu=gu(),Eu=()=>pu,yu=h=>{var e,t,l,n,v,R,T,L,_,E,I,M,D,b,A,u,r,s,i,a,d,o,y,p,m,g,f,c,x,S,C,O,P,w,U,k,N,B,K,W;return e=class extends h{constructor(){super();Le(this,f),Le(this,x),Le(this,C),Le(this,P),Le(this,U),Le(this,N),Le(this,K),Pr(this,"castEnabled",!1),Le(this,d,{paused:!1}),Le(this,o,void 0),Le(this,y,{}),Le(this,p,void 0),Le(this,m,void 0),Le(this,g,void 0),e.instances.add(this),He(this,U,k).call(this)}static get castElement(){return ae(e,t)}static get castEnabled(){return ae(e,l)}static get castState(){var F;return(F=ae(e,_,E))==null?void 0:F.getCastState()}static async exitCast(){let F=!0;try{await ae(e,_,E).endCurrentSession(F)}catch(H){console.error(H);return}}get castPlayer(){if(e.castElement===this)return ae(this,o)}attributeChangedCallback(F){if(this.castPlayer)switch(F){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(F={}){var H;He(H=e,i,a).call(H,F),ze(e,t,this),Object.entries(ae(this,y)).forEach(([Y,$])=>{ae(this,o).controller.addEventListener(Y,$)});try{await ae(e,_,E).requestSession()}catch{ze(e,t,void 0);return}ae(this,d).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(Y){console.error(Y)}}async load(){var F,H;if(!this.castPlayer)return super.load();let Y=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),$=[...this.querySelectorAll("track")].filter(({kind:X,src:ie})=>ie&&(X==="subtitles"||X==="captions")),Z=[],q=0;$.length&&(Y.tracks=$.map(X=>{let ie=++q;Z.length===0&&X.track.mode==="showing"&&Z.push(ie);let fe=new chrome.cast.media.Track(ie,chrome.cast.media.TrackType.TEXT);return fe.trackContentId=X.src,fe.trackContentType="text/vtt",fe.subtype=X.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,fe.name=X.label,fe.language=X.srclang,fe})),this.castStreamType==="live"?Y.streamType=chrome.cast.media.StreamType.LIVE:Y.streamType=chrome.cast.media.StreamType.BUFFERED,Y.metadata=new chrome.cast.media.GenericMediaMetadata,Y.metadata.title=this.title,Y.metadata.images=[{url:this.poster}];let oe=new chrome.cast.media.LoadRequest(Y);oe.currentTime=(F=super.currentTime)!=null?F:0,oe.autoplay=!ae(this,d).paused,oe.activeTrackIds=Z,await((H=ae(e,I,M))==null?void 0:H.loadMedia(oe)),this.dispatchEvent(new Event("volumechange"))}play(){var F;if(this.castPlayer){this.castPlayer.isPaused&&((F=this.castPlayer.controller)==null||F.playOrPause());return}return super.play()}pause(){var F;if(this.castPlayer){this.castPlayer.isPaused||(F=this.castPlayer.controller)==null||F.playOrPause();return}super.pause()}get castSrc(){var F,H,Y;return(Y=(H=this.getAttribute("cast-src"))!=null?H:(F=this.querySelector("source"))==null?void 0:F.src)!=null?Y:this.currentSrc}set castSrc(F){this.castSrc!=F&&this.setAttribute("cast-src",`${F}`)}get castContentType(){var F;return(F=this.getAttribute("cast-content-type"))!=null?F:void 0}set castContentType(F){this.setAttribute("cast-content-type",`${F}`)}get castStreamType(){var F;return(F=this.getAttribute("cast-stream-type"))!=null?F:void 0}set castStreamType(F){this.setAttribute("cast-stream-type",`${F}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var F;return this.castPlayer?(F=this.castPlayer)==null?void 0:F.isMuted:super.muted}set muted(F){var H;if(this.castPlayer){(F&&!this.castPlayer.isMuted||!F&&this.castPlayer.isMuted)&&((H=this.castPlayer.controller)==null||H.muteOrUnmute());return}super.muted=F}get volume(){var F,H;return this.castPlayer?(H=(F=this.castPlayer)==null?void 0:F.volumeLevel)!=null?H:1:super.volume}set volume(F){var H;if(this.castPlayer){this.castPlayer.volumeLevel=F,(H=this.castPlayer.controller)==null||H.setVolumeLevel();return}super.volume=F}get duration(){var F,H;return this.castPlayer&&ae(this,f,c)?(H=(F=this.castPlayer)==null?void 0:F.duration)!=null?H:NaN:super.duration}get currentTime(){var F,H;return this.castPlayer&&ae(this,f,c)?(H=(F=this.castPlayer)==null?void 0:F.currentTime)!=null?H:0:super.currentTime}set currentTime(F){var H;if(this.castPlayer){this.castPlayer.currentTime=F,(H=this.castPlayer.controller)==null||H.seek();return}super.currentTime=F}get onentercast(){return ae(this,p)}set onentercast(F){ae(this,p)&&(this.removeEventListener("entercast",ae(this,p)),ze(this,p,null)),typeof F=="function"&&(ze(this,p,F),this.addEventListener("entercast",F))}get onleavecast(){return ae(this,m)}set onleavecast(F){ae(this,m)&&(this.removeEventListener("leavecast",ae(this,m)),ze(this,m,null)),typeof F=="function"&&(ze(this,m,F),this.addEventListener("leavecast",F))}get oncastchange(){return ae(this,g)}set oncastchange(F){ae(this,g)&&(this.removeEventListener("castchange",ae(this,g)),ze(this,g,null)),typeof F=="function"&&(ze(this,g,F),this.addEventListener("castchange",F))}},t=new WeakMap,l=new WeakMap,n=new WeakMap,v=new WeakSet,R=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},T=new WeakSet,L=function(){return typeof cast!="undefined"&&cast.framework},_=new WeakSet,E=function(){if(ae(e,T,L))return cast.framework.CastContext.getInstance()},I=new WeakSet,M=function(){var F;return(F=ae(e,_,E))==null?void 0:F.getCurrentSession()},D=new WeakSet,b=function(){var F;return(F=ae(e,I,M))==null?void 0:F.getSessionObj().media[0]},A=new WeakSet,u=function(F){return new Promise((H,Y)=>{ae(e,D,b).editTracksInfo(F,H,Y)})},r=new WeakSet,s=function(F){return new Promise((H,Y)=>{ae(e,D,b).getStatus(F,H,Y)})},i=new WeakSet,a=function(F){return ae(e,_,E).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...F})},d=new WeakMap,o=new WeakMap,y=new WeakMap,p=new WeakMap,m=new WeakMap,g=new WeakMap,f=new WeakSet,c=function(){var F;return(F=this.castPlayer)==null?void 0:F.isMediaLoaded},x=new WeakSet,S=function(){ae(e,t)===this&&(Object.entries(ae(this,y)).forEach(([F,H])=>{ae(this,o).controller.removeEventListener(F,H)}),ze(e,t,void 0),this.muted=ae(this,o).isMuted,this.currentTime=ae(this,o).savedPlayerState.currentTime,ae(this,o).savedPlayerState.isPaused===!1&&this.play())},C=new WeakSet,O=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:ae(e,_,E).getCastState()}))},P=new WeakSet,w=async function(){var F,H;let{SESSION_RESUMED:Y}=cast.framework.SessionState;if(ae(e,_,E).getSessionState()===Y&&this.castSrc===((F=ae(e,D,b))==null?void 0:F.media.contentId)){ze(e,t,this),Object.entries(ae(this,y)).forEach(([$,Z])=>{ae(this,o).controller.addEventListener($,Z)});try{await He(H=e,r,s).call(H,new chrome.cast.media.GetStatusRequest)}catch($){console.error($)}ae(this,y)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),ae(this,y)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},U=new WeakSet,k=function(){var F;!ae(e,T,L)||this.castEnabled||(this.castEnabled=!0,He(F=e,i,a).call(F),this.textTracks.addEventListener("change",He(this,K,W).bind(this)),He(this,C,O).call(this),ze(this,o,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(ae(this,o)),ze(this,y,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:H})=>{H===!1&&He(this,x,S).call(this),this.dispatchEvent(new Event(H?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!ae(this,f,c)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var H,Y;((H=this.castPlayer)==null?void 0:H.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(Y=this.castPlayer)==null?void 0:Y.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!ae(this,f,c)||(await Promise.resolve(),He(this,N,B).call(this))}}))},N=new WeakSet,B=function(){He(this,K,W).call(this)},K=new WeakSet,W=async function(){var F,H,Y,$,Z,q;if(!this.castPlayer)return;let oe=((H=(F=ae(this,o).mediaInfo)==null?void 0:F.tracks)!=null?H:[]).filter(({type:Q})=>Q===chrome.cast.media.TrackType.TEXT),X=[...this.textTracks].filter(({kind:Q})=>Q==="subtitles"||Q==="captions"),ie=oe.map(({language:Q,name:te,trackId:ee})=>{var he;let{mode:_e}=(he=X.find(Ee=>Ee.language===Q&&Ee.label===te))!=null?he:{};return _e?{mode:_e,trackId:ee}:!1}).filter(Boolean),fe=ie.filter(({mode:Q})=>Q!=="showing").map(({trackId:Q})=>Q),ue=ie.find(({mode:Q})=>Q==="showing"),Se=(Z=($=(Y=ae(e,I,M))==null?void 0:Y.getSessionObj().media[0])==null?void 0:$.activeTrackIds)!=null?Z:[],re=Se;if(Se.length&&(re=re.filter(Q=>!fe.includes(Q))),(ue==null?void 0:ue.trackId)&&(re=[...re,ue.trackId]),re=[...new Set(re)],!((Q,te)=>Q.length===te.length&&Q.every(ee=>te.includes(ee)))(Se,re))try{let Q=new chrome.cast.media.EditTracksInfoRequest(re);await He(q=e,A,u).call(q,Q)}catch(Q){console.error(Q)}},Le(e,v),Le(e,T),Le(e,_),Le(e,I),Le(e,D),Le(e,A),Le(e,r),Le(e,i),Pr(e,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Pr(e,"instances",new Set),Le(e,t,void 0),Le(e,l,!1),Pr(e,"initCast",()=>{var F;ae(e,v,R)?ae(e,T,L)?ae(F=e,n).call(F,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var H;return ae(H=e,n).call(H,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var H;return ae(H=e,n).call(H,chrome.cast.isAvailable)})}}),Le(e,n,F=>{if(F){ze(e,l,!0);let{CAST_STATE_CHANGED:H}=cast.framework.CastContextEventType;ae(e,_,E).addEventListener(H,$=>{e.instances.forEach(Z=>{var q;return He(q=Z,C,O).call(q,$)})});let{SESSION_STATE_CHANGED:Y}=cast.framework.CastContextEventType;ae(e,_,E).addEventListener(Y,$=>{e.instances.forEach(Z=>{var q;return He(q=Z,P,w).call(q,$)})}),e.instances.forEach($=>{var Z;return He(Z=$,U,k).call(Z)})}}),e},Ki=yu(HTMLVideoElement);customElements.get("castable-video")||(customElements.define("castable-video",Ki,{extends:"video"}),globalThis.CastableVideoElement=Ki);Ki.initCast();var Wi=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","castchange","entercast","leavecast"],Os=document.createElement("template");Os.innerHTML=`
1244
+ <style>
1245
+ :host {
1246
+ display: inline-block;
1247
+ line-height: 0;
1248
+ width: auto;
1249
+ height: auto;
1250
+ }
1251
+
1252
+ video {
1253
+ max-width: 100%;
1254
+ max-height: 100%;
1255
+ min-width: 100%;
1256
+ min-height: 100%;
1257
+ }
1258
+ </style>
1259
+ <video is="castable-video" part="video" crossorigin></video>
1260
+ <slot></slot>
1261
+ `;var kr,wr,Ur,Hi,Nr,Gi,jt=class extends HTMLElement{constructor(){super();Le(this,Ur),Le(this,Nr),Le(this,kr,void 0),Le(this,wr,void 0),this.attachShadow({mode:"open"}),this.isConnected&&He(this,Ur,Hi).call(this)}static get observedAttributes(){let h=[],e=l=>l.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(l=>{let n=!1;try{typeof this.prototype[l]=="function"&&(n=!0)}catch{}!n&&l!==l.toUpperCase()&&h.push(l.toLowerCase(),e(l))});let t=Object.getPrototypeOf(this).observedAttributes;return t&&(h=h.concat(t)),h}attributeChangedCallback(h,e,t){!ae(this,kr)&&!this.isConnected&&(ze(this,kr,!0),He(this,Ur,Hi).call(this)),He(this,Nr,Gi).call(this,h,e,t)}connectedCallback(){}};kr=new WeakMap,wr=new WeakMap,Ur=new WeakSet,Hi=function(){if(ae(this,wr))return;ze(this,wr,!0),this.shadowRoot.append(Os.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Wi.forEach(e=>{this.nativeEl.addEventListener(e,t=>{this.dispatchEvent(new CustomEvent(t.type,{detail:t.detail}))})});let h=this.shadowRoot.querySelector("slot");h.addEventListener("slotchange",()=>{h.assignedElements().forEach(e=>{!["track","source"].includes(e.localName)||this.nativeEl.append(e)})}),Array.prototype.forEach.call(this.attributes,e=>{He(this,Nr,Gi).call(this,e.name,null,e.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},Nr=new WeakSet,Gi=function(h,e,t){let l=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=bu(l,h),v=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;n&&!v?typeof this[n]=="boolean"?t===null?this[n]=!1:this[n]=!0:this[n]=t:t===null?this.nativeEl.removeAttribute(h):["id","class"].indexOf(h)===-1&&this.nativeEl.setAttribute(h,t)};var Ps=[],ks=document.createElement("video",{is:"castable-video"}),Tu=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let h=Object.getPrototypeOf(ks);h&&h!==HTMLElement.prototype;h=Object.getPrototypeOf(h))Object.getOwnPropertyNames(h).forEach(e=>{Tu.indexOf(e)===-1&&Ps.push(e)});Ps.forEach(h=>{if(!(h in jt.prototype))if(typeof ks[h]=="function")jt.prototype[h]=function(){return this.nativeEl[h].apply(this.nativeEl,arguments)};else{let e={get(){return this.nativeEl[h]}};h!==h.toUpperCase()&&(e.set=function(t){this.nativeEl[h]=t}),Object.defineProperty(jt.prototype,h,e)}});function bu(h,e){let t=null;return h.forEach(l=>{l.toLowerCase()==e.toLowerCase()&&(t=l)}),t}globalThis.customElements.get("custom-video")||(globalThis.customElements.define("custom-video",jt),globalThis.CustomVideoElement=jt);var ws=jt,ge={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_MSE:"prefer-mse",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Au=Object.values(ge),Su=Eu(),_u="mux-video",Vi=class extends ws{constructor(){super();this.__metadata={},this.__playerInitTime=mn()}static get observedAttributes(){var h;return[...Au,...(h=ws.observedAttributes)!=null?h:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var h;return(h=this.__playerSoftwareName)!=null?h:_u}set playerSoftwareName(h){this.__playerSoftwareName=h}get playerSoftwareVersion(){var h;return(h=this.__playerSoftwareVersion)!=null?h:Su}set playerSoftwareVersion(h){this.__playerSoftwareVersion=h}get hls(){return console.warn("<mux-video>.hls is deprecated, please use ._hls instead"),this._hls}get _hls(){return this.__hls}get mux(){return this.nativeEl.mux}get error(){var h;return(h=En(this.nativeEl))!=null?h:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(h){this.__errorTranslator=h}get src(){return this.getAttribute("src")}set src(h){h!==this.src&&(h==null?this.removeAttribute("src"):this.setAttribute("src",h))}get type(){var h;return(h=this.getAttribute(ge.TYPE))!=null?h:void 0}set type(h){h!==this.type&&(h?this.setAttribute(ge.TYPE,h):this.removeAttribute(ge.TYPE))}get autoplay(){let h=this.getAttribute("autoplay");return h===null?!1:h===""?!0:h}set autoplay(h){let e=this.autoplay;h!==e&&(h?this.setAttribute("autoplay",typeof h=="string"?h:""):this.removeAttribute("autoplay"))}get debug(){return this.getAttribute(ge.DEBUG)!=null}set debug(h){h!==this.debug&&(h?this.setAttribute(ge.DEBUG,""):this.removeAttribute(ge.DEBUG))}get startTime(){let h=this.getAttribute(ge.START_TIME);if(h==null)return;let e=+h;return Number.isNaN(e)?void 0:e}set startTime(h){h!==this.startTime&&(h==null?this.removeAttribute(ge.START_TIME):this.setAttribute(ge.START_TIME,`${h}`))}get playbackId(){var h;return(h=this.getAttribute(ge.PLAYBACK_ID))!=null?h:void 0}set playbackId(h){h!==this.playbackId&&(h?this.setAttribute(ge.PLAYBACK_ID,h):this.removeAttribute(ge.PLAYBACK_ID))}get customDomain(){var h;return(h=this.getAttribute(ge.CUSTOM_DOMAIN))!=null?h:void 0}set customDomain(h){h!==this.customDomain&&(h?this.setAttribute(ge.CUSTOM_DOMAIN,h):this.removeAttribute(ge.CUSTOM_DOMAIN))}get envKey(){var h;return(h=this.getAttribute(ge.ENV_KEY))!=null?h:void 0}set envKey(h){h!==this.envKey&&(h?this.setAttribute(ge.ENV_KEY,h):this.removeAttribute(ge.ENV_KEY))}get beaconCollectionDomain(){var h;return(h=this.getAttribute(ge.BEACON_COLLECTION_DOMAIN))!=null?h:void 0}set beaconCollectionDomain(h){h!==this.beaconCollectionDomain&&(h?this.setAttribute(ge.BEACON_COLLECTION_DOMAIN,h):this.removeAttribute(ge.BEACON_COLLECTION_DOMAIN))}get streamType(){var h;return(h=this.getAttribute(ge.STREAM_TYPE))!=null?h:void 0}set streamType(h){h!==this.streamType&&(h?this.setAttribute(ge.STREAM_TYPE,h):this.removeAttribute(ge.STREAM_TYPE))}get preferMse(){return this.getAttribute(ge.PREFER_MSE)!=null}set preferMse(h){h?this.setAttribute(ge.PREFER_MSE,""):this.removeAttribute(ge.PREFER_MSE)}get metadata(){let h=this.getAttribute(ge.METADATA_VIDEO_ID),e=this.getAttribute(ge.METADATA_VIDEO_TITLE),t=this.getAttribute(ge.METADATA_VIEWER_USER_ID);return{...this.__metadata,...h!=null?{video_id:h}:{},...e!=null?{video_title:e}:{},...t!=null?{viewer_user_id:t}:{}}}set metadata(h){this.__metadata=h!=null?h:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){let h=Tn(this,this.nativeEl,this.__hls);this.__hls=h;let e=fn(this.nativeEl,this.autoplay,h);this.__updateAutoplay=e}unload(){mi(this.nativeEl,this.__hls),this.__hls=void 0}attributeChangedCallback(h,e,t){var l;switch(h){case ge.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t!=null?t:void 0;break;case ge.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t!=null?t:void 0;break;case"src":let n=!!e,v=!!t;!n&&v?this.load():n&&!v?this.unload():n&&v&&(this.unload(),this.load());break;case"autoplay":if(t===e)break;(l=this.__updateAutoplay)==null||l.call(this,this.autoplay);break;case ge.PLAYBACK_ID:this.src=gn(t!=null?t:void 0,{domain:this.customDomain});break;case ge.DEBUG:let R=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=R);break;case ge.METADATA_URL:t&&fetch(t).then(T=>T.json()).then(T=>this.metadata=T).catch(T=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;default:break}super.attributeChangedCallback(h,e,t)}disconnectedCallback(){this.unload()}};globalThis.customElements.get("mux-video")||(globalThis.customElements.define("mux-video",Vi),globalThis.MuxVideoElement=Vi);var Us=Vi;var xu="en",Lt={code:xu};var Ns="en";function pe(h,e=!0){var n,v;let t=e&&(v=(n=Lt)==null?void 0:n[h])!=null?v:h,l=e?Lt.code:Ns;return new Bs(t,l)}var Bs=class{constructor(e,t=(l=>(l=Lt.code)!=null?l:Ns)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,l)=>{var n;return(n=e[l])!=null?n:""})}toString(){return this.message}};function Fs(h){let e="";return Object.entries(h).forEach(([t,l])=>{l!=null&&(e+=`${Lu(t)}: ${l}; `)}),e?e.trim():void 0}function Lu(h){return h.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function js(h){return h.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function ar(h){if(h==null)return;let e=+h;return Number.isNaN(e)?void 0:e}function Br(h){let e=Du(h).toString();return e?"?"+e:""}function Du(h){let e={};for(let t in h)h[t]!=null&&(e[t]=h[t]);return new URLSearchParams(e)}function sr(h){let t=h.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),l=decodeURIComponent(atob(t).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(l)}var $i=(h,e)=>!h||!e?!1:h.contains(e)?!0:$i(h,e.getRootNode().host);var Yi="mux.com",Iu=()=>{try{return"0.1.0-beta.21"}catch{}return"UNKNOWN"},Mu=Iu(),Fr=()=>Mu,zi=(h,{token:e,domain:t=Yi}={})=>`https://stream.${t}/${h}.m3u8${Br(!!e?{token:e}:{redundant_streams:!0})}`,Ks=(h,{token:e,thumbnailTime:t,domain:l=Yi}={})=>{let n=e==null?t:void 0;return`https://image.${l}/${h}/thumbnail.jpg${Br({token:e,time:n})}`},Ws=(h,{token:e,domain:t=Yi}={})=>`https://image.${t}/${h}/storyboard.vtt${Br({token:e})}`,Ru={crossorigin:"crossOrigin",playsinline:"playsInline"};function Hs(h){var e;return(e=Ru[h])!=null?e:js(h)}var jr,Cu=(h="video")=>jr||(typeof window!="undefined"&&(jr=document.createElement(h)),jr),Gs=async(h=Cu())=>{if(!h)return!1;let e=h.volume;return h.volume=e/2+.1,new Promise((t,l)=>{setTimeout(()=>{t(h.volume!==e)},0)})};function Vs(h){var e,t;return Array.from((t=(e=h.media)==null?void 0:e.textTracks)!=null?t:[]).filter(({kind:l})=>l==="subtitles"||l==="captions")}var $s=h=>{var t,l;let{media:e}=h;return(l=(t=e==null?void 0:e._hls)==null?void 0:t.liveSyncPosition)!=null?l:(e==null?void 0:e.seekable.length)?e==null?void 0:e.seekable.end(e.seekable.length-1):void 0},Xi=h=>{let e=$s(h);if(e==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}h.currentTime=e},Ou=1,Pu=5,Ys=3,zs=.5,Xs=h=>{var v;let{streamType:e}=h,t=$s(h),l=(v=h.media)==null?void 0:v.currentTime;if(t==null||l==null)return!1;let n=t-l;return e===ve.LL_LIVE||e===ve.LL_DVR?n<=Ou*(Ys+zs):e===ve.LIVE||e===ve.DVR?n<=Pu*(Ys+zs):!1};var Qs=`[mux-player ${Fr()}]`;function st(...h){console.warn(Qs,...h)}function Dt(...h){console.error(Qs,...h)}function Kr(h){var t;let e=(t=h.message)!=null?t:"";if(h.file){let l="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${pe("Read more: ")}
1262
+ ${l}${h.file}`}st(e)}var ke={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",SRC:"src",POSTER:"poster",PRELOAD:"preload"},Wr={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ku=Wi.filter(h=>h!=="error"),wu=Object.values(ke),Uu=Object.values(Wr);function Js(h){h.querySelectorAll(":scope > track").forEach(e=>{var t;(t=h.media)==null||t.append(e.cloneNode())}),ku.forEach(e=>{var t;(t=h.media)==null||t.addEventListener(e,l=>{h.dispatchEvent(new Event(l.type))})})}var Zs=class extends HTMLElement{static get observedAttributes(){return[...wu,...Uu]}constructor(){super();this.querySelectorAll(":scope > track").forEach(l=>{var n;(n=this.media)==null||n.append(l.cloneNode())});let e=l=>{for(let n of l)n.type==="childList"&&(n.removedNodes.forEach(v=>{var T,L;let R=(T=this.media)==null?void 0:T.querySelector(`track[src="${v.src}"]`);R&&((L=this.media)==null||L.removeChild(R))}),n.addedNodes.forEach(v=>{var R;(R=this.media)==null||R.append(v.cloneNode())}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,l){switch(e){case Wr.MUTED:{this.media&&(this.media.muted=l!=null);return}case Wr.VOLUME:{let n=+l;this.media&&!Number.isNaN(n)&&(this.media.volume=n);return}case Wr.PLAYBACKRATE:{let n=+l;this.media&&!Number.isNaN(n)&&(this.media.playbackRate=n);return}}}play(){var e;return(e=this.media)==null?void 0:e.play()}pause(){var e;(e=this.media)==null||e.pause()}requestCast(e){var t;return(t=this.media)==null?void 0:t.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get video(){return st("<mux-player>.video is deprecated, please use .media instead"),this.media}get paused(){var e,t;return(t=(e=this.media)==null?void 0:e.paused)!=null?t:!0}get duration(){var e,t;return(t=(e=this.media)==null?void 0:e.duration)!=null?t:NaN}get ended(){var e,t;return(t=(e=this.media)==null?void 0:e.ended)!=null?t:!1}get buffered(){var e;return(e=this.media)==null?void 0:e.buffered}get readyState(){var e,t;return(t=(e=this.media)==null?void 0:e.readyState)!=null?t:0}get videoWidth(){var e;return(e=this.media)==null?void 0:e.videoWidth}get videoHeight(){var e;return(e=this.media)==null?void 0:e.videoHeight}get currentTime(){var e,t;return(t=(e=this.media)==null?void 0:e.currentTime)!=null?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return(t=(e=this.media)==null?void 0:e.volume)!=null?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get src(){return gt(this,ke.SRC)}set src(e){this.setAttribute(ke.SRC,`${e}`)}get poster(){var e;return(e=gt(this,ke.POSTER))!=null?e:""}set poster(e){this.setAttribute(ke.POSTER,`${e}`)}get playbackRate(){var e,t;return(t=(e=this.media)==null?void 0:e.playbackRate)!=null?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get crossOrigin(){return gt(this,ke.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(ke.CROSSORIGIN,`${e}`)}get autoplay(){return gt(this,ke.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(ke.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(ke.AUTOPLAY)}get loop(){return gt(this,ke.LOOP)!=null}set loop(e){e?this.setAttribute(ke.LOOP,""):this.removeAttribute(ke.LOOP)}get muted(){return gt(this,ke.MUTED)!=null}set muted(e){e?this.setAttribute(ke.MUTED,""):this.removeAttribute(ke.MUTED)}get playsInline(){return gt(this,ke.PLAYSINLINE)!=null}set playsInline(e){e?this.setAttribute(ke.PLAYSINLINE,""):this.removeAttribute(ke.PLAYSINLINE)}get preload(){return gt(this,ke.PRELOAD)}set preload(e){e?this.setAttribute(ke.PRELOAD,e):this.removeAttribute(ke.PRELOAD)}};function gt(h,e){return h.media?h.media.getAttribute(e):h.getAttribute(e)}var Qi=Zs;var qs=`
1263
+ :host {
1264
+ z-index: 100;
1265
+ display: flex;
1266
+ justify-content: center;
1267
+ align-items: center;
1268
+ width: 100%;
1269
+ height: 100%;
1270
+ position: absolute;
1271
+ top: 0;
1272
+ left: 0;
1273
+ box-sizing: border-box;
1274
+ color: #fff;
1275
+ line-height: 18px;
1276
+ font-family: Arial, sans-serif;
1277
+ padding: var(--media-dialog-backdrop-padding, 0);
1278
+ background: var(--media-dialog-backdrop-background,
1279
+ linear-gradient(to bottom, rgba(20, 20, 30, 0.7) 50%, rgba(20, 20, 30, 0.9))
1280
+ );
1281
+ /* Needs to use !important to prevent overwrite of media-chrome */
1282
+ transition: var(--media-dialog-transition-open, visibility .2s, opacity .2s) !important;
1283
+ transform: var(--media-dialog-transform-open, none) !important;
1284
+ visibility: visible !important;
1285
+ opacity: 1 !important;
1286
+ pointer-events: auto !important;
1287
+ }
1288
+
1289
+ :host(:not([open])) {
1290
+ /* Needs to use !important to prevent overwrite of media-chrome */
1291
+ transition: var(--media-dialog-transition-close, visibility .1s, opacity .1s) !important;
1292
+ transform: var(--media-dialog-transform-close, none) !important;
1293
+ visibility: hidden !important;
1294
+ opacity: 0 !important;
1295
+ pointer-events: none !important;
1296
+ }
1297
+
1298
+ /*
1299
+ Only show outline when keyboard focusing.
1300
+ https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
1301
+ :host-context support is bad https://caniuse.com/mdn-css_selectors_host-context
1302
+ */
1303
+ :host-context([media-keyboard-control]) ::slotted(:focus),
1304
+ :host-context([media-keyboard-control]) :focus {
1305
+ box-shadow: 0 0 0 2px rgba(27, 127, 204, 0.9);
1306
+ }
1307
+
1308
+ .dialog {
1309
+ position: relative;
1310
+ box-sizing: border-box;
1311
+ background: var(--media-dialog-background, none);
1312
+ padding: var(--media-dialog-padding, 10px);
1313
+ width: min(320px, 100%);
1314
+ word-wrap: break-word;
1315
+ max-height: 100%;
1316
+ overflow: auto;
1317
+ text-align: center;
1318
+ line-height: 1.4;
1319
+ }
1320
+ `,eo=document.createElement("template");eo.innerHTML=`
1321
+ <style>
1322
+ ${qs}
1323
+ </style>
1324
+
1325
+ <div class="dialog">
1326
+ <slot></slot>
1327
+ </div>
1328
+ `;var It=class extends HTMLElement{constructor(){super();var e;this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),to(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),Nu(this))}attributeChangedCallback(e,t,l){e==="open"&&t!==l&&(l!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&to(this)}};It.styles=qs,It.template=eo,It.observedAttributes=["open"];function to(h){let e=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(h.dispatchEvent(e),e.defaultPrevented)return;let t=h.querySelector("[autofocus]:not([disabled])");!t&&h.tabIndex>=0&&(t=h),t||(t=ro(h.shadowRoot)),h._previouslyFocusedElement=document.activeElement,document.activeElement instanceof HTMLElement&&document.activeElement.blur(),h.addEventListener("transitionend",()=>{t instanceof HTMLElement&&t.focus({preventScroll:!0})},{once:!0})}function ro(h){let t=["button","input","keygen","select","textarea"].map(function(n){return n+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');let l=h==null?void 0:h.querySelector(t.join(", "));if(!l&&"attachShadow"in Element.prototype){let n=(h==null?void 0:h.querySelectorAll("*"))||[];for(let v=0;v<n.length&&!(n[v].tagName&&n[v].shadowRoot&&(l=ro(n[v].shadowRoot),l));v++);}return l}function Nu(h){h._previouslyFocusedElement instanceof HTMLElement&&h._previouslyFocusedElement.focus()}globalThis.customElements.get("media-dialog")||(globalThis.customElements.define("media-dialog",It),globalThis.MediaDialog=It);var Ji=It;var io=document.createElement("template");io.innerHTML=`
1329
+ <style>
1330
+ ${Ji.styles}
1331
+
1332
+ .close {
1333
+ background: none;
1334
+ color: inherit;
1335
+ border: none;
1336
+ padding: 0;
1337
+ font: inherit;
1338
+ cursor: pointer;
1339
+ outline: inherit;
1340
+ width: 28px;
1341
+ height: 28px;
1342
+ position: absolute;
1343
+ top: 1rem;
1344
+ right: 1rem;
1345
+ }
1346
+ </style>
1347
+
1348
+ <div class="dialog">
1349
+ <slot></slot>
1350
+ </div>
1351
+
1352
+ <slot name="close">
1353
+ <button class="close" tabindex="0">
1354
+ <svg fill="none" viewBox="0 0 24 24" stroke="currentColor">
1355
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
1356
+ </svg>
1357
+ </button>
1358
+ </slot>
1359
+ `;var Hr=class extends Ji{constructor(){super();var e,t;(t=(e=this.shadowRoot)==null?void 0:e.querySelector(".close"))==null||t.addEventListener("click",()=>{this.close()})}};Hr.template=io;globalThis.customElements.get("mxp-dialog")||(globalThis.customElements.define("mxp-dialog",Hr),globalThis.MxpDialog=Hr);var no=`:host {
1360
+ display: inline-block;
1361
+ }
1362
+
1363
+ /* Hide custom elements that are not defined yet */
1364
+ :not(:defined) {
1365
+ display: none;
1366
+ }
1367
+
1368
+ a {
1369
+ color: #fff;
1370
+ font-size: 0.9em;
1371
+ text-decoration: underline;
1372
+ }
1373
+
1374
+ media-controller {
1375
+ width: 100%;
1376
+ height: 100%;
1377
+ }
1378
+
1379
+ .mxp-seek-to-live-button {
1380
+ height: 44px;
1381
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
1382
+ color: white;
1383
+ border: none;
1384
+ cursor: pointer;
1385
+ }
1386
+
1387
+ .mxp-seek-to-live-button[aria-disabled] {
1388
+ cursor: default;
1389
+ pointer-events: none;
1390
+ }
1391
+
1392
+ .mxp-seek-to-live-button::before {
1393
+ content: '\u25CF ';
1394
+ color: rgb(118, 118, 118);
1395
+ padding-right: 5px;
1396
+ }
1397
+
1398
+ .mxp-seek-to-live-button[aria-disabled]::before {
1399
+ color: #fb3c4d;
1400
+ }
1401
+ `;var ao=h=>me`
1402
+ <style>
1403
+ ${no}
1404
+ </style>
1405
+ ${Fu(h)}
1406
+ `,Fu=h=>{var e,t,l,n,v,R,T,L,_,E,I,M,D,b,A,u,r,s,i,a,d,o,y,p,m,g;return me`
1407
+ <media-theme-mux
1408
+ audio="${h.audio||!1}"
1409
+ style="${(e=Fs({"--primary-color":h.primaryColor,"--secondary-color":h.secondaryColor,"--mux-time-range-padding":h.secondaryColor?"0":null,"--media-range-track-border-radius":h.secondaryColor?"0":null}))!=null?e:!1}"
1410
+ class="size-${h.playerSize}"
1411
+ stream-type="${h.streamType}"
1412
+ player-size="${h.playerSize}"
1413
+ has-captions="${h.hasCaptions}"
1414
+ default-hidden-captions="${h.defaultHiddenCaptions}"
1415
+ forward-seek-offset="${h.forwardSeekOffset}"
1416
+ backward-seek-offset="${h.backwardSeekOffset}"
1417
+ >
1418
+ <mux-video
1419
+ slot="media"
1420
+ crossorigin
1421
+ playsinline
1422
+ autoplay="${(t=h.autoplay)!=null?t:!1}"
1423
+ muted="${(l=h.muted)!=null?l:!1}"
1424
+ loop="${(n=h.loop)!=null?n:!1}"
1425
+ preload="${(v=h.preload)!=null?v:!1}"
1426
+ debug="${(R=h.debug)!=null?R:!1}"
1427
+ prefer-mse="${(T=h.preferMse)!=null?T:!1}"
1428
+ start-time="${h.startTime!=null?h.startTime:!1}"
1429
+ metadata-video-id="${(E=(_=h.metadataVideoId)!=null?_:(L=h.metadata)==null?void 0:L.video_id)!=null?E:!1}"
1430
+ metadata-video-title="${(D=(M=h.metadataVideoTitle)!=null?M:(I=h.metadata)==null?void 0:I.video_title)!=null?D:!1}"
1431
+ metadata-viewer-user-id="${(u=(A=h.metadataViewerUserId)!=null?A:(b=h.metadata)==null?void 0:b.viewer_user_id)!=null?u:!1}"
1432
+ beacon-collection-domain="${(r=h.beaconCollectionDomain)!=null?r:!1}"
1433
+ player-software-name="${h.playerSoftwareName}"
1434
+ player-software-version="${h.playerSoftwareVersion}"
1435
+ env-key="${(s=h.envKey)!=null?s:!1}"
1436
+ stream-type="${(i=h.streamType)!=null?i:!1}"
1437
+ custom-domain="${(a=h.customDomain)!=null?a:!1}"
1438
+ src="${h.src?h.src:h.playbackId?zi(h.playbackId,{domain:h.customDomain,token:h.tokens.playback}):!1}"
1439
+ poster="${h.poster?h.poster:h.playbackId&&!h.audio?Ks(h.playbackId,{domain:h.customDomain,thumbnailTime:(d=h.thumbnailTime)!=null?d:h.startTime,token:h.tokens.thumbnail}):!1}"
1440
+ cast-src="${h.src?h.src:h.playbackId?zi(h.playbackId,{domain:h.customDomain,token:h.tokens.playback}):!1}"
1441
+ cast-stream-type="${[ve.LIVE,ve.LL_LIVE].includes(h.streamType)?"live":!1}"
1442
+ >
1443
+ ${h.playbackId&&!h.audio&&![ve.LIVE,ve.LL_LIVE,ve.DVR,ve.LL_DVR].includes(h.streamType)?me`<track
1444
+ label="thumbnails"
1445
+ default
1446
+ kind="metadata"
1447
+ src="${Ws(h.playbackId,{domain:h.customDomain,token:h.tokens.storyboard})}"
1448
+ />`:me``}
1449
+ </mux-video>
1450
+ <button
1451
+ slot="seek-to-live-button"
1452
+ aria-disabled="${h.inLiveWindow}"
1453
+ onclick="${function(f){var c;if((c=h.onSeekToLive)==null||c.call(h,f),h.paused){let x=new CustomEvent("mediaplayrequest",{composed:!0,bubbles:!0});this.dispatchEvent(x)}}}"
1454
+ class="mxp-seek-to-live-button"
1455
+ >
1456
+ Live
1457
+ </button>
1458
+ <mxp-dialog
1459
+ no-auto-hide
1460
+ open="${h.isDialogOpen}"
1461
+ onclose="${h.onCloseErrorDialog}"
1462
+ oninitfocus="${h.onInitFocusDialog}"
1463
+ >
1464
+ ${((o=h.dialog)==null?void 0:o.title)?me`<h3>${h.dialog.title}</h3>`:me``}
1465
+ <p>
1466
+ ${(y=h.dialog)==null?void 0:y.message}
1467
+ ${((p=h.dialog)==null?void 0:p.linkUrl)?me`<a
1468
+ href="${h.dialog.linkUrl}"
1469
+ target="_blank"
1470
+ rel="external noopener"
1471
+ aria-label="${(m=h.dialog.linkText)!=null?m:""} ${pe("(opens in a new window)")}"
1472
+ >${(g=h.dialog.linkText)!=null?g:h.dialog.linkUrl}</a
1473
+ >`:me``}
1474
+ </p>
1475
+ </mxp-dialog>
1476
+ </media-theme-mux>
1477
+ `};function Gr(h,e,t,l,n){var T,L,_;let v={},R={};switch(h.code){case Oe.MEDIA_ERR_NETWORK:{switch(v.title=pe("Network Error",n),v.message=h.message,(T=h.data)==null?void 0:T.response.code){case 412:{v.title=pe("Video is not currently available",n),v.message=pe("The live stream or video file are not yet ready.",n),R.message=pe("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",n),R.file="412-not-playable.md";break}case 404:{v.title=pe("Video does not exist",n),v.message="",R.message=pe("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",n),R.file="404-not-found.md";break}case 403:{if(v.title=pe("Invalid playback URL",n),v.message=pe("The video URL or playback-token are formatted with incorrect or incomplete information.",n),R.message=pe("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",n),R.file="missing-signed-tokens.md",!l)break;let{exp:E,aud:I,sub:M}=sr(l),D=Date.now()>E*1e3,b=M!==t,A=I!=="v",u={timeStyle:"medium",dateStyle:"medium"};if(D){v.title=pe("Video URL has expired",n),v.message=pe("The video\u2019s secured playback-token has expired.",n),R.message=pe("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",n).format({expiredDate:new Intl.DateTimeFormat(Lt.code,u).format(E*1e3),currentDate:new Intl.DateTimeFormat(Lt.code,u).format(Date.now())}),R.file="403-expired-token.md";break}if(b){v.title=pe("Video URL is formatted incorrectly",n),v.message=pe("The video\u2019s playback ID does not match the one encoded in the playback-token.",n),R.message=pe("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",n).format({playbackId:t,tokenPlaybackId:M}),R.file="403-playback-id-mismatch.md";break}if(A){v.title=pe("Video URL is formatted incorrectly",n),v.message=pe("The playback-token is formatted with incorrect information.",n),R.message=pe("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",n).format({tokenType:I}),R.file="403-incorrect-aud-value.md";break}R.message=pe("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",n),R.file="403-malformatted-token.md";break}}break}case Oe.MEDIA_ERR_DECODE:{let{message:E}=h;v={title:pe("Media Error",n),message:E},R.file="media-decode-error.md";break}case Oe.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(_=(L=h.data)==null?void 0:L.response)==null?void 0:_.code;if(E>=400&&E<500){h.code=Oe.MEDIA_ERR_NETWORK,h.data={response:{code:E}},{dialog:v,devlog:R}=Gr(h,e,t,l);break}v={title:pe("Source Not Supported",n),message:h.message},R.file="media-src-not-supported.md";break}default:v={title:pe("Error",n),message:h.message};break}return e&&(v={title:pe("Your device appears to be offline",n),message:pe("Check your internet connection and try reloading this video.",n)}),{dialog:v,devlog:R}}var ju=Object.values(ve),Ku=700,Wu=300,Zi={LG:"large",SM:"small",XS:"extra-small"};function Vr(h){let e=h.getBoundingClientRect();return e.width<Wu?Zi.XS:e.width<Ku?Zi.SM:Zi.LG}var Hu={SRC:"src"},xe={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_MSE:"prefer-mse",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},De={DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio"};function Gu(h,e){var t,l;return{src:!h.playbackId&&h.src,poster:h.getAttribute("poster"),thumbnailTime:!h.tokens.thumbnail&&h.thumbnailTime,autoplay:h.autoplay,crossOrigin:h.crossOrigin,loop:h.loop,muted:h.muted,paused:h.paused,playsInline:h.playsInline,preload:h.preload,playbackId:h.playbackId,envKey:h.envKey,debug:h.debug,tokens:h.tokens,beaconCollectionDomain:h.beaconCollectionDomain,metadata:h.metadata,playerSoftwareName:h.playerSoftwareName,playerSoftwareVersion:h.playerSoftwareVersion,startTime:h.startTime,preferMse:h.preferMse,audio:h.audio,streamType:h.streamType,primaryColor:h.primaryColor,secondaryColor:h.secondaryColor,forwardSeekOffset:h.forwardSeekOffset,backwardSeekOffset:h.backwardSeekOffset,defaultHiddenCaptions:h.defaultHiddenCaptions,customDomain:(t=h.getAttribute(xe.CUSTOM_DOMAIN))!=null?t:void 0,playerSize:Vr((l=h.mediaController)!=null?l:h),hasCaptions:!!Vs(h).length,metadataVideoId:h.getAttribute(xe.METADATA_VIDEO_ID),metadataVideoTitle:h.getAttribute(xe.METADATA_VIDEO_TITLE),metadataViewerUserId:h.getAttribute(xe.METADATA_VIEWER_USER_ID),...e}}var Vu=Object.values(xe),$u=Object.values(De),Yu=Fr(),zu="mux-player",so={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},Kt,lr,pt,Wt,ot,ur,oo,lt,Mt,Ht,qi,dr,lo,Yr,Xu,zr,Qu,Xr,Ju,Qr,Zu,Jr,qu,Zr,ed,qr,td,ei,rd,$r=class extends Qi{constructor(){super();je(this,ur);je(this,lt);je(this,Ht);je(this,dr);je(this,Yr);je(this,zr);je(this,Xr);je(this,Qr);je(this,Jr);je(this,Zr);je(this,qr);je(this,ei);je(this,Kt,!1);je(this,lr,{});je(this,pt,!0);je(this,Wt,void 0);je(this,ot,{...so,supportsAirPlay:!1,supportsVolume:!1,onCloseErrorDialog:()=>Ce(this,lt,Mt).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{$i(this,document.activeElement)||e.preventDefault()},onSeekToLive:()=>Xi(this)});this.attachShadow({mode:"open"}),this.isConnected&&Ce(this,ur,oo).call(this)}static get observedAttributes(){var e;return[...(e=Qi.observedAttributes)!=null?e:[],...Vu,...$u]}get theme(){var e,t;return Array.from((t=(e=this.shadowRoot)==null?void 0:e.children)!=null?t:[]).find(({localName:l})=>l.startsWith("media-theme-"))}get mediaController(){var e,t;return(t=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:t.querySelector("media-controller")}connectedCallback(){Ce(this,dr,lo).call(this),Ce(this,Yr,Xu).call(this)}disconnectedCallback(){Ce(this,zr,Qu).call(this)}attributeChangedCallback(e,t,l){switch(Ye(this,Kt)||Ce(this,ur,oo).call(this),super.attributeChangedCallback(e,t,l),[xe.PLAYBACK_ID,Hu.SRC,De.PLAYBACK_TOKEN].includes(e)&&t!==l&&Et(this,ot,{...Ye(this,ot),...so}),Ce(this,Ht,qi).call(this,{[Hs(e)]:l}),e){case De.THUMBNAIL_TIME:{l!=null&&this.tokens.thumbnail&&st(pe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case De.THUMBNAIL_TOKEN:{let{aud:v}=sr(l);l&&v!=="t"&&st(pe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:v}));break}case De.STORYBOARD_TOKEN:{let{aud:v}=sr(l);l&&v!=="s"&&st(pe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:v}));break}case xe.PLAYBACK_ID:{l.includes("?token")&&Dt(pe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:l})),this.streamType?this.streamType!=null&&!ju.includes(this.streamType)&&Kr({file:"invalid-stream-type.md",message:pe("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live` or `ll-live`").format({streamType:this.streamType})}):Kr({file:"invalid-stream-type.md",message:String(pe("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live` or `ll-live`"))});break}}}get hasPlayed(){var e,t;return(t=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?t:!1}get inLiveWindow(){return Ye(this,ot).inLiveWindow}get hls(){return st("<mux-player>.hls is deprecated, please use ._hls instead"),this._hls}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get audio(){return this.hasAttribute(De.AUDIO)}set audio(e){e||this.removeAttribute(De.AUDIO),this.setAttribute(De.AUDIO,"")}get thumbnailTime(){return ar(this.getAttribute(De.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(De.THUMBNAIL_TIME,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(De.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(De.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(De.SECONDARY_COLOR))!=null?e:void 0}set secondaryColor(e){this.setAttribute(De.SECONDARY_COLOR,`${e}`)}get forwardSeekOffset(){var e;return(e=ar(this.getAttribute(De.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(De.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=ar(this.getAttribute(De.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(De.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(De.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(xe.PLAYER_SOFTWARE_NAME))!=null?e:zu}get playerSoftwareVersion(){var e;return(e=this.getAttribute(xe.PLAYER_SOFTWARE_VERSION))!=null?e:Yu}get beaconCollectionDomain(){var e;return(e=this.getAttribute(xe.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(xe.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(xe.BEACON_COLLECTION_DOMAIN))}get playbackId(){var e;return(e=this.getAttribute(xe.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){this.setAttribute(xe.PLAYBACK_ID,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(xe.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(xe.CUSTOM_DOMAIN,e):this.removeAttribute(xe.CUSTOM_DOMAIN))}get envKey(){var e;return(e=or(this,xe.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(xe.ENV_KEY,`${e}`)}get debug(){return or(this,xe.DEBUG)!=null}set debug(e){e?this.setAttribute(xe.DEBUG,""):this.removeAttribute(xe.DEBUG)}get streamType(){return or(this,xe.STREAM_TYPE)}set streamType(e){this.setAttribute(xe.STREAM_TYPE,`${e}`)}get startTime(){return ar(or(this,xe.START_TIME))}set startTime(e){this.setAttribute(xe.START_TIME,`${e}`)}get preferMse(){return or(this,xe.PREFER_MSE)!=null}set preferMse(e){e?this.setAttribute(xe.PREFER_MSE,""):this.removeAttribute(xe.PREFER_MSE)}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){this.media&&(this.media.metadata=e)}get tokens(){let e=this.getAttribute(De.PLAYBACK_TOKEN),t=this.getAttribute(De.THUMBNAIL_TOKEN),l=this.getAttribute(De.STORYBOARD_TOKEN);return{...Ye(this,lr),...e!=null?{playback:e}:{},...t!=null?{thumbnail:t}:{},...l!=null?{storyboard:l}:{}}}set tokens(e){Et(this,lr,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(De.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(De.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(De.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(De.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(De.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(De.STORYBOARD_TOKEN,`${e}`)}};Kt=new WeakMap,lr=new WeakMap,pt=new WeakMap,Wt=new WeakMap,ot=new WeakMap,ur=new WeakSet,oo=function(){var e,t;Ye(this,Kt)||(Et(this,Kt,!0),Ce(this,lt,Mt).call(this,{playerSize:Vr(this)}),customElements.upgrade(this.theme),this.theme instanceof Cs||Dt("<media-theme-mux> failed to upgrade!"),customElements.upgrade(this.media),this.media instanceof Us||Dt("<mux-video> failed to upgrade!"),customElements.upgrade(this.mediaController),this.mediaController instanceof qt||Dt("<media-controller> failed to upgrade!"),Js(this),Ce(this,Qr,Zu).call(this),Ce(this,Jr,qu).call(this),Ce(this,qr,td).call(this),Ce(this,ei,rd).call(this),Ce(this,Xr,Ju).call(this),Et(this,pt,(t=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?t:!0),Ce(this,Zr,ed).call(this))},lt=new WeakSet,Mt=function(e){Object.assign(Ye(this,ot),e),Ce(this,Ht,qi).call(this)},Ht=new WeakSet,qi=function(e={}){ir(ao(Gu(this,{...Ye(this,ot),...e})),this.shadowRoot)},dr=new WeakSet,lo=function(){var e,t;Ye(this,ot).playerSize!=Vr((e=this.mediaController)!=null?e:this)&&Ce(this,lt,Mt).call(this,{playerSize:Vr((t=this.mediaController)!=null?t:this)})},Yr=new WeakSet,Xu=function(){var e;Et(this,Wt,new ResizeObserver(()=>Ce(this,dr,lo).call(this))),Ye(this,Wt).observe((e=this.mediaController)!=null?e:this)},zr=new WeakSet,Qu=function(){var e;(e=Ye(this,Wt))==null||e.disconnect()},Xr=new WeakSet,Ju=function(){var t,l,n,v,R;(t=this.mediaController)==null||t.addEventListener("mediaplayrequest",T=>{var L;((L=T.target)==null?void 0:L.localName)==="media-play-button"&&this.streamType&&[ve.LIVE,ve.LL_LIVE,ve.DVR,ve.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Xi(this)});let e=()=>{let T=Xs(this),L=Ye(this,ot).inLiveWindow;T!==L&&(Ce(this,lt,Mt).call(this,{inLiveWindow:T}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(l=this.media)==null||l.addEventListener("progress",e),(n=this.media)==null||n.addEventListener("waiting",e),(v=this.media)==null||v.addEventListener("timeupdate",e),(R=this.media)==null||R.addEventListener("emptied",e)},Qr=new WeakSet,Zu=function(){var t;let e=l=>{let{detail:n}=l;if(n instanceof Oe||(n=new Oe(n.message,n.code,n.fatal)),!(n==null?void 0:n.fatal)){st(n),n.data&&st(`${n.name} data:`,n.data);return}let{dialog:v,devlog:R}=Gr(n,!window.navigator.onLine,this.playbackId,this.playbackToken);R.message&&Kr(R),Dt(n),n.data&&Dt(`${n.name} data:`,n.data),Ce(this,lt,Mt).call(this,{isDialogOpen:!0,dialog:v})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(l={})=>{var v,R,T;if(!((v=this.media)==null?void 0:v.error))return l;let{devlog:n}=Gr((R=this.media)==null?void 0:R.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(T=this.media)==null?void 0:T.error.code,player_error_message:n.message?String(n.message):l.player_error_message}}),(t=this.media)==null||t.addEventListener("error",l=>{var v,R;let{detail:n}=l;if(!n){let{message:T,code:L}=(R=(v=this.media)==null?void 0:v.error)!=null?R:{};n=new Oe(T,L)}!(n==null?void 0:n.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Jr=new WeakSet,qu=function(){var t,l,n,v;let e=()=>Ce(this,Ht,qi).call(this);(l=(t=this.media)==null?void 0:t.textTracks)==null||l.addEventListener("addtrack",e),(v=(n=this.media)==null?void 0:n.textTracks)==null||v.addEventListener("removetrack",e)},Zr=new WeakSet,ed=function(){var E,I;let e=this.mediaController,t=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(/.*iPhone.*/.test(navigator.userAgent))return;let n,v=new WeakMap,R=()=>this.streamType&&[ve.LIVE,ve.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,T=(M,D)=>{if(R())return;Array.from(M&&M.activeCues||[]).forEach(A=>{if(!(!A.snapToLines||A.line<-5||A.line>=0&&A.line<10))if(!D||this.paused){let u=A.text.split(`
1478
+ `).length,r=t?-2:-3;this.streamType&&[ve.LIVE,ve.LL_LIVE].includes(this.streamType)&&(r=t?-1:-2);let s=r-u;if(A.line===s)return;v.has(A)||v.set(A,A.line),A.line=0,A.line=s}else setTimeout(()=>{A.line=v.get(A)||"auto"},500)})},L=()=>{var M;T(n,(M=e==null?void 0:e.hasAttribute("user-inactive"))!=null?M:!1)},_=()=>{var b;let D=Array.from(((b=e==null?void 0:e.media)==null?void 0:b.textTracks)||[]).filter(A=>["subtitles","captions"].includes(A.kind)&&A.mode==="showing")[0];D!==n&&(n==null||n.removeEventListener("cuechange",L)),n=D,n==null||n.addEventListener("cuechange",L),T(n,Ye(this,pt))};_(),(E=e==null?void 0:e.media)==null||E.textTracks.addEventListener("change",_),(I=e==null?void 0:e.media)==null||I.textTracks.addEventListener("addtrack",_),e==null||e.addEventListener("userinactivechange",()=>{let M=e==null?void 0:e.hasAttribute("user-inactive");Ye(this,pt)!==M&&(Et(this,pt,M),T(n,Ye(this,pt)))})},qr=new WeakSet,td=function(){var e;if(globalThis.WebKitPlaybackTargetAvailabilityEvent){let t=l=>{let n=l.availability==="available";Ce(this,lt,Mt).call(this,{supportsAirPlay:n})};(e=this.media)==null||e.addEventListener("webkitplaybacktargetavailabilitychanged",t)}},ei=new WeakSet,rd=async function(){let e=await Gs();Ce(this,lt,Mt).call(this,{supportsVolume:e})};function or(h,e){return h.media?h.media.getAttribute(e):h.getAttribute(e)}globalThis.customElements.get("mux-player")||(globalThis.customElements.define("mux-player",$r),globalThis.MuxPlayerElement=$r);var Qm=$r;})();