@streamlayer/react 1.23.2 → 1.24.0

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 (174) hide show
  1. package/lib/app/masters.d.ts +0 -1
  2. package/lib/cjs/Question.js +1 -1
  3. package/lib/cjs/advertisement.js +203 -28
  4. package/lib/cjs/analytics.js +1 -1
  5. package/lib/cjs/auth.js +1 -1
  6. package/lib/cjs/bet-pack.js +1 -1
  7. package/lib/cjs/feature.js +1 -1
  8. package/lib/cjs/gamification-feature.js +1 -1
  9. package/lib/cjs/gamification-feature2.js +1 -1
  10. package/lib/cjs/hooks-n9ax4LRT.js +1 -0
  11. package/lib/cjs/index-ByUNFvMk.js +5 -0
  12. package/lib/cjs/index.js +1 -1
  13. package/lib/cjs/index10.js +1 -1
  14. package/lib/cjs/index11.js +1 -3
  15. package/lib/cjs/index12.js +1 -1
  16. package/lib/cjs/index13.js +1 -3
  17. package/lib/cjs/index14.js +4 -1
  18. package/lib/cjs/index15.js +1 -1
  19. package/lib/cjs/index16.js +5 -3
  20. package/lib/cjs/index2.js +1 -1
  21. package/lib/cjs/index3.js +1 -1
  22. package/lib/cjs/index4.js +5 -3
  23. package/lib/cjs/index5.js +1 -1
  24. package/lib/cjs/index6.js +1 -1
  25. package/lib/cjs/index7.js +1 -1
  26. package/lib/cjs/index8.js +1 -1
  27. package/lib/cjs/index9.js +7 -1
  28. package/lib/cjs/insight.js +1 -1
  29. package/lib/cjs/masters.js +1 -1
  30. package/lib/cjs/masters2.js +8 -1
  31. package/lib/cjs/notification.js +1 -1
  32. package/lib/cjs/pause-ad.js +1 -1
  33. package/lib/cjs/points.js +1 -1
  34. package/lib/cjs/polymarket.js +14 -9
  35. package/lib/cjs/sl-types.js +1 -1
  36. package/lib/cjs/storage.js +1 -1
  37. package/lib/cjs/theme.js +1 -1
  38. package/lib/cjs/useStreamLayerApp.js +1 -1
  39. package/lib/cjs/useStreamLayerApp2.js +17 -3
  40. package/lib/cjs/utils.js +47 -1
  41. package/lib/classic/app/masters.d.ts +0 -1
  42. package/lib/classic/cjs/Question.js +1 -1
  43. package/lib/classic/cjs/advertisement.js +203 -28
  44. package/lib/classic/cjs/analytics.js +1 -1
  45. package/lib/classic/cjs/auth.js +1 -1
  46. package/lib/classic/cjs/bet-pack.js +5 -3
  47. package/lib/classic/cjs/feature.js +1 -1
  48. package/lib/classic/cjs/gamification-feature.js +1 -1
  49. package/lib/classic/cjs/hooks-n9ax4LRT.js +1 -0
  50. package/lib/classic/cjs/index-ByUNFvMk.js +5 -0
  51. package/lib/classic/cjs/index.js +1 -1
  52. package/lib/classic/cjs/index10.js +1 -1
  53. package/lib/classic/cjs/index11.js +1 -1
  54. package/lib/classic/cjs/index12.js +1 -1
  55. package/lib/classic/cjs/index13.js +4 -3
  56. package/lib/classic/cjs/index2.js +5 -3
  57. package/lib/classic/cjs/index3.js +1 -1
  58. package/lib/classic/cjs/index4.js +1 -1
  59. package/lib/classic/cjs/index5.js +1 -1
  60. package/lib/classic/cjs/index6.js +1 -1
  61. package/lib/classic/cjs/index7.js +7 -1
  62. package/lib/classic/cjs/index8.js +1 -1
  63. package/lib/classic/cjs/index9.js +1 -3
  64. package/lib/classic/cjs/insight.js +1 -1
  65. package/lib/classic/cjs/notification.js +1 -1
  66. package/lib/classic/cjs/notification2.js +1 -1
  67. package/lib/classic/cjs/pause-ad.js +1 -1
  68. package/lib/classic/cjs/points.js +1 -1
  69. package/lib/classic/cjs/polymarket.js +14 -9
  70. package/lib/classic/cjs/sl-types.js +1 -1
  71. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  72. package/lib/classic/cjs/useStreamLayerApp2.js +17 -3
  73. package/lib/classic/cjs/utils.js +47 -1
  74. package/lib/classic/es/Question.js +258 -275
  75. package/lib/classic/es/advertisement.js +22128 -38694
  76. package/lib/classic/es/analytics.js +55 -57
  77. package/lib/classic/es/auth.js +8 -14
  78. package/lib/classic/es/bet-pack.js +2413 -2455
  79. package/lib/classic/es/feature.js +46 -95
  80. package/lib/classic/es/gamification-feature.js +2 -2
  81. package/lib/classic/es/hooks-n9ax4LRT.js +97 -0
  82. package/lib/classic/es/index-ByUNFvMk.js +3775 -0
  83. package/lib/classic/es/index.js +13 -16
  84. package/lib/classic/es/index10.js +2587 -83
  85. package/lib/classic/es/index11.js +305 -3087
  86. package/lib/classic/es/index12.js +121 -124
  87. package/lib/classic/es/index13.js +559 -589
  88. package/lib/classic/es/index2.js +1755 -2114
  89. package/lib/classic/es/index3.js +13 -13
  90. package/lib/classic/es/index4.js +4 -283
  91. package/lib/classic/es/index5.js +5 -5
  92. package/lib/classic/es/index6.js +285 -10
  93. package/lib/classic/es/index7.js +179 -6
  94. package/lib/classic/es/index8.js +5 -10
  95. package/lib/classic/es/index9.js +8 -318
  96. package/lib/classic/es/insight.js +54 -61
  97. package/lib/classic/es/notification.js +5 -5
  98. package/lib/classic/es/notification2.js +730 -787
  99. package/lib/classic/es/pause-ad.js +168 -191
  100. package/lib/classic/es/points.js +47 -55
  101. package/lib/classic/es/polymarket.js +4058 -4289
  102. package/lib/classic/es/sl-types.js +128 -298
  103. package/lib/classic/es/useStreamLayerApp.js +2 -2
  104. package/lib/classic/es/useStreamLayerApp2.js +9090 -11121
  105. package/lib/classic/es/utils.js +28 -28
  106. package/lib/classic/index.d.ts +0 -1
  107. package/lib/classic/source.css +110 -0
  108. package/lib/dist/cjs/gamification-feature.js +1 -1
  109. package/lib/dist/cjs/index-ByUNFvMk.js +5 -0
  110. package/lib/dist/cjs/index.js +1 -1
  111. package/lib/dist/cjs/masters.js +69 -3
  112. package/lib/dist/es/gamification-feature.js +2 -2
  113. package/lib/dist/es/index-ByUNFvMk.js +3775 -0
  114. package/lib/dist/es/index.js +7 -10
  115. package/lib/dist/es/masters.js +16944 -19645
  116. package/lib/dist/index.d.ts +7 -17
  117. package/lib/dist/source.css +64 -0
  118. package/lib/es/Question.js +101 -105
  119. package/lib/es/advertisement.js +22128 -38694
  120. package/lib/es/analytics.js +55 -57
  121. package/lib/es/auth.js +8 -14
  122. package/lib/es/bet-pack.js +18 -29
  123. package/lib/es/feature.js +46 -95
  124. package/lib/es/gamification-feature.js +2 -2
  125. package/lib/es/gamification-feature2.js +2 -2
  126. package/lib/es/hooks-n9ax4LRT.js +97 -0
  127. package/lib/es/index-ByUNFvMk.js +3775 -0
  128. package/lib/es/index.js +13 -17
  129. package/lib/es/index10.js +8 -274
  130. package/lib/es/index11.js +172 -837
  131. package/lib/es/index12.js +2587 -183
  132. package/lib/es/index13.js +258 -314
  133. package/lib/es/index14.js +813 -81
  134. package/lib/es/index15.js +305 -3087
  135. package/lib/es/index16.js +803 -1005
  136. package/lib/es/index2.js +980 -1133
  137. package/lib/es/index3.js +4 -3
  138. package/lib/es/index4.js +2401 -2431
  139. package/lib/es/index5.js +13 -13
  140. package/lib/es/index6.js +5 -285
  141. package/lib/es/index7.js +7 -10
  142. package/lib/es/index8.js +283 -5
  143. package/lib/es/index9.js +180 -10
  144. package/lib/es/insight.js +54 -61
  145. package/lib/es/masters.js +5 -7
  146. package/lib/es/masters2.js +538 -708
  147. package/lib/es/notification.js +663 -719
  148. package/lib/es/pause-ad.js +168 -191
  149. package/lib/es/points.js +48 -56
  150. package/lib/es/polymarket.js +4058 -4289
  151. package/lib/es/sl-types.js +128 -317
  152. package/lib/es/storage.js +74 -75
  153. package/lib/es/theme.js +3 -190
  154. package/lib/es/useStreamLayerApp.js +2 -2
  155. package/lib/es/useStreamLayerApp2.js +9090 -11121
  156. package/lib/es/utils.js +28 -28
  157. package/lib/index.d.ts +0 -1
  158. package/lib/source.css +120 -0
  159. package/lib/style.css +1 -1
  160. package/package.json +21 -24
  161. package/lib/cjs/hooks-WfHlJH12.js +0 -1
  162. package/lib/cjs/index-eShKGO10.js +0 -1
  163. package/lib/cjs/style.css +0 -1
  164. package/lib/classic/cjs/hooks-WfHlJH12.js +0 -1
  165. package/lib/classic/cjs/index-eShKGO10.js +0 -1
  166. package/lib/classic/cjs/style.css +0 -1
  167. package/lib/classic/es/hooks-WfHlJH12.js +0 -98
  168. package/lib/classic/es/index-eShKGO10.js +0 -3757
  169. package/lib/classic/style.css +0 -1
  170. package/lib/dist/cjs/index-eShKGO10.js +0 -1
  171. package/lib/dist/es/index-eShKGO10.js +0 -3757
  172. package/lib/dist/style.css +0 -1
  173. package/lib/es/hooks-WfHlJH12.js +0 -98
  174. package/lib/es/index-eShKGO10.js +0 -3757
@@ -1,28 +1,203 @@
1
- "use strict";require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.to-primitive.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.copy-within.js"),require("core-js/modules/es.array.fill.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.array.find-index.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.array.last-index-of.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.reduce.js"),require("core-js/modules/es.array.reduce-right.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.sort.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.date.to-primitive.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.map.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.number.is-integer.js"),require("core-js/modules/es.number.max-safe-integer.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.define-properties.js"),require("core-js/modules/es.object.define-property.js"),require("core-js/modules/es.object.entries.js"),require("core-js/modules/es.object.freeze.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.object.get-own-property-names.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.object.values.js"),require("core-js/modules/es.parse-float.js"),require("core-js/modules/es.parse-int.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.reflect.construct.js"),require("core-js/modules/es.reflect.get.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.flags.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.set.js"),require("core-js/modules/es.string.ends-with.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.string.pad-start.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.typed-array.int32-array.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.uint16-array.js"),require("core-js/modules/es.typed-array.uint32-array.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.of.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/esnext.global-this.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");function e(n){var i="function"==typeof Map?new Map:void 0;return e=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,n)}function n(){return t(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)},e(n)}function t(e,t,n){if(h())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var r=new(e.bind.apply(e,i));return n&&m(r,n.prototype),r}function n(e,t,n,r){var a=i(p(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof a?function(e){return a.apply(n,e)}:a}function i(){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},i.apply(null,arguments)}function r(){
2
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function o(n,i,r,s){var o=i&&i.prototype instanceof l?i:l,c=Object.create(o.prototype);return a(c,"_invoke",function(n,i,r){var a,s,o,l=0,c=r||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,o=e,h.n=n,u}};function p(n,i){for(s=n,o=i,t=0;!d&&l&&!r&&t<c.length;t++){var r,a=c[t],p=h.p,f=a[2];n>3?(r=f===i)&&(o=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((r=n<2&&p<a[1])?(s=0,h.v=i,h.n=a[1]):p<f&&(r=n<3||a[0]>i||i>f)&&(a[4]=n,a[5]=i,h.n=f,s=0))}if(r||n>1)return u;throw d=!0,i}return function(r,c,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&p(c,f),s=c,o=f;(t=s<2?e:o)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,o)):h.n=o:h.v=o);try{if(l=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,o)))throw TypeError("iterator result is not an object");if(!t.done)return t;o=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(o=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(d=h.n<0)?o:n.call(i,h))!==u)break}catch(m){a=e,s=1,o=m}finally{l=1}}return{value:t,done:d}}}(n,r,s),!0),c}var u={};function l(){}function c(){}function d(){}t=Object.getPrototypeOf;var h=[][i]?t(t([][i]())):(a(t={},i,function(){return this}),t),p=d.prototype=l.prototype=Object.create(h);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=d,a(p,"constructor",d),a(d,"constructor",c),c.displayName="GeneratorFunction",a(d,s,"GeneratorFunction"),a(p),a(p,s,"Generator"),a(p,i,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:o,m:f}})()}function a(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(s){r=0}(a=function(e,t,n,i){function s(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(s("next",0),s("throw",1),s("return",2))})(e,t,n,i)}function s(e,t,n,i,r,a,s){try{var o=e[a](s),u=o.value}catch(l){return void n(l)}o.done?t(u):Promise.resolve(u).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)})}}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t=p(t),d(e,h()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(e,t){if(t&&("object"==k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!e})()}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,x(i.key),i)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=E(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function b(e){return function(e){if(Array.isArray(e))return C(e)}(e)||T(e)||E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){return A(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a,s,o=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(i=a.call(n)).done)&&(o.push(i.value),o.length!==t);u=!0);}catch(c){l=!0,r=c}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw r}}return o}}(e,t)||E(e,t)||w()}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function A(e){if(Array.isArray(e))return e}function I(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){var t=function(e,t){if("object"!=k(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=k(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==k(t)?t:t+""}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var L=require("react/jsx-runtime"),D=require("./index8.js"),P=require("./sl-types.js"),R=require("./analytics.js"),O=require("react"),N=require("./index3.js"),U=require("./useStreamLayerApp2.js"),M=require("./index14.js"),B=require("./index6.js"),j=require("./index13.js"),F=require("./index15.js"),q=require("./utils.js"),V=require("./hooks-WfHlJH12.js"),H=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function z(e){return"string"==typeof e&&H.test(e)}function W(e){if(!z(e))throw TypeError("Invalid UUID");var t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}function G(e,t,n,i,r,a){var s,o="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));for(var t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,u="string"==typeof i?W(i):i;if("string"==typeof i&&(i=W(i)),16!==(null===(s=i)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(u),l.set(o,u.length),(l=t(l))[6]=15&l[6]|e,l[8]=63&l[8]|128,r){a=a||0;for(var c=0;c<16;++c)r[a+c]=l[c];return r}return U.unsafeStringify(l)}function X(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:case 3:return t^n^i;case 2:return t&n^t&i^n&i}}function K(e,t){return e<<t|e>>>32-t}function Y(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],i=new Uint8Array(e.length+1);i.set(e),i[e.length]=128;for(var r=(e=i).length/4+2,a=Math.ceil(r/16),s=new Array(a),o=0;o<a;++o){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*o+4*l]<<24|e[64*o+4*l+1]<<16|e[64*o+4*l+2]<<8|e[64*o+4*l+3];s[o]=u}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var c=0;c<a;++c){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=s[c][h];for(var p=16;p<80;++p)d[p]=K(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var f=n[0],m=n[1],g=n[2],v=n[3],y=n[4],_=0;_<80;++_){var b=Math.floor(_/20),T=K(f,5)+X(b,m,g,v)+y+t[b]+d[_]>>>0;y=v,v=g,g=K(m,30)>>>0,m=f,f=T}n[0]=n[0]+f>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+g>>>0,n[3]=n[3]+v>>>0,n[4]=n[4]+y>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function Q(e,t,n,i){return G(80,Y,e,t,n,i)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$.apply(null,arguments)}Q.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Q.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var J=P.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Z=function(e){return"left"===e||"right"===e?"s35f1di":"b12050d8"},ee=function(e){return"left"===e||"right"===e?"sj4471g":"b1d5ybek"},te=function(e){return"left"===e?"avdxyl3":"right"===e?"a1bisd08":"top"===e?"a1u9y2aj":"a1qqaks"},ne=function(e){var t=e.children,n=e.style,i=e.className,r=e.enabled,a=void 0===r||r,s=e.hiding,o=e.direction,u=void 0===o?"left":o,l=e.onAnimationEnd;return L.jsx(J,{style:n,className:P.cx_default(i,"a1rlj479",te(u),a&&!s&&Z(u),a&&s&&ee(u)),onAnimationEnd:l,children:t})},ie=P.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),re=P.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),ae=P.styled_default(ie)({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),se=function(e){var t=e.promotion,n=e.promotionId,i=e.hiding,r=e.isEventFired,a=e.fireEvent,s=e.direction,o=void 0===s?"bottom":s,u=(null==t?void 0:t.adUnit)===U.AdUnit.STANDART,l=u?t.banner:t.additionalBanner;if(O.useEffect(function(){null!=l&&l.imageUrl&&t.type&&n&&(null!=r&&r("banner-showed")||(N.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:n,type:t.type}}),null==a||a("banner-showed")))},[null==l?void 0:l.imageUrl,a,r,t.type,n]),null==l||!l.imageUrl)return null;var c=null==l?void 0:l.url;return c&&0!==c.indexOf("http")&&(c="https://".concat(c)),L.jsx(ne,{direction:o,hiding:i,children:L.jsx(re,{className:"BannerContainer","data-is-ad":u,children:L.jsx(ae,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:"url(".concat(l.imageUrl,")"),cursor:c?"pointer":"default"},"data-promo-id":n,"data-promo-type":t.type,"data-a":"banner",target:"_blank","data-is-ad":u})})})},oe=function(e){var t=e.cardId,n=e.promotion,i=e.direction,r=void 0===i?"bottom":i;return L.jsx(se,{promotion:n,promotionId:t,direction:r,hiding:!1})},ue=P.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),le=P.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),ce=P.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),de=P.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),he=P.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),pe=P.styled_default(he)({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),fe=P.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),me=P.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),ge=P.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),ve=P.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),ye=P.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),_e=P.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),be=P.styled_default(_e)({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Te=P.styled_default(_e)({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),ke=I(I(I(I(I(I({},U.NotificationPromotionImagePosition.UNSET,he),U.NotificationPromotionImagePosition.FIT,he),U.NotificationPromotionImagePosition.CENTERED,he),U.NotificationPromotionImagePosition.SOLID,he),U.NotificationPromotionImagePosition.BOTTOM,he),U.NotificationPromotionImagePosition.MIDDLE,pe),Se=function(e){var t=e.src,n=e.imagePosition,i=ke[n];return L.jsx(i,{children:L.jsx("img",{src:t,alt:""})})},we=M.O(be),Ee=M.O(Te),Ce=function(e){var t=e.notification,n=e.open,i=e.close,r=e.webos;if(!t||!t.promotion||t.enabled!==U.NotificationEnabled.NOTIFICATION_ENABLED)return null;var a=t.title,s=t.body,o=t.image,u=t.promotion,l=u.sponsorLogo,c=u.sponsorLogoMode,d=u.imagePosition,h=u.ctaButton;return L.jsxs(ye,{"data-webos":r,className:"SL_Lower_Third_Notification",onClick:r?void 0:n,children:[L.jsxs(ue,{children:[L.jsx(Se,{src:o,imagePosition:d}),L.jsxs(le,{children:[a&&L.jsx(ce,{children:a}),s&&L.jsx(de,{children:s})]})]}),L.jsxs(ge,{children:[c!==U.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&L.jsxs(L.Fragment,{children:[L.jsx(me,{children:L.jsx("img",{src:l,alt:a})}),L.jsx(ve,{})]}),r?L.jsxs(L.Fragment,{children:[L.jsx(we,{webos:!0,onClick:i,children:"Dismiss"}),L.jsxs(Ee,{webos:!0,autoFocus:!0,style:{color:null==h?void 0:h.textColor,backgroundColor:null==h?void 0:h.color},onClick:n,children:[(null==h?void 0:h.ctaIcon)&&(null==h?void 0:h.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(fe,{src:null==h?void 0:h.ctaIcon,alt:"cta-icon"}),(null==h?void 0:h.label)||"Open"]})]}):L.jsxs(Te,{name:"promo-button",style:{color:null==h?void 0:h.textColor,backgroundColor:null==h?void 0:h.color},children:[(null==h?void 0:h.ctaIcon)&&(null==h?void 0:h.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(fe,{src:null==h?void 0:h.ctaIcon,alt:"cta-icon"}),(null==h?void 0:h.label)||"Open"]})]})]})},Ae=P.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Ie=P.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),xe=P.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Le=P.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),De=P.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Pe=P.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),Re=P.styled_default(Pe)({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Oe=P.styled_default(Pe)({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Ne=P.styled_default(Oe)({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Ue=P.styled_default(Pe)({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Me=P.styled_default(Pe)({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Be=P.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),je=P.styled_default(B.B1)({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Fe=P.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),qe=P.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),Ve=P.styled_default(qe)({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),He=P.styled_default(qe)({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),ze=I(I(I(I(I(I({},U.NotificationPromotionImagePosition.UNSET,Re),U.NotificationPromotionImagePosition.FIT,Re),U.NotificationPromotionImagePosition.CENTERED,Oe),U.NotificationPromotionImagePosition.BOTTOM,Ne),U.NotificationPromotionImagePosition.SOLID,Ue),U.NotificationPromotionImagePosition.MIDDLE,Me),We=function(e){var t=e.src,n=e.imagePosition,i=ze[n];return L.jsx(i,{children:L.jsx("img",{src:t,alt:""})})},Ge=M.O(Ve),Xe=M.O(He),Ke=function(e){var t=e.notification,n=e.open,i=(e.promotionId,e.hiding),r=e.direction,a=void 0===r?"left":r,s=e.close,o=e.webos;if(!t||!t.promotion||t.enabled!==U.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(t.promotion.mode===U.NotificationPromotionMode.LOWER_THIRD)return L.jsx(Ce,{notification:t,open:n,close:s,webos:o});var u=t.title,l=t.body,c=t.image,d=t.promotion,h=d.sponsorLogo,p=d.sponsorLogoMode,f=d.imagePosition,m=d.ctaButton;return L.jsx(ne,{className:"SL_Rich_Notification",direction:a,hiding:i,children:L.jsxs(Ie,{onClick:o?function(){}:n,children:[p!==U.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&h&&L.jsx(Fe,{children:L.jsx("img",{src:h,alt:u})}),L.jsxs(Ae,{children:[L.jsx(We,{src:c,imagePosition:f}),L.jsxs(xe,{children:[u&&L.jsx(Le,{children:u}),l&&L.jsx(De,{children:l})]}),o&&L.jsx(Ge,{webos:!0,onClick:function(e){e.stopPropagation(),null==s||s()},children:"Dismiss"}),L.jsxs(Xe,{webos:o,autoFocus:o,onClick:o?n:function(){},name:"promo-button",style:{color:null==m?void 0:m.textColor,backgroundColor:null==m?void 0:m.color},children:[(null==m?void 0:m.ctaIcon)&&(null==m?void 0:m.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(Be,{src:null==m?void 0:m.ctaIcon,alt:"cta-icon"}),(null==m?void 0:m.label)||"Open"]}),L.jsx(je,{name:"chevronRight"})]})]})})},Ye=P.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Qe=P.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),$e=P.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Je=P.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ze="h10toh7",et=P.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),tt=P.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),nt=P.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),it=P.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),rt=P.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),at=P.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),st=P.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),ot=P.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),ut=P.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),lt=P.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),ct=P.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),dt=P.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),ht=P.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),pt=P.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),ft=P.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),mt=P.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),gt=function(e){var t=e.time,n=e.adCount,i=e.adPosition,r=Math.floor(t/60),a=t-60*r;return 0===r&&0===a&&n===i?null:L.jsxs(pt,{children:[n>1&&L.jsxs(L.Fragment,{children:[L.jsxs(ft,{children:[i," of ",n]}),L.jsx(mt,{})]}),L.jsxs(ft,{children:[r,":",a<10?"0".concat(a):a]})]})},vt=P.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),yt=function(e){var t=e.whyThisAd,n=S(O.useState(!1),2),i=n[0],r=n[1];return t.iconClickThroughURLTemplate&&t.staticResource?L.jsxs(vt,{style:I(I({width:t.width,height:t.height},t.xPosition,3),t.yPosition,11),href:t.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!i&&L.jsx("img",{alt:"ad choice",src:t.staticResource,onLoad:function(){return r(!1)},onError:function(){return r(!0)}}),i&&L.jsx("span",{children:"ad choice"})]}):null},_t=P.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),bt=P.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),Tt=P.styled_default(bt)({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),kt=P.styled_default(bt)({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),St=P.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),wt=P.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),Et="m12n261r",Ct="m16vcml8",At="m1078nk6";function It(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}var xt=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function Lt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],r=Rt(e);for(var a in!t.ERRORCODE||n.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=Bt(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING,t)t[a]=Mt(t[a]);for(var s in r){var o=r[s];"string"==typeof o&&i.push(Dt(o,t))}return i}function Dt(e,t){var n=(e=Pt(e,t)).match(/[^[\]]+(?=])/g);if(!n)return e;var i=n.filter(function(e){return xt.indexOf(e)>-1});return 0===i.length?e:Pt(e,i=i.reduce(function(e,t){return e[t]=-1,e},{}))}function Pt(e,t){var n=e;for(var i in t){var r=t[i];n=n.replace(new RegExp("(?:\\[|%%)(".concat(i,")(?:\\]|%%)"),"g"),r)}return n}function Rt(e){return Array.isArray(e)?e.map(function(e){return e&&e.hasOwnProperty("url")?e.url:e}):e}function Ot(e){return/^(https?:\/\/|\/\/)/.test(e)}function Nt(e,t){for(var n=0;n<t.length;n++)if(Ut(t[n],e))return!0;return!1}function Ut(e,t){if(e&&t){var n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return n.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Mt(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16))})}function Bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}var jt={track:function(e,t,n){Lt(e,t,n).forEach(function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:Lt,extractURLsFromTemplates:Rt,filterUrlTemplates:function(e){return e.reduce(function(e,t){var n=t.url||t;return Ot(n)?e.validUrls.push(n):e.invalidUrls.push(n),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Nt,isTemplateObjectEqual:Ut,encodeURIComponentRFC3986:Mt,replaceUrlMacros:Dt,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce(function(t,n){return t.concat(Array.isArray(n)?e(n):n)},[])},joinArrayOfUniqueTemplateObjs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return n.concat(i).reduce(function(e,t){return Nt(t,e)||e.push(t),e},[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:Bt,isValidUrl:Ot,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=k(e)?e:JSON.stringify(e)}};function Ft(e){return["true","TRUE","True","1"].includes(e)}var qt={childByName:function(e,t){return Array.from(e.childNodes).find(function(e){return e.nodeName===t})},childrenByName:function(e,t){return Array.from(e.childNodes).filter(function(e){return e.nodeName===t})},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){var n=location.protocol;return"".concat(n).concat(e)}if(!e.includes("://")){var i=t.slice(0,t.lastIndexOf("/"));return"".concat(i,"/").concat(e)}return e},parseBoolean:Ft,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,n){var i=t.getAttribute(e);i&&n.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce(function(e,t){return e[t.nodeName]=t.nodeValue,e},{})},parseDuration:function(e){if(null==e)return-1;if(jt.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var n=t[2].split("."),i=parseInt(n[0]);2===n.length&&(i+=parseFloat("0.".concat(n[1])));var r=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(r)||isNaN(i)||r>3600||i>60?-1:a+r+i},getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(e){return!parseInt(e.sequence,10)})},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(e){return parseInt(e.sequence,10)}).sort(function(e,t){return e.sequence-t.sequence})},assignAttributes:function(e,t){e&&Array.from(e).forEach(function(e){var n=e.nodeName,i=e.nodeValue;if(n&&i&&t.hasOwnProperty(n)){var r=i;"boolean"==typeof t[n]&&(r=Ft(r)),t[n]=r}})},mergeWrapperAdData:function(e,t){var n;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[].concat(b(e.viewableImpression),b(t.viewableImpression))),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;var i=(t.creatives||[]).filter(function(e){return e&&"companion"===e.type}),r=i.reduce(function(e,t){return(t.variations||[]).forEach(function(t){(t.companionClickTrackingURLTemplates||[]).forEach(function(t){jt.containsTemplateObject(t,e)||e.push(t)})}),e},[]);e.creatives=i.concat(e.creatives);var a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var n in t.trackingEvents[e.type]){var i=t.trackingEvents[e.type][n];Array.isArray(e.trackingEvents[n])||(e.trackingEvents[n]=[]),e.trackingEvents[n]=e.trackingEvents[n].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&r.length&&(e.variations||[]).forEach(function(e){e.companionClickTrackingURLTemplates=jt.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,r)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(n=t.creatives)&&void 0!==n&&n.length){var o=t.creatives.filter(function(e){var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});o.length&&(e.creatives=e.creatives.concat(o))}}};function Vt(e,t){var n=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"companion",required:null,variations:[]}}(t);return n.required=e.getAttribute("required")||null,n.variations=qt.childrenByName(e,"Companion").map(function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(qt.parseAttributes(e));t.htmlResources=qt.childrenByName(e,"HTMLResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat(n):e},[]),t.iframeResources=qt.childrenByName(e,"IFrameResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat(n):e},[]),t.staticResources=qt.childrenByName(e,"StaticResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat({url:n,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=qt.parseNodeText(qt.childByName(e,"AltText"))||null;var n=qt.childByName(e,"TrackingEvents");n&&qt.childrenByName(n,"Tracking").forEach(function(e){var n=e.getAttribute("event"),i=qt.parseNodeText(e);n&&i&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(i))}),t.companionClickTrackingURLTemplates=qt.childrenByName(e,"CompanionClickTracking").map(function(e){return{id:e.getAttribute("id")||null,url:qt.parseNodeText(e)}}),t.companionClickThroughURLTemplate=qt.parseNodeText(qt.childByName(e,"CompanionClickThrough"))||null;var i=qt.childByName(e,"AdParameters");return i&&(t.adParameters={value:qt.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),n}function Ht(e,t){var n,i=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=qt.parseDuration(qt.parseNodeText(qt.childByName(e,"Duration")));var r=e.getAttribute("skipoffset");if(null==r)i.skipDelay=null;else if("%"===r.charAt(r.length-1)&&-1!==i.duration){var a=parseInt(r,10);i.skipDelay=i.duration*(a/100)}else i.skipDelay=qt.parseDuration(r);var s=qt.childByName(e,"VideoClicks");if(s){var o=qt.childByName(s,"ClickThrough");i.videoClickThroughURLTemplate=o?{id:o.getAttribute("id")||null,url:qt.parseNodeText(o)}:null,qt.childrenByName(s,"ClickTracking").forEach(function(e){i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})}),qt.childrenByName(s,"CustomClick").forEach(function(e){i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})})}var u=qt.childByName(e,"AdParameters");u&&(i.adParameters={value:qt.parseNodeText(u),xmlEncoded:u.getAttribute("xmlEncoded")||null}),qt.childrenByName(e,"TrackingEvents").forEach(function(e){qt.childrenByName(e,"Tracking").forEach(function(e){var t=e.getAttribute("event"),r=qt.parseNodeText(e);if(t&&r){if("progress"===t){if(!(n=e.getAttribute("offset")))return;t="%"===n.charAt(n.length-1)?"progress-".concat(n):"progress-".concat(qt.parseDuration(n))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r)}})}),qt.childrenByName(e,"MediaFiles").forEach(function(e){qt.childrenByName(e,"MediaFile").forEach(function(e){i.mediaFiles.push(function(e){var t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=qt.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);var n=e.getAttribute("scalable");n&&"string"==typeof n&&(t.scalable=qt.parseBoolean(n));var i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=qt.parseBoolean(i)),t}(e))});var t,n,r=qt.childByName(e,"InteractiveCreativeFile");r&&(i.interactiveCreativeFile=(t=r,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:qt.parseBoolean(e.variableDuration),fileURL:null}}(qt.parseAttributes(t)),n.fileURL=qt.parseNodeText(t),n));var a=qt.childByName(e,"ClosedCaptionFiles");a&&qt.childrenByName(a,"ClosedCaptionFile").forEach(function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(qt.parseAttributes(e));t.fileURL=qt.parseNodeText(e),i.closedCaptionFiles.push(t)});var s=qt.childByName(e,"Mezzanine"),o=function(e){var t={},n=!1;return["delivery","type","width","height"].forEach(function(i){e&&e.getAttribute(i)?t[i]=e.getAttribute(i):n=!0}),n?null:t}(s);if(o){var u={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};u.id=s.getAttribute("id"),u.fileURL=qt.parseNodeText(s),u.delivery=o.delivery,u.codec=s.getAttribute("codec"),u.type=o.type,u.width=parseInt(o.width,10),u.height=parseInt(o.height,10),u.fileSize=parseInt(s.getAttribute("fileSize"),10),u.mediaType=s.getAttribute("mediaType")||"2D",i.mezzanine=u}});var l=qt.childByName(e,"Icons");return l&&qt.childrenByName(l,"Icon").forEach(function(e){i.icons.push(function(e){var t,n={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};n.program=e.getAttribute("program"),n.height=parseInt(e.getAttribute("height")||0),n.width=parseInt(e.getAttribute("width")||0),n.xPosition=(t=e.getAttribute("xPosition"),-1!==["left","right"].indexOf(t)?t:parseInt(t||0)),n.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),n.apiFramework=e.getAttribute("apiFramework"),n.pxratio=e.getAttribute("pxratio")||"1",n.offset=qt.parseDuration(e.getAttribute("offset")),n.duration=qt.parseDuration(e.getAttribute("duration")),n.altText=e.getAttribute("altText"),n.hoverText=e.getAttribute("hoverText"),qt.childrenByName(e,"HTMLResource").forEach(function(e){n.type=e.getAttribute("creativeType")||"text/html",n.htmlResource=qt.parseNodeText(e)}),qt.childrenByName(e,"IFrameResource").forEach(function(e){n.type=e.getAttribute("creativeType")||0,n.iframeResource=qt.parseNodeText(e)}),qt.childrenByName(e,"StaticResource").forEach(function(e){n.type=e.getAttribute("creativeType")||0,n.staticResource=qt.parseNodeText(e)});var i=qt.childByName(e,"IconClicks");if(i){n.iconClickThroughURLTemplate=qt.parseNodeText(qt.childByName(i,"IconClickThrough")),qt.childrenByName(i,"IconClickTracking").forEach(function(e){n.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})});var r=qt.childByName(i,"IconClickFallbackImages");r&&qt.childrenByName(r,"IconClickFallbackImage").forEach(function(e){n.iconClickFallbackImages.push({url:qt.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return n.iconViewTrackingURLTemplate=qt.parseNodeText(qt.childByName(e,"IconViewTracking")),n}(e))}),i}function zt(e,t){var n=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return qt.childrenByName(e,"TrackingEvents").forEach(function(e){var t,i;qt.childrenByName(e,"Tracking").forEach(function(e){t=e.getAttribute("event"),i=qt.parseNodeText(e),t&&i&&(Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(i))})}),qt.childrenByName(e,"NonLinear").forEach(function(e){var t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=qt.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=qt.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=qt.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),qt.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=qt.parseNodeText(e)}),qt.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=qt.parseNodeText(e)}),qt.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=qt.parseNodeText(e)});var i=qt.childByName(e,"AdParameters");i&&(t.adParameters={value:qt.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=qt.parseNodeText(qt.childByName(e,"NonLinearClickThrough")),qt.childrenByName(e,"NonLinearClickTracking").forEach(function(e){t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})}),n.variations.push(t)}),n}function Wt(e){var t=[];return e.forEach(function(e){var n=Gt(e);n&&t.push(n)}),t}function Gt(e){if("#comment"===e.nodeName)return null;var t,n={name:null,value:null,attributes:{},children:[]},i=e.attributes,r=e.childNodes;if(n.name=e.nodeName,e.attributes)for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s.nodeName&&s.nodeValue&&(n.attributes[s.nodeName]=s.nodeValue)}for(var o in r)if(r.hasOwnProperty(o)){var u=Gt(r[o]);u&&n.children.push(u)}if(0===n.children.length||1===n.children.length&&["#cdata-section","#text"].indexOf(n.children[0].name)>=0){var l=qt.parseNodeText(e);""!==l&&(n.value=l),n.children=[]}return null===(t=n).value&&0===Object.keys(t.attributes).length&&0===t.children.length?null:n}function Xt(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}var Kt={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Yt(e,t){if(Kt[e.nodeName]&&Kt[e.nodeName].attributes){var n=Kt[e.nodeName].attributes.filter(function(t){return!e.getAttribute(t)});n.length>0&&Jt({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:n},t)}}function Qt(e,t,n){var i=Kt[e.nodeName],r=!n&&"Wrapper"!==e.nodeName;if(i&&!r){if(i.subElements){var a=i.subElements.filter(function(t){return!qt.childByName(e,t)});a.length>0&&Jt({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:a},t)}n&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(function(t){return qt.childByName(e,t)})||Jt({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function $t(e){return e.children&&0!==e.children.length}function Jt(e,t){var n=e.name,i=e.parentName,r=e.attributes,a=e.subElements,s=e.oneOfResources,o="Element '".concat(n,"'");t("VAST-warning",{message:o+=r?" missing required attribute(s) '".concat(r.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",parentElement:i,specVersion:4.1})}var Zt=function e(t,n,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),Yt(t,n),$t(t)){Qt(t,n,i);for(var r=0;r<t.children.length;r++)e(t.children[r],n,i)}else 0===qt.parseNodeText(t).length&&Jt({name:t.nodeName,parentName:t.parentNode.nodeName},n)};function en(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.allowMultipleAds,a=i.followAdditionalWrappers,s=_(Array.from(e.childNodes).filter(function(e){var t=e.nodeName.toLowerCase();return"inline"===t||!1!==a&&"wrapper"===t}));try{for(s.s();!(n=s.n()).done;){var o=n.value;if(qt.copyNodeAttribute("id",e,o),qt.copyNodeAttribute("sequence",e,o),qt.copyNodeAttribute("adType",e,o),"Wrapper"===o.nodeName)return{ad:rn(o,t),type:"WRAPPER"};if("InLine"===o.nodeName)return{ad:tn(o,t,{allowMultipleAds:r}),type:"INLINE"};var u=o.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(o.nodeName,"inline"===u?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:o})}}catch(l){s.e(l)}finally{s.f()}}function tn(e,t){return!1===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowMultipleAds&&e.getAttribute("sequence")?null:nn(e,t)}function nn(e,t){var n=[];t&&Zt(e,t);var i=Array.from(e.childNodes),r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(qt.parseAttributes(e));return i.forEach(function(e){switch(e.nodeName){case"Error":r.errorURLTemplates.push(qt.parseNodeText(e));break;case"Impression":r.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)});break;case"Creatives":r.creatives=(i=qt.childrenByName(e,"Creative"),a=[],i.forEach(function(e){var t,n={id:e.getAttribute("id")||null,adId:Xt(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];qt.childrenByName(e,"UniversalAdId").forEach(function(e){var t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:qt.parseNodeText(e)};i.push(t)});var r=qt.childByName(e,"CreativeExtensions");for(var s in r&&(t=Wt(qt.childrenByName(r,"CreativeExtension"))),e.childNodes){var o=e.childNodes[s],u=void 0;switch(o.nodeName){case"Linear":u=Ht(o,n);break;case"NonLinearAds":u=zt(o,n);break;case"CompanionAds":u=Vt(o,n)}u&&(i&&(u.universalAdIds=i),t&&(u.creativeExtensions=t),a.push(u))}}),a);break;case"Extensions":var t=qt.childrenByName(e,"Extension");r.extensions=Wt(t),r.adVerifications.length||(n=function(e){var t=null,n=[];return e.some(function(e){return t=qt.childByName(e,"AdVerifications")}),t&&(n=an(qt.childrenByName(t,"Verification"))),n}(t));break;case"AdVerifications":r.adVerifications=an(qt.childrenByName(e,"Verification"));break;case"AdSystem":r.system={value:qt.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":r.title=qt.parseNodeText(e);break;case"AdServingId":r.adServingId=qt.parseNodeText(e);break;case"Category":r.categories.push({authority:e.getAttribute("authority")||null,value:qt.parseNodeText(e)});break;case"Expires":r.expires=parseInt(qt.parseNodeText(e),10);break;case"ViewableImpression":r.viewableImpression.push(function(e){var t=function(e,t){var n=qt.parseNodeText(t);return n&&e.push(n),e};return{id:e.getAttribute("id")||null,viewable:qt.childrenByName(e,"Viewable").reduce(t,[]),notViewable:qt.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:qt.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":r.description=qt.parseNodeText(e);break;case"Advertiser":r.advertiser={id:e.getAttribute("id")||null,value:qt.parseNodeText(e)};break;case"Pricing":r.pricing={value:qt.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":r.survey={value:qt.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:qt.parseNodeText(e)})}var i,a}),n.length&&(r.adVerifications=r.adVerifications.concat(n)),r}function rn(e,t){var n=nn(e,t),i=e.getAttribute("followAdditionalWrappers"),r=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");n.followAdditionalWrappers=!i||qt.parseBoolean(i),n.allowMultipleAds=!!r&&qt.parseBoolean(r),n.fallbackOnNoAd=a?qt.parseBoolean(a):null;var s=qt.childByName(e,"VASTAdTagURI");if(s?n.nextWrapperURL=qt.parseNodeText(s):(s=qt.childByName(e,"VASTAdTagURL"))&&(n.nextWrapperURL=qt.parseNodeText(qt.childByName(s,"URL"))),n.creatives.forEach(function(e){if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){n.trackingEvents||(n.trackingEvents={}),n.trackingEvents[e.type]||(n.trackingEvents[e.type]={});var t=function(t){var i=e.trackingEvents[t];Array.isArray(n.trackingEvents[e.type][t])||(n.trackingEvents[e.type][t]=[]),i.forEach(function(i){n.trackingEvents[e.type][t].push(i)})};for(var i in e.trackingEvents)t(i)}e.videoClickTrackingURLTemplates&&(Array.isArray(n.videoClickTrackingURLTemplates)||(n.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(function(e){n.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(n.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(n.videoCustomClickURLTemplates)||(n.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(function(e){n.videoCustomClickURLTemplates.push(e)}))}}),n.nextWrapperURL)return n}function an(e){var t=[];return e.forEach(function(e){var n={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);qt.assignAttributes(e.attributes,n),i.forEach(function(e){var t=e.nodeName,i=e.textContent,r=e.attributes;switch(t){case"JavaScriptResource":case"ExecutableResource":n.resource=i.trim(),qt.assignAttributes(r,n);break;case"VerificationParameters":n.parameters=i.trim()}});var r=qt.childByName(e,"TrackingEvents");r&&qt.childrenByName(r,"Tracking").forEach(function(e){var t=e.getAttribute("event"),i=qt.parseNodeText(e);t&&i&&(Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(i))}),t.push(n)}),t}var sn,on,un=function(){return y(function e(){g(this,e),this._handlers=[]},[{key:"on",value:function(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(k(t)));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(k(e)));return this._handlers.push({event:e,handler:t}),this}},{key:"once",value:function(e,t){return this.on(e,function(e,t,n){var i={fired:!1,wrapFn:void 0};function r(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,n.bind(e).apply(void 0,arguments))}return i.wrapFn=r,r}(this,e,t))}},{key:"off",value:function(e,t){return this._handlers=this._handlers.filter(function(n){return n.event!==e||n.handler!==t}),this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r=!1;return this._handlers.forEach(function(t){"*"===t.event&&(r=!0,t.handler.apply(t,[e].concat(n))),t.event===e&&(r=!0,t.handler.apply(t,n))}),r}},{key:"removeAllListeners",value:function(e){return e?(this._handlers=this._handlers.filter(function(t){return t.event!==e}),this):(this._handlers=[],this)}},{key:"listenerCount",value:function(e){return this._handlers.filter(function(t){return t.event===e}).length}},{key:"listeners",value:function(e){return this._handlers.reduce(function(t,n){return n.event===e&&t.push(n.handler),t},[])}},{key:"eventNames",value:function(){return this._handlers.map(function(e){return e.event})}}])}(),ln=0,cn=0,dn=function(e,t){!e||!t||e<=0||t<=0||(cn=(cn*ln+8*e/t)/++ln)},hn={ERRORCODE:900,extensions:[]},pn="VAST response version not supported",fn=function(){function e(){var t;g(this,e);var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).fetcher;return(t=c(this,e)).maxWrapperDepth=null,t.rootErrorURLTemplates=[],t.errorURLTemplates=[],t.remainingAds=[],t.parsingOptions={},t.fetcher=n||null,t.keepFailedAdPod=!1,t}return f(e,un),y(e,[{key:"trackVastError",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];this.emit("VAST-error",Object.assign.apply(Object,[{},hn,t].concat(i))),jt.track(e,t)}},{key:"getErrorURLTemplates",value:function(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}},{key:"getEstimatedBitrate",value:function(){return cn}},{key:"initParsingStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),dn(e.byteLength,e.requestDuration)}},{key:"resetParsingStatus",value:function(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}},{key:"getRemainingAds",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));var n=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(n,{wrapperDepth:0,url:this.rootURL}).then(function(e){return t.buildVASTResponse(e)})}},{key:"parseVAST",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(n),n.isRootVAST=!0,this.parse(e,n).then(function(e){return t.buildVASTResponse(e)})}},{key:"buildVASTResponse",value:function(e){var t,n={ads:(t={ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion}).ads||[],errorURLTemplates:t.errorURLTemplates||[],version:t.version||null};return this.completeWrapperResolving(n),n}},{key:"parseVastXml",value:function(e,t){var n=t.isRootVAST,i=void 0!==n&&n,r=t.url,a=void 0===r?null:r,s=t.wrapperDepth,o=void 0===s?0:s,u=t.allowMultipleAds,l=t.followAdditionalWrappers;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var c;this.emit("VAST-ad-parsed",{type:"ERROR",url:a,wrapperDepth:o});var d="VideoAdServingTemplate"===(null==e||null===(c=e.documentElement)||void 0===c?void 0:c.nodeName);throw new Error(d?pn:"Invalid VAST XMLDocument")}var h=[],p=e.documentElement.childNodes,f=e.documentElement.getAttribute("version");for(var m in i&&f&&(this.vastVersion=f),p){var g=p[m];if("Error"===g.nodeName){var v=qt.parseNodeText(g);i?this.rootErrorURLTemplates.push(v):this.errorURLTemplates.push(v)}else if("Ad"===g.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)u=!0;else if(!1===u&&h.length>1)break;var y=en(g,this.emit.bind(this),{allowMultipleAds:u,followAdditionalWrappers:l});y.ad?(h.push(y.ad),this.emit("VAST-ad-parsed",{type:y.type,url:a,wrapperDepth:o,adIndex:h.length-1,vastVersion:f})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.url,i=void 0===n?null:n,r=t.resolveAll,a=void 0===r||r,s=t.wrapperSequence,o=void 0===s?null:s,u=t.previousUrl,l=void 0===u?null:u,c=t.wrapperDepth,d=void 0===c?0:c,h=t.isRootVAST,p=void 0!==h&&h,f=t.followAdditionalWrappers,m=t.allowMultipleAds,g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&p&&(m=!0);try{g=this.parseVastXml(e,{isRootVAST:p,url:i,wrapperDepth:d,allowMultipleAds:m,followAdditionalWrappers:f})}catch(_){return Promise.reject(_)}if(1===g.length&&null!=o&&(g[0].sequence=o),!1===a){var v=qt.getSortedAdPods(g),y=qt.getStandAloneAds(g);v.length?g=v:y.length&&(g=[y.shift()]),this.remainingAds=y}return this.resolveAds(g,{wrapperDepth:d,previousUrl:l,url:i})}},{key:"resolveAds",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,i=n.wrapperDepth,r=n.previousUrl,a=n.url,s=[];return r=a,t.forEach(function(t){var n=e.resolveWrappers(t,i,r);s.push(n)}),Promise.all(s).then(function(e){return jt.flatten(e)})}},{key:"resolveWrappers",value:function(e,t,n){var i=this,r=l({},e);return new Promise(function(e){var a;if(t++,!r.nextWrapperURL)return delete r.nextWrapperURL,e(r);if(!i.fetcher)return r.VASTAdTagURI=r.nextWrapperURL,delete r.nextWrapperURL,e(r);if(t>=i.maxWrapperDepth)return r.errorCode=302,delete r.nextWrapperURL,e(r);r.nextWrapperURL=qt.resolveVastAdTagURI(r.nextWrapperURL,n);var s=null!==(a=i.parsingOptions.allowMultipleAds)&&void 0!==a?a:r.allowMultipleAds,o=r.sequence;i.fetcher.fetchVAST({url:r.nextWrapperURL,emitter:i.emit.bind(i),maxWrapperDepth:i.maxWrapperDepth}).then(function(a){return i.parse(a,{url:r.nextWrapperURL,previousUrl:n,wrapperSequence:o,wrapperDepth:t,followAdditionalWrappers:r.followAdditionalWrappers,allowMultipleAds:s}).then(function(t){if(delete r.nextWrapperURL,0===t.length)return r.creatives=[],e(r);t.forEach(function(e){e&&qt.mergeWrapperAdData(e,r)}),e(t)})}).catch(function(t){r.errorCode=t.message===pn?102:301,r.errorMessage=t.message,e(r)})})}},{key:"completeWrapperResolving",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var n=e.ads[t],i=!n.creatives.some(function(e){var t,n;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(n=e.variations)||void 0===n?void 0:n.length)>0});!n.errorCode&&!i||n.VASTAdTagURI||(this.trackVastError(n.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:n.errorCode||303},{ERRORMESSAGE:n.errorMessage||""},{extensions:n.extensions},{system:n.system}),this.keepFailedAdPod&&n.sequence?n.hasFailed=!0:e.ads.splice(t,1))}}}])}(),mn=null,gn={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete this.data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},vn=function(){return y(function e(){g(this,e),this.storage=this.initStorage()},[{key:"initStorage",value:function(){if(mn)return mn;try{mn="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){mn=null}return mn&&!this.isStorageDisabled(mn)||(mn=gn).clear(),mn}},{key:"isStorageDisabled",value:function(e){var t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(n){return!0}return e.removeItem(t),!1}},{key:"getItem",value:function(e){return this.storage.getItem(e)}},{key:"setItem",value:function(e,t){return this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){return this.storage.removeItem(e)}},{key:"clear",value:function(){return this.storage.clear()}}])}(),yn=12e4,_n={get:(sn=o(r().m(function e(t,n){var i,a,s,u,c;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,i=new AbortController,a=setTimeout(function(){throw i.abort(),new Error("URLHandler: Request timed out after ".concat(n.timeout||yn," ms (408)"))},n.timeout||yn),e.n=1,fetch(t,l(l({},n),{},{signal:i.signal,credentials:n.withCredentials?"include":"omit"})).finally(function(){clearTimeout(a)});case 1:return s=e.v,u=function(e){return jt.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(s),e.a(2,u?{error:new Error(u),statusCode:s.status}:function(){var e=o(r().m(function e(t){var n,i,a,s;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.text();case 1:if(n=e.v,!jt.isBrowserEnvironment()){e.n=2;break}a=new DOMParser,e.n=4;break;case 2:return e.n=3,Promise.resolve().then(function(){return Bs});case 3:s=e.v.DOMParser,a=new s;case 4:return i=a,e.a(2,{xml:i.parseFromString(n,"text/xml"),details:{byteLength:n.length,statusCode:t.status,rawXml:n}})}},e)}));return function(t){return e.apply(this,arguments)}}()(s));case 2:return e.p=2,c=e.v,e.a(2,{error:c,statusCode:"AbortError"===c.name?408:null})}},e,null,[[0,2]])})),function(e,t){return sn.apply(this,arguments)})},bn=function(){return y(function e(){g(this,e),this.URLTemplateFilters=[]},[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||_n,this.fetchingOptions=l(l({},e.fetchOptions),{},{timeout:e.timeout||yn,withCredentials:Boolean(e.withCredentials)})}},{key:"addURLTemplateFilter",value:function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}},{key:"removeLastURLTemplateFilter",value:function(){this.URLTemplateFilters.pop()}},{key:"countURLTemplateFilters",value:function(){return this.URLTemplateFilters.length}},{key:"clearURLTemplateFilters",value:function(){this.URLTemplateFilters=[]}},{key:"fetchVAST",value:(e=o(r().m(function e(t){var n,i,a,s,o,u,c,d,h,p,f,m,g;return r().w(function(e){for(;;)switch(e.n){case 0:return i=t.url,a=t.maxWrapperDepth,s=t.emitter,o=t.wrapperDepth,u=void 0===o?0:o,c=t.previousUrl,d=void 0===c?null:c,h=t.wrapperAd,p=void 0===h?null:h,f=Date.now(),this.URLTemplateFilters.forEach(function(e){i=e(i)}),s("VAST-resolving",{url:i,previousUrl:d,wrapperDepth:u,maxWrapperDepth:a,timeout:this.fetchingOptions.timeout,wrapperAd:p}),e.n=1,this.urlHandler.get(i,this.fetchingOptions);case 1:if(m=e.v,g=Math.round(Date.now()-f),s("VAST-resolved",l({url:i,previousUrl:d,wrapperDepth:u,error:(null==m?void 0:m.error)||null,duration:g,statusCode:(null==m?void 0:m.statusCode)||null},null==m?void 0:m.details)),dn(null==m||null===(n=m.details)||void 0===n?void 0:n.byteLength,g),!m.error){e.n=2;break}throw new Error(m.error);case 2:return e.a(2,m.xml)}},e,this)})),function(t){return e.apply(this,arguments)})}]);var e}(),Tn=function(){return y(function e(){g(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new vn;this.cappingFreeLunch=t,this.cappingMinimumTimeInterval=n,this.fetcher=new bn,this.vastParser=new fn({fetcher:this.fetcher}),this.storage=i,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)},[{key:"addURLTemplateFilter",value:function(e){this.fetcher.addURLTemplateFilter(e)}},{key:"removeLastURLTemplateFilter",value:function(){this.fetcher.removeLastURLTemplateFilter()}},{key:"countURLTemplateFilters",value:function(){return this.fetcher.countURLTemplateFilters()}},{key:"clearURLTemplateFilters",value:function(){this.fetcher.clearURLTemplateFilters()}},{key:"getParser",value:function(){return this.vastParser}},{key:"lastSuccessfulAd",get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)}},{key:"totalCalls",get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)}},{key:"totalCallsTimeout",get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)}},{key:"hasRemainingAds",value:function(){return this.vastParser.remainingAds.length>0}},{key:"getNextAds",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:"parseVAST",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}},{key:"get",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Date.now();return n.hasOwnProperty("resolveAll")||(n.resolveAll=!1),this.totalCallsTimeout<i?(this.totalCalls=1,this.totalCallsTimeout=i+36e5):this.totalCalls++,new Promise(function(r,a){if(t.cappingFreeLunch>=t.totalCalls)return a(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(t.totalCalls,"/").concat(t.cappingFreeLunch)));var s=i-t.lastSuccessfulAd;if(s<0)t.lastSuccessfulAd=0;else if(s<t.cappingMinimumTimeInterval)return a(new Error("VAST call canceled – (".concat(t.cappingMinimumTimeInterval,")ms minimum interval reached")));t.vastParser.initParsingStatus(n),t.fetcher.setOptions(n),t.vastParser.rootURL=e,t.fetcher.fetchVAST({url:e,emitter:t.vastParser.emit.bind(t.vastParser),maxWrapperDepth:t.vastParser.maxWrapperDepth}).then(function(i){return n.previousUrl=e,n.isRootVAST=!0,n.url=e,t.vastParser.parse(i,n).then(function(e){var n=t.vastParser.buildVASTResponse(e);r(n)})}).catch(function(e){return a(e)})})}}])}(),kn=function(){function e(t,n,i){var r,a;g(this,e);var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];for(var u in(r=c(this,e)).ad=n,r.creative=i,r.variation=s,r.muted=o,r.impressed=!1,r.skippable=!1,r.trackingEvents={},r.trackedProgressEvents=[],r.lastPercentage=0,r._alreadyTriggeredQuartiles={},r.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"],r.creative.trackingEvents){var l=r.creative.trackingEvents[u];r.trackingEvents[u]=l.slice(0)}return r.viewableImpressionTrackers=(null===(a=r.ad.viewableImpression)||void 0===a?void 0:a.reduce(function(e,t){var n,i,r;return(n=e.notViewable).push.apply(n,b(t.notViewable)),(i=e.viewUndetermined).push.apply(i,b(t.viewUndetermined)),(r=e.viewable).push.apply(r,b(t.viewable)),e},{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(r.viewableImpressionTrackers).forEach(function(e){var t=S(e,2),n=t[0],i=t[1];i.length&&(r.trackingEvents[n]=i)}),"linear"!==r.creative.type?r._initVariationTracking():r._initLinearTracking(),t&&r.on("start",function(){t.lastSuccessfulAd=Date.now()}),r}return f(e,un),y(e,[{key:"_initLinearTracking",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:"_initVariationTracking",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):"companionAd"===this.variation.adType&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:"setDuration",value:function(e){jt.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}},{key:"setProgress",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(jt.isValidTimeValue(e)&&"object"==k(n)){var r=this.skipDelay||-1;if(-1===r||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){var a=Math.round(e/this.assetDuration*100),s=[];if(e>0){s.push("start");for(var o=this.lastPercentage;o<a;o++)s.push("progress-".concat(o+1,"%"));for(var u in s.push("progress-".concat(e)),this.quartiles)this.isQuartileReached(u,this.quartiles[u],e)&&(s.push(u),this._alreadyTriggeredQuartiles[u]=!0);this.lastPercentage=a}s.forEach(function(e){t.track(e,{macros:n,once:i})}),e<this.progress&&(this.track("rewind",{macros:n}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}else this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(jt.formatMacrosValues(n))})}},{key:"isQuartileReached",value:function(e,t,n){var i=!1;return t<=n&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}},{key:"setMuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"setPaused",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"setFullscreen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"setExpand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"setSkipDelay",value:function(e){jt.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}},{key:"trackImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}},{key:"trackViewableImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"trackNotViewableImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"trackUndeterminedImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"error",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(jt.formatMacrosValues(e),", isCustomCode: ").concat(t)})}},{key:"errorWithCode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}},{key:"complete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}},{key:"notUsed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}},{key:"otherAdInteraction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}},{key:"acceptInvitation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}},{key:"adExpand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}},{key:"adCollapse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}},{key:"minimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}},{key:"verificationNotExecuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e&&"object"==k(t)){if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");var n=this.ad.adVerifications.find(function(t){return t.vendor===e});if(!n)throw new Error("No associated verification element found for vendor: ".concat(e));var i=n.trackingEvents;if(i&&i.verificationNotExecuted){var r=i.verificationNotExecuted;this.trackURLs(r,t),this.emit("verificationNotExecuted",{trackingURLTemplates:r})}}else this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"overlayViewDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==k(t)?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}},{key:"skip",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}},{key:"click",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=k(t))this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))});else{this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);var n=this.clickThroughURLTemplate||e,i=l({},t);if(n){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());var r=jt.resolveURLTemplates([n],i)[0];this.emit("clickthrough",r)}}}},{key:"trackProgressEvents",value:function(e,t,n){var i=this,r=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(function(e){return S(e,1)[0].startsWith("progress-")}).map(function(e){var t=S(e,2),n=t[0],i=t[1];return{name:n,time:parseFloat(n.split("-")[1]),urls:i}}).filter(function(e){var t=e.time;return t<=r&&t>i.progress}).forEach(function(e){var r=e.name,a=e.urls;!n&&i.trackedProgressEvents.includes(r)||(i.emit(r,{trackingURLTemplates:a}),i.trackURLs(a,t),n?delete i.trackingEvents[r]:i.trackedProgressEvents.push(r))})}},{key:"track",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.macros,i=void 0===n?{}:n,r=t.once,a=void 0!==r&&r;if("object"==k(i)){"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,i,a);var s=this.trackingEvents[e],o=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,i)):o&&this.emit(e,null),a&&(delete this.trackingEvents[e],o&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}else this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(i)})}},{key:"trackURLs",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=jt.filterUrlTemplates(e),a=r.validUrls,s=r.invalidUrls;s.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(s)});var o=l({},n);this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map(function(e){return e.idRegistry.concat(" ",e.value)}).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map(function(e){return e.value}).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(function(e){return e.value}).join(","))),jt.track(a,o,i)}},{key:"convertToTimecode",value:function(e){if(!jt.isValidTimeValue(e))return"";var t=1e3*e,n=Math.floor(t/36e5),i=Math.floor(t/6e4%60),r=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(jt.addLeadingZeros(n,2),":").concat(jt.addLeadingZeros(i,2),":").concat(jt.addLeadingZeros(r,2),".").concat(jt.addLeadingZeros(a,3))}},{key:"progressFormatted",value:function(){return this.convertToTimecode(this.progress)}}])}(),Sn="undefined"!=typeof window?window:void 0!==F.commonjsGlobal?F.commonjsGlobal:"undefined"!=typeof self?self:{},wn=F.getDefaultExportFromCjs(Sn),En=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),Cn=F.getAugmentedNamespace(En),An=void 0!==F.commonjsGlobal?F.commonjsGlobal:"undefined"!=typeof window?window:{},In=Cn;"undefined"!=typeof document?on=document:(on=An["__GLOBAL_DOCUMENT_CACHE@4"])||(on=An["__GLOBAL_DOCUMENT_CACHE@4"]=In);var xn=on,Ln=F.getDefaultExportFromCjs(xn),Dn={exports:{}},Pn={exports:{}};!function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(null,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Pn);var Rn=Pn.exports,On=function(e){if(!e)return!1;var t=Nn.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},Nn=Object.prototype.toString;function Un(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Mn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mn(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Bn=function(){function e(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},t.addInterceptor=function(e,t){this.typeToInterceptorsMap_.has(e)||this.typeToInterceptorsMap_.set(e,new Set);var n=this.typeToInterceptorsMap_.get(e);return!n.has(t)&&(n.add(t),!0)},t.removeInterceptor=function(e,t){var n=this.typeToInterceptorsMap_.get(e);return!(!n||!n.has(t))&&(n.delete(t),!0)},t.clearInterceptorsByType=function(e){return!!this.typeToInterceptorsMap_.get(e)&&(this.typeToInterceptorsMap_.delete(e),this.typeToInterceptorsMap_.set(e,new Set),!0)},t.clear=function(){return!!this.typeToInterceptorsMap_.size&&(this.typeToInterceptorsMap_=new Map,!0)},t.getForType=function(e){return this.typeToInterceptorsMap_.get(e)||new Set},t.execute=function(e,t){for(var n,i=Un(this.getForType(e));!(n=i()).done;){var r=n.value;try{t=r(t)}catch(a){}}return t},e}(),jn=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(e){this.maxAttempts_=e},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(e){this.delayFactor_=e},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(e){this.fuzzFactor_=e},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(e){this.initialDelay_=e},t.createRetry=function(e){var t=void 0===e?{}:e,n=t.maxAttempts,i=t.delayFactor,r=t.fuzzFactor,a=t.initialDelay;return new Fn({maxAttempts:n||this.maxAttempts_,delayFactor:i||this.delayFactor_,fuzzFactor:r||this.fuzzFactor_,initialDelay:a||this.initialDelay_})},e}(),Fn=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},t.getCurrentDelay=function(){return this.currentDelay_},t.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},t.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},t.getCurrentFuzzedDelay=function(){var e=this.getCurrentMinPossibleDelay(),t=this.getCurrentMaxPossibleDelay();return e+Math.random()*(t-e)},e}(),qn=Sn;var Vn=function(e,t){return void 0===t&&(t=!1),function(n,i,r){if(n)e(n);else if(i.statusCode>=400&&i.statusCode<=599){var a=r;if(t)if(qn.TextDecoder){var s=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),i=n[0],r=n[1];return"charset"===i.trim()?r.trim():e},"utf-8")}(i.headers&&i.headers["content-type"]);try{a=new TextDecoder(s).decode(r)}catch(o){}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a})}else e(null,r)}},Hn=Sn,zn=Rn,Wn=On,Gn=Bn,Xn=jn;Qn.httpHandler=Vn,Qn.requestInterceptorsStorage=new Gn,Qn.responseInterceptorsStorage=new Gn,Qn.retryManager=new Xn;
4
- /**
5
- * @license
6
- * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
7
- * Copyright (c) 2014 David Björklund
8
- * Available under the MIT license
9
- * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
10
- */
11
- var Kn=function(e){var t={};return e?(e.trim().split("\n").forEach(function(e){var n=e.indexOf(":"),i=e.slice(0,n).trim().toLowerCase(),r=e.slice(n+1).trim();void 0===t[i]?t[i]=r:Array.isArray(t[i])?t[i].push(r):t[i]=[t[i],r]}),t):t};function Yn(e,t,n){var i=e;return Wn(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=zn({},t,{uri:e}),i.callback=n,i}function Qn(e,t,n){return $n(t=Yn(e,t,n))}function $n(e){if(void 0===e.callback)throw new Error("callback argument missing");if(e.requestType&&Qn.requestInterceptorsStorage.getIsEnabled()){var t={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},n=Qn.requestInterceptorsStorage.execute(e.requestType,t);e.uri=n.uri,e.headers=n.headers,e.body=n.body,e.metadata=n.metadata,e.retry=n.retry,e.timeout=n.timeout}var i=!1,r=function(t,n,r){i||(i=!0,e.callback(t,n,r))};function a(){var e=void 0;if(e=c.response?c.response:c.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(n){}return null}(c),v)try{e=JSON.parse(e)}catch(t){}return e}function s(t){if(clearTimeout(d),clearTimeout(e.retryTimeout),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,l||!Qn.retryManager.getIsEnabled()||!e.retry||!e.retry.shouldRetry()){if(e.requestType&&Qn.responseInterceptorsStorage.getIsEnabled()){var n={headers:y.headers||{},body:y.body,responseUrl:c.responseURL,responseType:c.responseType},i=Qn.responseInterceptorsStorage.execute(e.requestType,n);y.body=i.body,y.headers=i.headers}return r(t,y)}e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=c,$n(e)},e.retry.getCurrentFuzzedDelay())}function o(){if(!l){var t;clearTimeout(d),clearTimeout(e.retryTimeout),t=e.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var n=y,i=null;if(0!==t?(n={body:a(),statusCode:t,method:p,headers:{},url:h,rawRequest:c},c.getAllResponseHeaders&&(n.headers=Kn(c.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),e.requestType&&Qn.responseInterceptorsStorage.getIsEnabled()){var s={headers:n.headers||{},body:n.body,responseUrl:c.responseURL,responseType:c.responseType},o=Qn.responseInterceptorsStorage.execute(e.requestType,s);n.body=o.body,n.headers=o.headers}return r(i,n,n.body)}}var u,l,c=e.xhr||null;c||(c=e.cors||e.useXDR?new Qn.XDomainRequest:new Qn.XMLHttpRequest);var d,h=c.url=e.uri||e.url,p=c.method=e.method||"GET",f=e.body||e.data,m=c.headers=e.headers||{},g=!!e.sync,v=!1,y={body:void 0,headers:{},statusCode:0,method:p,url:h,rawRequest:c};if("json"in e&&!1!==e.json&&(v=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),f=JSON.stringify(!0===e.json?f:e.json))),c.onreadystatechange=function(){4!==c.readyState||Qn.responseInterceptorsStorage.getIsEnabled()||setTimeout(o,0)},c.onload=o,c.onerror=s,c.onprogress=function(){},c.onabort=function(){l=!0,clearTimeout(e.retryTimeout)},c.ontimeout=s,c.open(p,h,!g,e.username,e.password),g||(c.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(d=setTimeout(function(){if(!l){l=!0,c.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",s(e)}},e.timeout)),c.setRequestHeader)for(u in m)m.hasOwnProperty(u)&&c.setRequestHeader(u,m[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(c.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(c),c.send(f||null),c}Dn.exports=Qn,Dn.exports.default=Qn,Qn.XMLHttpRequest=Hn.XMLHttpRequest||function(){},Qn.XDomainRequest="withCredentials"in new Qn.XMLHttpRequest?Qn.XMLHttpRequest:Hn.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){Qn["delete"===e?"del":e]=function(t,n,i){return(n=Yn(t,n,i)).method=e.toUpperCase(),$n(n)}});var Jn=Dn.exports,Zn=F.getDefaultExportFromCjs(Jn),ei={exports:{}},ti=xn,ni=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function ii(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function ri(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+(0|i)/1e3}var n=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}function ai(){this.values=ni(null)}function si(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(n);if(2===s.length)t(s[0].trim(),s[1].trim())}}function oi(e,t,n){var i=e;function r(){var t=ri(e);if(null===t)throw new ii(ii.Errors.BadTimeStamp,"Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new ii(ii.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var i=new ai;si(e,function(e,t){switch(e){case"region":for(var r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];i.integer(e,s),i.percent(e,s)&&i.set("snapToLines",!1),i.alt(e,s,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start","center","end"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start","center","end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");try{t.line=i.get("line","auto")}catch(r){}t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100);try{t.align=i.get("align","center")}catch(r){t.align=i.get("align","middle")}try{t.position=i.get("position","auto")}catch(r){t.position=i.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=i.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}ii.prototype=ni(Error.prototype),ii.prototype.constructor=ii,ii.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},ai.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ui=ti.createElement&&ti.createElement("textarea"),li={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ci={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},di={v:"title",lang:"lang"},hi={rt:"ruby"};function pi(e,t){function n(){if(!t)return null;var e,n=t.match(/^([^<]*)(<[^>]*>?)?/);return e=n[1]?n[1]:n[2],t=t.substr(e.length),e}function i(e){return ui.innerHTML=e,e=ui.textContent,ui.textContent="",e}function r(e,t){return!hi[t.localName]||hi[t.localName]===e.localName}function a(t,n){var i=li[t];if(!i)return null;var r=e.document.createElement(i),a=di[t];return a&&n&&(r[a]=n.trim()),r}for(var s,o=e.document.createElement("div"),u=o,l=[];null!==(s=n());)if("<"!==s[0])u.appendChild(e.document.createTextNode(i(s)));else{if("/"===s[1]){l.length&&l[l.length-1]===s.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,d=ri(s.substr(1,s.length-2));if(d){c=e.document.createProcessingInstruction("timestamp",d),u.appendChild(c);continue}var h=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!h)continue;if(!(c=a(h[1],h[3])))continue;if(!r(u,c))continue;if(h[2]){var p=h[2].split(".");p.forEach(function(e){var t=/^bg_/.test(e),n=t?e.slice(3):e;if(ci.hasOwnProperty(n)){var i=t?"background-color":"color",r=ci[n];c.style[i]=r}}),c.className=p.join(" ")}l.push(h[1]),u.appendChild(c),u=c}return o}var fi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function mi(e){for(var t=0;t<fi.length;t++){var n=fi[t];if(e>=n[0]&&e<=n[1])return!0}return!1}function gi(e){var t=[],n="";if(!e||!e.childNodes)return"ltr";function i(e,t){for(var n=t.childNodes.length-1;n>=0;n--)e.push(t.childNodes[n])}function r(e){if(!e||!e.length)return null;var t=e.pop(),n=t.textContent||t.innerText;if(n){var a=n.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):n}return"ruby"===t.tagName?r(e):t.childNodes?(i(e,t),r(e)):void 0}for(i(t,e);n=r(t);)for(var a=0;a<n.length;a++)if(mi(n.charCodeAt(a)))return"rtl";return"ltr"}function vi(){}function yi(e,t,n){vi.call(this),this.cue=t,this.cueDiv=pi(e,t.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=e.document.createElement("div"),i={direction:gi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:n.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _i(e){var t,n,i,r;if(e.div){n=e.div.offsetHeight,i=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||n,this.bottom=e.bottom||r+(e.height||n),this.width=e.width||i,this.lineHeight=void 0!==t?t:e.lineHeight}function bi(e,t,n,i){var r=new _i(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,n=t.textTrackList,i=0,r=0;r<n.length&&n[r]!==t;r++)"showing"===n[r].mode&&i++;return-1*++i}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(s),d=n[u]+l,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?n.height:n.width,o=o.reverse()),r.move(h,c)}else{var p=r.lineHeight/n.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new _i(t)}var f=function(e,t){for(var r,a=new _i(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(n,t[o])||e.within(n)&&e.overlapsAny(i);)e.move(t[o]);if(e.within(n))return e;var u=e.intersectPercentage(n);s>u&&(r=new _i(e),s=u),e=new _i(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(n))}function Ti(){}vi.prototype.applyStyles=function(e,t){for(var n in t=t||this.div,e)e.hasOwnProperty(n)&&(t.style[n]=e[n])},vi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},yi.prototype=ni(vi.prototype),yi.prototype.constructor=yi,_i.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},_i.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},_i.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},_i.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_i.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},_i.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_i.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_i.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,n=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,i=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||i,height:e.height||t,bottom:e.bottom||i+(e.height||t),width:e.width||n}},Ti.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ti.convertCueToDOMTree=function(e,t){return e&&t?pi(e,t):null};Ti.processCues=function(e,t,n){if(!e||!t||!n)return null;for(;n.firstChild;)n.removeChild(n.firstChild);var i=e.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",n.appendChild(i),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=_i.getSimpleBoxPosition(i),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var n,o,u=0;u<t.length;u++)o=t[u],n=new yi(e,o,s),i.appendChild(n.div),bi(0,n,a,r),o.displayState=n.div,r.push(_i.getSimpleBoxPosition(n))}()}else for(var o=0;o<t.length;o++)i.appendChild(t[o].displayState)},Ti.Parser=function(e,t,n){n||(n=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=n||new TextDecoder("utf8"),this.regionList=[]},Ti.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof ii))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function n(){for(var e=t.buffer,n=0;n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}function i(e){e.match(/X-TIMESTAMP-MAP/)?si(e,function(e,n){if("X-TIMESTAMP-MAP"===e)!function(e){var n=new ai;si(e,function(e,t){switch(e){case"MPEGT":n.integer(e+"S",t);break;case"LOCA":n.set(e+"L",ri(t))}},/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")})}(n)},/=/):si(e,function(e,n){if("Region"===e)!function(e){var n=new ai;if(si(e,function(e,t){switch(e){case"id":n.set(e,t);break;case"width":n.percent(e,t);break;case"lines":n.integer(e,t);break;case"regionanchor":case"viewportanchor":var i=t.split(",");if(2!==i.length)break;var r=new ai;if(r.percent("x",i[0]),r.percent("y",i[1]),!r.has("x")||!r.has("y"))break;n.set(e+"X",r.get("x")),n.set(e+"Y",r.get("y"));break;case"scroll":n.alt(e,t,["up"])}},/=/,/\s/),n.has("id")){var i=new(t.vttjs.VTTRegion||t.window.VTTRegion);i.width=n.get("width",100),i.lines=n.get("lines",3),i.regionAnchorX=n.get("regionanchorX",0),i.regionAnchorY=n.get("regionanchorY",100),i.viewportAnchorX=n.get("viewportanchorX",0),i.viewportAnchorY=n.get("viewportanchorY",100),i.scroll=n.get("scroll",""),t.onregion&&t.onregion(i),t.regionList.push({id:n.get("id"),region:i})}}(n)},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=n()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new ii(ii.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=n(),t.state){case"HEADER":/:/.test(r)?i(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(u){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{oi(r,t.cue,t.regionList)}catch(u){t.reportOrThrowError(u),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(u){t.reportOrThrowError(u),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ii(ii.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var ki=Ti,Si={"":1,lr:1,rl:1},wi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Ei(e){return"string"==typeof e&&(!!wi[e.toLowerCase()]&&e.toLowerCase())}function Ci(e,t,n){this.hasBeenReset=!1;var i="",r=!1,a=e,s=t,o=n,u=null,l="",c=!0,d="auto",h="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return i},set:function(e){i=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&!!Si[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");d=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){var t=Ei(e);t?(h=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=Ei(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Ei(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ci.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ai=Ci,Ii={"":!0,up:!0};function xi(e){return"number"==typeof e&&e>=0&&e<=100}var Li=function(){var e=100,t=3,n=0,i=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!xi(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return i},set:function(e){if(!xi(e))throw new Error("RegionAnchorX must be between 0 and 100.");i=e}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!xi(e))throw new Error("RegionAnchorY must be between 0 and 100.");n=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!xi(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!xi(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Ii[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Di=Sn,Pi=ei.exports={WebVTT:ki,VTTCue:Ai,VTTRegion:Li};Di.vttjs=Pi,Di.WebVTT=Pi.WebVTT;var Ri=Pi.VTTCue,Oi=Pi.VTTRegion,Ni=Di.VTTCue,Ui=Di.VTTRegion;Pi.shim=function(){Di.VTTCue=Ri,Di.VTTRegion=Oi},Pi.restore=function(){Di.VTTCue=Ni,Di.VTTRegion=Ui},Di.VTTCue||Pi.shim();for(var Mi=ei.exports,Bi=F.getDefaultExportFromCjs(Mi),ji="https://example.com",Fi=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=wn.location&&wn.location.href||"");var n=/^\/\//.test(e),i=!wn.location&&!/\/\//i.test(e);e=new wn.URL(e,wn.location||ji);var r=new URL(t,e);return i?r.href.slice(19):n?r.href.slice(r.protocol.length):r.href},qi=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var n=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),Vi={},Hi={byteLength:function(e){var t=Yi(e),n=t[0],i=t[1];return 3*(n+i)/4-i},toByteArray:function(e){var t,n,i=Yi(e),r=i[0],a=i[1],s=new Gi(function(e,t,n){return 3*(t+n)/4-n}(0,r,a)),o=0,u=a>0?r-4:r;for(n=0;n<u;n+=4)t=Wi[e.charCodeAt(n)]<<18|Wi[e.charCodeAt(n+1)]<<12|Wi[e.charCodeAt(n+2)]<<6|Wi[e.charCodeAt(n+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=255&t;2===a&&(t=Wi[e.charCodeAt(n)]<<2|Wi[e.charCodeAt(n+1)]>>4,s[o++]=255&t);1===a&&(t=Wi[e.charCodeAt(n)]<<10|Wi[e.charCodeAt(n+1)]<<4|Wi[e.charCodeAt(n+2)]>>2,s[o++]=t>>8&255,s[o++]=255&t);return s},fromByteArray:function(e){for(var t,n=e.length,i=n%3,r=[],a=16383,s=0,o=n-i;s<o;s+=a)r.push($i(e,s,s+a>o?o:s+a));1===i?(t=e[n-1],r.push(zi[t>>2]+zi[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(zi[t>>10]+zi[t>>4&63]+zi[t<<2&63]+"="));return r.join("")}},zi=[],Wi=[],Gi="undefined"!=typeof Uint8Array?Uint8Array:Array,Xi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ki=0;Ki<64;++Ki)zi[Ki]=Xi[Ki],Wi[Xi.charCodeAt(Ki)]=Ki;function Yi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Qi(e){return zi[e>>18&63]+zi[e>>12&63]+zi[e>>6&63]+zi[63&e]}function $i(e,t,n){for(var i,r=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),r.push(Qi(i));return r.join("")}Wi["-".charCodeAt(0)]=62,Wi["_".charCodeAt(0)]=63;var Ji={
12
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
13
- read:function(e,t,n,i,r){var a,s,o=8*r-i-1,u=(1<<o)-1,l=u>>1,c=-7,d=n?r-1:0,h=n?-1:1,p=e[t+d];for(d+=h,a=p&(1<<-c)-1,p>>=-c,c+=o;c>0;a=256*a+e[t+d],d+=h,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=i;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),a-=l}return(p?-1:1)*s*Math.pow(2,a-i)},write:function(e,t,n,i,r,a){var s,o,u,l=8*a-r-1,c=(1<<l)-1,d=c>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:a-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*u-1)*Math.pow(2,r),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&o,p+=f,o/=256,r-=8);for(s=s<<r|o,l+=r;l>0;e[n+p]=255&s,p+=f,s/=256,l-=8);e[n+p-f]|=128*m}};
14
- /*!
15
- * The buffer module from node.js, for the browser.
16
- *
17
- * @author Feross Aboukhadijeh <https://feross.org>
18
- * @license MIT
19
- */
20
- !function(e){var t=Hi,n=Ji,i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;var r=2147483647;e.kMaxLength=r;var a=globalThis.Uint8Array,s=globalThis.ArrayBuffer,o=globalThis.SharedArrayBuffer;function u(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new a(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return d(e,t,n)}function d(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|b(e,t),i=u(n),r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(s.isView(e))return function(e){if(te(e,a)){var t=new a(e);return v(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+k(e));if(te(e,s)||e&&te(e.buffer,s))return v(e,t,n);if(void 0!==o&&(te(e,o)||e&&te(e.buffer,o)))return v(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);var r=function(e){if(l.isBuffer(e)){var t=0|_(e.length),n=u(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||ne(e.length)?u(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+k(e))}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return h(e),u(e<0?0:0|_(e))}function m(e){for(var t=e.length<0?0:0|_(e.length),n=u(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function v(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===t&&void 0===n?new a(e):void 0===n?new a(e,t):new a(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function _(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function b(e,t){if(l.isBuffer(e))return e.length;if(s.isView(e)||te(e,s))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+k(e));var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(r)return i?-1:J(e).length;t=(""+t).toLowerCase(),r=!0}}function T(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return D(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function S(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function w(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),ne(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?r?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,i,r){var a,s=1,o=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var c=-1;for(a=n;a<o;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*s}else-1!==c&&(a-=a-c),c=-1}else for(n+u>o&&(n=o-u),a=n;a>=0;a--){for(var d=!0,h=0;h<u;h++)if(l(e,a+h)!==l(t,h)){d=!1;break}if(d)return a}return-1}function C(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var a,s=t.length;for(i>s/2&&(i=s/2),a=0;a<i;++a){var o=parseInt(t.substr(2*a,2),16);if(ne(o))return a;e[n+a]=o}return a}function A(e,t,n,i){return ee(J(t,e.length-n),e,n,i)}function I(e,t,n,i){return ee(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function x(e,t,n,i){return ee(Z(t),e,n,i)}function L(e,t,n,i){return ee(function(e,t){for(var n,i,r,a=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(n=e.charCodeAt(s))>>8,r=n%256,a.push(r),a.push(i);return a}(t,e.length-n),e,n,i)}function D(e,n,i){return 0===n&&i===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,i))}function P(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var a=e[r],s=null,o=a>239?4:a>223?3:a>191?2:1;if(r+o<=n){var u=void 0,l=void 0,c=void 0,d=void 0;switch(o){case 1:a<128&&(s=a);break;case 2:128==(192&(u=e[r+1]))&&(d=(31&a)<<6|63&u)>127&&(s=d);break;case 3:u=e[r+1],l=e[r+2],128==(192&u)&&128==(192&l)&&(d=(15&a)<<12|(63&u)<<6|63&l)>2047&&(d<55296||d>57343)&&(s=d);break;case 4:u=e[r+1],l=e[r+2],c=e[r+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(d=(15&a)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&d<1114112&&(s=d)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=R));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(n){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(l.prototype,a.prototype),Object.setPrototypeOf(l,a),l.alloc=function(e,t,n){return function(e,t,n){return h(e),e<=0?u(e):void 0!==t?"string"==typeof n?u(e).fill(t,n):u(e).fill(t):u(e)}(e,t,n)},l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(te(e,a)&&(e=l.from(e,e.offset,e.byteLength)),te(t,a)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,i=t.length,r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=l.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(te(s,a))r+s.length>i.length?(l.isBuffer(s)||(s=l.from(s)),s.copy(i,r)):a.prototype.set.call(i,s,r);else{if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r)}r+=s.length}return i},l.byteLength=b,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)S(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)S(this,t,t+3),S(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)S(this,t,t+7),S(this,t+1,t+6),S(this,t+2,t+5),S(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?P(this,0,e):T.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(te(e,a)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+k(e));if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(s,o),c=this.slice(i,r),d=e.slice(t,n),h=0;h<u;++h)if(c[h]!==d[h]){s=c[h],o=d[h];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return C(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return I(this,e,t,n);case"base64":return x(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function O(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function N(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function U(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",a=t;a<n;++a)r+=ie[e[a]];return r}function M(e,t,n){for(var i=e.slice(t,n),r="",a=0;a<i.length-1;a+=2)r+=String.fromCharCode(i[a]+256*i[a+1]);return r}function B(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,n,i,r,a){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<a)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function F(e,t,n,i,r){K(t,i,r,e,n,7);var a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function q(e,t,n,i,r){K(t,i,r,e,n,7);var a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function V(e,t,n,i,r,a){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,i,r,a){return t=+t,i>>>=0,a||V(e,0,i,4),n.write(e,t,i,r,23,4),i+4}function z(e,t,i,r,a){return t=+t,i>>>=0,a||V(e,0,i,8),n.write(e,t,i,r,52,8),i+8}l.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e],r=1,a=0;++a<t&&(r*=256);)i+=this[e+a]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24),r=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+n*Math.pow(2,24);return BigInt(i)+(BigInt(r)<<BigInt(32))}),l.prototype.readBigUInt64BE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=t*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e],r=this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n;return(BigInt(i)<<BigInt(32))+BigInt(r)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e],r=1,a=0;++a<t&&(r*=256);)i+=this[e+a]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=t,r=1,a=this[e+--i];i>0&&(r*=256);)a+=this[e+--i]*r;return a>=(r*=128)&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=this[e+4]+this[e+5]*Math.pow(2,8)+this[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24))}),l.prototype.readBigInt64BE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=(t<<24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,a=0;for(this[t]=255&e;++a<n&&(r*=256);)this[t+a]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,a=1;for(this[t+r]=255&e;--r>=0&&(a*=256);)this[t+r]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=re(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=re(function(e){return q(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);j(this,e,t,n,r-1,-r)}var a=0,s=1,o=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);j(this,e,t,n,r-1,-r)}var a=n-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=re(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=re(function(e){return q(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r=i-n;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,n,i):a.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var r=e.charCodeAt(0);("utf8"===i&&r<128||"latin1"===i)&&(e=r)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=s[a%o]}return this};var W={};function G(e,t,n){W[e]=function(n){function i(){var n;return g(this,i),n=c(this,i),Object.defineProperty(n,"message",{value:t.apply(n,arguments),writable:!0,configurable:!0}),n.name="".concat(n.name," [").concat(e,"]"),n.stack,delete n.name,n}return f(i,n),y(i,[{key:"code",get:function(){return e},set:function(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}},{key:"toString",value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}])}(n)}function X(e){for(var t="",n=e.length,i="-"===e[0]?1:0;n>=i+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function K(e,t,n,i,r,a){if(e>n||e<t){var s,o="bigint"==typeof t?"n":"";throw s=0===t||t===BigInt(0)?">= 0".concat(o," and < 2").concat(o," ** ").concat(8*(a+1)).concat(o):">= -(2".concat(o," ** ").concat(8*(a+1)-1).concat(o,") and < 2 ** ")+"".concat(8*(a+1)-1).concat(o),new W.ERR_OUT_OF_RANGE("value",s,e)}!function(e,t,n){Y(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Q(t,e.length-(n+1))}(i,r,a)}function Y(e,t){if("number"!=typeof e)throw new W.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,n){if(Math.floor(e)!==e)throw Y(e,n),new W.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE("offset",">= ".concat(0," and <= ",t),e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(k(t))},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){var i='The value of "'.concat(e,'" is out of range.'),r=n;return Number.isInteger(n)&&Math.abs(n)>Math.pow(2,32)?r=X(String(n)):"bigint"==typeof n&&(r=String(n),(n>Math.pow(BigInt(2),BigInt(32))||n<-Math.pow(BigInt(2),BigInt(32)))&&(r=X(r)),r+="n"),i+=" It must be ".concat(t,". Received ").concat(r)},RangeError);var $=/[^+/0-9A-Za-z-_]/g;function J(e,t){var n;t=t||1/0;for(var i=e.length,r=null,a=[],s=0;s<i;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&a.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Z(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ee(e,t,n,i){var r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function te(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function ne(e){return e!=e}var ie=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var i=16*n,r=0;r<16;++r)t[i+r]=e[n]+e[r];return t}();function re(e){return"undefined"==typeof BigInt?ae:e}function ae(){throw new Error("BigInt not supported")}}(Vi);var Zi=Vi.Buffer;function er(e){for(var t,n=(t=e,wn.atob?wn.atob(t):Zi.from(t,"base64").toString("binary")),i=new Uint8Array(n.length),r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}
21
- /*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */var tr,nr,ir=function(){function e(){var t;return g(this,e),(t=c(this,e)).buffer="",t}return f(e,qi),y(e,[{key:"push",value:function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}])}(),rr=String.fromCharCode(9),ar=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),n={};return t[1]&&(n.length=parseInt(t[1],10)),t[2]&&(n.offset=parseInt(t[2],10)),n},sr=function(e){var t={};if(!e)return t;for(var n,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),r=i.length;r--;)""!==i[r]&&((n=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),t[n[0]]=n[1]);return t},or=function(e){var t=e.split("x"),n={};return t[0]&&(n.width=parseInt(t[0],10)),t[1]&&(n.height=parseInt(t[1],10)),n},ur=function(){function e(){var t;return g(this,e),(t=c(this,e)).customParsers=[],t.tagMappers=[],t}return f(e,qi),y(e,[{key:"push",value:function(e){var t,n,i=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(function(t,n){var i=n(e);return i===e?t:t.concat([i])},[e]).forEach(function(e){for(var r=0;r<i.customParsers.length;r++)if(i.customParsers[r].call(i,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))i.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e))return n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),void i.trigger("data",n);if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e))return n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),void i.trigger("data",n);if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(e))return n=$(ar(t[1]),{type:"tag",tagType:"byterange"}),void i.trigger("data",n);if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e))return n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-MAP:(.*)$/.exec(e)){if(n={type:"tag",tagType:"map"},t[1]){var a=sr(t[1]);a.URI&&(n.uri=a.URI),a.BYTERANGE&&(n.byterange=ar(a.BYTERANGE))}i.trigger("data",n)}else{if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(e))return n={type:"tag",tagType:"stream-inf"},t[1]&&(n.attributes=sr(t[1]),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=or(n.attributes.RESOLUTION)),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))),void i.trigger("data",n);if(t=/^#EXT-X-MEDIA:(.*)$/.exec(e))return n={type:"tag",tagType:"media"},t[1]&&(n.attributes=sr(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-ENDLIST/.exec(e))i.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))i.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e))return n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-KEY:(.*)$/.exec(e))return n={type:"tag",tagType:"key"},t[1]&&(n.attributes=sr(t[1]),n.attributes.IV&&("0x"===n.attributes.IV.substring(0,2).toLowerCase()&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),void i.trigger("data",n);if(t=/^#EXT-X-START:(.*)$/.exec(e))return n={type:"tag",tagType:"start"},t[1]&&(n.attributes=sr(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if((t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"skip"}).attributes=sr(t[1]),n.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(n.attributes["SKIPPED-SEGMENTS"]=parseInt(n.attributes["SKIPPED-SEGMENTS"],10)),n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(n.attributes["RECENTLY-REMOVED-DATERANGES"]=n.attributes["RECENTLY-REMOVED-DATERANGES"].split(rr)),void i.trigger("data",n);if((t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"part"}).attributes=sr(t[1]),["DURATION"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["INDEPENDENT","GAP"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/.test(n.attributes[e]))}),n.attributes.hasOwnProperty("BYTERANGE")&&(n.attributes.byterange=ar(n.attributes.BYTERANGE)),void i.trigger("data",n);if((t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"server-control"}).attributes=sr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/.test(n.attributes[e]))}),void i.trigger("data",n);if((t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"part-inf"}).attributes=sr(t[1]),["PART-TARGET"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),void i.trigger("data",n);if((t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"preload-hint"}).attributes=sr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(e){if(n.attributes.hasOwnProperty(e)){n.attributes[e]=parseInt(n.attributes[e],10);var t="BYTERANGE-LENGTH"===e?"length":"offset";n.attributes.byterange=n.attributes.byterange||{},n.attributes.byterange[t]=n.attributes[e],delete n.attributes[e]}}),void i.trigger("data",n);if((t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"rendition-report"}).attributes=sr(t[1]),["LAST-MSN","LAST-PART"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseInt(n.attributes[e],10))}),void i.trigger("data",n);if((t=/^#EXT-X-DATERANGE:(.*)$/.exec(e))&&t[1]){(n={type:"tag",tagType:"daterange"}).attributes=sr(t[1]),["ID","CLASS"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=String(n.attributes[e]))}),["START-DATE","END-DATE"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=new Date(n.attributes[e]))}),["DURATION","PLANNED-DURATION"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["END-ON-NEXT"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/i.test(n.attributes[e]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=n.attributes[e].toString(16))});var s=/^X-([A-Z]+-)+[A-Z]+$/;for(var o in n.attributes)if(s.test(o)){var u=/[0-9A-Fa-f]{6}/g.test(n.attributes[o]),l=/^\d+(\.\d+)?$/.test(n.attributes[o]);n.attributes[o]=u?n.attributes[o].toString(16):l?parseFloat(n.attributes[o]):String(n.attributes[o])}i.trigger("data",n)}else if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e))i.trigger("data",{type:"tag",tagType:"independent-segments"});else if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(e))i.trigger("data",{type:"tag",tagType:"i-frames-only"});else{if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(e))return(n={type:"tag",tagType:"content-steering"}).attributes=sr(t[1]),void i.trigger("data",n);if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(e))return(n={type:"tag",tagType:"i-frame-playlist"}).attributes=sr(t[1]),n.attributes.URI&&(n.uri=n.attributes.URI),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=or(n.attributes.RESOLUTION)),n.attributes["AVERAGE-BANDWIDTH"]&&(n.attributes["AVERAGE-BANDWIDTH"]=parseInt(n.attributes["AVERAGE-BANDWIDTH"],10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),void i.trigger("data",n);if(t=/^#EXT-X-DEFINE:(.*)$/.exec(e))return(n={type:"tag",tagType:"define"}).attributes=sr(t[1]),void i.trigger("data",n);i.trigger("data",{type:"tag",data:e.slice(4)})}}}}else i.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:e}))}},{key:"addParser",value:function(e){var t=this,n=e.expression,i=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push(function(e){if(n.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:i,segment:a}),!0})}},{key:"addTagMapper",value:function(e){var t=e.expression,n=e.map;this.tagMappers.push(function(e){return t.test(e)?n(e):e})}}])}(),lr=function(e){var t={};return Object.keys(e).forEach(function(n){var i;t[(i=n,i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()}))]=e[n]}),t},cr=function(e){var t=e.serverControl,n=e.targetDuration,i=e.partTargetDuration;if(t){var r="#EXT-X-SERVER-CONTROL",a="holdBack",s="partHoldBack",o=n&&3*n,u=i&&2*i;n&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:"".concat(r," defaulting HOLD-BACK to targetDuration * 3 (").concat(o,").")})),o&&t[a]<o&&(this.trigger("warn",{message:"".concat(r," clamping HOLD-BACK (").concat(t[a],") to targetDuration * 3 (").concat(o,")")}),t[a]=o),i&&!t.hasOwnProperty(s)&&(t[s]=3*i,this.trigger("info",{message:"".concat(r," defaulting PART-HOLD-BACK to partTargetDuration * 3 (").concat(t[s],").")})),i&&t[s]<u&&(this.trigger("warn",{message:"".concat(r," clamping PART-HOLD-BACK (").concat(t[s],") to partTargetDuration * 2 (").concat(u,").")}),t[s]=u)}},dr=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),(t=c(this,e)).lineStream=new ir,t.parseStream=new ur,t.lineStream.pipe(t.parseStream),t.mainDefinitions=n.mainDefinitions||{},t.params=new URL(n.uri,"https://a.com").searchParams,t.lastProgramDateTime=null;var i,r,a=t,s=[],o={},u=!1,l=function(){},d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},h=0;t.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};var p=0,f=0,m={};return t.on("end",function(){o.uri||!o.parts&&!o.preloadHints||(!o.map&&i&&(o.map=i),!o.key&&r&&(o.key=r),o.timeline||"number"!=typeof h||(o.timeline=h),t.manifest.preloadSegment=o)}),t.parseStream.on("data",function(e){var t,n;if(a.manifest.definitions)for(var c in a.manifest.definitions)if(e.uri&&(e.uri=e.uri.replace("{$".concat(c,"}"),a.manifest.definitions[c])),e.attributes)for(var g in e.attributes)"string"==typeof e.attributes[g]&&(e.attributes[g]=e.attributes[g].replace("{$".concat(c,"}"),a.manifest.definitions[c]));({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(o.byterange=t,t.length=e.length,"offset"in e||(e.offset=p)),"offset"in e&&(o.byterange=t,t.offset=e.offset),p=t.offset+t.length},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.title&&(o.title=e.title),e.duration>0&&(o.duration=e.duration),0===e.duration&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:er(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(r.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,h=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),r&&(i.key=r)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes?(o.attributes||(o.attributes={}),$(o.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(n={default:/yes/i.test(e.attributes.DEFAULT)}).default?n.autoselect=!0:n.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(n.language=e.attributes.LANGUAGE),e.attributes.URI&&(n.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(n.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(n.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(n.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=n}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){h+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),o.dateTimeString=e.dateTimeString,o.dateTimeObject=e.dateTimeObject;var t=this.lastProgramDateTime;this.lastProgramDateTime=new Date(e.dateTimeString).getTime(),null===t&&this.manifest.segments.reduceRight(function(e,t){return t.programDateTime=e-1e3*t.duration,t.programDateTime},this.lastProgramDateTime)},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,cr.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){o.cueOut=e.data},"cue-out-cont":function(){o.cueOutCont=e.data},"cue-in":function(){o.cueIn=e.data},skip:function(){this.manifest.skip=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;u=!0;var n=this.manifest.segments.length,i=lr(e.attributes);o.parts=o.parts||[],o.parts.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=f),f=i.byterange.offset+i.byterange.length);var r=o.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #".concat(r," for segment #").concat(n),e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(function(e,n){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #".concat(n," lacks required attribute(s): LAST-PART")})})},"server-control":function(){var t=this.manifest.serverControl=lr(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),cr.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,n=lr(e.attributes),i=n.type&&"PART"===n.type;o.preloadHints=o.preloadHints||[],o.preloadHints.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=i?f:0,i&&(f=n.byterange.offset+n.byterange.length)));var r=o.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #".concat(r," for segment #").concat(t),e.attributes,["TYPE","URI"]),n.type)for(var a=0;a<o.preloadHints.length-1;a++){var s=o.preloadHints[a];s.type&&(s.type===n.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #".concat(r," for segment #").concat(t," has the same TYPE ").concat(n.type," as preload hint #").concat(a)}))}},"rendition-report":function(){var t=lr(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var n=this.manifest.renditionReports.length-1,i=["LAST-MSN","URI"];u&&i.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #".concat(n),e.attributes,i)},"part-inf":function(){this.manifest.partInf=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),cr.call(this,this.manifest)},daterange:function(){this.manifest.dateRanges.push(lr(e.attributes));var t=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_("#EXT-X-DATERANGE #".concat(t),e.attributes,["ID","START-DATE"]);var n=this.manifest.dateRanges[t];n.endDate&&n.startDate&&new Date(n.endDate)<new Date(n.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),n.duration&&n.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),n.plannedDuration&&n.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});var i=!!n.endOnNext;if(i&&!n.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),i&&(n.duration||n.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),n.duration&&n.endDate){var r=n.startDate.getTime()+1e3*n.duration;this.manifest.dateRanges[t].endDate=new Date(r)}if(m[n.id]){for(var a in m[n.id])if(n[a]&&JSON.stringify(m[n.id][a])!==JSON.stringify(n[a])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}var s=this.manifest.dateRanges.findIndex(function(e){return e.id===n.id});this.manifest.dateRanges[s]=$(this.manifest.dateRanges[s],n),m[n.id]=$(m[n.id],n),this.manifest.dateRanges.pop()}else m[n.id]=n},"independent-segments":function(){this.manifest.independentSegments=!0},"i-frames-only":function(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering":function(){this.manifest.contentSteering=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",e.attributes,["SERVER-URI"])},define:function(){var t=this;this.manifest.definitions=this.manifest.definitions||{};var n=function(e,n){e in t.manifest.definitions?t.trigger("error",{message:"EXT-X-DEFINE: Duplicate name ".concat(e)}):t.manifest.definitions[e]=n};if("QUERYPARAM"in e.attributes){if("NAME"in e.attributes||"IMPORT"in e.attributes)return void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});var i=this.params.get(e.attributes.QUERYPARAM);return i?void n(e.attributes.QUERYPARAM,decodeURIComponent(i)):void this.trigger("error",{message:"EXT-X-DEFINE: No query param ".concat(e.attributes.QUERYPARAM)})}return"NAME"in e.attributes?"IMPORT"in e.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in e.attributes&&"string"==typeof e.attributes.VALUE?void n(e.attributes.NAME,e.attributes.VALUE):void this.trigger("error",{message:"EXT-X-DEFINE: No value for ".concat(e.attributes.NAME)}):"IMPORT"in e.attributes?this.mainDefinitions[e.attributes.IMPORT]?void n(e.attributes.IMPORT,this.mainDefinitions[e.attributes.IMPORT]):void this.trigger("error",{message:"EXT-X-DEFINE: No value ".concat(e.attributes.IMPORT," to import, or IMPORT used on main playlist")}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist":function(){this.manifest.iFramePlaylists.push({attributes:e.attributes,uri:e.uri,timeline:h}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",e.attributes,["BANDWIDTH","URI"])}}[e.tagType]||l).call(a)},uri:function(){o.uri=e.uri,s.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),r&&(o.key=r),o.timeline=h,i&&(o.map=i),f=0,null!==this.lastProgramDateTime&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*o.duration),o={}},comment:function(){},custom:function(){e.segment?(o.custom=o.custom||{},o.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(a)}),t}return f(e,qi),y(e,[{key:"requiredCompatibilityversion",value:function(e,t){(e<t||!e)&&this.trigger("warn",{message:"manifest must be at least version ".concat(t)})}},{key:"warnOnMissingAttributes_",value:function(e,t,n){var i=[];n.forEach(function(e){t.hasOwnProperty(e)||i.push(e)}),i.length&&this.trigger("warn",{message:"".concat(e," lacks required attribute(s): ").concat(i.join(", "))})}},{key:"push",value:function(e){this.lineStream.push(e)}},{key:"end",value:function(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}},{key:"addParser",value:function(e){this.parseStream.addParser(e)}},{key:"addTagMapper",value:function(e){this.parseStream.addTagMapper(e)}}])}(),hr={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},pr=["video","audio","text"],fr=["Video","Audio","Text"],mr=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(n).toString(16)).slice(-2)}):e},gr=function(e){void 0===e&&(e="");var t=e.split(","),n=[];return t.forEach(function(e){var t;e=e.trim(),pr.forEach(function(i){var r=hr[i].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=i;var a=e.substring(0,r[1].length),s=e.replace(a,"");n.push({type:a,details:s,mediaType:i})}}),t||n.push({type:e,details:"",mediaType:"unknown"})}),n},vr=function(e){return void 0===e&&(e=""),hr.audio.test(e.trim().toLowerCase())},yr=function(e){if(e&&"string"==typeof e){var t,n=e.toLowerCase().split(",").map(function(e){return mr(e.trim())}),i="video";1===n.length&&vr(n[0])?i="audio":1===n.length&&(void 0===(t=n[0])&&(t=""),hr.text.test(t.trim().toLowerCase()))&&(i="application");var r="mp4";return n.every(function(e){return hr.mp4.test(e)})?r="mp4":n.every(function(e){return hr.webm.test(e)})?r="webm":n.every(function(e){return hr.ogg.test(e)})&&(r="ogg"),i+"/"+r+';codecs="'+e+'"'}},_r=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=!1),wn.MediaSource&&wn.MediaSource.isTypeSupported&&wn.MediaSource.isTypeSupported(yr(e))||t&&wn.ManagedMediaSource&&wn.ManagedMediaSource.isTypeSupported&&wn.ManagedMediaSource.isTypeSupported(yr(e))||!1},br=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<fr.length;t++){if(hr["muxer"+fr[t]].test(e))return!0}return!1})},Tr="mp4a.40.2",kr=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Sr=/^application\/dash\+xml/i,wr=function(e){return kr.test(e)?"hls":Sr.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Er=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Cr=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Er(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ar=wn.BigInt||Number,Ir=[Ar("0x1"),Ar("0x100"),Ar("0x10000"),Ar("0x1000000"),Ar("0x100000000"),Ar("0x10000000000"),Ar("0x1000000000000"),Ar("0x100000000000000"),Ar("0x10000000000000000")];tr=new Uint16Array([65484]),255===(nr=new Uint8Array(tr.buffer,tr.byteOffset,tr.byteLength))[0]||nr[0];var xr=function(e,t){var n=void 0===t?{}:t,i=n.signed,r=void 0!==i&&i,a=n.le,s=void 0!==a&&a;e=Cr(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,function(t,n,i){var r=s?i:Math.abs(i+1-e.length);return t+Ar(n)*Ir[r]},Ar(0));if(r){var l=Ir[e.length]/Ar(2)-Ar(1);(u=Ar(u))>l&&(u-=l,u-=l,u-=Ar(2))}return Number(u)},Lr=function(e,t){var n={}.le,i=void 0!==n&&n;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=Ar(e);for(var r,a=(r=e,Math.ceil(function(e){return e.toString(2).length}(r)/8)),s=new Uint8Array(new ArrayBuffer(a)),o=0;o<a;o++){var u=i?o:Math.abs(o+1-s.length);s[u]=Number(e/Ir[o]&Ar(255)),e<0&&(s[u]=Math.abs(~s[u]),s[u]-=0===o?1:2)}return s},Dr=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n},Pr=function(e,t,n){var i=void 0===n?{}:n,r=i.offset,a=void 0===r?0:r,s=i.mask,o=void 0===s?[]:s;e=Cr(e);var u=(t=Cr(t)).every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&u.call(t,function(t,n){return t===(o[n]?o[n]&e[a+n]:e[a+n])})},Rr={},Or={};function Nr(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var Ur=Nr({HTML:"text/html",isHTML:function(e){return e===Ur.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Mr=Nr({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Mr.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Or.assign=function(e,t){if(null===e||"object"!==k(e))throw new TypeError("target is not an object");for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Or.find=function(e,t,n){if(void 0===n&&(n=Array.prototype),e&&"function"==typeof n.find)return n.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];if(t.call(void 0,r,i,e))return r}},Or.freeze=Nr,Or.MIME_TYPE=Ur,Or.NAMESPACE=Mr;var Br=Or,jr=Br.find,Fr=Br.NAMESPACE;function qr(e){return""!==e}function Vr(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Hr(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(qr):[]}(e);return Object.keys(t.reduce(Vr,{}))}function zr(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function Wr(e,t){var n=e.prototype;if(!(n instanceof t)){var i=function(){};i.prototype=t.prototype,zr(n,i=new i),e.prototype=n=i}n.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),n.constructor=e)}var Gr={},Xr=Gr.ELEMENT_NODE=1,Kr=Gr.ATTRIBUTE_NODE=2,Yr=Gr.TEXT_NODE=3,Qr=Gr.CDATA_SECTION_NODE=4,$r=Gr.ENTITY_REFERENCE_NODE=5,Jr=Gr.ENTITY_NODE=6,Zr=Gr.PROCESSING_INSTRUCTION_NODE=7,ea=Gr.COMMENT_NODE=8,ta=Gr.DOCUMENT_NODE=9,na=Gr.DOCUMENT_TYPE_NODE=10,ia=Gr.DOCUMENT_FRAGMENT_NODE=11,ra=Gr.NOTATION_NODE=12,aa={},sa={};aa.INDEX_SIZE_ERR=(sa[1]="Index size error",1),aa.DOMSTRING_SIZE_ERR=(sa[2]="DOMString size error",2);var oa=aa.HIERARCHY_REQUEST_ERR=(sa[3]="Hierarchy request error",3);aa.WRONG_DOCUMENT_ERR=(sa[4]="Wrong document",4),aa.INVALID_CHARACTER_ERR=(sa[5]="Invalid character",5),aa.NO_DATA_ALLOWED_ERR=(sa[6]="No data allowed",6),aa.NO_MODIFICATION_ALLOWED_ERR=(sa[7]="No modification allowed",7);var ua=aa.NOT_FOUND_ERR=(sa[8]="Not found",8);aa.NOT_SUPPORTED_ERR=(sa[9]="Not supported",9);var la=aa.INUSE_ATTRIBUTE_ERR=(sa[10]="Attribute in use",10);function ca(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,sa[e]),this.message=sa[e],Error.captureStackTrace&&Error.captureStackTrace(this,ca);return n.code=e,t&&(this.message=this.message+": "+t),n}function da(){}function ha(e,t){this._node=e,this._refresh=t,pa(this)}function pa(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var n=e._refresh(e._node);if(ts(e,"length",n.length),!e.$$length||n.length<e.$$length)for(var i=n.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];zr(n,e),e._inc=t}}function fa(){}function ma(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function ga(e,t,n,i){if(i?t[ma(t,i)]=n:t[t.length++]=n,e){n.ownerElement=e;var r=e.ownerDocument;r&&(i&&Sa(r,e,i),function(e,t,n){e&&e._inc++;var i=n.namespaceURI;i===Fr.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(r,e,n))}}function va(e,t,n){var i=ma(t,n);if(!(i>=0))throw new ca(ua,new Error(e.tagName+"@"+n));for(var r=t.length-1;i<r;)t[i]=t[++i];if(t.length=r,e){var a=e.ownerDocument;a&&(Sa(a,e,n),n.ownerElement=null)}}function ya(){}function _a(){}function ba(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function Ta(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Ta(e,t))return!0}while(e=e.nextSibling)}function ka(){this.ownerDocument=this}function Sa(e,t,n,i){e&&e._inc++,n.namespaceURI===Fr.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function wa(e,t,n){if(e&&e._inc){e._inc++;var i=t.childNodes;if(n)i[i.length++]=n;else{for(var r=t.firstChild,a=0;r;)i[a++]=r,r=r.nextSibling;i.length=a,delete i[i.length]}}}function Ea(e,t){var n=t.previousSibling,i=t.nextSibling;return n?n.nextSibling=i:e.firstChild=i,i?i.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,wa(e.ownerDocument,e),t}function Ca(e){return e&&e.nodeType===_a.DOCUMENT_TYPE_NODE}function Aa(e){return e&&e.nodeType===_a.ELEMENT_NODE}function Ia(e){return e&&e.nodeType===_a.TEXT_NODE}function xa(e,t){var n=e.childNodes||[];if(jr(n,Aa)||Ca(t))return!1;var i=jr(n,Ca);return!(t&&i&&n.indexOf(i)>n.indexOf(t))}function La(e,t){var n=e.childNodes||[];if(jr(n,function(e){return Aa(e)&&e!==t}))return!1;var i=jr(n,Ca);return!(t&&i&&n.indexOf(i)>n.indexOf(t))}function Da(e,t,n){if(!function(e){return e&&(e.nodeType===_a.DOCUMENT_NODE||e.nodeType===_a.DOCUMENT_FRAGMENT_NODE||e.nodeType===_a.ELEMENT_NODE)}(e))throw new ca(oa,"Unexpected parent node type "+e.nodeType);if(n&&n.parentNode!==e)throw new ca(ua,"child not in parent");if(!function(e){return e&&(Aa(e)||Ia(e)||Ca(e)||e.nodeType===_a.DOCUMENT_FRAGMENT_NODE||e.nodeType===_a.COMMENT_NODE||e.nodeType===_a.PROCESSING_INSTRUCTION_NODE)}(t)||Ca(t)&&e.nodeType!==_a.DOCUMENT_NODE)throw new ca(oa,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Pa(e,t,n){var i=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===_a.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Aa);if(a.length>1||jr(r,Ia))throw new ca(oa,"More than one element or text in fragment");if(1===a.length&&!xa(e,n))throw new ca(oa,"Element in fragment can not be inserted before doctype")}if(Aa(t)&&!xa(e,n))throw new ca(oa,"Only one element can be added and only after doctype");if(Ca(t)){if(jr(i,Ca))throw new ca(oa,"Only one doctype is allowed");var s=jr(i,Aa);if(n&&i.indexOf(s)<i.indexOf(n))throw new ca(oa,"Doctype can only be inserted before an element");if(!n&&s)throw new ca(oa,"Doctype can not be appended since element is present")}}function Ra(e,t,n){var i=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===_a.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Aa);if(a.length>1||jr(r,Ia))throw new ca(oa,"More than one element or text in fragment");if(1===a.length&&!La(e,n))throw new ca(oa,"Element in fragment can not be inserted before doctype")}if(Aa(t)&&!La(e,n))throw new ca(oa,"Only one element can be added and only after doctype");if(Ca(t)){if(jr(i,function(e){return Ca(e)&&e!==n}))throw new ca(oa,"Only one doctype is allowed");var s=jr(i,Aa);if(n&&i.indexOf(s)<i.indexOf(n))throw new ca(oa,"Doctype can only be inserted before an element")}}function Oa(e,t,n,i){Da(e,t,n),e.nodeType===_a.DOCUMENT_NODE&&(i||Pa)(e,t,n);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===ia){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=n?n.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=n,o?o.nextSibling=a:e.firstChild=a,null==n?e.lastChild=s:n.previousSibling=s;do{a.parentNode=e,Na(a,e.ownerDocument||e)}while(a!==s&&(a=a.nextSibling));return wa(e.ownerDocument||e,e),t.nodeType==ia&&(t.firstChild=t.lastChild=null),t}function Na(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===Xr&&e.attributes)for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);i&&(i.ownerDocument=t)}for(var r=e.firstChild;r;)Na(r,t),r=r.nextSibling}}function Ua(){this._nsMap={}}function Ma(){}function Ba(){}function ja(){}function Fa(){}function qa(){}function Va(){}function Ha(){}function za(){}function Wa(){}function Ga(){}function Xa(){}function Ka(){}function Ya(e,t){var n=[],i=9==this.nodeType&&this.documentElement||this,r=i.prefix,a=i.namespaceURI;if(a&&null==r&&null==(r=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return Ja(this,n,e,t,s),n.join("")}function Qa(e,t,n){var i=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===i&&r===Fr.XML||r===Fr.XMLNS)return!1;for(var a=n.length;a--;){var s=n[a];if(s.prefix===i)return s.namespace!==r}return!0}function $a(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,ba),'"')}function Ja(e,t,n,i,r){if(r||(r=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Xr:var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName,l=u;if(!(n=Fr.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var c,d=0;d<a.length;d++)if("xmlns"===a.item(d).name){c=a.item(d).value;break}if(!c)for(var h=r.length-1;h>=0;h--){if(""===(p=r[h]).prefix&&p.namespace===e.namespaceURI){c=p.namespace;break}}if(c!==e.namespaceURI)for(h=r.length-1;h>=0;h--){var p;if((p=r[h]).namespace===e.namespaceURI){p.prefix&&(l=p.prefix+":"+u);break}}}t.push("<",l);for(var f=0;f<s;f++){"xmlns"==(m=a.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value})}for(f=0;f<s;f++){var m,g,v;if(Qa(m=a.item(f),0,r))$a(t,(g=m.prefix||"")?"xmlns:"+g:"xmlns",v=m.namespaceURI),r.push({prefix:g,namespace:v});Ja(m,t,n,i,r)}if(u===l&&Qa(e,0,r))$a(t,(g=e.prefix||"")?"xmlns:"+g:"xmlns",v=e.namespaceURI),r.push({prefix:g,namespace:v});if(o||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),n&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Ja(o,t,n,i,r.slice()),o=o.nextSibling;else for(;o;)Ja(o,t,n,i,r.slice()),o=o.nextSibling;t.push("</",l,">")}else t.push("/>");return;case ta:case ia:for(o=e.firstChild;o;)Ja(o,t,n,i,r.slice()),o=o.nextSibling;return;case Kr:return $a(t,e.name,e.value);case Yr:return t.push(e.data.replace(/[<&>]/g,ba));case Qr:return t.push("<![CDATA[",e.data,"]]>");case ea:return t.push("\x3c!--",e.data,"--\x3e");case na:var y=e.publicId,_=e.systemId;if(t.push("<!DOCTYPE ",e.name),y)t.push(" PUBLIC ",y),_&&"."!=_&&t.push(" ",_),t.push(">");else if(_&&"."!=_)t.push(" SYSTEM ",_,">");else{var b=e.internalSubset;b&&t.push(" [",b,"]"),t.push(">")}return;case Zr:return t.push("<?",e.target," ",e.data,"?>");case $r:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Za(e,t,n){var i;switch(t.nodeType){case Xr:(i=t.cloneNode(!1)).ownerDocument=e;case ia:break;case Kr:n=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,n)for(var r=t.firstChild;r;)i.appendChild(Za(e,r,n)),r=r.nextSibling;return i}function es(e,t,n){var i=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var a=t[r];"object"!=k(a)&&a!=i[r]&&(i[r]=a)}switch(t.childNodes&&(i.childNodes=new da),i.ownerDocument=e,i.nodeType){case Xr:var s=t.attributes,o=i.attributes=new fa,u=s.length;o._ownerElement=i;for(var l=0;l<u;l++)i.setAttributeNode(es(e,s.item(l),!0));break;case Kr:n=!0}if(n)for(var c=t.firstChild;c;)i.appendChild(es(e,c,n)),c=c.nextSibling;return i}function ts(e,t,n){e[t]=n}aa.INVALID_STATE_ERR=(sa[11]="Invalid state",11),aa.SYNTAX_ERR=(sa[12]="Syntax error",12),aa.INVALID_MODIFICATION_ERR=(sa[13]="Invalid modification",13),aa.NAMESPACE_ERR=(sa[14]="Invalid namespace",14),aa.INVALID_ACCESS_ERR=(sa[15]="Invalid access",15),ca.prototype=Error.prototype,zr(aa,ca),da.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var n=[],i=0;i<this.length;i++)Ja(this[i],n,e,t);return n.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},ha.prototype.item=function(e){return pa(this),this[e]||null},Wr(ha,da),fa.prototype={length:0,item:da.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ca(la);var n=this.getNamedItem(e.nodeName);return ga(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new ca(la);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ga(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return va(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return va(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var i=this[n];if(i.localName==t&&i.namespaceURI==e)return i}return null}},ya.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,n){var i=new ka;if(i.implementation=this,i.childNodes=new da,i.doctype=n||null,n&&i.appendChild(n),t){var r=i.createElementNS(e,t);i.appendChild(r)}return i},createDocumentType:function(e,t,n){var i=new Va;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=n||"",i}},_a.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Oa(this,e,t)},replaceChild:function(e,t){Oa(this,e,t,Ra),t&&this.removeChild(t)},removeChild:function(e){return Ea(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return es(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Yr&&e.nodeType==Yr?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&n[i]===e)return i;t=t.nodeType==Kr?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,e))return n[e];t=t.nodeType==Kr?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},zr(Gr,_a),zr(Gr,_a.prototype),ka.prototype={nodeName:"#document",nodeType:ta,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==ia){for(var n=e.firstChild;n;){var i=n.nextSibling;this.insertBefore(n,t),n=i}return e}return Oa(this,e,t),Na(e,this),null===this.documentElement&&e.nodeType===Xr&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Ea(this,e)},replaceChild:function(e,t){Oa(this,e,t,Ra),Na(e,this),t&&this.removeChild(t),Aa(e)&&(this.documentElement=e)},importNode:function(e,t){return Za(this,e,t)},getElementById:function(e){var t=null;return Ta(this.documentElement,function(n){if(n.nodeType==Xr&&n.getAttribute("id")==e)return t=n,!0}),t},getElementsByClassName:function(e){var t=Hr(e);return new ha(this,function(n){var i=[];return t.length>0&&Ta(n.documentElement,function(r){if(r!==n&&r.nodeType===Xr){var a=r.getAttribute("class");if(a){var s=e===a;if(!s){var o=Hr(a);s=t.every((u=o,function(e){return u&&-1!==u.indexOf(e)}))}s&&i.push(r)}}var u}),i})},createElement:function(e){var t=new Ua;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new da,(t.attributes=new fa)._ownerElement=t,t},createDocumentFragment:function(){var e=new Ga;return e.ownerDocument=this,e.childNodes=new da,e},createTextNode:function(e){var t=new ja;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Fa;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new qa;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Xa;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new Ma;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Wa;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new Ua,i=t.split(":"),r=n.attributes=new fa;return n.childNodes=new da,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,r._ownerElement=n,n},createAttributeNS:function(e,t){var n=new Ma,i=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,n}},Wr(ka,_a),Ua.prototype={nodeType:Xr,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===ia?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,wa(e.ownerDocument,e,t),Na(t,e.ownerDocument||e),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ha(this,function(t){var n=[];return Ta(t,function(i){i===t||i.nodeType!=Xr||"*"!==e&&i.tagName!=e||n.push(i)}),n})},getElementsByTagNameNS:function(e,t){return new ha(this,function(n){var i=[];return Ta(n,function(r){r===n||r.nodeType!==Xr||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||i.push(r)}),i})}},ka.prototype.getElementsByTagName=Ua.prototype.getElementsByTagName,ka.prototype.getElementsByTagNameNS=Ua.prototype.getElementsByTagNameNS,Wr(Ua,_a),Ma.prototype.nodeType=Kr,Wr(Ma,_a),Ba.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(sa[oa])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},Wr(Ba,_a),ja.prototype={nodeName:"#text",nodeType:Yr,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},Wr(ja,Ba),Fa.prototype={nodeName:"#comment",nodeType:ea},Wr(Fa,Ba),qa.prototype={nodeName:"#cdata-section",nodeType:Qr},Wr(qa,Ba),Va.prototype.nodeType=na,Wr(Va,_a),Ha.prototype.nodeType=ra,Wr(Ha,_a),za.prototype.nodeType=Jr,Wr(za,_a),Wa.prototype.nodeType=$r,Wr(Wa,_a),Ga.prototype.nodeName="#document-fragment",Ga.prototype.nodeType=ia,Wr(Ga,_a),Xa.prototype.nodeType=Zr,Wr(Xa,_a),Ka.prototype.serializeToString=function(e,t,n){return Ya.call(e,t,n)},_a.prototype.toString=Ya;try{if(Object.defineProperty){var ns=function(e){switch(e.nodeType){case Xr:case ia:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(ns(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(ha.prototype,"length",{get:function(){return pa(this),this.$$length}}),Object.defineProperty(_a.prototype,"textContent",{get:function(){return ns(this)},set:function(e){switch(this.nodeType){case Xr:case ia:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ts=function(e,t,n){e["$$"+t]=n}}}catch(vy){}Rr.DocumentType=Va,Rr.DOMException=ca,Rr.DOMImplementation=ya,Rr.Element=Ua,Rr.Node=_a,Rr.NodeList=da,Rr.XMLSerializer=Ka;var is,rs,as={},ss={};is=ss,rs=Or.freeze,is.XML_ENTITIES=rs({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),is.HTML_ENTITIES=rs({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),is.entityMap=is.HTML_ENTITIES;var os={},us=Or.NAMESPACE,ls=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,cs=new RegExp("[\\-\\.0-9"+ls.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ds=new RegExp("^"+ls.source+cs.source+"*(?::"+ls.source+cs.source+"*)?$");function hs(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,hs)}function ps(){}function fs(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function ms(e,t,n,i,r,a){function s(e,t,i){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),i)}for(var o,u=++t,l=0;;){var c=e.charAt(u);switch(c){case"=":if(1===l)o=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!((u=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");s(o,d=e.slice(t,u),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(o,d=e.slice(t,u),t),a.warning('attribute "'+o+'" missed start quot('+c+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,n.closed=!0;case 4:case 1:break;case 2:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&n.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,u)).slice(-1)&&(n.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=o),4==l?(a.warning('attribute "'+d+'" missed quot(")!'),s(o,d,t)):(us.isHTML(i[""])&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),s(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"€":c=" ";default:if(c<=" ")switch(l){case 0:n.setTagName(e.slice(t,u)),l=6;break;case 1:o=e.slice(t,u),l=2;break;case 4:var d=e.slice(t,u);a.warning('attribute "'+d+'" missed quot(")!!'),s(o,d,t);case 5:l=6}else switch(l){case 2:n.tagName,us.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function gs(e,t,n){for(var i=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;if((h=o.indexOf(":"))>0)var l=s.prefix=o.slice(0,h),c=o.slice(h+1),d="xmlns"===l&&c;else c=o,l=null,d="xmlns"===o&&"";s.localName=c,!1!==d&&(null==r&&(r={},_s(n,n={})),n[d]=r[d]=u,s.uri=us.XMLNS,t.startPrefixMapping(d,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=us.XML),"xmlns"!==l&&(s.uri=n[l||""]))}var h;(h=i.indexOf(":"))>0?(l=e.prefix=i.slice(0,h),c=e.localName=i.slice(h+1)):(l=null,c=e.localName=i);var p=e.uri=n[l||""];if(t.startElement(p,c,i,e),!e.closed)return e.currentNSMap=n,e.localNSMap=r,!0;if(t.endElement(p,c,i),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&t.endPrefixMapping(l)}function vs(e,t,n,i,r){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf("</"+n+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(n)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),r.characters(s,0,s.length),a)}return t+1}function ys(e,t,n,i){var r=i[n];return null==r&&((r=e.lastIndexOf("</"+n+">"))<t&&(r=e.lastIndexOf("</"+n)),i[n]=r),r<t}function _s(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function bs(e,t,n,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,r-t-4),r+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,r-t-9),n.endCDATA(),r+3}var a=function(e,t){var n,i=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;n=r.exec(e);)if(i.push(n),n[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[s-1];return n.startDTD(o,u,l),n.endDTD(),c.index+c[0].length}return-1}function Ts(e,t,n){var i=e.indexOf("?>",t);if(i){var r=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,n.processingInstruction(r[1],r[2]),i+2):-1}return-1}function ks(){this.attributeNames={}}hs.prototype=new Error,hs.prototype.name=hs.name,ps.prototype={parse:function(e,t,n){var i=this.domBuilder;i.startDocument(),_s(t,t={}),function(e,t,n,i,r){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function o(t){if(t>m){var n=e.substring(m,t).replace(/&#?\w+;/g,s);h&&u(m),i.characters(n,0,t-m),m=t}}function u(t,n){for(;t>=c&&(n=d.exec(e));)l=n.index,c=l+n[0].length,h.lineNumber++;h.columnNumber=t-l+1}var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,h=i.locator,p=[{currentNSMap:t}],f={},m=0;for(;;){try{var g=e.indexOf("<",m);if(g<0){if(!e.substr(m).match(/^\s*$/)){var v=i.doc,y=v.createTextNode(e.substr(m));v.appendChild(y),i.currentElement=y}return}switch(g>m&&o(g),e.charAt(g+1)){case"/":var _=e.indexOf(">",g+3),b=e.substring(g+2,_).replace(/[ \t\n\r]+$/g,""),T=p.pop();_<0?(b=e.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+b+" is not complete:"+T.tagName),_=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),r.error("end tag name: "+b+" maybe not complete"),_=g+1+b.length);var k=T.localNSMap,S=T.tagName==b;if(S||T.tagName&&T.tagName.toLowerCase()==b.toLowerCase()){if(i.endElement(T.uri,T.localName,b),k)for(var w in k)Object.prototype.hasOwnProperty.call(k,w)&&i.endPrefixMapping(w);S||r.fatalError("end tag name: "+b+" is not match the current start tagName:"+T.tagName)}else p.push(T);_++;break;case"?":h&&u(g),_=Ts(e,g,i);break;case"!":h&&u(g),_=bs(e,g,i,r);break;default:h&&u(g);var E=new ks,C=p[p.length-1].currentNSMap,A=(_=ms(e,g,E,C,s,r),E.length);if(!E.closed&&ys(e,_,E.tagName,f)&&(E.closed=!0,n.nbsp||r.warning("unclosed xml attribute")),h&&A){for(var I=fs(h,{}),x=0;x<A;x++){var L=E[x];u(L.offset),L.locator=fs(h,{})}i.locator=I,gs(E,i,C)&&p.push(E),i.locator=h}else gs(E,i,C)&&p.push(E);us.isHTML(E.uri)&&!E.closed?_=vs(e,_,E.tagName,s,i):_++}}catch(vy){if(vy instanceof hs)throw vy;r.error("element parse error: "+vy),_=-1}_>m?m=_:o(Math.max(g,m)+1)}}(e,t,n,i,this.errorHandler),i.endDocument()}},ks.prototype={setTagName:function(e){if(!ds.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!ds.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},os.XMLReader=ps,os.ParseError=hs;var Ss=Or,ws=ss,Es=os,Cs=Rr.DOMImplementation,As=Ss.NAMESPACE,Is=Es.ParseError,xs=Es.XMLReader;function Ls(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ds(e){this.options=e||{locator:{}}}function Ps(){this.cdata=!1}function Rs(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Os(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Ns(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function Us(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ds.prototype.parseFromString=function(e,t){var n=this.options,i=new xs,r=n.domBuilder||new Ps,a=n.errorHandler,s=n.locator,o=n.xmlns||{},u=/\/x?html?$/.test(t),l=u?ws.HTML_ENTITIES:ws.XML_ENTITIES;s&&r.setDocumentLocator(s),i.errorHandler=function(e,t,n){if(!e){if(t instanceof Ps)return t;e=t}var i={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(n){e(t,n)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+Os(n))}||function(){}}return n=n||{},a("warning"),a("error"),a("fatalError"),i}(a,r,s),i.domBuilder=n.domBuilder||r,u&&(o[""]=As.HTML),o.xml=o.xml||As.XML;var c=n.normalizeLineEndings||Ls;return e&&"string"==typeof e?i.parse(c(e),o,l):i.errorHandler.error("invalid doc source"),r.doc},Ps.prototype={startDocument:function(){this.doc=(new Cs).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,i){var r=this.doc,a=r.createElementNS(e,n||t),s=i.length;Us(this,a),this.currentElement=a,this.locator&&Rs(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var u=i.getValue(o),l=(n=i.getQName(o),r.createAttributeNS(e,n));this.locator&&Rs(i.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,n){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&Rs(this.locator,n),Us(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=Ns.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&Rs(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=Ns.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&Rs(this.locator,i),Us(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(e,t,n);this.locator&&Rs(this.locator,r),Us(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,Os(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,Os(this.locator))},fatalError:function(e){throw new Is(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Ps.prototype[e]=function(){return null}}),as.__DOMHandler=Ps,as.normalizeLineEndings=Ls,as.DOMParser=Ds;var Ms=as.DOMParser,Bs=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Ms},Symbol.toStringTag,{value:"Module"})),js=function(e){return!!e&&"object"===k(e)},Fs=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return"object"!==k(t)||Object.keys(t).forEach(function(n){Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):js(e[n])&&js(t[n])?e[n]=Fs(e[n],t[n]):e[n]=t[n]}),e},{})},qs=function(e){return Object.keys(e).map(function(t){return e[t]})},Vs=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},Hs=function(e){if(!e.length)return[];for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},zs="INVALID_NUMBER_OF_PERIOD",Ws="DASH_EMPTY_MANIFEST",Gs="DASH_INVALID_XML",Xs="NO_BASE_URL",Ks="SEGMENT_TIME_UNSPECIFIED",Ys="UNSUPPORTED_UTC_TIMING_SCHEME",Qs=function(e){var t=e.baseUrl,n=void 0===t?"":t,i=e.source,r=void 0===i?"":i,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:Fi(n||"",r)};if(s||u){var c,d=(s||u).split("-"),h=wn.BigInt?wn.BigInt(d[0]):parseInt(d[0],10),p=wn.BigInt?wn.BigInt(d[1]):parseInt(d[1],10);h<Number.MAX_SAFE_INTEGER&&"bigint"==typeof h&&(h=Number(h)),p<Number.MAX_SAFE_INTEGER&&"bigint"==typeof p&&(p=Number(p)),"bigint"==typeof(c="bigint"==typeof p||"bigint"==typeof h?wn.BigInt(p)-wn.BigInt(h)+wn.BigInt(1):p-h+1)&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),l.byterange={length:c,offset:h}}return l},$s=function(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e},Js={static:function(e){var t=e.duration,n=e.timescale,i=void 0===n?1:n,r=e.sourceDuration,a=e.periodDuration,s=$s(e.endNumber),o=t/i;return"number"==typeof s?{start:0,end:s}:"number"==typeof a?{start:0,end:a/o}:{start:0,end:r/o}},dynamic:function(e){var t=e.NOW,n=e.clientOffset,i=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.periodStart,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,p=$s(e.endNumber),f=(t+n)/1e3,m=i+u,g=f+c-m,v=Math.ceil(g*a/s),y=Math.floor((f-m-h)*a/s),_=Math.floor((f-m)*a/s);return{start:Math.max(0,y),end:"number"==typeof p?p:Math.min(v,_)}}},Zs=function(e){var t=e.type,n=e.duration,i=e.timescale,r=void 0===i?1:i,a=e.periodDuration,s=e.sourceDuration,o=Js[t](e),u=function(e,t){for(var n=[],i=e;i<t;i++)n.push(i);return n}(o.start,o.end).map(function(e){return function(t){var n=e.duration,i=e.timescale,r=void 0===i?1:i,a=e.periodStart,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:n/r,timeline:a,time:t*n}}}(e));if("static"===t){var l=u.length-1,c="number"==typeof a?a:s;u[l].duration=c-n/r*l}return u},eo=function(e){var t=e.baseUrl,n=e.initialization,i=void 0===n?{}:n,r=e.sourceDuration,a=e.indexRange,s=void 0===a?"":a,o=e.periodStart,u=e.presentationTime,l=e.number,c=void 0===l?0:l,d=e.duration;if(!t)throw new Error(Xs);var h=Qs({baseUrl:t,source:i.sourceURL,range:i.range}),p=Qs({baseUrl:t,source:t,indexRange:s});if(p.map=h,d){var f=Zs(e);f.length&&(p.duration=f[0].duration,p.timeline=f[0].timeline)}else r&&(p.duration=r,p.timeline=o);return p.presentationTime=u||o,p.number=c,[p]},to=function(e,t,n){var i,r=e.sidx.map?e.sidx.map:null,a=e.sidx.duration,s=e.timeline||0,o=e.sidx.byterange,u=o.offset+o.length,l=t.timescale,c=t.references.filter(function(e){return 1!==e.referenceType}),d=[],h=e.endList?"static":"dynamic",p=e.sidx.timeline,f=p,m=e.mediaSequence||0;i="bigint"==typeof t.firstOffset?wn.BigInt(u)+t.firstOffset:u+t.firstOffset;for(var g=0;g<c.length;g++){var v=t.references[g],y=v.referencedSize,_=v.subsegmentDuration,b=void 0;b="bigint"==typeof i?i+wn.BigInt(y)-wn.BigInt(1):i+y-1;var T="".concat(i,"-").concat(b),k=eo({baseUrl:n,timescale:l,timeline:s,periodStart:p,presentationTime:f,number:m,duration:_,sourceDuration:a,indexRange:T,type:h})[0];r&&(k.map=r),d.push(k),i+="bigint"==typeof i?wn.BigInt(y):y,f+=_/l,m++}return e.segments=d,e},no=["AUDIO","SUBTITLES"],io=1/60,ro=function(e){return(t=e,n=function(e){return e.timeline},qs(t.reduce(function(e,t){return t.forEach(function(t){e[n(t)]=t}),e},{}))).sort(function(e,t){return e.timeline>t.timeline?1:-1});var t,n},ao=function(e){var t,n,i=[];return t=e,n=function(e,t,n,r){i=i.concat(e.playlists||[])},no.forEach(function(e){for(var i in t.mediaGroups[e])for(var r in t.mediaGroups[e][i]){var a=t.mediaGroups[e][i][r];n(a,e,i,r)}}),i},so=function(e){var t=e.playlist,n=e.mediaSequence;t.mediaSequence=n,t.segments.forEach(function(e,n){e.number=t.mediaSequence+n})},oo=function(e){var t=e.oldManifest,n=e.newManifest,i=t.playlists.concat(ao(t)),r=n.playlists.concat(ao(n));return n.timelineStarts=ro([t.timelineStarts,n.timelineStarts]),function(e){var t=e.oldPlaylists,n=e.newPlaylists,i=e.timelineStarts;n.forEach(function(e){e.discontinuitySequence=i.findIndex(function(t){return t.timeline===e.timeline});var n=function(e,t){for(var n=0;n<e.length;n++)if(e[n].attributes.NAME===t)return e[n];return null}(t,e.attributes.NAME);if(n&&!e.sidx){var r=e.segments[0],a=n.segments.findIndex(function(e){return Math.abs(e.presentationTime-r.presentationTime)<io});if(-1===a)return so({playlist:e,mediaSequence:n.mediaSequence+n.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),void((!n.segments.length&&e.timeline>n.timeline||n.segments.length&&e.timeline>n.segments[n.segments.length-1].timeline)&&e.discontinuitySequence--);n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),so({playlist:e,mediaSequence:n.segments[a].number})}})}({oldPlaylists:i,newPlaylists:r,timelineStarts:n.timelineStarts}),n},uo=function(e){return e&&e.uri+"-"+(t=e.byterange,n="bigint"==typeof t.offset||"bigint"==typeof t.length?wn.BigInt(t.offset)+wn.BigInt(t.length)-wn.BigInt(1):t.offset+t.length-1,"".concat(t.offset,"-").concat(n));var t,n},lo=function(e){var t=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{}),n=[];return Object.values(t).forEach(function(e){var t=qs(e.reduce(function(e,t){var n=t.attributes.id+(t.attributes.lang||"");if(e[n]){var i;if(t.segments)t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,b(t.segments));t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)}else e[n]=t,e[n].attributes.timelineStarts=[];return e[n].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));n=n.concat(t)}),n.map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments||[],n="discontinuity",t.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])),e})},co=function(e,t){var n=uo(e.sidx),i=n&&t[n]&&t[n].sidx;return i&&to(e,i,e.sidx.resolvedUri),e},ho=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object.keys(t).length)return e;for(var n in e)e[n]=co(e[n],t);return e},po=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.reduce(function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" (".concat(a,")"):"";o="".concat(r.attributes.lang).concat(u)}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=co(function(e,t){var n=e.attributes,i=e.segments,r=e.sidx,a=e.mediaSequence,s=e.discontinuitySequence,o=e.discontinuityStarts,u={attributes:I({NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},"PROGRAM-ID",1),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuitySequence:s,discontinuityStarts:o,timelineStarts:n.timelineStarts,mediaSequence:a,segments:i};return n.contentProtection&&(u.contentProtection=n.contentProtection),n.serviceLocation&&(u.attributes.serviceLocation=n.serviceLocation),r&&(u.sidx=r),t&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u}(r,i),n);return e[o].playlists.push(l),void 0===t&&"main"===a&&((t=r).default=!0),e},{});t||(r[Object.keys(r)[0]].default=!0);return r},fo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.reduce(function(e,n){var i=n.attributes.label||n.attributes.lang||"text",r=n.attributes.lang||"und";return e[i]||(e[i]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(co(function(e){var t=e.attributes,n=e.segments,i=e.mediaSequence,r=e.discontinuityStarts,a=e.discontinuitySequence;void 0===n&&(n=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);var s=I({NAME:t.id,BANDWIDTH:t.bandwidth},"PROGRAM-ID",1);t.codecs&&(s.CODECS=t.codecs);var o={attributes:s,uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:r,discontinuitySequence:a,mediaSequence:i,segments:n};return t.serviceLocation&&(o.attributes.serviceLocation=t.serviceLocation),o}(n),t)),e},{})},mo=function(e){var t=e.attributes,n=e.segments,i=e.sidx,r=e.discontinuityStarts,a={attributes:I({NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth},"PROGRAM-ID",1),uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:r,timelineStarts:t.timelineStarts,segments:n};return t.frameRate&&(a.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(a.contentProtection=t.contentProtection),t.serviceLocation&&(a.attributes.serviceLocation=t.serviceLocation),i&&(a.sidx=i),a},go=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},vo=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},yo=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},_o=function(e){return e?Object.keys(e).reduce(function(t,n){var i=e[n];return t.concat(i.playlists)},[]):[]},bo=function(e,t,n){var i=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.periodStart,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(i+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/n)},To=function(e,t){for(var n=e.type,i=e.minimumUpdatePeriod,r=void 0===i?0:i,a=e.media,s=void 0===a?"":a,o=e.sourceDuration,u=e.timescale,l=void 0===u?1:u,c=e.startNumber,d=void 0===c?1:c,h=e.periodStart,p=[],f=-1,m=0;m<t.length;m++){var g=t[m],v=g.d,y=g.r||0,_=g.t||0;f<0&&(f=_),_&&_>f&&(f=_);var b=void 0;if(y<0){var T=m+1;b=T===t.length?"dynamic"===n&&r>0&&s.indexOf("$Number$")>0?bo(e,f,v):(o*l-f)/v:(t[T].t-f)/v}else b=y+1;for(var k=d+p.length+b,S=d+p.length;S<k;)p.push({number:S,duration:v/l,time:f,timeline:h}),f+=v,S++}return p},ko=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,So=function(e,t){return e.replace(ko,function(e){return function(t,n,i,r){if("$$"===t)return"$";if(void 0===e[n])return t;var a=""+e[n];return"RepresentationID"===n?a:(r=i?parseInt(r,10):1,a.length>=r?a:"".concat(new Array(r-a.length+1).join("0")).concat(a))}}(t))},wo=function(e,t){var n={RepresentationID:e.id,Bandwidth:e.bandwidth||0},i=e.initialization,r=void 0===i?{sourceURL:"",range:""}:i,a=Qs({baseUrl:e.baseUrl,source:So(r.sourceURL,n),range:r.range}),s=function(e,t){return e.duration||t?e.duration?Zs(e):To(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]}(e,t);return s.map(function(t){n.Number=t.number,n.Time=t.time;var i=So(e.media||"",n),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:i,timeline:t.timeline,duration:t.duration,resolvedUri:Fi(e.baseUrl||"",i),map:a,number:t.number,presentationTime:o}})},Eo=function(e,t){var n=e.duration,i=e.segmentUrls,r=void 0===i?[]:i,a=e.periodStart;if(!n&&!t||n&&t)throw new Error(Ks);var s,o=r.map(function(t){return function(e,t){var n=e.baseUrl,i=e.initialization,r=void 0===i?{}:i,a=Qs({baseUrl:n,source:r.sourceURL,range:r.range}),s=Qs({baseUrl:n,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)});return n&&(s=Zs(e)),t&&(s=To(e,t)),s.map(function(t,n){if(o[n]){var i=o[n],r=e.timescale||1,s=e.presentationTimeOffset||0;return i.timeline=t.timeline,i.duration=t.duration,i.number=t.number,i.presentationTime=a+(t.time-s)/r,i}}).filter(function(e){return e})},Co=function(e){var t,n,i=e.attributes,r=e.segmentInfo;r.template?(n=wo,t=Fs(i,r.template)):r.base?(n=eo,t=Fs(i,r.base)):r.list&&(n=Eo,t=Fs(i,r.list));var a={attributes:i};if(!n)return a;var s=n(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Ao=function(e,t){return Hs(e.childNodes).filter(function(e){return e.tagName===t})},Io=function(e){return e.textContent.trim()},xo=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var n=S(t.slice(1),6),i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],u=n[5];return 31536e3*parseFloat(i||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},Lo={mediaPresentationDuration:function(e){return xo(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return xo(e)},suggestedPresentationDelay:function(e){return xo(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return xo(e)},start:function(e){return xo(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},frameRate:function(e){return function(e){return parseFloat(e.split("/").reduce(function(e,t){return e/t}))}(e)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?xo(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},presentationTime:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},Do=function(e){return e&&e.attributes?Hs(e.attributes).reduce(function(e,t){var n=Lo[t.name]||Lo.DEFAULT;return e[t.name]=n(t.value),e},{}):{}},Po={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Ro=function(e,t){return t.length?Vs(e.map(function(e){return t.map(function(t){var n=Io(t),i=Fi(e.baseUrl,n),r=Fs(Do(t),{baseUrl:i});return i!==n&&!r.serviceLocation&&e.serviceLocation&&(r.serviceLocation=e.serviceLocation),r})})):e},Oo=function(e){var t=Ao(e,"SegmentTemplate")[0],n=Ao(e,"SegmentList")[0],i=n&&Ao(n,"SegmentURL").map(function(e){return Fs({tag:"SegmentURL"},Do(e))}),r=Ao(e,"SegmentBase")[0],a=n||t,s=a&&Ao(a,"SegmentTimeline")[0],o=n||r||t,u=o&&Ao(o,"Initialization")[0],l=t&&Do(t);l&&u?l.initialization=u&&Do(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,segmentTimeline:s&&Ao(s,"S").map(function(e){return Do(e)}),list:n&&Fs(Do(n),{segmentUrls:i,initialization:Do(u)}),base:r&&Fs(Do(r),{initialization:Do(u)})};return Object.keys(c).forEach(function(e){c[e]||delete c[e]}),c},No=function(e){return Vs(Ao(e.node,"EventStream").map(function(t){var n=Do(t),i=n.schemeIdUri;return Ao(t,"Event").map(function(t){var r=Do(t),a=r.presentationTime||0,s=n.timescale||1,o=r.duration||0,u=a/s+e.attributes.start;return{schemeIdUri:i,value:n.value,id:r.id,start:u,end:u+o/s,messageData:Io(t)||r.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})}))},Uo=function(e,t,n){return function(i){var r,a=Do(i),s=Ro(t,Ao(i,"BaseURL")),o=Ao(i,"Role")[0],u={role:Do(o)},l=Fs(e,a,u),c=Ao(i,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(r=Do(c)).schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map(function(e){var t,n;if(n=e,/^CC\d=/.test(e)){var i=S(e.split("="),2);t=i[0],n=i[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:n}}):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map(function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var n=S(e.split("="),2),i=n[0],r=n[1],a=void 0===r?"":r;t.channel=i,t.language=e,a.split(",").forEach(function(e){var n=S(e.split(":"),2),i=n[0],r=n[1];"lang"===i?t.language=r:"er"===i?t.easyReader=Number(r):"war"===i?t.aspectRatio=Number(r):"3D"===i&&(t["3D"]=Number(r))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}):void 0;d&&(l=Fs(l,{captionServices:d}));var h=Ao(i,"Label")[0];if(h&&h.childNodes.length){var p=h.childNodes[0].nodeValue.trim();l=Fs(l,{label:p})}var f=Ao(i,"ContentProtection").reduce(function(e,t){var n=Do(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());var i=Po[n.schemeIdUri];if(i){e[i]={attributes:n};var r=Ao(t,"cenc:pssh")[0];if(r){var a=Io(r);e[i].pssh=a&&er(a)}}return e},{});Object.keys(f).length&&(l=Fs(l,{contentProtection:f}));var m=Oo(i),g=Ao(i,"Representation"),v=Fs(n,m);return Vs(g.map(function(e,t,n){return function(i){var r=Ao(i,"BaseURL"),a=Ro(t,r),s=Fs(e,Do(i)),o=Oo(i);return a.map(function(e){return{segmentInfo:Fs(n,o),attributes:Fs(s,e)}})}}(l,s,v)))}},Mo=function(e,t){return function(n,i){var r=Ro(t,Ao(n.node,"BaseURL")),a=Fs(e,{periodStart:n.attributes.start});"number"==typeof n.attributes.duration&&(a.periodDuration=n.attributes.duration);var s=Ao(n.node,"AdaptationSet"),o=Oo(n.node);return Vs(s.map(Uo(a,r,o)))}},Bo=function(e,t){if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;var n=Fs({serverURL:Io(e[0])},Do(e[0]));return n.queryBeforeStart="true"===n.queryBeforeStart,n},jo=function(e){if(""===e)throw new Error(Ws);var t,n,i=new Ms;try{n=(t=i.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(vy){}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Gs);return n},Fo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.manifestUri,i=void 0===n?"":n,r=t.NOW,a=void 0===r?Date.now():r,s=t.clientOffset,o=void 0===s?0:s,u=t.eventHandler,l=void 0===u?function(){}:u,c=Ao(e,"Period");if(!c.length)throw new Error(zs);var d=Ao(e,"Location"),h=Do(e),p=Ro([{baseUrl:i}],Ao(e,"BaseURL")),f=Ao(e,"ContentSteering");h.type=h.type||"static",h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=a,h.clientOffset=o,d.length&&(h.locations=d.map(Io));var m=[];return c.forEach(function(e,t){var n=Do(e),i=m[t-1];n.start=function(e){var t=e.attributes,n=e.priorPeriodAttributes,i=e.mpdType;return"number"==typeof t.start?t.start:n&&"number"==typeof n.start&&"number"==typeof n.duration?n.start+n.duration:n||"static"!==i?null:0}({attributes:n,priorPeriodAttributes:i?i.attributes:null,mpdType:h.type}),m.push({node:e,attributes:n})}),{locations:h.locations,contentSteeringInfo:Bo(f,l),representationInfo:Vs(m.map(Mo(h,p))),eventStream:Vs(m.map(No))}}(jo(e),t);return function(e){var t=e.dashPlaylists,n=e.locations,i=e.contentSteering,r=e.sidxMapping,a=void 0===r?{}:r,s=e.previousManifest,o=e.eventStream;if(!t.length)return{};var u=t[0].attributes,l=u.sourceDuration,c=u.type,d=u.suggestedPresentationDelay,h=u.minimumUpdatePeriod,p=lo(t.filter(go)).map(mo),f=lo(t.filter(vo)),m=lo(t.filter(yo)),g=t.map(function(e){return e.attributes.captionServices}).filter(Boolean),v={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:I(I({AUDIO:{},VIDEO:{}},"CLOSED-CAPTIONS",{}),"SUBTITLES",{}),uri:"",duration:l,playlists:ho(p,a)};h>=0&&(v.minimumUpdatePeriod=1e3*h),n&&(v.locations=n),i&&(v.contentSteering=i),"dynamic"===c&&(v.suggestedPresentationDelay=d),o&&o.length>0&&(v.eventStream=o);var y,_,b=0===v.playlists.length,T=f.length?po(f,a,b):null,k=m.length?fo(m,a):null,S=p.concat(_o(T),_o(k)),w=S.map(function(e){return e.timelineStarts});return v.timelineStarts=ro(w),y=S,_=v.timelineStarts,y.forEach(function(e){e.mediaSequence=0,e.discontinuitySequence=_.findIndex(function(t){return t.timeline===e.timeline}),e.segments&&e.segments.forEach(function(e,t){e.number=t})}),T&&(v.mediaGroups.AUDIO.audio=T),k&&(v.mediaGroups.SUBTITLES.subs=k),g.length&&(v.mediaGroups["CLOSED-CAPTIONS"].cc=g.reduce(function(e,t){return t?(t.forEach(function(t){var n=t.channel,i=t.language;e[i]={autoselect:!1,default:!1,instreamId:n,language:i},t.hasOwnProperty("aspectRatio")&&(e[i].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[i].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[i]["3D"]=t["3D"])}),e):e},{})),s?oo({oldManifest:s,newManifest:v}):v}({dashPlaylists:n.representationInfo.map(Co),locations:n.locations,contentSteering:n.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:n.eventStream})},qo=function(e){return function(e){var t=Ao(e,"UTCTiming")[0];if(!t)return null;var n=Do(t);switch(n.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":n.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":n.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":n.method="DIRECT",n.value=Date.parse(n.value);break;default:throw new Error(Ys)}return n}(jo(e))},Vo=Math.pow(2,32),Ho=function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getBigUint64?(t=n.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:n.getUint32(0)*Vo+n.getUint32(4)},zo=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},i=12;0===n.version?(n.earliestPresentationTime=t.getUint32(i),n.firstOffset=t.getUint32(i+4),i+=8):(n.earliestPresentationTime=Ho(e.subarray(i)),n.firstOffset=Ho(e.subarray(i+8)),i+=16),i+=2;var r=t.getUint16(i);for(i+=2;r>0;i+=12,r--)n.references.push({referenceType:(128&e[i])>>>7,referencedSize:2147483647&t.getUint32(i),subsegmentDuration:t.getUint32(i+4),startsWithSap:!!(128&e[i+8]),sapType:(112&e[i+8])>>>4,sapDeltaTime:268435455&t.getUint32(i+8)});return n},Wo=F.getDefaultExportFromCjs(zo),Go=Cr([73,68,51]),Xo=function e(t,n){return void 0===n&&(n=0),(t=Cr(t)).length-n<10||!Pr(t,Go,{offset:n})?n:(n+=function(e,t){void 0===t&&(t=0);var n=(e=Cr(e))[t+5],i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&n)>>4?i+20:i+10}(t,n),e(t,n))},Ko=function(e){return"string"==typeof e?Dr(e):e},Yo=function e(t,n,i){void 0===i&&(i=!1),n=function(e){return Array.isArray(e)?e.map(function(e){return Ko(e)}):[Ko(e)]}(n),t=Cr(t);var r=[];if(!n.length)return r;for(var a=0;a<t.length;){var s=(t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3])>>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(i)break;u=t.length}var l=t.subarray(a+8,u);Pr(o,n[0])&&(1===n.length?r.push(l):r.push.apply(r,e(l,n.slice(1),i))),a=u}return r},Qo={EBML:Cr([26,69,223,163]),DocType:Cr([66,130]),Segment:Cr([24,83,128,103]),SegmentInfo:Cr([21,73,169,102]),Tracks:Cr([22,84,174,107]),Track:Cr([174]),TrackNumber:Cr([215]),DefaultDuration:Cr([35,227,131]),TrackEntry:Cr([174]),TrackType:Cr([131]),FlagDefault:Cr([136]),CodecID:Cr([134]),CodecPrivate:Cr([99,162]),VideoTrack:Cr([224]),AudioTrack:Cr([225]),Cluster:Cr([31,67,182,117]),Timestamp:Cr([231]),TimestampScale:Cr([42,215,177]),BlockGroup:Cr([160]),BlockDuration:Cr([155]),Block:Cr([161]),SimpleBlock:Cr([163])},$o=[128,64,32,16,8,4,2,1],Jo=function(e,t,n,i){void 0===n&&(n=!0),void 0===i&&(i=!1);var r=function(e){for(var t=1,n=0;n<$o.length&&!(e&$o[n]);n++)t++;return t}(e[t]),a=e.subarray(t,t+r);return n&&((a=Array.prototype.slice.call(e,t,t+r))[0]^=$o[r-1]),{length:r,value:xr(a,{signed:i}),bytes:a}},Zo=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map(function(t){return e(t)}):"number"==typeof t?Lr(t):t},eu=function e(t,n,i){if(i>=n.length)return n.length;var r=Jo(n,i,!1);if(Pr(t.bytes,r.bytes))return i;var a=Jo(n,i+r.length);return e(t,n,i+a.length+a.value+r.length)},tu=function e(t,n){n=function(e){return Array.isArray(e)?e.map(function(e){return Zo(e)}):[Zo(e)]}(n),t=Cr(t);var i=[];if(!n.length)return i;for(var r=0;r<t.length;){var a=Jo(t,r,!1),s=Jo(t,r+a.length),o=r+a.length+s.length;127===s.value&&(s.value=eu(a,t,o),s.value!==t.length&&(s.value-=o));var u=o+s.value>t.length?t.length:o+s.value,l=t.subarray(o,u);Pr(n[0],a.bytes)&&(1===n.length?i.push(l):i=i.concat(e(l,n.slice(1)))),r+=a.length+s.length+l.length}return i},nu=Cr([0,0,0,1]),iu=Cr([0,0,1]),ru=Cr([0,0,3]),au=function(e){for(var t=[],n=1;n<e.length-2;)Pr(e.subarray(n,n+3),ru)&&(t.push(n+2),n++),n++;if(0===t.length)return e;var i=e.length-t.length,r=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===t[0]&&(a++,t.shift()),r[n]=e[a];return r},su=function(e,t,n,i){e=Cr(e),n=[].concat(n);for(var r,a=0,s=0;a<e.length&&(s<i||r);){var o=void 0;if(Pr(e.subarray(a),nu)?o=4:Pr(e.subarray(a),iu)&&(o=3),o){if(s++,r)return au(e.subarray(r,a));var u=void 0;"h264"===t?u=31&e[a+o]:"h265"===t&&(u=e[a+o]>>1&63),-1!==n.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},ou={webm:Cr([119,101,98,109]),matroska:Cr([109,97,116,114,111,115,107,97]),flac:Cr([102,76,97,67]),ogg:Cr([79,103,103,83]),ac3:Cr([11,119]),riff:Cr([82,73,70,70]),avi:Cr([65,86,73]),wav:Cr([87,65,86,69]),"3gp":Cr([102,116,121,112,51,103]),mp4:Cr([102,116,121,112]),fmp4:Cr([115,116,121,112]),mov:Cr([102,116,121,112,113,116]),moov:Cr([109,111,111,118]),moof:Cr([109,111,111,102])},uu={aac:function(e){var t=Xo(e);return Pr(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Xo(e);return Pr(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=tu(e,[Qo.EBML,Qo.DocType])[0];return Pr(t,ou.webm)},mkv:function(e){var t=tu(e,[Qo.EBML,Qo.DocType])[0];return Pr(t,ou.matroska)},mp4:function(e){return!uu["3gp"](e)&&!uu.mov(e)&&(!(!Pr(e,ou.mp4,{offset:4})&&!Pr(e,ou.fmp4,{offset:4}))||(!(!Pr(e,ou.moof,{offset:4})&&!Pr(e,ou.moov,{offset:4}))||void 0))},mov:function(e){return Pr(e,ou.mov,{offset:4})},"3gp":function(e){return Pr(e,ou["3gp"],{offset:4})},ac3:function(e){var t=Xo(e);return Pr(e,ou.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=Xo(e);return Pr(e,ou.flac,{offset:t})},ogg:function(e){return Pr(e,ou.ogg)},avi:function(e){return Pr(e,ou.riff)&&Pr(e,ou.avi,{offset:8})},wav:function(e){return Pr(e,ou.riff)&&Pr(e,ou.wav,{offset:8})},h264:function(e){return function(e,t,n){return su(e,"h264",t,n)}(e,7,3).length},h265:function(e){return function(e,t,n){return su(e,"h265",t,n)}(e,[32,33],3).length}},lu=Object.keys(uu).filter(function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e}).concat(["ts","h264","h265"]);lu.forEach(function(e){var t=uu[e];uu[e]=function(e){return t(Cr(e))}});var cu,du,hu,pu,fu=uu,mu=function(e){e=Cr(e);for(var t=0;t<lu.length;t++){var n=lu[t];if(fu[n](e))return n}return""},gu=9e4;var vu,yu=gu,_u=(cu=function(e){return e*gu},du=function(e,t){return e*t},hu=function(e){return e/gu},pu=function(e,t){return e/t},"8.21.0"),bu={},Tu=function(e,t){return bu[e]=bu[e]||[],t&&(bu[e]=bu[e].concat(t)),bu[e]},ku=function(e,t){var n=Tu(e).indexOf(t);return!(n<=-1)&&(bu[e]=bu[e].slice(),bu[e].splice(n,1),!0)},Su={prefixed:!0},wu=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Eu=wu[0];for(Ki=0;Ki<wu.length;Ki++)if(wu[Ki][1]in Ln){vu=wu[Ki];break}if(vu){for(var Cu=0;Cu<vu.length;Cu++)Su[Eu[Cu]]=vu[Cu];Su.prefixed=vu[0]!==Eu[0]}var Au=[];var Iu=function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a="info";function s(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n("log",a,t)}return n=function(e,t,n){return function(i,r,a){var s=t.levels[r],o=new RegExp("^(".concat(s,")$")),u=e;if("log"!==i&&a.unshift(i.toUpperCase()+":"),n&&(u="%c".concat(e),a.unshift(n)),a.unshift(u+":"),Au){Au.push([].concat(a));var l=Au.length-1e3;Au.splice(0,l>0?l:0)}if(wn.console){var c=wn.console[i];c||"debug"!==i||(c=wn.console.info||wn.console.log),c&&s&&o.test(i)&&c[Array.isArray(a)?"apply":"call"](wn.console,a)}}}(t,s,r),s.createLogger=function(n,a,s){var o=void 0!==a?a:i,u=void 0!==s?s:r;return e("".concat(t," ").concat(o," ").concat(n),o,u)},s.createNewLogger=function(t,n,i){return e(t,n,i)},s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:a},s.level=function(e){if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error('"'.concat(e,'" in not a valid log level'));a=e}return a},s.history=function(){return Au?[].concat(Au):[]},s.history.filter=function(e){return(Au||[]).filter(function(t){return new RegExp(".*".concat(e,".*")).test(t[0])})},s.history.clear=function(){Au&&(Au.length=0)},s.history.disable=function(){null!==Au&&(Au.length=0,Au=null)},s.history.enable=function(){null===Au&&(Au=[])},s.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("error",a,t)},s.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("warn",a,t)},s.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("debug",a,t)},s}("VIDEOJS"),xu=Iu.createLogger,Lu=Object.prototype.toString,Du=function(e){return Ou(e)?Object.keys(e):[]};function Pu(e,t){Du(e).forEach(function(n){return t(e[n],n)})}function Ru(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Du(e).reduce(function(n,i){return t(n,e[i],i)},n)}function Ou(e){return!!e&&"object"===k(e)}function Nu(e){return Ou(e)&&"[object Object]"===Lu.call(e)&&e.constructor===Object}function Uu(){for(var e={},t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){t&&Pu(t,function(t,n){Nu(t)?(Nu(e[n])||(e[n]={}),e[n]=Uu(e[n],t)):e[n]=t})}),e}function Mu(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];t.push(i)}return t}function Bu(e,t,n){var i=function(n){return Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0})},r={configurable:!0,enumerable:!0,get:function(){var e=n();return i(e),e}};return(!(arguments.length>3&&void 0!==arguments[3])||arguments[3])&&(r.set=i),Object.defineProperty(e,t,r)}var ju,Fu,qu,Vu,Hu=Object.freeze({__proto__:null,each:Pu,reduce:Ru,isObject:Ou,isPlain:Nu,merge:Uu,values:Mu,defineLazyProperty:Bu}),zu=!1,Wu=null,Gu=!1,Xu=!1,Ku=!1,Yu=!1,Qu=!1,$u=null,Ju=null,Zu=Boolean(wn.cast&&wn.cast.framework&&wn.cast.framework.CastReceiverContext),el=null,tl=!1,nl=!1,il=!1,rl=!1,al=!1,sl=!1,ol=!1,ul=Boolean(ml()&&("ontouchstart"in wn||wn.navigator.maxTouchPoints||wn.DocumentTouch&&wn.document instanceof wn.DocumentTouch)),ll=wn.navigator&&wn.navigator.userAgentData;if(ll&&ll.platform&&ll.brands&&(Gu="Android"===ll.platform,Ku=Boolean(ll.brands.find(function(e){return"Microsoft Edge"===e.brand})),Yu=Boolean(ll.brands.find(function(e){return"Chromium"===e.brand})),Qu=!Ku&&Yu,$u=Ju=(ll.brands.find(function(e){return"Chromium"===e.brand})||{}).version||null,nl="Windows"===ll.platform),!Yu){var cl=wn.navigator&&wn.navigator.userAgent||"";zu=/iPod/i.test(cl),Vu=cl.match(/OS (\d+)_/i),Wu=Vu&&Vu[1]?Vu[1]:null,Gu=/Android/i.test(cl),ju=function(){var e=cl.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Xu=/Firefox/i.test(cl),Ku=/Edg/i.test(cl),Yu=/Chrome/i.test(cl)||/CriOS/i.test(cl),Qu=!Ku&&Yu,$u=Ju=function(){var e=cl.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Fu=/MSIE\s(\d+)\.\d/.exec(cl),!(qu=Fu&&parseFloat(Fu[1]))&&/Trident\/7.0/i.test(cl)&&/rv:11.0/.test(cl)&&(qu=11),el=qu,al=/Tizen/i.test(cl),sl=/Web0S/i.test(cl),ol=al||sl,tl=/Safari/i.test(cl)&&!Qu&&!Gu&&!Ku&&!ol,nl=/Windows/i.test(cl),il=/iPad/i.test(cl)||tl&&ul&&!/iPhone/i.test(cl),rl=/iPhone/i.test(cl)&&!il}var dl=rl||il||zu,hl=(tl||dl)&&!Qu,pl=Object.freeze({__proto__:null,get IS_IPOD(){return zu},get IOS_VERSION(){return Wu},get IS_ANDROID(){return Gu},get ANDROID_VERSION(){return ju},get IS_FIREFOX(){return Xu},get IS_EDGE(){return Ku},get IS_CHROMIUM(){return Yu},get IS_CHROME(){return Qu},get CHROMIUM_VERSION(){return $u},get CHROME_VERSION(){return Ju},IS_CHROMECAST_RECEIVER:Zu,get IE_VERSION(){return el},get IS_SAFARI(){return tl},get IS_WINDOWS(){return nl},get IS_IPAD(){return il},get IS_IPHONE(){return rl},get IS_TIZEN(){return al},get IS_WEBOS(){return sl},get IS_SMART_TV(){return ol},TOUCH_ENABLED:ul,IS_IOS:dl,IS_ANY_SAFARI:hl});function fl(e){return"string"==typeof e&&Boolean(e.trim())}function ml(){return Ln===wn.document}function gl(e){return Ou(e)&&1===e.nodeType}function vl(){try{return wn.parent!==wn.self}catch(e){return!0}}function yl(e){return function(t,n){if(!fl(t))return Ln[e](null);fl(n)&&(n=Ln.querySelector(n));var i=gl(n)?n:Ln;return i[e]&&i[e](t)}}function _l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,r=Ln.createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){var n=t[e];"textContent"===e?bl(r,n):r[e]===n&&"tabIndex"!==e||(r[e]=n)}),Object.getOwnPropertyNames(n).forEach(function(e){r.setAttribute(e,n[e])}),i&&jl(r,i),r}function bl(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function Tl(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function kl(e,t){return function(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(t),e.classList.contains(t)}function Sl(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return(t=e.classList).add.apply(t,b(i.reduce(function(e,t){return e.concat(t.split(/\s+/))},[]))),e}function wl(e){var t;if(!e)return Iu.warn("removeClass was called with an element that doesn't exist"),null;for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return(t=e.classList).remove.apply(t,b(i.reduce(function(e,t){return e.concat(t.split(/\s+/))},[]))),e}function El(e,t,n){return"function"==typeof n&&(n=n(e,t)),"boolean"!=typeof n&&(n=void 0),t.split(/\s+/).forEach(function(t){return e.classList.toggle(t,n)}),e}function Cl(e,t){Object.getOwnPropertyNames(t).forEach(function(n){var i=t[n];null==i||!1===i?e.removeAttribute(n):e.setAttribute(n,!0===i?"":i)})}function Al(e){var t={},n=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,r=i.length-1;r>=0;r--){var a=i[r].name,s=i[r].value;n.includes(a)&&(s=null!==s),t[a]=s}return t}function Il(e,t){return e.getAttribute(t)}function xl(e,t,n){e.setAttribute(t,n)}function Ll(e,t){e.removeAttribute(t)}function Dl(){Ln.body.focus(),Ln.onselectstart=function(){return!1}}function Pl(){Ln.onselectstart=function(){return!0}}function Rl(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),n={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n.height||(n.height=parseFloat(zl(e,"height"))),n.width||(n.width=parseFloat(zl(e,"width"))),n}}function Ol(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,n=e.offsetHeight,i=0,r=0;e.offsetParent&&e!==Ln[Su.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:n}}function Nl(e,t){var n={x:0,y:0};if(dl)for(var i=e;i&&"html"!==i.nodeName.toLowerCase();){var r=zl(i,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);n.x+=a[4],n.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);n.x+=s[12],n.y+=s[13]}if(i.assignedSlot&&i.assignedSlot.parentElement&&wn.WebKitCSSMatrix){var o=wn.getComputedStyle(i.assignedSlot.parentElement).transform,u=new wn.WebKitCSSMatrix(o);n.x+=u.m41,n.y+=u.m42}i=i.parentNode||i.host}var l={},c=Ol(t.target),d=Ol(e),h=d.width,p=d.height,f=t.offsetY-(d.top-c.top),m=t.offsetX-(d.left-c.left);return t.changedTouches&&(m=t.changedTouches[0].pageX-d.left,f=t.changedTouches[0].pageY+d.top,dl&&(m-=n.x,f-=n.y)),l.y=1-Math.max(0,Math.min(1,f/p)),l.x=Math.max(0,Math.min(1,m/h)),l}function Ul(e){return Ou(e)&&3===e.nodeType}function Ml(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Bl(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),gl(e)||Ul(e)?e:"string"==typeof e&&/\S/.test(e)?Ln.createTextNode(e):void 0}).filter(function(e){return e})}function jl(e,t){return Bl(t).forEach(function(t){return e.appendChild(t)}),e}function Fl(e,t){return jl(Ml(e),t)}function ql(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||("mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons)))}var Vl=yl("querySelector"),Hl=yl("querySelectorAll");function zl(e,t){if(!e||!t)return"";if("function"==typeof wn.getComputedStyle){var n;try{n=wn.getComputedStyle(e)}catch(vy){return""}return n?n.getPropertyValue(t)||n[t]:""}return""}function Wl(e){b(Ln.styleSheets).forEach(function(t){try{var n=b(t.cssRules).map(function(e){return e.cssText}).join(""),i=Ln.createElement("style");i.textContent=n,e.document.head.appendChild(i)}catch(vy){var r=Ln.createElement("link");r.rel="stylesheet",r.type=t.type,r.media=t.media.mediaText,r.href=t.href,e.document.head.appendChild(r)}})}var Gl,Xl=Object.freeze({__proto__:null,isReal:ml,isEl:gl,isInFrame:vl,createEl:_l,textContent:bl,prependTo:Tl,hasClass:kl,addClass:Sl,removeClass:wl,toggleClass:El,setAttributes:Cl,getAttributes:Al,getAttribute:Il,setAttribute:xl,removeAttribute:Ll,blockTextSelection:Dl,unblockTextSelection:Pl,getBoundingClientRect:Rl,findPosition:Ol,getPointerPosition:Nl,isTextNode:Ul,emptyEl:Ml,normalizeContent:Bl,appendContent:jl,insertContent:Fl,isSingleLeftClick:ql,$:Vl,$$:Hl,computedStyle:zl,copyStyleSheetsToWindow:Wl}),Kl=!1,Yl=function(){if(!1!==Gl.options.autoSetup){var e=Array.prototype.slice.call(Ln.getElementsByTagName("video")),t=Array.prototype.slice.call(Ln.getElementsByTagName("audio")),n=Array.prototype.slice.call(Ln.getElementsByTagName("video-js")),i=e.concat(t,n);if(i&&i.length>0)for(var r=0,a=i.length;r<a;r++){var s=i[r];if(!s||!s.getAttribute){Ql(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&Gl(s)}else Kl||Ql(1)}};function Ql(e,t){ml()&&(t&&(Gl=t),wn.setTimeout(Yl,e))}function $l(){Kl=!0,wn.removeEventListener("load",$l)}ml()&&("complete"===Ln.readyState?$l():wn.addEventListener("load",$l));var Jl,Zl=function(e){var t=Ln.createElement("style");return t.className=e,t},ec=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},tc=new WeakMap,nc=3;function ic(){return nc++}function rc(e,t){if(tc.has(e)){var n=tc.get(e);0===n.handlers[t].length&&(delete n.handlers[t],e.removeEventListener?e.removeEventListener(t,n.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&tc.delete(e)}}function ac(e,t,n,i){n.forEach(function(n){e(t,n,i)})}function sc(e){if(e.fixed_)return e;function t(){return!0}function n(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var i=e||wn.event;e={};var r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(var a in i)r.includes(a)||"returnValue"===a&&i.preventDefault||(e[a]=i[a]);if(e.target||(e.target=e.srcElement||Ln),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){i.preventDefault&&i.preventDefault(),e.returnValue=!1,i.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),e.cancelBubble=!0,i.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=n,e.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=n,null!==e.clientX&&void 0!==e.clientX){var s=Ln.documentElement,o=Ln.body;e.pageX=e.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=e.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var oc=["touchstart","touchmove"];function uc(e,t,n){if(Array.isArray(t))return ac(uc,e,t,n);tc.has(e)||tc.set(e,{});var i=tc.get(e);if(i.handlers||(i.handlers={}),i.handlers[t]||(i.handlers[t]=[]),n.guid||(n.guid=ic()),i.handlers[t].push(n),i.dispatcher||(i.disabled=!1,i.dispatcher=function(t,n){if(!i.disabled){t=sc(t);var r=i.handlers[t.type];if(r)for(var a=r.slice(0),s=0,o=a.length;s<o&&!t.isImmediatePropagationStopped();s++)try{a[s].call(e,t,n)}catch(vy){Iu.error(vy)}}}),1===i.handlers[t].length)if(e.addEventListener){var r=!1;(function(){if("boolean"!=typeof Jl){Jl=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Jl=!0}});wn.addEventListener("test",null,e),wn.removeEventListener("test",null,e)}catch(vy){}}return Jl})()&&oc.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,i.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,i.dispatcher)}function lc(e,t,n){if(tc.has(e)){var i=tc.get(e);if(i.handlers){if(Array.isArray(t))return ac(lc,e,t,n);var r=function(e,t){i.handlers[t]=[],rc(e,t)};if(void 0!==t){var a=i.handlers[t];if(a)if(n){if(n.guid)for(var s=0;s<a.length;s++)a[s].guid===n.guid&&a.splice(s--,1);rc(e,t)}else r(e,t)}else for(var o in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},o)&&r(e,o)}}}function cc(e,t,n){var i=tc.has(e)?tc.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=sc(t),i.dispatcher&&i.dispatcher.call(e,t,n),r&&!t.isPropagationStopped()&&!0===t.bubbles)cc.call(null,r,t,n);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){tc.has(t.target)||tc.set(t.target,{});var a=tc.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function dc(e,t,n){if(Array.isArray(t))return ac(dc,e,t,n);var i=function(){lc(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||ic(),uc(e,t,i)}function hc(e,t,n){var i=function(){lc(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||ic(),uc(e,t,i)}var pc,fc=Object.freeze({__proto__:null,fixEvent:sc,on:uc,off:lc,trigger:cc,one:dc,any:hc}),mc=30,gc=function(e,t,n){t.guid||(t.guid=ic());var i=t.bind(e);return i.guid=n?n+"_"+t.guid:t.guid,i},vc=function(e,t){var n=wn.performance.now();return function(){var i=wn.performance.now();i-n>=t&&(e.apply(void 0,arguments),n=i)}},yc=function(e,t,n){var i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wn,a=function(){var a=this,s=arguments,o=function(){i=null,o=null,n||e.apply(a,s)};!i&&n&&e.apply(a,s),r.clearTimeout(i),i=r.setTimeout(o,t)};return a.cancel=function(){r.clearTimeout(i),i=null},a},_c=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:mc,bind_:gc,throttle:vc,debounce:yc}),bc=function(){return y(function e(){g(this,e)},[{key:"on",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},uc(this,e,t),this.addEventListener=n}},{key:"off",value:function(e,t){lc(this,e,t)}},{key:"one",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},dc(this,e,t),this.addEventListener=n}},{key:"any",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},hc(this,e,t),this.addEventListener=n}},{key:"trigger",value:function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=sc(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),cc(this,e)}},{key:"queueTrigger",value:function(e){var t=this;pc||(pc=new Map);var n=e.type||e,i=pc.get(this);i||(i=new Map,pc.set(this,i));var r=i.get(n);i.delete(n),wn.clearTimeout(r);var a=wn.setTimeout(function(){i.delete(n),0===i.size&&(i=null,pc.delete(t)),t.trigger(e)},0);i.set(n,a)}}])}();bc.prototype.allowedEvents_={},bc.prototype.addEventListener=bc.prototype.on,bc.prototype.removeEventListener=bc.prototype.off,bc.prototype.dispatchEvent=bc.prototype.trigger;var Tc=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:k(e)},kc=function(e){return e instanceof bc||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},Sc=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},wc=function(e,t,n){if(!e||!e.nodeName&&!kc(e))throw new Error("Invalid target for ".concat(Tc(t),"#").concat(n,"; must be a DOM node or evented object."))},Ec=function(e,t,n){if(!Sc(e))throw new Error("Invalid event type for ".concat(Tc(t),"#").concat(n,"; must be a non-empty string or array."))},Cc=function(e,t,n){if("function"!=typeof e)throw new Error("Invalid listener for ".concat(Tc(t),"#").concat(n,"; must be a function."))},Ac=function(e,t,n){var i,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;if(s){i=e.eventBusEl_,t.length>=3&&t.shift();var o=S(t,2);r=o[0],a=o[1]}else i=t[0],r=t[1],a=t[2];return wc(i,e,n),Ec(r,e,n),Cc(a,e,n),{isTargetingSelf:s,target:i,type:r,listener:a=gc(e,a)}},Ic=function(e,t,n,i){wc(e,e,t),e.nodeName?fc[t](e,n,i):e[t](n,i)},xc={on:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"on"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(Ic(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,Ic(this,"on","dispose",l),Ic(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"one"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ic(s,"one",o,u);else{var l=function(){e.off(s,o,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];u.apply(null,n)};l.guid=u.guid,Ic(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"any"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ic(s,"any",o,u);else{var l=function(){e.off(s,o,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];u.apply(null,n)};l.guid=u.guid,Ic(s,"any",o,l)}},off:function(e,t,n){if(!e||Sc(e))lc(this.eventBusEl_,e,t);else{var i=e,r=t;wc(i,this,"off"),Ec(r,this,"off"),Cc(n,this,"off"),n=gc(this,n),this.off("dispose",n),i.nodeName?(lc(i,r,n),lc(i,"dispose",n)):kc(i)&&(i.off(r,n),i.off("dispose",n))}},trigger:function(e,t){wc(this.eventBusEl_,this,"trigger");var n=e&&"string"!=typeof e?e.type:e;if(!Sc(n))throw new Error("Invalid event type for ".concat(Tc(this),"#trigger; ")+"must be a non-empty string or object with a type key that has a non-empty value.");return cc(this.eventBusEl_,e,t)}};function Lc(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).eventBusKey;if(t){if(!e[t].nodeName)throw new Error('The eventBusKey "'.concat(t,'" does not refer to an element.'));e.eventBusEl_=e[t]}else e.eventBusEl_=_l("span",{className:"vjs-event-bus"});return Object.assign(e,xc),e.eventedCallbacks&&e.eventedCallbacks.forEach(function(e){e()}),e.on("dispose",function(){e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&tc.has(e)&&tc.delete(e)}),wn.setTimeout(function(){e.eventBusEl_=null},0)}),e}var Dc={state:{},setState:function(e){var t,n=this;return"function"==typeof e&&(e=e()),Pu(e,function(e,i){n.state[i]!==e&&((t=t||{})[i]={from:n.state[i],to:e}),n.state[i]=e}),t&&kc(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Pc(e,t){return Object.assign(e,Dc),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&kc(e)&&e.on("statechanged",e.handleStateChanged),e}var Rc=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})},Oc=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})},Nc=function(e,t){return Oc(e)===Oc(t)},Uc=Object.freeze({__proto__:null,toLowerCase:Rc,toTitleCase:Oc,titleCaseEquals:Nc}),Mc=function(){function e(t,n,i){var r=this;if(g(this,e),!t&&this.play?this.player_=t=this:this.player_=t,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Uu({},this.options_),n=this.options_=Uu(this.options_,n),this.id_=n.id||n.el&&n.el.id,!this.id_){var a=t&&t.id&&t.id()||"no_player";this.id_="".concat(a,"_component_").concat(ic())}this.name_=n.name||null,n.el?this.el_=n.el:!1!==n.createEl&&(this.el_=this.createEl()),n.className&&this.el_&&n.className.split(" ").forEach(function(e){return r.addClass(e)}),["on","off","one","any","trigger"].forEach(function(e){r[e]=void 0}),!1!==n.evented&&(Lc(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Pc(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,!1!==n.initChildren&&this.initChildren(),this.ready(i),!1!==n.reportTouchActivity&&this.enableTouchActivity()}return y(e,[{key:"dispose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}},{key:"isDisposed",value:function(){return Boolean(this.isDisposed_)}},{key:"player",value:function(){return this.player_}},{key:"options",value:function(e){return e?(this.options_=Uu(this.options_,e),this.options_):this.options_}},{key:"el",value:function(){return this.el_}},{key:"createEl",value:function(e,t,n){return _l(e,t,n)}},{key:"localize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[i],s=i&&i.split("-")[0],o=r&&r[s],u=n;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(e,n){var i=t[n-1],r=i;return void 0===i&&(r=e),r})),u}},{key:"handleLanguagechange",value:function(){}},{key:"contentEl",value:function(){return this.contentEl_||this.el_}},{key:"id",value:function(){return this.id_}},{key:"name",value:function(){return this.name_}},{key:"children",value:function(){return this.children_}},{key:"getChildById",value:function(e){return this.childIndex_[e]}},{key:"getChild",value:function(e){if(e)return this.childNameIndex_[e]}},{key:"getDescendant",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.reduce(function(e,t){return e.concat(t)},[]);for(var i=this,r=0;r<t.length;r++)if(!(i=i.getChild(t[r]))||!i.getChild)return;return i}},{key:"setIcon",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(this.player_.options_.experimentalSvgIcons){var n="http://www.w3.org/2000/svg",i=_l("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),r=Ln.createElementNS(n,"svg");r.setAttributeNS(null,"viewBox","0 0 512 512");var a=Ln.createElementNS(n,"use");return r.appendChild(a),a.setAttributeNS(null,"href","#vjs-icon-".concat(e)),i.appendChild(r),this.iconIsSet_?t.replaceChild(i,t.querySelector(".vjs-icon-placeholder")):t.appendChild(i),this.iconIsSet_=!0,i}}},{key:"addChild",value:function(t){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length;if("string"==typeof t){i=Oc(t);var s=r.componentClass||i;r.name=i;var o=e.getComponent(s);if(!o)throw new Error("Component ".concat(s," does not exist"));if("function"!=typeof o)return null;n=new o(this.player_||this,r)}else n=t;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(a,0,n),n.parentComponent_=this,"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(i=i||n.name&&Oc(n.name()))&&(this.childNameIndex_[i]=n,this.childNameIndex_[Rc(i)]=n),"function"==typeof n.el&&n.el()){var u=null;this.children_[a+1]&&(this.children_[a+1].el_?u=this.children_[a+1].el_:gl(this.children_[a+1])&&(u=this.children_[a+1])),this.contentEl().insertBefore(n.el(),u)}return n}},{key:"removeChild",value:function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Oc(e.name())]=null,this.childNameIndex_[Rc(e.name())]=null;var i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}}},{key:"initChildren",value:function(){var t=this,n=this.options_.children;if(n){var i,r=this.options_,a=e.getComponent("Tech");(i=Array.isArray(n)?n:Object.keys(n)).concat(Object.keys(this.options_).filter(function(e){return!i.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(e){var i,r;return"string"==typeof e?r=n[i=e]||t.options_[i]||{}:(i=e.name,r=e),{name:i,opts:r}}).filter(function(t){var n=e.getComponent(t.opts.componentClass||Oc(t.name));return n&&!a.isTech(n)}).forEach(function(e){var n=e.name,i=e.opts;if(void 0!==r[n]&&(i=r[n]),!1!==i){!0===i&&(i={}),i.playerOptions=t.options_.playerOptions;var a=t.addChild(n,i);a&&(t[n]=a)}})}}},{key:"buildCSSClass",value:function(){return""}},{key:"ready",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}},{key:"triggerReady",value:function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)}},{key:"$",value:function(e,t){return Vl(e,t||this.contentEl())}},{key:"$$",value:function(e,t){return Hl(e,t||this.contentEl())}},{key:"hasClass",value:function(e){return kl(this.el_,e)}},{key:"addClass",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Sl.apply(void 0,[this.el_].concat(t))}},{key:"removeClass",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];wl.apply(void 0,[this.el_].concat(t))}},{key:"toggleClass",value:function(e,t){El(this.el_,e,t)}},{key:"show",value:function(){this.removeClass("vjs-hidden")}},{key:"hide",value:function(){this.addClass("vjs-hidden")}},{key:"lockShowing",value:function(){this.addClass("vjs-lock-showing")}},{key:"unlockShowing",value:function(){this.removeClass("vjs-lock-showing")}},{key:"getAttribute",value:function(e){return Il(this.el_,e)}},{key:"setAttribute",value:function(e,t){xl(this.el_,e,t)}},{key:"removeAttribute",value:function(e){Ll(this.el_,e)}},{key:"width",value:function(e,t){return this.dimension("width",e,t)}},{key:"height",value:function(e,t){return this.dimension("height",e,t)}},{key:"dimensions",value:function(e,t){this.width(e,!0),this.height(t)}},{key:"dimension",value:function(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var i=this.el_.style[e],r=i.indexOf("px");return-1!==r?parseInt(i.slice(0,r),10):parseInt(this.el_["offset"+Oc(e)],10)}},{key:"currentDimension",value:function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=zl(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var n="offset".concat(Oc(e));t=this.el_[n]}return t}},{key:"currentDimensions",value:function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}},{key:"currentWidth",value:function(){return this.currentDimension("width")}},{key:"currentHeight",value:function(){return this.currentDimension("height")}},{key:"getPositions",value:function(){var e=this.el_.getBoundingClientRect();return{boundingClientRect:{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},center:{x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2}}}},{key:"focus",value:function(){this.el_.focus()}},{key:"blur",value:function(){this.el_.blur()}},{key:"handleKeyDown",value:function(e){this.player_&&("Tab"===e.key||this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled||e.stopPropagation(),this.player_.handleKeyDown(e))}},{key:"handleKeyPress",value:function(e){this.handleKeyDown(e)}},{key:"emitTapEvents",value:function(){var e,t=0,n=null;this.on("touchstart",function(i){1===i.touches.length&&(n={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},t=wn.performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(n){var i=t.touches[0].pageX-n.pageX,r=t.touches[0].pageY-n.pageY;Math.sqrt(i*i+r*r)>10&&(e=!1)}});var i=function(){e=!1};this.on("touchleave",i),this.on("touchcancel",i),this.on("touchend",function(i){(n=null,!0===e)&&(wn.performance.now()-t<200&&(i.preventDefault(),this.trigger("tap")))})}},{key:"enableTouchActivity",value:function(){if(this.player()&&this.player().reportUserActivity){var e,t=gc(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var n=function(n){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}}},{key:"setTimeout",value:function(e,t){var n,i=this;return e=gc(this,e),this.clearTimersOnDispose_(),n=wn.setTimeout(function(){i.setTimeoutIds_.has(n)&&i.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}},{key:"clearTimeout",value:function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),wn.clearTimeout(e)),e}},{key:"setInterval",value:function(e,t){e=gc(this,e),this.clearTimersOnDispose_();var n=wn.setInterval(e,t);return this.setIntervalIds_.add(n),n}},{key:"clearInterval",value:function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),wn.clearInterval(e)),e}},{key:"requestAnimationFrame",value:function(e){var t,n=this;return this.clearTimersOnDispose_(),e=gc(this,e),t=wn.requestAnimationFrame(function(){n.rafIds_.has(t)&&n.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}},{key:"requestNamedAnimationFrame",value:function(e,t){var n=this;this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=gc(this,t);var i=this.requestAnimationFrame(function(){t(),n.namedRafs_.has(e)&&n.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}},{key:"cancelNamedAnimationFrame",value:function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}},{key:"cancelAnimationFrame",value:function(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),wn.cancelAnimationFrame(e)),e}},{key:"clearTimersOnDispose_",value:function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var n=S(t,2),i=n[0],r=n[1];e[i].forEach(function(t,n){return e[r](n)})}),e.clearingTimersOnDispose_=!1}))}},{key:"getIsDisabled",value:function(){return Boolean(this.el_.disabled)}},{key:"getIsExpresslyInert",value:function(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}},{key:"getIsFocusable",value:function(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}},{key:"getIsAvailableToBeFocused",value:function(e){function t(e){var t=wn.getComputedStyle(e,null),n=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(n)}return e||(e=this.el()),!!(function(e){if(e.offsetWidth+e.offsetHeight+e.getBoundingClientRect().height+e.getBoundingClientRect().width===0)return!1;var t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(t.x<0)return!1;if(t.x>(Ln.documentElement.clientWidth||wn.innerWidth))return!1;if(t.y<0)return!1;if(t.y>(Ln.documentElement.clientHeight||wn.innerHeight))return!1;for(var n=Ln.elementFromPoint(t.x,t.y);n;){if(n===e)return!0;if(!n.parentNode)return!1;n=n.parentNode}}(e)&&(n=e,t(n.parentElement)&&t(n)&&"0"!==n.style.opacity&&"0px"!==wn.getComputedStyle(n).height&&"0px"!==wn.getComputedStyle(n).width)&&(!e.parentElement||e.tabIndex>=0));var n}}],[{key:"registerComponent",value:function(t,n){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'.concat(t,'"; must be a non-empty string.'));var i,r=e.getComponent("Tech"),a=r&&r.isTech(n),s=e===n||e.prototype.isPrototypeOf(n.prototype);if(a||!s)throw i=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'.concat(t,'"; ').concat(i,"."));t=Oc(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map(function(e){return u[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=n,e.components_[Rc(t)]=n,n}},{key:"getComponent",value:function(t){if(t&&e.components_)return e.components_[t]}}])}();function Bc(e,t,n,i){return function(e,t,n){if("number"!=typeof t||t<0||t>n)throw new Error("Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (").concat(t,") is non-numeric or out of bounds (0-").concat(n,")."))}(e,i,n.length-1),n[i][t]}function jc(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Bc.bind(null,"start",0,e),end:Bc.bind(null,"end",1,e)},wn.Symbol&&wn.Symbol.iterator&&(t[wn.Symbol.iterator]=function(){return(e||[]).values()}),t}function Fc(e,t){return Array.isArray(e)?jc(e):void 0===e||void 0===t?jc():jc([[e,t]])}Mc.registerComponent("Component",Mc);var qc=function(e,t){e=e<0?0:e;var n=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=i=n="-"),(r=r>0||s>0?r+":":"")+(i=((r||a>=10)&&i<10?"0"+i:i)+":")+(n=n<10?"0"+n:n)},Vc=qc;function Hc(e){Vc=e}function zc(){Vc=qc}function Wc(e){return Vc(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e)}var Gc=Object.freeze({__proto__:null,createTimeRanges:Fc,createTimeRange:Fc,setFormatTime:Hc,resetFormatTime:zc,formatTime:Wc});function Xc(e,t){var n,i,r=0;if(!t)return 0;e&&e.length||(e=Fc(0,0));for(var a=0;a<e.length;a++)n=e.start(a),(i=e.end(a))>t&&(i=t),r+=i-n;return r/t}function Kc(e){if(e instanceof Kc)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Ou(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=Kc.defaultMessages[this.code]||"")}function Yc(e){return null!=e&&"function"==typeof e.then}function Qc(e){Yc(e)&&e.then(null,function(e){})}Kc.prototype.code=0,Kc.prototype.message="",Kc.prototype.status=null,Kc.prototype.metadata=null,Kc.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Kc.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."},Kc.MEDIA_ERR_CUSTOM=0,Kc.prototype.MEDIA_ERR_CUSTOM=0,Kc.MEDIA_ERR_ABORTED=1,Kc.prototype.MEDIA_ERR_ABORTED=1,Kc.MEDIA_ERR_NETWORK=2,Kc.prototype.MEDIA_ERR_NETWORK=2,Kc.MEDIA_ERR_DECODE=3,Kc.prototype.MEDIA_ERR_DECODE=3,Kc.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Kc.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Kc.MEDIA_ERR_ENCRYPTED=5,Kc.prototype.MEDIA_ERR_ENCRYPTED=5;var $c=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,n,i){return e[n]&&(t[n]=e[n]),t},{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Jc=function(e){var t=e.$$("track"),n=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=$c(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===n.indexOf(e)}).map($c))},Zc=function(e,t){return e.forEach(function(e){var n=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return n.addCue(e)})}),t.textTracks()},ed="vjs-modal-dialog",td=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleKeyDown_=function(e){return i.handleKeyDown(e)},i.close_=function(e){return i.close(e)},i.opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=_l("div",{className:"".concat(ed,"-content")},{role:"document"}),i.descEl_=_l("p",{className:"".concat(ed,"-description vjs-control-text"),id:i.el().getAttribute("aria-describedby")}),bl(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":"".concat(this.id(),"_description"),"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"}])}},{key:"dispose",value:function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,n(e,"dispose",this,3)([])}},{key:"buildCSSClass",value:function(){return"".concat(ed," vjs-hidden ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"label",value:function(){return this.localize(this.options_.label||"Modal Window")}},{key:"description",value:function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}},{key:"open",value:function(){if(this.opened_)this.options_.fillAlways&&this.fill();else{var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}},{key:"opened",value:function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}},{key:"close",value:function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}}},{key:"closeable",value:function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,n=this.getChild("closeButton");if(t&&!n){var i=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}},{key:"fill",value:function(){this.fillWith(this.content())}},{key:"fillWith",value:function(e){var t=this.contentEl(),n=t.parentNode,i=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Fl(t,e),this.trigger("modalfill"),i?n.insertBefore(t,i):n.appendChild(t);var r=this.getChild("closeButton");r&&n.appendChild(r.el_),this.trigger("aftermodalfill")}},{key:"empty",value:function(){this.trigger("beforemodalempty"),Ml(this.contentEl()),this.trigger("modalempty")}},{key:"content",value:function(e){return void 0!==e&&(this.content_=e),this.content_}},{key:"conditionalFocus_",value:function(){var e=Ln.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}},{key:"conditionalBlur_",value:function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}},{key:"handleKeyDown",value:function(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())return e.preventDefault(),void this.close();if("Tab"===e.key){for(var t,n=this.focusableEls_(),i=this.el_.querySelector(":focus"),r=0;r<n.length;r++)if(i===n[r]){t=r;break}Ln.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||t!==n.length-1||(n[0].focus(),e.preventDefault())}}},{key:"focusableEls_",value:function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,function(e){return(e instanceof wn.HTMLAnchorElement||e instanceof wn.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof wn.HTMLInputElement||e instanceof wn.HTMLSelectElement||e instanceof wn.HTMLTextAreaElement||e instanceof wn.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof wn.HTMLIFrameElement||e instanceof wn.HTMLObjectElement||e instanceof wn.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")})}}])}();td.prototype.options_={pauseOnOpen:!0,temporary:!0},Mc.registerComponent("ModalDialog",td);var nd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e),(t=c(this,e)).tracks_=[],Object.defineProperty(t,"length",{get:function(){return this.tracks_.length}});for(var i=0;i<n.length;i++)t.addTrack(n[i]);return t}return f(e,bc),y(e,[{key:"addTrack",value:function(e){var t=this,n=this.tracks_.length;""+n in this||Object.defineProperty(this,n,{get:function(){return this.tracks_[n]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},kc(e)&&e.addEventListener("labelchange",e.labelchange_)}},{key:"removeTrack",value:function(e){for(var t,n=0,i=this.length;n<i;n++)if(this[n]===e){(t=this[n]).off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}},{key:"getTrackById",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t}}])}();for(var id in nd.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},nd.prototype.allowedEvents_)nd.prototype["on"+id]=null;var rd=function(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].enabled=!1)},ad=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e);for(var i=n.length-1;i>=0;i--)if(n[i].enabled){rd(n,n[i]);break}return(t=c(this,e,[n])).changing_=!1,t}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;t.enabled&&rd(this,t),n(e,"addTrack",this,3)([t]),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,rd(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)}}])}(),sd=function(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].selected=!1)},od=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e);for(var i=n.length-1;i>=0;i--)if(n[i].selected){sd(n,n[i]);break}return(t=c(this,e,[n])).changing_=!1,Object.defineProperty(t,"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),t}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;t.selected&&sd(this,t),n(e,"addTrack",this,3)([t]),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,sd(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)}}])}(),ud=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;n(e,"addTrack",this,3)([t]),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}])}(),ld=function(){return y(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var n=0,i=t.length;n<i;n++)this.addTrackElement_(t[n])},[{key:"addTrackElement_",value:function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}},{key:"getTrackElementByTrack_",value:function(e){for(var t,n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t}},{key:"removeTrackElement_",value:function(e){for(var t=0,n=this.trackElements_.length;t<n;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}])}(),cd=function(){return y(function e(t){g(this,e),e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})},[{key:"setCues_",value:function(e){var t=this.length||0,n=0,i=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<i)for(n=t;n<i;n++)r.call(this,n)}},{key:"getCueById",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t}}])}(),dd={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},hd={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},pd={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},fd={disabled:"disabled",hidden:"hidden",showing:"showing"},md=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),t=c(this,e);var i={id:n.id||"vjs_track_"+ic(),kind:n.kind||"",language:n.language||""},r=n.label||"",a=function(e){Object.defineProperty(t,e,{get:function(){return i[e]},set:function(){}})};for(var s in i)a(s);return Object.defineProperty(t,"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),t}return f(e,bc),y(e)}(),gd=function(e){return new URL(e,Ln.baseURI)},vd=function(e){return new URL(e,Ln.baseURI).href},yd=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},_d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wn.location;return gd(e).origin!==t.origin},bd=Object.freeze({__proto__:null,parseUrl:gd,getAbsoluteURL:vd,getFileExtension:yd,isCrossOrigin:_d}),Td=function(e,t){var n=new wn.WebVTT.Parser(wn,wn.vttjs,wn.WebVTT.StringDecoder()),i=[];n.oncue=function(e){t.addCue(e)},n.onparsingerror=function(e){i.push(e)},n.onflush=function(){t.trigger({type:"loadeddata",target:t})},n.parse(e),i.length>0&&(wn.console&&wn.console.groupCollapsed&&wn.console.groupCollapsed("Text Track parsing errors for ".concat(t.src)),i.forEach(function(e){return Iu.error(e)}),wn.console&&wn.console.groupEnd&&wn.console.groupEnd()),n.flush()},kd=function(e,t){var n={uri:e},i=_d(e);i&&(n.cors=i);var r="use-credentials"===t.tech_.crossOrigin();r&&(n.withCredentials=r),Zn(n,gc(this,function(e,n,i){if(e)return Iu.error(e,n);t.loaded_=!0,"function"!=typeof wn.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return Td(i,t);Iu.error("vttjs failed to load, stopping trying to process ".concat(t.src))}):Td(i,t)}))},Sd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(g(this,e),!n.tech)throw new Error("A tech was not provided.");var i=Uu(n,{kind:pd[n.kind]||"subtitles",language:n.language||n.srclang||""}),r=fd[i.mode]||"disabled",a=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(r="hidden"),(t=c(this,e,[i])).tech_=i.tech,t.cues_=[],t.activeCues_=[],t.preload_=!1!==t.tech_.preloadTextTracks;var s=new cd(t.cues_),o=new cd(t.activeCues_),u=!1;t.timeupdateHandler=gc(t,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});return t.tech_.one("dispose",function(){t.stopTracking()}),"disabled"!==r&&t.startTracking(),Object.defineProperties(t,{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){fd[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||kd(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],n=0,i=this.cues.length;n<i;n++){var r=this.cues[n];r.startTime<=e&&r.endTime>=e&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),i.src?(t.src=i.src,t.preload_||(t.loaded_=!0),(t.preload_||"subtitles"!==i.kind&&"captions"!==i.kind)&&kd(t.src,t)):t.loaded_=!0,t}return f(e,md),y(e,[{key:"startTracking",value:function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}},{key:"stopTracking",value:function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}},{key:"addCue",value:function(e){var t=e;if(!("getCueAsHTML"in t)){for(var n in t=new wn.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}for(var i=this.tech_.textTracks(),r=0;r<i.length;r++)i[r]!==this&&i[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}},{key:"removeCue",value:function(e){for(var t=this.cues_.length;t--;){var n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}])}();Sd.prototype.allowedEvents_={cuechange:"cuechange"};var wd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e);var i=Uu(n,{kind:hd[n.kind]||""});t=c(this,e,[i]);var r=!1;return Object.defineProperty(t,"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),i.enabled&&(t.enabled=i.enabled),t.loaded_=!0,t}return f(e,md),y(e)}(),Ed=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e);var i=Uu(n,{kind:dd[n.kind]||""});t=c(this,e,[i]);var r=!1;return Object.defineProperty(t,"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),i.selected&&(t.selected=i.selected),t}return f(e,md),y(e)}(),Cd=function(){function e(){var t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),t=c(this,e);var r=new Sd(i);return t.kind=r.kind,t.src=r.src,t.srclang=r.language,t.label=r.label,t.default=r.default,Object.defineProperties(t,{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=e.NONE,r.addEventListener("loadeddata",function(){n=e.LOADED,t.trigger({type:"load",target:t})}),t}return f(e,bc),y(e)}();Cd.prototype.allowedEvents_={load:"load"},Cd.NONE=0,Cd.LOADING=1,Cd.LOADED=2,Cd.ERROR=3;var Ad={audio:{ListClass:ad,TrackClass:wd,capitalName:"Audio"},video:{ListClass:od,TrackClass:Ed,capitalName:"Video"},text:{ListClass:ud,TrackClass:Sd,capitalName:"Text"}};Object.keys(Ad).forEach(function(e){Ad[e].getterName="".concat(e,"Tracks"),Ad[e].privateName="".concat(e,"Tracks_")});var Id={remoteText:{ListClass:ud,TrackClass:Sd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:ld,TrackClass:Cd,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},xd=Object.assign({},Ad,Id);Id.names=Object.keys(Id),Ad.names=Object.keys(Ad),xd.names=[].concat(Id.names).concat(Ad.names);var Ld=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};return g(this,e),n.reportTouchActivity=!1,(t=c(this,e,[null,n,i])).onDurationChange_=function(e){return t.onDurationChange(e)},t.trackProgress_=function(e){return t.trackProgress(e)},t.trackCurrentTime_=function(e){return t.trackCurrentTime(e)},t.stopTrackingCurrentTime_=function(e){return t.stopTrackingCurrentTime(e)},t.disposeSourceHandler_=function(e){return t.disposeSourceHandler(e)},t.queuedHanders_=new Set,t.hasStarted_=!1,t.on("playing",function(){this.hasStarted_=!0}),t.on("loadstart",function(){this.hasStarted_=!1}),xd.names.forEach(function(e){var i=xd[e];n&&n[i.getterName]&&(t[i.privateName]=n[i.getterName])}),t.featuresProgressEvents||t.manualProgressOn(),t.featuresTimeupdateEvents||t.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(e){!1===n["native".concat(e,"Tracks")]&&(t["featuresNative".concat(e,"Tracks")]=!1)}),!1===n.nativeCaptions||!1===n.nativeTextTracks?t.featuresNativeTextTracks=!1:!0!==n.nativeCaptions&&!0!==n.nativeTextTracks||(t.featuresNativeTextTracks=!0),t.featuresNativeTextTracks||t.emulateTextTracks(),t.preloadTextTracks=!1!==n.preloadTextTracks,t.autoRemoteTextTracks_=new xd.text.ListClass,t.initTrackListeners(),n.nativeControlsForTouch||t.emitTapEvents(),t.constructor&&(t.name_=t.constructor.name||"Unknown Tech"),t}return f(e,Mc),y(e,[{key:"triggerSourceset",value:function(e){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)}),this.trigger({src:e,type:"sourceset"})}},{key:"manualProgressOn",value:function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}},{key:"manualProgressOff",value:function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}},{key:"trackProgress",value:function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(gc(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)}},{key:"onDurationChange",value:function(e){this.duration_=this.duration()}},{key:"buffered",value:function(){return Fc(0,0)}},{key:"bufferedPercent",value:function(){return Xc(this.buffered(),this.duration_)}},{key:"stopTrackingProgress",value:function(){this.clearInterval(this.progressInterval)}},{key:"manualTimeUpdatesOn",value:function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}},{key:"manualTimeUpdatesOff",value:function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}},{key:"trackCurrentTime",value:function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}},{key:"stopTrackingCurrentTime",value:function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}},{key:"dispose",value:function(){this.clearTracks(Ad.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),n(e,"dispose",this,3)([])}},{key:"clearTracks",value:function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var n=t["".concat(e,"Tracks")]()||[],i=n.length;i--;){var r=n[i];"text"===e&&t.removeRemoteTextTrack(r),n.removeTrack(r)}})}},{key:"cleanupAutoTextTracks",value:function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var n=e[t];this.removeRemoteTextTrack(n)}}},{key:"reset",value:function(){}},{key:"crossOrigin",value:function(){}},{key:"setCrossOrigin",value:function(){}},{key:"error",value:function(e){return void 0!==e&&(this.error_=new Kc(e),this.trigger("error")),this.error_}},{key:"played",value:function(){return this.hasStarted_?Fc(0,0):Fc()}},{key:"play",value:function(){}},{key:"setScrubbing",value:function(e){}},{key:"scrubbing",value:function(){}},{key:"setCurrentTime",value:function(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}},{key:"initTrackListeners",value:function(){var e=this;Ad.names.forEach(function(t){var n=Ad[t],i=function(){e.trigger("".concat(t,"trackchange"))},r=e[n.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),e.on("dispose",function(){r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}},{key:"addWebVttScript_",value:function(){var e=this;if(!wn.WebVTT)if(Ln.body.contains(this.el())){if(!this.options_["vtt.js"]&&Nu(Bi)&&Object.keys(Bi).length>0)return void this.trigger("vttjsloaded");var t=Ln.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",function(){t.onload=null,t.onerror=null}),wn.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)}},{key:"emulateTextTracks",value:function(){var e=this,t=this.textTracks(),n=this.remoteTextTracks(),i=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};n.on("addtrack",i),n.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var n=t[e];n.removeEventListener("cuechange",a),"showing"===n.mode&&n.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",function(){n.off("addtrack",i),n.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",a)}})}},{key:"addTextTrack",value:function(e,t,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=e.textTracks();r.kind=t,n&&(r.label=n),i&&(r.language=i),r.tech=e;var s=new xd.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,n)}},{key:"createRemoteTextTrack",value:function(e){var t=Uu(e,{tech:this});return new Id.remoteTextEl.TrackClass(t)}},{key:"addRemoteTextTrack",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=this.createRemoteTextTrack(t);return"boolean"!=typeof n&&(n=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===n&&this.ready(function(){return e.autoRemoteTextTracks_.addTrack(i.track)}),i}},{key:"removeRemoteTextTrack",value:function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}},{key:"getVideoPlaybackQuality",value:function(){return{}}},{key:"requestPictureInPicture",value:function(){return Promise.reject()}},{key:"disablePictureInPicture",value:function(){return!0}},{key:"setDisablePictureInPicture",value:function(){}},{key:"requestVideoFrameCallback",value:function(e){var t=this,n=ic();return!this.isReady_||this.paused()?(this.queuedHanders_.add(n),this.one("playing",function(){t.queuedHanders_.has(n)&&(t.queuedHanders_.delete(n),e())})):this.requestNamedAnimationFrame(n,e),n}},{key:"cancelVideoFrameCallback",value:function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}},{key:"setPoster",value:function(){}},{key:"playsinline",value:function(){}},{key:"setPlaysinline",value:function(){}},{key:"overrideNativeAudioTracks",value:function(e){}},{key:"overrideNativeVideoTracks",value:function(e){}},{key:"canPlayType",value:function(e){return""}}],[{key:"canPlayType",value:function(e){return""}},{key:"canPlaySource",value:function(t,n){return e.canPlayType(t.type)}},{key:"isTech",value:function(t){return t.prototype instanceof e||t instanceof e||t===e}},{key:"registerTech",value:function(t,n){if(e.techs_||(e.techs_={}),!e.isTech(n))throw new Error("Tech ".concat(t," must be a Tech"));if(!e.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!e.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=Oc(t),e.techs_[t]=n,e.techs_[Rc(t)]=n,"Tech"!==t&&e.defaultTechOrder_.push(t),n}},{key:"getTech",value:function(t){if(t)return e.techs_&&e.techs_[t]?e.techs_[t]:(t=Oc(t),wn&&wn.videojs&&wn.videojs[t]?(Iu.warn("The ".concat(t," tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)")),wn.videojs[t]):void 0)}}])}();xd.names.forEach(function(e){var t=xd[e];Ld.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),Ld.prototype.featuresVolumeControl=!0,Ld.prototype.featuresMuteControl=!0,Ld.prototype.featuresFullscreenResize=!1,Ld.prototype.featuresPlaybackRate=!1,Ld.prototype.featuresProgressEvents=!1,Ld.prototype.featuresSourceset=!1,Ld.prototype.featuresTimeupdateEvents=!1,Ld.prototype.featuresNativeTextTracks=!1,Ld.prototype.featuresVideoFrameCallback=!1,Ld.withSourceHandlers=function(e){e.registerSourceHandler=function(t,n){var i=e.sourceHandlers;i||(i=e.sourceHandlers=[]),void 0===n&&(n=i.length),i.splice(n,0,t)},e.canPlayType=function(t){for(var n,i=e.sourceHandlers||[],r=0;r<i.length;r++)if(n=i[r].canPlayType(t))return n;return""},e.selectSourceHandler=function(t,n){for(var i=e.sourceHandlers||[],r=0;r<i.length;r++)if(i[r].canHandleSource(t,n))return i[r];return null},e.canPlaySource=function(t,n){var i=e.selectSourceHandler(t,n);return i?i.canHandleSource(t,n):""};["seekable","seeking","duration"].forEach(function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},e.prototype),e.prototype.setSource=function(t){var n=e.selectSourceHandler(t,this.options_);n||(e.nativeSourceHandler?n=e.nativeSourceHandler:Iu.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),n!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=n.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Mc.registerComponent("Tech",Ld),Ld.registerTech("Tech",Ld),Ld.defaultTechOrder_=[];var Dd={},Pd={},Rd={};function Od(e,t,n){e.setTimeout(function(){return Fd(t,Dd[t.type],n,e)},1)}function Nd(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r="call"+Oc(n),a=e.reduce(jd(r),i),s=a===Rd,o=s?null:t[n](a);return function(e,t,n,i){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](i,n)}}(e,n,o,s),o}var Ud={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Md={setCurrentTime:1,setMuted:1,setVolume:1},Bd={play:1,pause:1};function jd(e){return function(t,n){return t===Rd?Rd:n[e]?n[e](t):t}}function Fd(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=A(e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])||T(e)||E(e)||w(),o=s[0],u=C(s).slice(1);if("string"==typeof o)Fd(t,Dd[o],n,i,r,a);else if(o){var l=function(e,t){var n=Pd[e.id()],i=null;if(null==n)return i=t(e),Pd[e.id()]=[[t,i]],i;for(var r=0;r<n.length;r++){var a=S(n[r],2),s=a[0],o=a[1];s===t&&(i=o)}return null===i&&(i=t(e),n.push([t,i])),i}(i,o);if(!l.setSource)return r.push(l),Fd(t,u,n,i,r,a);l.setSource(Object.assign({},t),function(e,s){if(e)return Fd(t,u,n,i,r,a);r.push(l),Fd(s,t.type===s.type?u:Dd[s.type],n,i,r,a)})}else u.length?Fd(t,u,n,i,r,a):a?n(t,r):Fd(t,Dd["*"],n,i,r,!0)}var qd={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Vd=function(){var e=yd(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"");return qd[e.toLowerCase()]||""},Hd=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){e=Hd(e),Array.isArray(e)?t=t.concat(e):Ou(e)&&t.push(e)}),e=t}else e="string"==typeof e&&e.trim()?[zd({src:e})]:Ou(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[zd(e)]:[];return e};function zd(e){if(!e.type){var t=Vd(e.src);t&&(e.type=t)}return e}var Wd=al?10009:sl?461:8,Gd={codes:{play:415,pause:19,ff:417,rw:412,back:Wd},names:I({415:"play",19:"pause",417:"ff",412:"rw"},Wd,"back"),isEventKey:function(e,t){return t=t.toLowerCase(),!(!this.names[e.keyCode]||this.names[e.keyCode]!==t)},getEventName:function(e){if(this.names[e.keyCode])return this.names[e.keyCode];if(this.codes[e.code]){var t=this.codes[e.code];return this.names[t]}return null}},Xd=function(){function e(t){var n;return g(this,e),(n=c(this,e)).player_=t,n.focusableComponents=[],n.isListening_=!1,n.isPaused_=!1,n.onKeyDown_=n.onKeyDown_.bind(n),n.lastFocusedComponent_=null,n}return f(e,bc),y(e,[{key:"start",value:function(){var e=this;this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",function(){e.focus(e.updateFocusableComponents()[0])}),this.player_.on("modalclose",function(){e.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",function(){e.updateFocusableComponents(),e.focusableComponents.length&&(e.focusableComponents.length>1?e.focusableComponents[1].focus():e.focusableComponents[0].focus())}))}},{key:"stop",value:function(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}},{key:"onKeyDown_",value:function(e){var t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();var n=t.key.substring(5).toLowerCase();this.move(n)}else if(Gd.isEventKey(t,"play")||Gd.isEventKey(t,"pause")||Gd.isEventKey(t,"ff")||Gd.isEventKey(t,"rw")){t.preventDefault();var i=Gd.getEventName(t);this.performMediaAction_(i)}else Gd.isEventKey(t,"Back")&&e.target&&"function"==typeof e.target.closeable&&e.target.closeable()&&(t.preventDefault(),e.target.close())}},{key:"performMediaAction_",value:function(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+5);break;case"rw":this.userSeek_(this.player_.currentTime()-5)}}},{key:"userSeek_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}},{key:"pause",value:function(){this.isPaused_=!0}},{key:"resume",value:function(){this.isPaused_=!1}},{key:"handlePlayerBlur_",value:function(e){var t=e.relatedTarget,n=null,i=this.getCurrentComponent(e.target);t&&(n=Boolean(t.closest(".video-js")),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(e.currentTarget.contains(e.relatedTarget)||n)&&t||(i&&"CloseButton"===i.name()?this.refocusComponent():(this.pause(),i&&i.el()&&(this.lastFocusedComponent_=i)))}},{key:"handlePlayerFocus_",value:function(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}},{key:"updateFocusableComponents",value:function(){var e=this,t=this.player_,n=[];function i(e){var t,r=_(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;a.hasOwnProperty("el_")&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el())&&n.push(a),a.hasOwnProperty("children_")&&a.children_.length>0&&i(a.children_)}}catch(s){r.e(s)}finally{r.f()}}return t.children_.forEach(function(t){if(t.hasOwnProperty("el_")){if(t.getIsFocusable&&t.getIsAvailableToBeFocused&&t.getIsFocusable()&&t.getIsAvailableToBeFocused(t.el()))return void n.push(t);t.hasOwnProperty("children_")&&t.children_.length>0?i(t.children_):t.hasOwnProperty("items")&&t.items.length>0?i(t.items):e.findSuitableDOMChild(t)&&n.push(t)}if("ErrorDisplay"===t.name_&&t.opened_){var r=t.el_.querySelector(".vjs-errors-ok-button-container");if(r)r.querySelectorAll("button").forEach(function(e,t){n.push({name:function(){return"ModalButton"+(t+1)},el:function(){return e},getPositions:function(){var t=e.getBoundingClientRect();return{boundingClientRect:{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},center:{x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2}}},getIsAvailableToBeFocused:function(){return!0},getIsFocusable:function(e){return!0},focus:function(){return e.focus()}})})}}),this.focusableComponents=n,this.focusableComponents}},{key:"findSuitableDOMChild",value:function(e){return e.el()?function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(var i=0;i<n.children.length;i++){var r=t(n.children[i]);if(r)return r}return null}(e.el()):null}},{key:"getCurrentComponent",value:function(e){this.updateFocusableComponents();var t=e||document.activeElement;if(this.focusableComponents.length){var n,i=_(this.focusableComponents);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.el()===t)return r}}catch(a){i.e(a)}finally{i.f()}}}},{key:"add",value:function(e){var t=b(this.focusableComponents);e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}},{key:"remove",value:function(e){for(var t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name())return this.focusableComponents.splice(t,1),void this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}},{key:"clear",value:function(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}},{key:"move",value:function(e){var t=this,n=this.getCurrentComponent();if(n){var i=n.getPositions(),r=this.focusableComponents.filter(function(r){return r!==n&&t.isInDirection_(i.boundingClientRect,r.getPositions().boundingClientRect,e)}),a=this.findBestCandidate_(i.center,r,e);a?this.focus(a):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:n})}}},{key:"findBestCandidate_",value:function(e,t,n){var i,r=1/0,a=null,s=_(t);try{for(s.s();!(i=s.n()).done;){var o=i.value,u=o.getPositions().center,l=this.calculateDistance_(e,u,n);l<r&&(r=l,a=o)}}catch(c){s.e(c)}finally{s.f()}return a}},{key:"isInDirection_",value:function(e,t,n){switch(n){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}},{key:"refocusComponent",value:function(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(var e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name())return void this.focus(this.focusableComponents[e])}else this.focus(this.updateFocusableComponents()[0])}},{key:"focus",value:function(e){"object"===k(e)&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}},{key:"calculateDistance_",value:function(e,t,n){var i,r=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);switch(n){case"right":case"left":i=r+100*a;break;case"up":i=2*a+.5*r;break;case"down":i=5*a+r;break;default:i=r+a}return i}},{key:"searchForTrackSelect_",value:function(){var e,t=_(this.updateFocusableComponents());try{for(t.s();!(e=t.n()).done;){var n=e.value;if("TextTrackSelect"===n.constructor.name){this.focus(n);break}}}catch(i){t.e(i)}finally{t.f()}}}])}(),Kd=function(){function e(t,n,i){var r;if(g(this,e),r=c(this,e,[t,Uu({createEl:!1},n),i]),n.playerOptions.sources&&0!==n.playerOptions.sources.length)t.src(n.playerOptions.sources);else for(var a=0,s=n.playerOptions.techOrder;a<s.length;a++){var o=Oc(s[a]),u=Ld.getTech(o);if(o||(u=Mc.getComponent(o)),u&&u.isSupported()){t.loadTech_(o);break}}return r}return f(e,Mc),y(e)}();Mc.registerComponent("MediaLoader",Kd);var Yd=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).options_.controlText&&i.controlText(i.options_.controlText),i.handleMouseOver_=function(e){return i.handleMouseOver(e)},i.handleMouseOut_=function(e){return i.handleMouseOut(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.emitTapEvents(),i.enable(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&Iu.error("Creating a ClickableComponent with an HTML element of ".concat(e," is not supported; use a Button instead.")),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;var i=_l(e,t,n);return this.player_.options_.experimentalSvgIcons||i.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i}},{key:"dispose",value:function(){this.controlTextEl_=null,n(e,"dispose",this,3)([])}},{key:"createControlTextEl",value:function(e){return this.controlTextEl_=_l("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}},{key:"controlText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(void 0===e)return this.controlText_||"Need Text";var n=this.localize(e);this.controlText_=e,bl(this.controlTextEl_,n),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",n)}},{key:"buildCSSClass",value:function(){return"vjs-control vjs-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"enable",value:function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}},{key:"disable",value:function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}},{key:"handleLanguagechange",value:function(){this.controlText(this.controlText_)}},{key:"handleClick",value:function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}},{key:"handleKeyDown",value:function(t){" "===t.key||"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n(e,"handleKeyDown",this,3)([t])}}])}();Mc.registerComponent("ClickableComponent",Yd);var Qd=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update(),i.update_=function(e){return i.update(e)},t.on("posterchange",i.update_),i}return f(e,Yd),y(e,[{key:"dispose",value:function(){this.player().off("posterchange",this.update_),n(e,"dispose",this,3)([])}},{key:"createEl",value:function(){return _l("div",{className:"vjs-poster"})}},{key:"crossOrigin",value:function(e){if(void 0===e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null===e||"anonymous"===e||"use-credentials"===e?this.$("img")&&(this.$("img").crossOrigin=e):this.player_.log.warn('crossOrigin must be null, "anonymous" or "use-credentials", given "'.concat(e,'"'))}},{key:"update",value:function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}},{key:"setSrc",value:function(e){e?(this.$("img")||this.el_.appendChild(_l("picture",{className:"vjs-poster",tabIndex:-1},{},_l("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}},{key:"handleClick",value:function(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Qc(this.player_.play()):this.player_.pause())}}])}();Qd.prototype.crossorigin=Qd.prototype.crossOrigin,Mc.registerComponent("PosterImage",Qd);var $d="#222",Jd="#ccc",Zd={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function eh(e,t){var n;if(4===e.length)n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");n=e.slice(1)}return"rgba("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+","+t+")"}function th(e,t,n){try{e.style[t]=n}catch(vy){return}}function nh(e){return e?"".concat(e,"px"):""}var ih=function(){function e(t,n,i){var r;g(this,e),r=c(this,e,[t,n,i]);var a=function(e){r.updateDisplayOverlay(),r.updateDisplay(e)};return t.on("loadstart",function(e){return r.toggleDisplay(e)}),t.on("texttrackchange",function(e){return r.updateDisplay(e)}),t.on("loadedmetadata",function(e){r.updateDisplayOverlay(),r.preselectTrack(e)}),t.ready(gc(r,function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a);var e=wn.screen.orientation||wn,n=wn.screen.orientation?"change":"orientationchange";e.addEventListener(n,a),t.on("dispose",function(){return e.removeEventListener(n,a)});for(var i=this.options_.playerOptions.tracks||[],r=0;r<i.length;r++)this.player_.addRemoteTextTrack(i[r],!0);this.preselectTrack()}})),r}return f(e,Mc),y(e,[{key:"preselectTrack",value:function(){for(var e,t,n,i={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in i?o.kind===a.kind?n=o:n||(n=o):a&&!a.enabled?(n=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in i&&!t&&(t=o):e=o)}n?n.mode="showing":t?t.mode="showing":e&&(e.mode="showing")}},{key:"toggleDisplay",value:function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"}])}},{key:"clearDisplay",value:function(){"function"==typeof wn.WebVTT&&wn.WebVTT.processCues(wn,[],this.el_)}},{key:"updateDisplay",value:function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var n=[],i=0;i<e.length;++i){var r=e[i];"showing"===r.mode&&n.push(r)}this.updateForTrack(n)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}if(s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a)),!wn.CSS.supports("inset","10px")){var l=this.el_,c=l.querySelectorAll(".vjs-text-track-cue"),d=this.player_.controlBar.el_.getBoundingClientRect().height,h=this.player_.el_.getBoundingClientRect().height;l.style="",th(l,"position","relative"),th(l,"height",h-d+"px"),th(l,"top","unset"),th(l,"bottom",ol?h+"px":"0px"),c.length>0&&c.forEach(function(e){if(e.style.inset){var t=e.style.inset.split(" ");3===t.length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}})}}}},{key:"updateDisplayOverlay",value:function(){if(this.player_.videoHeight()&&wn.CSS.supports("inset-inline: 10px")){var e=this.player_.currentWidth(),t=this.player_.currentHeight(),n=e/t,i=this.player_.videoWidth()/this.player_.videoHeight(),r=0,a=0;Math.abs(n-i)>.1&&(n>i?r=Math.round((e-t*i)/2):a=Math.round((t-e/i)/2)),th(this.el_,"insetInline",nh(r)),th(this.el_,"insetBlock",nh(a))}}},{key:"updateDisplayState",value:function(e){for(var t=this.player_.textTrackSettings.getValues(),n=e.activeCues,i=n.length;i--;){var r=n[i];if(r){var a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&th(a.firstChild,"color",eh(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&th(a.firstChild,"backgroundColor",eh(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?th(a,"backgroundColor",eh(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?a.firstChild.style.textShadow="2px 2px 3px ".concat($d,", 2px 2px 4px ").concat($d,", 2px 2px 5px ").concat($d):"raised"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px ".concat($d,", 2px 2px ").concat($d,", 3px 3px ").concat($d):"depressed"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px ".concat(Jd,", 0 1px ").concat(Jd,", -1px -1px ").concat($d,", 0 -1px ").concat($d):"uniform"===t.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px ".concat($d,", 0 0 4px ").concat($d,", 0 0 4px ").concat($d,", 0 0 4px ").concat($d))),t.fontPercent&&1!==t.fontPercent){var s=wn.parseFloat(a.style.fontSize);a.style.fontSize=s*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=Zd[t.fontFamily])}}}},{key:"updateForTrack",value:function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof wn.WebVTT&&!e.every(function(e){return!e.activeCues})){for(var t=[],n=0;n<e.length;++n)for(var i=e[n],r=0;r<i.activeCues.length;++r)t.push(i.activeCues[r]);wn.WebVTT.processCues(wn,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;Sl(u,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:a)),s.language&&xl(u,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}}}])}();Mc.registerComponent("TextTrackDisplay",ih);var rh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),r=_l("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),a=n(e,"createEl",this,3)(["div",{className:"vjs-loading-spinner",dir:"ltr"}]);return a.appendChild(r),a}},{key:"handleLanguagechange",value:function(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}])}();Mc.registerComponent("LoadingSpinner",rh);var ah=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Yd),y(e,[{key:"createEl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_l(e="button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n));return this.player_.options_.experimentalSvgIcons||i.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i}},{key:"addChild",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.constructor.name;return Iu.warn("Adding an actionable (user controllable) child to a Button (".concat(n,") is not supported; use a ClickableComponent instead.")),Mc.prototype.addChild.call(this,e,t)}},{key:"enable",value:function(){n(e,"enable",this,3)([]),this.el_.removeAttribute("disabled")}},{key:"disable",value:function(){n(e,"disable",this,3)([]),this.el_.setAttribute("disabled","disabled")}},{key:"handleKeyDown",value:function(t){" "!==t.key&&"Enter"!==t.key?n(e,"handleKeyDown",this,3)([t]):t.stopPropagation()}}])}();Mc.registerComponent("Button",ah);var sh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).mouseused_=!1,i.setIcon("play"),i.on("mousedown",function(e){return i.handleMouseDown(e)}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-big-play-button"}},{key:"handleClick",value:function(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)return Qc(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());var n=this.player_.getChild("controlBar"),i=n&&n.getChild("playToggle");if(i){var r=function(){return i.focus()};Yc(t)?t.then(r,function(){}):this.setTimeout(r,1)}else this.player_.tech(!0).focus()}},{key:"handleKeyDown",value:function(t){this.mouseused_=!1,n(e,"handleKeyDown",this,3)([t])}},{key:"handleMouseDown",value:function(e){this.mouseused_=!0}}])}();sh.prototype.controlText_="Play Video",Mc.registerComponent("BigPlayButton",sh);var oh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("cancel"),i.controlText(n&&n.controlText||i.localize("Close")),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-close-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){this.trigger({type:"close",bubbles:!1})}},{key:"handleKeyDown",value:function(t){"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n(e,"handleKeyDown",this,3)([t])}}])}();Mc.registerComponent("CloseButton",oh);var uh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),n=c(this,e,[t,i]),i.replay=void 0===i.replay||i.replay,n.setIcon("play"),n.on(t,"play",function(e){return n.handlePlay(e)}),n.on(t,"pause",function(e){return n.handlePause(e)}),i.replay&&n.on(t,"ended",function(e){return n.handleEnded(e)}),n}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-play-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){this.player_.paused()?Qc(this.player_.play()):this.player_.pause()}},{key:"handleSeeked",value:function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}},{key:"handlePlay",value:function(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}},{key:"handlePause",value:function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}},{key:"handleEnded",value:function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",function(e){return t.handleSeeked(e)})}}])}();uh.prototype.controlText_="Play",Mc.registerComponent("PlayToggle",uh);var lh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,["timeupdate","ended","seeking"],function(e){return i.update(e)}),i.updateTextNode_(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=this.buildCSSClass(),i=n(e,"createEl",this,3)(["div",{className:"".concat(t," vjs-time-control vjs-control")}]),r=_l("span",{className:"vjs-control-text",textContent:"".concat(this.localize(this.labelText_)," ")},{role:"presentation"});return i.appendChild(r),this.contentEl_=_l("span",{className:"".concat(t,"-display")},{role:"presentation"}),i.appendChild(this.contentEl_),i}},{key:"dispose",value:function(){this.contentEl_=null,this.textNode_=null,n(e,"dispose",this,3)([])}},{key:"update",value:function(e){(this.player_.options_.enableSmoothSeeking||"seeking"!==e.type)&&this.updateContent(e)}},{key:"updateTextNode_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;t=Wc(t),this.formattedTime_!==t&&(this.formattedTime_=t,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(e.contentEl_){var t=e.textNode_;t&&e.contentEl_.firstChild!==t&&(t=null,Iu.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),e.textNode_=Ln.createTextNode(e.formattedTime_),e.textNode_&&(t?e.contentEl_.replaceChild(e.textNode_,t):e.contentEl_.appendChild(e.textNode_))}}))}},{key:"updateContent",value:function(e){}}])}();lh.prototype.labelText_="Time",lh.prototype.controlText_="Time",Mc.registerComponent("TimeDisplay",lh);var ch=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-current-time"}},{key:"updateContent",value:function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}])}();ch.prototype.labelText_="Current Time",ch.prototype.controlText_="Current Time",Mc.registerComponent("CurrentTimeDisplay",ch);var dh=function(){function e(t,n){var i;g(this,e);var r=function(e){return i.updateContent(e)};return(i=c(this,e,[t,n])).on(t,"durationchange",r),i.on(t,"loadstart",r),i.on(t,"loadedmetadata",r),i}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-duration"}},{key:"updateContent",value:function(e){var t=this.player_.duration();this.updateTextNode_(t)}}])}();dh.prototype.labelText_="Duration",dh.prototype.controlText_="Duration",Mc.registerComponent("DurationDisplay",dh);var hh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}]),i=n(e,"createEl",this,3)(["div"]),r=n(e,"createEl",this,3)(["span",{textContent:"/"}]);return i.appendChild(r),t.appendChild(i),t}}])}();Mc.registerComponent("TimeDivider",hh);var ph=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,"durationchange",function(e){return i.updateContent(e)}),i}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-remaining-time"}},{key:"createEl",value:function(){var t=n(e,"createEl",this,3)([]);return!1!==this.options_.displayNegative&&t.insertBefore(_l("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t}},{key:"updateContent",value:function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))}}])}();ph.prototype.labelText_="Remaining Time",ph.prototype.controlText_="Remaining Time",Mc.registerComponent("RemainingTimeDisplay",ph);var fh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).updateShowing(),i.on(i.player(),"durationchange",function(e){return i.updateShowing(e)}),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-live-control vjs-control"}]);return this.contentEl_=_l("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(_l("span",{className:"vjs-control-text",textContent:"".concat(this.localize("Stream Type")," ")})),this.contentEl_.appendChild(Ln.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t}},{key:"dispose",value:function(){this.contentEl_=null,n(e,"dispose",this,3)([])}},{key:"updateShowing",value:function(e){this.player().duration()===1/0?this.show():this.hide()}}])}();Mc.registerComponent("LiveDisplay",fh);var mh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).updateLiveEdgeStatus(),i.player_.liveTracker&&(i.updateLiveEdgeStatusHandler_=function(e){return i.updateLiveEdgeStatus(e)},i.on(i.player_.liveTracker,"liveedgechange",i.updateLiveEdgeStatusHandler_)),i}return f(e,ah),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["button",{className:"vjs-seek-to-live-control vjs-control"}]);return this.setIcon("circle",t),this.textEl_=_l("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t}},{key:"updateLiveEdgeStatus",value:function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}},{key:"handleClick",value:function(){this.player_.liveTracker.seekToLiveEdge()}},{key:"dispose",value:function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,n(e,"dispose",this,3)([])}}])}();function gh(e,t,n){return e=Number(e),Math.min(n,Math.max(t,isNaN(e)?t:e))}mh.prototype.controlText_="Seek to live, currently playing live",Mc.registerComponent("SeekToLive",mh);var vh=Object.freeze({__proto__:null,clamp:gh}),yh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleMouseDown_=function(e){return i.handleMouseDown(e)},i.handleMouseUp_=function(e){return i.handleMouseUp(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleMouseMove_=function(e){return i.handleMouseMove(e)},i.update_=function(e){return i.update(e)},i.bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}return f(e,Mc),y(e,[{key:"enabled",value:function(){return this.enabled_}},{key:"enable",value:function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}},{key:"disable",value:function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}}},{key:"createEl",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.className=i.className+" vjs-slider",i=Object.assign({tabIndex:0},i),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),n(e,"createEl",this,3)([t,i,r])}},{key:"handleMouseDown",value:function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Qu||e.preventDefault(),Dl(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}},{key:"handleMouseMove",value:function(e){}},{key:"handleMouseUp",value:function(e){var t=this.bar.el_.ownerDocument;Pl(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}},{key:"update",value:function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",function(){var n=e.vertical()?"height":"width";e.bar.el().style[n]=(100*t).toFixed(2)+"%"})),t}}},{key:"getProgress",value:function(){return Number(gh(this.getPercent(),0,1).toFixed(4))}},{key:"calculateDistance",value:function(e){var t=Nl(this.el_,e);return this.vertical()?t.y:t.x}},{key:"handleKeyDown",value:function(t){var i=this.options_.playerOptions.spatialNavigation,r=i&&i.enabled,a=i&&i.horizontalSeek;r?a&&"ArrowLeft"===t.key||!a&&"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepBack()):a&&"ArrowRight"===t.key||!a&&"ArrowUp"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepForward()):n(e,"handleKeyDown",this,3)([t]):"ArrowLeft"===t.key||"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepBack()):"ArrowUp"===t.key||"ArrowRight"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepForward()):n(e,"handleKeyDown",this,3)([t])}},{key:"handleClick",value:function(e){e.stopPropagation(),e.preventDefault()}},{key:"vertical",value:function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}])}();Mc.registerComponent("Slider",yh);var _h=function(e,t){return gh(e/t*100,0,100).toFixed(2)+"%"},bh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).partEls_=[],i.on(t,"progress",function(e){return i.update(e)}),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-load-progress"}]),i=_l("span",{className:"vjs-control-text"}),r=_l("span",{textContent:this.localize("Loaded")}),a=Ln.createTextNode(": ");return this.percentageEl_=_l("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(r),i.appendChild(a),i.appendChild(this.percentageEl_),t}},{key:"dispose",value:function(){this.partEls_=null,this.percentageEl_=null,n(e,"dispose",this,3)([])}},{key:"update",value:function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var e=t.player_.liveTracker,n=t.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=_h(r,i);t.percent_!==s&&(t.el_.style.width=s,bl(t.percentageEl_,s),t.percent_=s);for(var o=0;o<n.length;o++){var u=n.start(o),l=n.end(o),c=a[o];c||(c=t.el_.appendChild(_l()),a[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=_h(u,r),c.style.width=_h(l-u,r))}for(var d=a.length;d>n.length;d--)t.el_.removeChild(a[d-1]);a.length=n.length})}}])}();Mc.registerComponent("LoadProgressBar",bh);var Th=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t,n){var i=Ol(this.el_),r=Rl(this.player_.el()),a=e.width*t;if(r&&i){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right);o||(o=e.width-a,s=a);var u=i.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>i.width&&(u=i.width),u=Math.round(u),this.el_.style.right="-".concat(u,"px"),this.write(n)}}},{key:"write",value:function(e){bl(this.el_,e)}},{key:"updateTime",value:function(e,t,n,i){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+Wc(u,o)}else a=Wc(n,s);r.update(e,t,a),i&&i()})}}])}();Mc.registerComponent("TimeTooltip",Th);var kh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("circle"),i.update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t){var n=this.getChild("timeTooltip");if(n){var i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,i)}}}])}();kh.prototype.options_={children:[]},dl||Gu||kh.prototype.options_.children.push("timeTooltip"),Mc.registerComponent("PlayProgressBar",kh);var Sh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-mouse-display"}])}},{key:"update",value:function(e,t){var n=this,i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,function(){n.el_.style.left="".concat(e.width*t,"px")})}}])}();Sh.prototype.options_={children:["timeTooltip"]},Mc.registerComponent("MouseTimeDisplay",Sh);var wh=function(){function e(t,n){var i;g(this,e),(n=Uu(e.prototype.options_,n)).children=b(n.children);var r=t.options_.disableSeekWhileScrubbingOnMobile&&(dl||Gu);return(!dl&&!Gu||r)&&n.children.splice(1,0,"mouseTimeDisplay"),(i=c(this,e,[t,n])).shouldDisableSeekWhileScrubbingOnMobile_=r,i.pendingSeekTime_=null,i.setEventHandlers_(),i}return f(e,yh),y(e,[{key:"setEventHandlers_",value:function(){var e=this;this.update_=gc(this,this.update),this.update=vc(this.update_,mc),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Ln&&"visibilityState"in Ln&&this.on(Ln,"visibilitychange",this.toggleVisibility_)}},{key:"toggleVisibility_",value:function(e){"hidden"===Ln.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}},{key:"enableInterval_",value:function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,mc))}},{key:"disableInterval_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")}])}},{key:"update",value:function(t){var i=this;if("hidden"!==Ln.visibilityState){var r=n(e,"update",this,3)([]);return this.requestNamedAnimationFrame("SeekBar#update",function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,n=i.player_.duration();t&&t.isLive()&&(n=i.player_.liveTracker.liveCurrentTime()),i.percent_!==r&&(i.el_.setAttribute("aria-valuenow",(100*r).toFixed(2)),i.percent_=r),i.currentTime_===e&&i.duration_===n||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[Wc(e,n),Wc(n,n)],"{1} of {2}")),i.currentTime_=e,i.duration_=n),i.bar&&i.bar.update(Rl(i.el()),i.getProgress())}),r}}},{key:"userSeek_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}},{key:"getCurrentTime_",value:function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}},{key:"getPercent",value:function(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();var e,t=this.getCurrentTime_(),n=this.player_.liveTracker;return n&&n.isLive()?(e=(t-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e}},{key:"handleMouseDown",value:function(t){ql(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),n(e,"handleMouseDown",this,3)([t]))}},{key:"handleMouseMove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ql(e)&&!isNaN(this.player_.duration())){var n;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var i=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(i>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((n=a+i*r.liveWindow())>=s&&(n=s),n<=a&&(n=a+.1),n===1/0)return}else(n=i*this.player_.duration())===this.player_.duration()&&(n-=.1);this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=n:this.userSeek_(n),this.player_.options_.enableSmoothSeeking&&this.update()}}},{key:"enable",value:function(){n(e,"enable",this,3)([]);var t=this.getChild("mouseTimeDisplay");t&&t.show()}},{key:"disable",value:function(){n(e,"disable",this,3)([]);var t=this.getChild("mouseTimeDisplay");t&&t.hide()}},{key:"handleMouseUp",value:function(t){n(e,"handleMouseUp",this,3)([t]),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Qc(this.player_.play()):this.update_()}},{key:"stepForward",value:function(){this.userSeek_(this.player_.currentTime()+5)}},{key:"stepBack",value:function(){this.userSeek_(this.player_.currentTime()-5)}},{key:"handleAction",value:function(e){this.player_.paused()?this.player_.play():this.player_.pause()}},{key:"handleKeyDown",value:function(t){var i=this.player_.liveTracker;if(" "===t.key||"Enter"===t.key)t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if("Home"===t.key)t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if("End"===t.key)t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(t.key)){t.preventDefault(),t.stopPropagation();var r=.1*parseInt(t.key,10);i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else"PageDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):"PageUp"===t.key?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):n(e,"handleKeyDown",this,3)([t])}},{key:"dispose",value:function(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Ln&&"visibilityState"in Ln&&this.off(Ln,"visibilitychange",this.toggleVisibility_),n(e,"dispose",this,3)([])}}])}();wh.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Mc.registerComponent("SeekBar",wh);var Eh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleMouseMove=vc(gc(i,i.handleMouseMove),mc),i.throttledHandleMouseSeek=vc(gc(i,i.handleMouseSeek),mc),i.handleMouseUpHandler_=function(e){return i.handleMouseUp(e)},i.handleMouseDownHandler_=function(e){return i.handleMouseDown(e)},i.enable(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-progress-control vjs-control"}])}},{key:"handleMouseMove",value:function(e){var t=this.getChild("seekBar");if(t){var n=t.getChild("playProgressBar"),i=t.getChild("mouseTimeDisplay");if(n||i){var r=t.el(),a=Ol(r),s=Nl(r,e).x;s=gh(s,0,1),i&&i.update(a,s),n&&n.update(a,t.getProgress())}}}},{key:"handleMouseSeek",value:function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}},{key:"enabled",value:function(){return this.enabled_}},{key:"disable",value:function(){if(this.children().forEach(function(e){return e.disable&&e.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Qc(this.player_.play())}}},{key:"enable",value:function(){this.children().forEach(function(e){return e.enable&&e.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}},{key:"removeListenersAddedOnMousedownAndTouchstart",value:function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}},{key:"handleMouseDown",value:function(e){var t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}},{key:"handleMouseUp",value:function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}])}();Eh.prototype.options_={children:["seekBar"]},Mc.registerComponent("ProgressControl",Eh);var Ch=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("picture-in-picture-enter"),i.on(t,["enterpictureinpicture","leavepictureinpicture"],function(e){return i.handlePictureInPictureChange(e)}),i.on(t,["disablepictureinpicturechanged","loadedmetadata"],function(e){return i.handlePictureInPictureEnabledChange(e)}),i.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){return i.handlePictureInPictureAudioModeChange()}),i.disable(),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-picture-in-picture-control vjs-hidden ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handlePictureInPictureAudioModeChange",value:function(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}},{key:"handlePictureInPictureEnabledChange",value:function(){Ln.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in wn?this.enable():this.disable()}},{key:"handlePictureInPictureChange",value:function(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}},{key:"handleClick",value:function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}},{key:"show",value:function(){"function"==typeof Ln.exitPictureInPicture&&n(e,"show",this,3)([])}}])}();Ch.prototype.controlText_="Picture-in-Picture",Mc.registerComponent("PictureInPictureToggle",Ch);var Ah=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("fullscreen-enter"),i.on(t,"fullscreenchange",function(e){return i.handleFullscreenChange(e)}),!1===Ln[t.fsApi_.fullscreenEnabled]&&i.disable(),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-fullscreen-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleFullscreenChange",value:function(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}},{key:"handleClick",value:function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}])}();Ah.prototype.controlText_="Fullscreen",Mc.registerComponent("FullscreenToggle",Ah);var Ih=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-volume-level"}]);return this.setIcon("circle",t),t.appendChild(n(e,"createEl",this,3)(["span",{className:"vjs-control-text"}])),t}}])}();Mc.registerComponent("VolumeLevel",Ih);var xh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t,n,i){if(!n){var r=Rl(this.el_),a=Rl(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;o<l?l+=l-o:u<l&&(l=u),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-".concat(l,"px")}this.write("".concat(i,"%"))}},{key:"write",value:function(e){bl(this.el_,e)}},{key:"updateVolume",value:function(e,t,n,i,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){a.update(e,t,n,i.toFixed(0)),r&&r()})}}])}();Mc.registerComponent("VolumeLevelTooltip",xh);var Lh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-mouse-display"}])}},{key:"update",value:function(e,t,n){var i=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,function(){n?i.el_.style.bottom="".concat(e.height*t,"px"):i.el_.style.left="".concat(e.width*t,"px")})}}])}();Lh.prototype.options_={children:["volumeLevelTooltip"]},Mc.registerComponent("MouseVolumeLevelDisplay",Lh);var Dh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on("slideractive",function(e){return i.updateLastVolume_(e)}),i.on(t,"volumechange",function(e){return i.updateARIAAttributes(e)}),t.ready(function(){return i.updateARIAAttributes()}),i}return f(e,yh),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"}])}},{key:"handleMouseDown",value:function(t){ql(t)&&n(e,"handleMouseDown",this,3)([t])}},{key:"handleMouseMove",value:function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var n=this.el(),i=Rl(n),r=this.vertical(),a=Nl(n,e);a=gh(a=r?a.y:a.x,0,1),t.update(i,a,r)}ql(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}},{key:"checkMuted",value:function(){this.player_.muted()&&this.player_.muted(!1)}},{key:"getPercent",value:function(){return this.player_.muted()?0:this.player_.volume()}},{key:"stepForward",value:function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}},{key:"stepBack",value:function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}},{key:"updateARIAAttributes",value:function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}},{key:"volumeAsPercentage_",value:function(){return Math.round(100*this.player_.volume())}},{key:"updateLastVolume_",value:function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})}}])}();Dh.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},dl||Gu||Dh.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Dh.prototype.playerEvent="volumechange",Mc.registerComponent("VolumeBar",Dh);var Ph=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.vertical=i.vertical||!1,(void 0===i.volumeBar||Nu(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(n=c(this,e,[t,i]),t),n.throttledHandleMouseMove=vc(gc(n,n.handleMouseMove),mc),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",function(e){return n.handleMouseDown(e)}),n.on("touchstart",function(e){return n.handleMouseDown(e)}),n.on("mousemove",function(e){return n.handleMouseMove(e)}),n.on(n.volumeBar,["focus","slideractive"],function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")}),n.on(n.volumeBar,["blur","sliderinactive"],function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")}),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),n(e,"createEl",this,3)(["div",{className:"vjs-volume-control vjs-control ".concat(t)}])}},{key:"handleMouseDown",value:function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}},{key:"handleMouseUp",value:function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}},{key:"handleMouseMove",value:function(e){this.volumeBar.handleMouseMove(e)}}])}();Ph.prototype.options_={children:["volumeBar"]},Mc.registerComponent("VolumeControl",Ph);var Rh=function(){function e(t,n){var i;return g(this,e),function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(i=c(this,e,[t,n]),t),i.on(t,["loadstart","volumechange"],function(e){return i.update(e)}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-mute-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){var t=this.player_.volume(),n=this.player_.lastVolume_();if(0===t){var i=n<.1?.1:n;this.player_.volume(i),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}},{key:"update",value:function(e){this.updateIcon_(),this.updateControlText_()}},{key:"updateIcon_",value:function(){var e=this.player_.volume(),t=3;this.setIcon("volume-high"),dl&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),wl(this.el_,[0,1,2,3].reduce(function(e,t){return e+"".concat(t?" ":"","vjs-vol-").concat(t)},"")),Sl(this.el_,"vjs-vol-".concat(t))}},{key:"updateControlText_",value:function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}])}();Rh.prototype.controlText_="Mute",Mc.registerComponent("MuteToggle",Rh);var Oh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||Nu(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=c(this,e,[t,i])).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],function(e){return n.volumePanelState_(e)}),n.on(n.muteToggle,"keyup",function(e){return n.handleKeyPress(e)}),n.on(n.volumeControl,"keyup",function(e){return n.handleVolumeControlKeyUp(e)}),n.on("keydown",function(e){return n.handleKeyPress(e)}),n.on("mouseover",function(e){return n.handleMouseOver(e)}),n.on("mouseout",function(e){return n.handleMouseOut(e)}),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}return f(e,Mc),y(e,[{key:"sliderActive_",value:function(){this.addClass("vjs-slider-active")}},{key:"sliderInactive_",value:function(){this.removeClass("vjs-slider-active")}},{key:"volumePanelState_",value:function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}},{key:"createEl",value:function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),n(e,"createEl",this,3)(["div",{className:"vjs-volume-panel vjs-control ".concat(t)}])}},{key:"dispose",value:function(){this.handleMouseOut(),n(e,"dispose",this,3)([])}},{key:"handleVolumeControlKeyUp",value:function(e){"Escape"===e.key&&this.muteToggle.focus()}},{key:"handleMouseOver",value:function(e){this.addClass("vjs-hover"),uc(Ln,"keyup",this.handleKeyPressHandler_)}},{key:"handleMouseOut",value:function(e){this.removeClass("vjs-hover"),lc(Ln,"keyup",this.handleKeyPressHandler_)}},{key:"handleKeyPress",value:function(e){"Escape"===e.key&&this.handleMouseOut()}}])}();Oh.prototype.options_={children:["muteToggle","volumeControl"]},Mc.registerComponent("VolumePanel",Oh);var Nh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).validOptions=[5,10,30],i.skipTime=i.getSkipForwardTime(),i.skipTime&&i.validOptions.includes(i.skipTime)?(i.setIcon("forward-".concat(i.skipTime)),i.controlText(i.localize("Skip forward {1} seconds",[i.skipTime.toLocaleString(t.language())])),i.show()):i.hide(),i}return f(e,ah),y(e,[{key:"getSkipForwardTime",value:function(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}},{key:"buildCSSClass",value:function(){return"vjs-skip-forward-".concat(this.getSkipForwardTime()," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){if(!isNaN(this.player_.duration())){var t,n=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()?i.seekableEnd():this.player_.duration();t=n+this.skipTime<=r?n+this.skipTime:r,this.player_.currentTime(t)}}},{key:"handleLanguagechange",value:function(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}])}();Nh.prototype.controlText_="Skip Forward",Mc.registerComponent("SkipForward",Nh);var Uh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).validOptions=[5,10,30],i.skipTime=i.getSkipBackwardTime(),i.skipTime&&i.validOptions.includes(i.skipTime)?(i.setIcon("replay-".concat(i.skipTime)),i.controlText(i.localize("Skip backward {1} seconds",[i.skipTime.toLocaleString(t.language())])),i.show()):i.hide(),i}return f(e,ah),y(e,[{key:"getSkipBackwardTime",value:function(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}},{key:"buildCSSClass",value:function(){return"vjs-skip-backward-".concat(this.getSkipBackwardTime()," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){var t,n=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()&&i.seekableStart();t=r&&n-this.skipTime<=r?r:n>=this.skipTime?n-this.skipTime:0,this.player_.currentTime(t)}},{key:"handleLanguagechange",value:function(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}])}();Uh.prototype.controlText_="Skip Backward",Mc.registerComponent("SkipBackward",Uh);var Mh=function(){function e(t,n){var i;return g(this,e),i=c(this,e,[t,n]),n&&(i.menuButton_=n.menuButton),i.focusedChild_=-1,i.on("keydown",function(e){return i.handleKeyDown(e)}),i.boundHandleBlur_=function(e){return i.handleBlur(e)},i.boundHandleTapClick_=function(e){return i.handleTapClick(e)},i}return f(e,Mc),y(e,[{key:"addEventListenerForItem",value:function(e){e instanceof Mc&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}},{key:"removeEventListenerForItem",value:function(e){e instanceof Mc&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}},{key:"removeChild",value:function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),n(e,"removeChild",this,3)([t])}},{key:"addItem",value:function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)}},{key:"createEl",value:function(){var t=this.options_.contentElType||"ul";this.contentEl_=_l(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=n(e,"createEl",this,3)(["div",{append:this.contentEl_,className:"vjs-menu"}]);return i.appendChild(this.contentEl_),uc(i,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),i}},{key:"dispose",value:function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,n(e,"dispose",this,3)([])}},{key:"handleBlur",value:function(e){var t=e.relatedTarget||Ln.activeElement;if(!this.children().some(function(e){return e.el()===t})){var n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}},{key:"handleTapClick",value:function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var n=t.filter(function(t){return t.el()===e.target})[0];if(!n)return;"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus()}}},{key:"handleKeyDown",value:function(e){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),e.stopPropagation(),this.stepBack())}},{key:"stepForward",value:function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}},{key:"stepBack",value:function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}])}();Mc.registerComponent("Menu",Mh);var Bh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e),(n=c(this,e,[t,i])).menuButton_=new ah(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=ah.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",function(e){return n.handleKeyDown(e)}),n.on(n.menuButton_,"mouseenter",function(){n.addClass("vjs-hover"),n.menu.show(),uc(Ln,"keyup",n.handleMenuKeyUp_)}),n.on("mouseleave",function(e){return n.handleMouseLeave(e)}),n.on("keydown",function(e){return n.handleSubmenuKeyDown(e)}),n}return f(e,Mc),y(e,[{key:"update",value:function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}},{key:"createMenu",value:function(){var e=new Mh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=_l("li",{className:"vjs-menu-title",textContent:Oc(this.options_.title),tabIndex:-1}),n=new Mc(this.player_,{el:t});e.addItem(n)}if(this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)e.addItem(this.items[i]);return e}},{key:"createItems",value:function(){}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildWrapperCSSClass()},{}])}},{key:"setIcon",value:function(t){n(e,"setIcon",this,3)([t,this.menuButton_.el_])}},{key:"buildWrapperCSSClass",value:function(){var t="vjs-menu-button";!0===this.options_.inline?t+="-inline":t+="-popup";var i=ah.prototype.buildCSSClass();return"vjs-menu-button ".concat(t," ").concat(i," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button ".concat(t," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"controlText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(e,t)}},{key:"dispose",value:function(){this.handleMouseLeave(),n(e,"dispose",this,3)([])}},{key:"handleClick",value:function(e){this.buttonPressed_?this.unpressButton():this.pressButton()}},{key:"handleMouseLeave",value:function(e){this.removeClass("vjs-hover"),lc(Ln,"keyup",this.handleMenuKeyUp_)}},{key:"focus",value:function(){this.menuButton_.focus()}},{key:"blur",value:function(){this.menuButton_.blur()}},{key:"handleKeyDown",value:function(e){"Escape"===e.key||"Tab"===e.key?(this.buttonPressed_&&this.unpressButton(),"Tab"===!e.key&&(e.preventDefault(),this.menuButton_.focus())):"Up"!==e.key&&("Down"!==e.key||this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)||this.buttonPressed_||(e.preventDefault(),this.pressButton())}},{key:"handleMenuKeyUp",value:function(e){"Escape"!==e.key&&"Tab"!==e.key||this.removeClass("vjs-hover")}},{key:"handleSubmenuKeyPress",value:function(e){this.handleSubmenuKeyDown(e)}},{key:"handleSubmenuKeyDown",value:function(e){"Escape"!==e.key&&"Tab"!==e.key||(this.buttonPressed_&&this.unpressButton(),"Tab"===!e.key&&(e.preventDefault(),this.menuButton_.focus()))}},{key:"pressButton",value:function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),dl&&vl())return;this.menu.focus()}}},{key:"unpressButton",value:function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}},{key:"disable",value:function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}},{key:"enable",value:function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}])}();Mc.registerComponent("MenuButton",Bh);var jh=function(){function e(t,n){var i;g(this,e);var r=n.tracks;if((i=c(this,e,[t,n])).items.length<=1&&i.hide(),!r)return d(i);var a=gc(i,i.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),r.addEventListener("labelchange",a),i.player_.on("ready",a),i.player_.on("dispose",function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a),r.removeEventListener("labelchange",a)}),i}return f(e,Bh),y(e)}();Mc.registerComponent("TrackButton",jh);var Fh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).selectable=n.selectable,i.isSelected_=n.selected||!1,i.multiSelectable=n.multiSelectable,i.selected(i.isSelected_),i.selectable?i.multiSelectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitemradio"):i.el_.setAttribute("role","menuitem"),i}return f(e,Yd),y(e,[{key:"createEl",value:function(t,i,r){this.nonIconControl=!0;var a=n(e,"createEl",this,3)(["li",Object.assign({className:"vjs-menu-item",tabIndex:-1},i),r]),s=_l("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?a.appendChild(s):a.replaceChild(s,a.querySelector(".vjs-icon-placeholder")),a}},{key:"handleKeyDown",value:function(t){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(t.key)||n(e,"handleKeyDown",this,3)([t])}},{key:"handleClick",value:function(e){this.selected(!0)}},{key:"selected",value:function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}])}();Mc.registerComponent("MenuItem",Fh);var qh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=t.textTracks();n.label=r.label||r.language||"Unknown",n.selected="showing"===r.mode,(i=c(this,e,[t,n])).track=r,i.kinds=(n.kinds||[n.kind||i.track.kind]).filter(Boolean);var s,o=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleTracksChange.apply(i,t)},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleSelectedLanguageChange.apply(i,t)};(t.on(["loadstart","texttrackchange"],o),a.addEventListener("change",o),a.addEventListener("selectedlanguagechange",u),i.on("dispose",function(){t.off(["loadstart","texttrackchange"],o),a.removeEventListener("change",o),a.removeEventListener("selectedlanguagechange",u)}),void 0===a.onchange)&&i.on(["tap","click"],function(){if("object"!==k(wn.Event))try{s=new wn.Event("change")}catch(e){}s||(s=Ln.createEvent("Event")).initEvent("change",!0,!0),a.dispatchEvent(s)});return i.handleTracksChange(),i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){var i=this.track,r=this.player_.textTracks();if(n(e,"handleClick",this,3)([t]),r)for(var a=0;a<r.length;a++){var s=r[a];-1!==this.kinds.indexOf(s.kind)&&(s===i?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled"))}}},{key:"handleTracksChange",value:function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}},{key:"handleSelectedLanguageChange",value:function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}},{key:"dispose",value:function(){this.track=null,n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("TextTrackMenuItem",qh);var Vh=function(){function e(t,n){return g(this,e),n.track={player:t,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,c(this,e,[t,n])}return f(e,qh),y(e,[{key:"handleTracksChange",value:function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n!==this.isSelected_&&this.selected(n)}},{key:"handleSelectedLanguageChange",value:function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}},{key:"handleLanguagechange",value:function(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),n(e,"handleLanguagechange",this,3)([])}}])}();Mc.registerComponent("OffTextTrackMenuItem",Vh);var Hh=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),n.tracks=t.textTracks(),c(this,e,[t,n])}return f(e,jh),y(e,[{key:"createItems",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qh;this.label_&&(e="".concat(this.label_," off")),t.push(new Vh(this.player_,{kinds:this.kinds_,kind:this.kind_,label:e})),this.hideThreshold_+=1;var i=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<i.length;r++){var a=i[r];if(this.kinds_.indexOf(a.kind)>-1){var s=new n(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-".concat(a.kind,"-menu-item")),t.push(s)}}return t}}])}();Mc.registerComponent("TextTrackButton",Hh);var zh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=n.cue,s=t.currentTime();return n.selectable=!0,n.multiSelectable=!1,n.label=a.text,n.selected=a.startTime<=s&&s<a.endTime,(i=c(this,e,[t,n])).track=r,i.cue=a,i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){n(e,"handleClick",this,3)([]),this.player_.currentTime(this.cue.startTime)}}])}();Mc.registerComponent("ChaptersTrackMenuItem",zh);var Wh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("chapters"),r.selectCurrentItem_=function(){r.items.forEach(function(e){e.selected(r.track_.activeCues[0]===e.cue)})},r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-chapters-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-chapters-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"update",value:function(t){if(!t||!t.track||"chapters"===t.track.kind){var i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),n(e,"update",this,3)([])):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&n(e,"update",this,3)([])}}},{key:"setTrack",value:function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}},{key:"findChaptersTrack",value:function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var n=e[t];if(n.kind===this.kind_)return n}}},{key:"getMenuCaption",value:function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Oc(this.kind_))}},{key:"createMenu",value:function(){return this.options_.title=this.getMenuCaption(),n(e,"createMenu",this,3)([])}},{key:"createItems",value:function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var n=0,i=t.length;n<i;n++){var r=t[n],a=new zh(this.player_,{track:this.track_,cue:r});e.push(a)}return e}}])}();Wh.prototype.kind_="chapters",Wh.prototype.controlText_="Chapters",Mc.registerComponent("ChaptersButton",Wh);var Gh=function(){function e(t,n,i){var r;g(this,e),(r=c(this,e,[t,n,i])).setIcon("audio-description");var a=t.textTracks(),s=gc(r,r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",function(){a.removeEventListener("change",s)}),r}return f(e,Hh),y(e,[{key:"handleTracksChange",value:function(e){for(var t=this.player().textTracks(),n=!1,i=0,r=t.length;i<r;i++){var a=t[i];if(a.kind!==this.kind_&&"showing"===a.mode){n=!0;break}}n?this.disable():this.enable()}},{key:"buildCSSClass",value:function(){return"vjs-descriptions-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-descriptions-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}}])}();Gh.prototype.kind_="descriptions",Gh.prototype.controlText_="Descriptions",Mc.registerComponent("DescriptionsButton",Gh);var Xh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("subtitles"),r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-subtitles-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-subtitles-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}}])}();Xh.prototype.kind_="subtitles",Xh.prototype.controlText_="Subtitles",Mc.registerComponent("SubtitlesButton",Xh);var Kh=function(){function e(t,n){var i;return g(this,e),n.track={player:t,kind:n.kind,label:n.kind+" settings",selectable:!1,default:!1,mode:"disabled"},n.selectable=!1,n.name="CaptionSettingsMenuItem",(i=c(this,e,[t,n])).addClass("vjs-texttrack-settings"),i.controlText(", opens "+n.kind+" settings dialog"),i}return f(e,qh),y(e,[{key:"handleClick",value:function(e){this.player().getChild("textTrackSettings").open()}},{key:"handleLanguagechange",value:function(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),n(e,"handleLanguagechange",this,3)([])}}])}();Mc.registerComponent("CaptionSettingsMenuItem",Kh);var Yh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("captions"),r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-captions-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-captions-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kh(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n(e,"createItems",this,3)([t])}}])}();Yh.prototype.kind_="captions",Yh.prototype.controlText_="Captions",Mc.registerComponent("CaptionsButton",Yh);var Qh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,qh),y(e,[{key:"createEl",value:function(t,i,r){var a=n(e,"createEl",this,3)([t,i,r]),s=a.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",a):s.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(_l("span",{className:"vjs-control-text",textContent:" ".concat(this.localize("Captions"))}))),a}}])}();Mc.registerComponent("SubsCapsMenuItem",Qh);var $h=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).label_="subtitles",n.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions",n.setIcon("captions")),n.menuButton_.controlText(Oc(n.label_)),n}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-subs-caps-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-subs-caps-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kh(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=n(e,"createItems",this,3)([t,Qh])}}])}();$h.prototype.kinds_=["captions","subtitles"],$h.prototype.controlText_="Subtitles",Mc.registerComponent("SubsCapsButton",$h);var Jh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=t.audioTracks();n.label=r.label||r.language||"Unknown",n.selected=r.enabled,(i=c(this,e,[t,n])).track=r,i.addClass("vjs-".concat(r.kind,"-menu-item"));var s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleTracksChange.apply(i,t)};return a.addEventListener("change",s),i.on("dispose",function(){a.removeEventListener("change",s)}),i}return f(e,Fh),y(e,[{key:"createEl",value:function(t,i,r){var a=n(e,"createEl",this,3)([t,i,r]),s=a.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(_l("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),a}},{key:"handleClick",value:function(t){if(n(e,"handleClick",this,3)([t]),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var i=this.player_.audioTracks(),r=0;r<i.length;r++){var a=i[r];a!==this.track&&(a.enabled=a===this.track)}}},{key:"handleTracksChange",value:function(e){this.selected(this.track.enabled)}}])}();Mc.registerComponent("AudioTrackMenuItem",Jh);var Zh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.tracks=t.audioTracks(),(n=c(this,e,[t,i])).setIcon("audio"),n}return f(e,jh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-audio-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-audio-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;for(var t=this.player_.audioTracks(),n=0;n<t.length;n++){var i=t[n];e.push(new Jh(this.player_,{track:i,selectable:!0,multiSelectable:!1}))}return e}}])}();Zh.prototype.controlText_="Audio Track",Mc.registerComponent("AudioTrackButton",Zh);var ep=function(){function e(t,n){var i;g(this,e);var r=n.rate,a=parseFloat(r,10);return n.label=r,n.selected=a===t.playbackRate(),n.selectable=!0,n.multiSelectable=!1,(i=c(this,e,[t,n])).label=r,i.rate=a,i.on(t,"ratechange",function(e){return i.update(e)}),i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){n(e,"handleClick",this,3)([]),this.player().playbackRate(this.rate)}},{key:"update",value:function(e){this.selected(this.player().playbackRate()===this.rate)}}])}();ep.prototype.contentElType="button",Mc.registerComponent("PlaybackRateMenuItem",ep);var tp=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).menuButton_.el_.setAttribute("aria-describedby",i.labelElId_),i.updateVisibility(),i.updateLabel(),i.on(t,"loadstart",function(e){return i.updateVisibility(e)}),i.on(t,"ratechange",function(e){return i.updateLabel(e)}),i.on(t,"playbackrateschange",function(e){return i.handlePlaybackRateschange(e)}),i}return f(e,Bh),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)([]);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=_l("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t}},{key:"dispose",value:function(){this.labelEl_=null,n(e,"dispose",this,3)([])}},{key:"buildCSSClass",value:function(){return"vjs-playback-rate ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-playback-rate ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){for(var e=this.playbackRates(),t=[],n=e.length-1;n>=0;n--)t.push(new ep(this.player(),{rate:e[n]+"x"}));return t}},{key:"handlePlaybackRateschange",value:function(e){this.update()}},{key:"playbackRates",value:function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}},{key:"playbackRateSupported",value:function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}},{key:"updateVisibility",value:function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}},{key:"updateLabel",value:function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}])}();tp.prototype.controlText_="Playback Rate",Mc.registerComponent("PlaybackRateMenuButton",tp);var np=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"buildCSSClass",value:function(){return"vjs-spacer ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.className||(i.className=this.buildCSSClass()),n(e,"createEl",this,3)([t,i,r])}}])}();Mc.registerComponent("Spacer",np);var ip=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,np),y(e,[{key:"buildCSSClass",value:function(){return"vjs-custom-control-spacer ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildCSSClass(),textContent:" "}])}}])}();Mc.registerComponent("CustomControlSpacer",ip);var rp=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-control-bar",dir:"ltr"}])}}])}();rp.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},Mc.registerComponent("ControlBar",rp);var ap=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,"error",function(e){i.open(e)}),i}return f(e,td),y(e,[{key:"buildCSSClass",value:function(){return"vjs-error-display ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"content",value:function(){var e=this.player().error();return e?this.localize(e.message):""}}])}();ap.prototype.options_=Object.assign({},td.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Mc.registerComponent("ErrorDisplay",ap);var sp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).el_.setAttribute("aria-labelledby",n.selectLabelledbyIds),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){var e=this;return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),_l("select",{id:this.options_.id},{},this.options_.SelectOptions.map(function(t){var n=(e.options_.labelId?e.options_.labelId:"vjs-track-option-".concat(ic()))+"-"+t[1].replace(/\W+/g,""),i=_l("option",{id:n,value:e.localize(t[0]),textContent:e.localize(t[1])});return i.setAttribute("aria-labelledby","".concat(e.selectLabelledbyIds," ").concat(n)),i}))}}])}();Mc.registerComponent("TextTrackSelect",sp);var op=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=_l("legend",{textContent:(n=c(this,e,[t,i])).localize(n.options_.legendText),id:n.options_.legendId});n.el().appendChild(r);var a,s=_(n.options_.selects);try{for(s.s();!(a=s.n()).done;){var o=a.value,u=n.options_.selectConfigs[o],l=u.className,d=u.id.replace("%s",n.options_.id_),h=null,p="vjs_select_".concat(ic());if("colors"===n.options_.type){h=_l("span",{className:l});var f=_l("label",{id:d,className:"vjs-label",textContent:n.localize(u.label)});f.setAttribute("for",p),h.appendChild(f)}var m=new sp(t,{SelectOptions:u.options,legendId:n.options_.legendId,id:p,labelId:d});n.addChild(m),"colors"===n.options_.type&&(h.appendChild(m.el()),n.el().appendChild(h))}}catch(v){s.e(v)}finally{s.f()}return n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("fieldset",{className:this.options_.className})}}])}();Mc.registerComponent("TextTrackFieldset",op);var up=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).options_.textTrackComponentid,a=new op(t,{id_:r,legendId:"captions-text-legend-".concat(r),legendText:n.localize("Text"),className:"vjs-fg vjs-track-setting",selects:n.options_.fieldSets[0],selectConfigs:n.options_.selectConfigs,type:"colors"});n.addChild(a);var s=new op(t,{id_:r,legendId:"captions-background-".concat(r),legendText:n.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:n.options_.fieldSets[1],selectConfigs:n.options_.selectConfigs,type:"colors"});n.addChild(s);var o=new op(t,{id_:r,legendId:"captions-window-".concat(r),legendText:n.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:n.options_.fieldSets[2],selectConfigs:n.options_.selectConfigs,type:"colors"});return n.addChild(o),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-colors"})}}])}();Mc.registerComponent("TextTrackSettingsColors",up);var lp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).options_.textTrackComponentid,a=new op(t,{id_:r,legendId:"captions-font-size-".concat(r),legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:n.options_.fieldSets[0],selectConfigs:n.options_.selectConfigs,type:"font"});n.addChild(a);var s=new op(t,{id_:r,legendId:"captions-edge-style-".concat(r),legendText:n.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:n.options_.fieldSets[1],selectConfigs:n.options_.selectConfigs,type:"font"});n.addChild(s);var o=new op(t,{id_:r,legendId:"captions-font-family-".concat(r),legendText:n.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:n.options_.fieldSets[2],selectConfigs:n.options_.selectConfigs,type:"font"});return n.addChild(o),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-font"})}}])}();Mc.registerComponent("TextTrackSettingsFont",lp);var cp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).localize("restore all settings to the default values"),a=new ah(t,{controlText:r,className:"vjs-default-button"});a.el().classList.remove("vjs-control","vjs-button"),a.el().textContent=n.localize("Reset"),n.addChild(a);var s=new ah(t,{controlText:r,className:"vjs-done-button"});return s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=n.localize("Done"),n.addChild(s),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-controls"})}}])}();Mc.registerComponent("TrackSettingsControls",cp);var dp="vjs-text-track-settings",hp=["#000","Black"],pp=["#00F","Blue"],fp=["#0FF","Cyan"],mp=["#0F0","Green"],gp=["#F0F","Magenta"],vp=["#F00","Red"],yp=["#FFF","White"],_p=["#FF0","Yellow"],bp=["1","Opaque"],Tp=["0.5","Semi-Transparent"],kp=["0","Transparent"],Sp={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[hp,yp,vp,mp,pp,_p,gp,fp],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[bp,Tp,kp],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[yp,hp,vp,mp,pp,_p,gp,fp],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[bp,Tp],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[kp,Tp,bp],className:"vjs-window-opacity vjs-opacity"}};function wp(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Sp.windowColor.options=Sp.backgroundColor.options;var Ep=function(){function e(t,n){var i;return g(this,e),n.temporary=!1,(i=c(this,e,[t,n])).updateDisplay=i.updateDisplay.bind(i),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.renderModalComponents(t),i.endDialog=_l("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),void 0===n.persistTextTrackSettings&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.bindFunctionsToSelectsAndButtons(),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}return f(e,td),y(e,[{key:"renderModalComponents",value:function(e){var t=new up(e,{textTrackComponentid:this.id_,selectConfigs:Sp,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);var n=new lp(e,{textTrackComponentid:this.id_,selectConfigs:Sp,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(n);var i=new cp(e);this.addChild(i)}},{key:"bindFunctionsToSelectsAndButtons",value:function(){var e=this;this.on(this.$(".vjs-done-button"),["click","tap"],function(){e.saveSettings(),e.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],function(){e.setDefaults(),e.updateDisplay()}),Pu(Sp,function(t){e.on(e.$(t.selector),"change",e.updateDisplay)})}},{key:"dispose",value:function(){this.endDialog=null,n(e,"dispose",this,3)([])}},{key:"label",value:function(){return this.localize("Caption Settings Dialog")}},{key:"description",value:function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}},{key:"buildCSSClass",value:function(){return n(e,"buildCSSClass",this,3)([])+" vjs-text-track-settings"}},{key:"getValues",value:function(){var e=this;return Ru(Sp,function(t,n,i){var r,a,s=(r=e.$(n.selector),a=n.parser,wp(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(t[i]=s),t},{})}},{key:"setValues",value:function(e){var t=this;Pu(Sp,function(n,i){!function(e,t,n){if(t)for(var i=0;i<e.options.length;i++)if(wp(e.options[i].value,n)===t){e.selectedIndex=i;break}}(t.$(n.selector),e[i],n.parser)})}},{key:"setDefaults",value:function(){var e=this;Pu(Sp,function(t){var n=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=n})}},{key:"restoreSettings",value:function(){var e;try{e=JSON.parse(wn.localStorage.getItem(dp))}catch(t){Iu.warn(t)}e&&this.setValues(e)}},{key:"saveSettings",value:function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?wn.localStorage.setItem(dp,JSON.stringify(e)):wn.localStorage.removeItem(dp)}catch(t){Iu.warn(t)}}}},{key:"updateDisplay",value:function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}},{key:"handleLanguagechange",value:function(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}])}();Mc.registerComponent("TextTrackSettings",Ep);var Cp=function(){function e(t,n){var i;g(this,e);var r=n.ResizeObserver||wn.ResizeObserver;null===n.ResizeObserver&&(r=!1);var a=Uu({createEl:!r,reportTouchActivity:!1},n);return(i=c(this,e,[t,a])).ResizeObserver=n.ResizeObserver||wn.ResizeObserver,i.loadListener_=null,i.resizeObserver_=null,i.debouncedHandler_=yc(function(){i.resizeHandler()},100,!1,i),r?(i.resizeObserver_=new i.ResizeObserver(i.debouncedHandler_),i.resizeObserver_.observe(t.el())):(i.loadListener_=function(){if(i.el_&&i.el_.contentWindow){var e=i.debouncedHandler_,t=i.unloadListener_=function(){lc(this,"resize",e),lc(this,"unload",t),t=null};uc(i.el_.contentWindow,"unload",t),uc(i.el_.contentWindow,"resize",e)}},i.one("load",i.loadListener_)),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"}])}},{key:"resizeHandler",value:function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}},{key:"dispose",value:function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("ResizeManager",Cp);var Ap={trackingThreshold:20,liveTolerance:15},Ip=function(){function e(t,n){var i;g(this,e);var r=Uu(Ap,n,{createEl:!1});return(i=c(this,e,[t,r])).trackLiveHandler_=function(){return i.trackLive_()},i.handlePlay_=function(e){return i.handlePlay(e)},i.handleFirstTimeupdate_=function(e){return i.handleFirstTimeupdate(e)},i.handleSeeked_=function(e){return i.handleSeeked(e)},i.seekToLiveEdge_=function(e){return i.seekToLiveEdge(e)},i.reset_(),i.on(i.player_,"durationchange",function(e){return i.handleDurationchange(e)}),i.on(i.player_,"canplay",function(){return i.toggleTracking()}),i}return f(e,Mc),y(e,[{key:"trackLive_",value:function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(wn.performance.now().toFixed(4)),n=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;var i=this.liveCurrentTime(),r=this.player_.currentTime(),a=this.player_.paused()||this.seekedBehindLive_||Math.abs(i-r)>this.options_.liveTolerance;this.timeupdateSeen_&&i!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}}},{key:"handleDurationchange",value:function(){this.toggleTracking()}},{key:"toggleTracking",value:function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}},{key:"startTracking",value:function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,mc),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}},{key:"handleFirstTimeupdate",value:function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}},{key:"handleSeeked",value:function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}},{key:"handlePlay",value:function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}},{key:"reset_",value:function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}},{key:"nextSeekedFromUser",value:function(){this.nextSeekedFromUser_=!0}},{key:"stopTracking",value:function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}},{key:"seekableEnd",value:function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}},{key:"seekableStart",value:function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.start(n));return t.length?t.sort()[0]:0}},{key:"liveWindow",value:function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}},{key:"isLive",value:function(){return this.isTracking()}},{key:"atLiveEdge",value:function(){return!this.behindLiveEdge()}},{key:"liveCurrentTime",value:function(){return this.pastSeekEnd()+this.seekableEnd()}},{key:"pastSeekEnd",value:function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}},{key:"behindLiveEdge",value:function(){return this.behindLiveEdge_}},{key:"isTracking",value:function(){return"number"==typeof this.trackingInterval_}},{key:"seekToLiveEdge",value:function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}},{key:"dispose",value:function(){this.stopTracking(),n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("LiveTracker",Ip);var xp=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on("statechanged",function(e){return i.updateDom_()}),i.updateDom_(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return this.els={title:_l("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-".concat(ic())}),description:_l("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-".concat(ic())})},_l("div",{className:"vjs-title-bar"},{},Mu(this.els))}},{key:"updateDom_",value:function(){var e=this,t=this.player_.tech_,n=t&&t.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(function(t){var r=e.state[t],a=e.els[t],s=i[t];Ml(a),r&&bl(a,r),n&&(n.removeAttribute(s),r&&n.setAttribute(s,a.id))}),this.state.title||this.state.description?this.show():this.hide()}},{key:"update",value:function(e){this.setState(e)}},{key:"dispose",value:function(){var t=this.player_.tech_,i=t&&t.el_;i&&(i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-describedby")),n(e,"dispose",this,3)([]),this.els=null}}])}();Mc.registerComponent("TitleBar",xp);var Lp={initialDisplay:4e3,position:[],takeFocus:!1},Dp=function(){function e(t,n){var i;return g(this,e),n=Uu(Lp,n),(i=c(this,e,[t,n])).controlText(n.controlText),i.hide(),i.on(i.player_,["useractive","userinactive"],function(e){i.removeClass("force-display")}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-transient-button focus-visible ".concat(this.options_.position.map(function(e){return"vjs-".concat(e)}).join(" "))}},{key:"createEl",value:function(){var e=_l("button",{},{type:"button",class:this.buildCSSClass()},_l("span"));return this.controlTextEl_=e.querySelector("span"),e}},{key:"show",value:function(){var t=this;n(e,"show",this,3)([]),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(function(){t.removeClass("force-display")},this.options_.initialDisplay)}},{key:"hide",value:function(){this.removeClass("force-display"),n(e,"hide",this,3)([])}},{key:"dispose",value:function(){this.player_.clearTimeout(this.forceDisplayTimeout),n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("TransientButton",Dp);var Pp=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var n=e.$$("source"),i=[],r="";if(!n.length)return!1;for(var a=0;a<n.length;a++){var s=n[a].src;s&&-1===i.indexOf(s)&&i.push(s)}return!!i.length&&(1===i.length&&(r=i[0]),e.triggerSourceset(r),!0)},Rp=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=Ln.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var n=Ln.createDocumentFragment();t.childNodes.length;)n.appendChild(t.childNodes[0]);return this.innerText="",wn.Element.prototype.appendChild.call(this,n),this.innerHTML}}),Op=function(e,t){for(var n={},i=0;i<e.length&&!((n=Object.getOwnPropertyDescriptor(e[i],t))&&n.set&&n.get);i++);return n.enumerable=!0,n.configurable=!0,n},Np=function(e){var t=e.el();if(!t.resetSourceWatch_){var n={},i=function(e){return Op([e.el(),wn.HTMLMediaElement.prototype,wn.Element.prototype,Rp],"innerHTML")}(e),r=function(n){return function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];var s=n.apply(t,r);return Pp(e),s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){t[e]&&(n[e]=t[e],t[e]=r(n[e]))}),Object.defineProperty(t,"innerHTML",Uu(i,{set:r(i.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(n).forEach(function(e){t[e]=n[e]}),Object.defineProperty(t,"innerHTML",i)},e.one("sourceset",t.resetSourceWatch_)}},Up=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?vd(wn.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return wn.Element.prototype.setAttribute.call(this,"src",e),e}}),Mp=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var n=function(e){return Op([e.el(),wn.HTMLMediaElement.prototype,Up],"src")}(e),i=t.setAttribute,r=t.load;Object.defineProperty(t,"src",Uu(n,{set:function(i){var r=n.set.call(t,i);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(n,r){var a=i.call(t,n,r);return/src/i.test(n)&&e.triggerSourceset(t.src),a},t.load=function(){var n=r.call(t);return Pp(e)||(e.triggerSourceset(""),Np(e)),n},t.currentSrc?e.triggerSourceset(t.currentSrc):Pp(e)||Np(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=i,Object.defineProperty(t,"src",n),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},Bp=function(){function e(t,n){var i;g(this,e),i=c(this,e,[t,n]);var r=t.source,a=!1;if(i.featuresVideoFrameCallback=i.featuresVideoFrameCallback&&"VIDEO"===i.el_.tagName,r&&(i.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?i.setSource(r):i.handleLateInit_(i.el_),t.enableSourceset&&i.setupSourcesetHandling_(),i.isScrubbing_=!1,i.el_.hasChildNodes()){for(var s=i.el_.childNodes,o=s.length,u=[];o--;){var l=s[o];"track"===l.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(l),i.remoteTextTracks().addTrack(l.track),i.textTracks().addTrack(l.track),a||i.el_.hasAttribute("crossorigin")||!_d(l.src)||(a=!0)):u.push(l))}for(var d=0;d<u.length;d++)i.el_.removeChild(u[d])}return i.proxyNativeTracks_(),i.featuresNativeTextTracks&&a&&Iu.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),i.restoreMetadataTracksInIOSNativePlayer_(),(ul||rl)&&!0===t.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}return f(e,Ld),y(e,[{key:"dispose",value:function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),e.disposeMediaElement(this.el_),this.options_=null,n(e,"dispose",this,3)([])}},{key:"setupSourcesetHandling_",value:function(){Mp(this)}},{key:"restoreMetadataTracksInIOSNativePlayer_",value:function(){var e,t=this.textTracks(),n=function(){e=[];for(var n=0;n<t.length;n++){var i=t[n];"metadata"===i.kind&&e.push({track:i,storedMode:i.mode})}};n(),t.addEventListener("change",n),this.on("dispose",function(){return t.removeEventListener("change",n)});var i=function(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",n),t.removeEventListener("change",i),t.addEventListener("change",i)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",n),t.addEventListener("change",n),t.removeEventListener("change",i)})}},{key:"overrideNative_",value:function(e,t){var n=this;if(t===this["featuresNative".concat(e,"Tracks")]){var i=e.toLowerCase();this["".concat(i,"TracksListeners_")]&&Object.keys(this["".concat(i,"TracksListeners_")]).forEach(function(e){n.el()["".concat(i,"Tracks")].removeEventListener(e,n["".concat(i,"TracksListeners_")][e])}),this["featuresNative".concat(e,"Tracks")]=!t,this["".concat(i,"TracksListeners_")]=null,this.proxyNativeTracksForType_(i)}}},{key:"overrideNativeAudioTracks",value:function(e){this.overrideNative_("Audio",e)}},{key:"overrideNativeVideoTracks",value:function(e){this.overrideNative_("Video",e)}},{key:"proxyNativeTracksForType_",value:function(e){var t=this,n=Ad[e],i=this.el()[n.getterName],r=this[n.getterName]();if(this["featuresNative".concat(n.capitalName,"Tracks")]&&i&&i.addEventListener){var a={change:function(n){var i={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(i),"text"===e&&t[Id.remoteText.getterName]().trigger(i)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var n=!1,a=0;a<i.length;a++)if(i[a]===r[t]){n=!0;break}n||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[n.getterName+"Listeners_"]=a,Object.keys(a).forEach(function(e){var n=a[e];i.addEventListener(e,n),t.on("dispose",function(t){return i.removeEventListener(e,n)})}),this.on("loadstart",s),this.on("dispose",function(e){return t.off("loadstart",s)})}}},{key:"proxyNativeTracks_",value:function(){var e=this;Ad.names.forEach(function(t){e.proxyNativeTracksForType_(t)})}},{key:"createEl",value:function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var n=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(n,t),e.disposeMediaElement(t),t=n}else{t=Ln.createElement("video");var i=Uu({},this.options_.tag&&Al(this.options_.tag));ul&&!0===this.options_.nativeControlsForTouch||delete i.controls,Cl(t,Object.assign(i,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}void 0!==this.options_.preload&&xl(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);for(var r=["loop","muted","playsinline","autoplay"],a=0;a<r.length;a++){var s=r[a],o=this.options_[s];void 0!==o&&(o?xl(t,s,s):Ll(t,s),t[s]=o)}return t}},{key:"handleLateInit_",value:function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,n=function(){t=!0};this.on("loadstart",n);var i=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",i),void this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",i),t||this.trigger("loadstart")})}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready(function(){r.forEach(function(e){this.trigger(e)},this)})}}},{key:"setScrubbing",value:function(e){this.isScrubbing_=e}},{key:"scrubbing",value:function(){return this.isScrubbing_}},{key:"setCurrentTime",value:function(e){try{this.isScrubbing_&&this.el_.fastSeek&&hl?this.el_.fastSeek(e):this.el_.currentTime=e}catch(vy){Iu(vy,"Video is not ready. (Video.js)")}}},{key:"duration",value:function(){var e=this;if(this.el_.duration===1/0&&Gu&&Qu&&0===this.el_.currentTime){var t=function(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))};return this.on("timeupdate",t),NaN}return this.el_.duration||NaN}},{key:"width",value:function(){return this.el_.offsetWidth}},{key:"height",value:function(){return this.el_.offsetHeight}},{key:"proxyWebkitFullscreen_",value:function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},n=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){e.off("webkitbeginfullscreen",n),e.off("webkitendfullscreen",t)})}}},{key:"supportsFullScreen",value:function(){return"function"==typeof this.el_.webkitEnterFullScreen}},{key:"enterFullScreen",value:function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Qc(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(vy){this.trigger("fullscreenerror",vy)}},0);else try{e.webkitEnterFullScreen()}catch(vy){this.trigger("fullscreenerror",vy)}}},{key:"exitFullScreen",value:function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}},{key:"requestPictureInPicture",value:function(){return this.el_.requestPictureInPicture()}},{key:"requestVideoFrameCallback",value:function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):n(e,"requestVideoFrameCallback",this,3)([t])}},{key:"cancelVideoFrameCallback",value:function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):n(e,"cancelVideoFrameCallback",this,3)([t])}},{key:"src",value:function(e){if(void 0===e)return this.el_.src;this.setSrc(e)}},{key:"addSourceElement",value:function(e,t){if(!e)return Iu.error("Invalid source URL."),!1;var n={src:e};t&&(n.type=t);var i=_l("source",{},n);return this.el_.appendChild(i),!0}},{key:"removeSourceElement",value:function(e){if(!e)return Iu.error("Source URL is required to remove the source element."),!1;var t,n=_(this.el_.querySelectorAll("source"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.src===e)return this.el_.removeChild(i),!0}}catch(r){n.e(r)}finally{n.f()}return Iu.warn("No matching source element found with src: ".concat(e)),!1}},{key:"reset",value:function(){e.resetMediaElement(this.el_)}},{key:"currentSrc",value:function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}},{key:"setControls",value:function(e){this.el_.controls=!!e}},{key:"addTextTrack",value:function(t,i,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,r):n(e,"addTextTrack",this,3)([t,i,r])}},{key:"createRemoteTextTrack",value:function(t){if(!this.featuresNativeTextTracks)return n(e,"createRemoteTextTrack",this,3)([t]);var i=Ln.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i}},{key:"addRemoteTextTrack",value:function(t,i){var r=n(e,"addRemoteTextTrack",this,3)([t,i]);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}},{key:"removeRemoteTextTrack",value:function(t){if(n(e,"removeRemoteTextTrack",this,3)([t]),this.featuresNativeTextTracks)for(var i=this.$$("track"),r=i.length;r--;)t!==i[r]&&t!==i[r].track||this.el().removeChild(i[r])}},{key:"getVideoPlaybackQuality",value:function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),wn.performance&&(e.creationTime=wn.performance.now()),e}}])}();Bu(Bp,"TEST_VID",function(){if(ml()){var e=Ln.createElement("video"),t=Ln.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}}),Bp.isSupported=function(){try{Bp.TEST_VID.volume=.5}catch(vy){return!1}return!(!Bp.TEST_VID||!Bp.TEST_VID.canPlayType)},Bp.canPlayType=function(e){return Bp.TEST_VID.canPlayType(e)},Bp.canPlaySource=function(e,t){return Bp.canPlayType(e.type)},Bp.canControlVolume=function(){try{var e=Bp.TEST_VID.volume;Bp.TEST_VID.volume=e/2+.1;var t=e!==Bp.TEST_VID.volume;return t&&dl?(wn.setTimeout(function(){Bp&&Bp.prototype&&(Bp.prototype.featuresVolumeControl=e!==Bp.TEST_VID.volume)}),!1):t}catch(vy){return!1}},Bp.canMuteVolume=function(){try{var e=Bp.TEST_VID.muted;return Bp.TEST_VID.muted=!e,Bp.TEST_VID.muted?xl(Bp.TEST_VID,"muted","muted"):Ll(Bp.TEST_VID,"muted"),e!==Bp.TEST_VID.muted}catch(vy){return!1}},Bp.canControlPlaybackRate=function(){if(Gu&&Qu&&Ju<58)return!1;try{var e=Bp.TEST_VID.playbackRate;return Bp.TEST_VID.playbackRate=e/2+.1,e!==Bp.TEST_VID.playbackRate}catch(vy){return!1}},Bp.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(Ln.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(Ln.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(Ln.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(Ln.createElement("audio"),"innerHTML",{get:e,set:e})}catch(vy){return!1}return!0},Bp.supportsNativeTextTracks=function(){return hl||dl&&Qu},Bp.supportsNativeVideoTracks=function(){return!(!Bp.TEST_VID||!Bp.TEST_VID.videoTracks)},Bp.supportsNativeAudioTracks=function(){return!(!Bp.TEST_VID||!Bp.TEST_VID.audioTracks)},Bp.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(e){var t=S(e,2),n=t[0],i=t[1];Bu(Bp.prototype,n,function(){return Bp[i]()},!0)}),Bp.prototype.featuresVolumeControl=Bp.canControlVolume(),Bp.prototype.movingMediaElementInDOM=!dl,Bp.prototype.featuresFullscreenResize=!0,Bp.prototype.featuresProgressEvents=!0,Bp.prototype.featuresTimeupdateEvents=!0,Bp.prototype.featuresVideoFrameCallback=!(!Bp.TEST_VID||!Bp.TEST_VID.requestVideoFrameCallback),Bp.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(vy){}}()}},Bp.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),n=t.length;n--;)e.removeChild(t[n]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(vy){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Bp.prototype["set"+Oc(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){Bp.prototype["set"+Oc(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]()}}),Ld.withSourceHandlers(Bp),Bp.nativeSourceHandler={},Bp.nativeSourceHandler.canPlayType=function(e){try{return Bp.TEST_VID.canPlayType(e)}catch(vy){return""}},Bp.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Bp.nativeSourceHandler.canPlayType(e.type);if(e.src){var n=yd(e.src);return Bp.nativeSourceHandler.canPlayType("video/".concat(n))}return""},Bp.nativeSourceHandler.handleSource=function(e,t,n){t.setSrc(e.src)},Bp.nativeSourceHandler.dispose=function(){},Bp.registerSourceHandler(Bp.nativeSourceHandler),Ld.registerTech("Html5",Bp);var jp=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Fp={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},qp=["tiny","xsmall","small","medium","large","xlarge","huge"],Vp={};qp.forEach(function(e){var t="x"===e.charAt(0)?"x-".concat(e.substring(1)):e;Vp[e]="vjs-layout-".concat(t)});var Hp={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},zp=function(){function e(t,n,i){var r;if(g(this,e),t.id=t.id||n.id||"vjs_video_".concat(ic()),(n=Object.assign(e.getTagSettings(t),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language){var a=t.closest("[lang]");a&&(n.language=a.getAttribute("lang"))}if((r=c(this,e,[null,n,i])).boundDocumentFullscreenChange_=function(e){return r.documentFullscreenChange_(e)},r.boundFullWindowOnEscKey_=function(e){return r.fullWindowOnEscKey(e)},r.boundUpdateStyleEl_=function(e){return r.updateStyleEl_(e)},r.boundApplyInitTime_=function(e){return r.applyInitTime_(e)},r.boundUpdateCurrentBreakpoint_=function(e){return r.updateCurrentBreakpoint_(e)},r.boundHandleTechClick_=function(e){return r.handleTechClick_(e)},r.boundHandleTechDoubleClick_=function(e){return r.handleTechDoubleClick_(e)},r.boundHandleTechTouchStart_=function(e){return r.handleTechTouchStart_(e)},r.boundHandleTechTouchMove_=function(e){return r.handleTechTouchMove_(e)},r.boundHandleTechTouchEnd_=function(e){return r.handleTechTouchEnd_(e)},r.boundHandleTechTap_=function(e){return r.handleTechTap_(e)},r.boundUpdatePlayerHeightOnAudioOnlyMode_=function(e){return r.updatePlayerHeightOnAudioOnlyMode_(e)},r.isFullscreen_=!1,r.log=xu(r.id_),r.fsApi_=Su,r.isPosterFromTech_=!1,r.queuedCallbacks_=[],r.isReady_=!1,r.hasStarted_=!1,r.userActive_=!1,r.debugEnabled_=!1,r.audioOnlyMode_=!1,r.audioPosterMode_=!1,r.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!r.options_||!r.options_.techOrder||!r.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(r.tag=t,r.tagAttributes=t&&Al(t),r.language(r.options_.language),n.languages){var s={};Object.getOwnPropertyNames(n.languages).forEach(function(e){s[e.toLowerCase()]=n.languages[e]}),r.languages_=s}else r.languages_=e.prototype.options_.languages;r.resetCache_(),r.poster_=n.poster||"",r.controls_=!!n.controls,t.controls=!1,t.removeAttribute("controls"),r.changingSrc_=!1,r.playCallbacks_=[],r.playTerminatedQueue_=[],t.hasAttribute("autoplay")?r.autoplay(!0):r.autoplay(r.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach(function(e){if("function"!=typeof r[e])throw new Error('plugin "'.concat(e,'" does not exist'))}),r.scrubbing_=!1,r.el_=r.createEl(),Lc(r,{eventBusKey:"el_"}),r.fsApi_.requestFullscreen&&(uc(Ln,r.fsApi_.fullscreenchange,r.boundDocumentFullscreenChange_),r.on(r.fsApi_.fullscreenchange,r.boundDocumentFullscreenChange_)),r.fluid_&&r.on(["playerreset","resize"],r.boundUpdateStyleEl_);var o=Uu(r.options_);if(n.plugins&&Object.keys(n.plugins).forEach(function(e){r[e](n.plugins[e])}),n.debug&&r.debug(!0),r.options_.playerOptions=o,r.middleware_=[],r.playbackRates(n.playbackRates),n.experimentalSvgIcons){var u=(new wn.DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <defs>\n <symbol viewBox="0 0 48 48" id="vjs-icon-play">\n <path d="M16 10v28l22-14z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-pause">\n <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-audio">\n <path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-captions">\n <path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">\n <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">\n <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">\n <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">\n <path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">\n <path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">\n <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">\n <path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">\n <path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">\n <path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>\n </symbol>\n <symbol viewBox="0 0 24 24" id="vjs-icon-hd">\n <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">\n <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>\n </symbol>\n <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">\n <path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">\n <path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">\n <path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">\n <path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-share">\n <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cog">\n <path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-square">\n <path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle">\n <circle cx="24" cy="24" r="20"></circle>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">\n <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">\n <path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">\n <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-replay">\n <path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">\n <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">\n <path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">\n <path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">\n <path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">\n <path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">\n <path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">\n <path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>\n </symbol>\n <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">\n <g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">\n <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">\n <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">\n <path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cast">\n <path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">\n <path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>\n </symbol>\n <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">\n <path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>\n <path fill="none" d="M-1-3h24v24H-1z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">\n <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">\n <path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>\n </symbol>\n <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">\n <path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">\n <path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">\n <path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>\n </symbol>\n </defs>\n</svg>',"image/svg+xml");if(u.querySelector("parsererror"))Iu.warn("Failed to load SVG Icons. Falling back to Font Icons."),r.options_.experimentalSvgIcons=null;else{var l=u.documentElement;l.style.display="none",r.el_.appendChild(l),r.addClass("vjs-svg-icons-enabled")}}r.initChildren(),r.isAudio("audio"===t.nodeName.toLowerCase()),r.controls()?r.addClass("vjs-controls-enabled"):r.addClass("vjs-controls-disabled"),r.el_.setAttribute("role","region"),r.isAudio()?r.el_.setAttribute("aria-label",r.localize("Audio Player")):r.el_.setAttribute("aria-label",r.localize("Video Player")),r.isAudio()&&r.addClass("vjs-audio"),n.spatialNavigation&&n.spatialNavigation.enabled&&(r.spatialNavigation=new Xd(r),r.addClass("vjs-spatial-navigation-enabled")),ul&&r.addClass("vjs-touch-enabled"),dl||r.addClass("vjs-workinghover"),e.players[r.id_]=r;var d=_u.split(".")[0];return r.addClass("vjs-v".concat(d)),r.userActive(!0),r.reportUserActivity(),r.one("play",function(e){return r.listenForUserActivity_(e)}),r.on("keydown",function(e){return r.handleKeyDown(e)}),r.on("languagechange",function(e){return r.handleLanguagechange(e)}),r.breakpoints(r.options_.breakpoints),r.responsive(r.options_.responsive),r.on("ready",function(){r.audioPosterMode(r.options_.audioPosterMode),r.audioOnlyMode(r.options_.audioOnlyMode)}),r}return f(e,Mc),y(e,[{key:"dispose",value:function(){var t,i=this;this.trigger("dispose"),this.off("dispose"),lc(Ln,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),lc(Ln,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),e.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),t=this,Pd.hasOwnProperty(t.id())&&delete Pd[t.id()],xd.names.forEach(function(e){var t=xd[e],n=i[t.getterName]();n&&n.off&&n.off()}),n(e,"dispose",this,3)([{restoreEl:this.options_.restoreEl}])}},{key:"createEl",value:function(){var t,i=this.tag,r=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),a="video-js"===this.tag.tagName.toLowerCase();r?t=this.el_=i.parentNode:a||(t=this.el_=n(e,"createEl",this,3)(["div"]));var s=Al(i);if(a){for(t=this.el_=i,i=this.tag=Ln.createElement("video");t.children.length;)i.appendChild(t.firstChild);kl(t,"video-js")||Sl(t,"video-js"),t.appendChild(i),r=this.playerElIngest_=t,Object.keys(t).forEach(function(e){try{i[e]=t[e]}catch(vy){}})}i.setAttribute("tabindex","-1"),s.tabindex="-1",Qu&&nl&&(i.setAttribute("role","application"),s.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(e){a&&"class"===e||t.setAttribute(e,s[e]),a&&i.setAttribute(e,s[e])}),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused");var o=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(function(e){return pl[e]}).map(function(e){return"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-")});if(this.addClass.apply(this,b(o)),!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Zl("vjs-styles-dimensions");var u=Vl(".vjs-styles-defaults"),l=Vl("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var c=i.getElementsByTagName("a"),d=0;d<c.length;d++){var h=c.item(d);Sl(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!r&&i.parentNode.insertBefore(t,i),Tl(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}},{key:"crossOrigin",value:function(e){if(void 0===e)return this.techGet_("crossOrigin");null===e||"anonymous"===e||"use-credentials"===e?(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)):Iu.warn('crossOrigin must be null, "anonymous" or "use-credentials", given "'.concat(e,'"'))}},{key:"width",value:function(e){return this.dimension("width",e)}},{key:"height",value:function(e){return this.dimension("height",e)}},{key:"dimension",value:function(e,t){var n=e+"_";if(void 0===t)return this[n]||0;if(""===t||"auto"===t)return this[n]=void 0,void this.updateStyleEl_();var i=parseFloat(t);isNaN(i)?Iu.error('Improper value "'.concat(t,'" supplied for for ').concat(e)):(this[n]=i,this.updateStyleEl_())}},{key:"fluid",value:function(e){var t,n,i=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,kc(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),n=function(){i.on(["playerreset","resize"],i.boundUpdateStyleEl_)},kc(t=this)?n():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(n))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}},{key:"fill",value:function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}},{key:"aspectRatio",value:function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}},{key:"updateStyleEl_",value:function(){if(!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,n,i=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=i[1]/i[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),ec(this.styleEl_,"\n .".concat(n," {\n width: ").concat(e,"px;\n height: ").concat(t,"px;\n }\n\n .").concat(n,".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ").concat(100*r,"%;\n }\n "))}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}}},{key:"loadTech_",value:function(e,t){var n=this;this.tech_&&this.unloadTech_();var i=Oc(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Ld.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:"".concat(this.id(),"_").concat(r,"_api"),playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};xd.names.forEach(function(e){var t=xd[e];s[t.getterName]=n[t.privateName]}),Object.assign(s,this.options_[i]),Object.assign(s,this.options_[r]),Object.assign(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Ld.getTech(e);if(!o)throw new Error("No Tech named '".concat(i,"' exists! '").concat(i,"' should be registered using videojs.registerTech()'"));this.tech_=new o(s),this.tech_.ready(gc(this,this.handleTechReady_),!0),Zc(this.textTracksJson_||[],this.tech_),jp.forEach(function(e){n.on(n.tech_,e,function(t){return n["handleTech".concat(Oc(e),"_")](t)})}),Object.keys(Fp).forEach(function(e){n.on(n.tech_,e,function(t){0===n.tech_.playbackRate()&&n.tech_.seeking()?n.queuedCallbacks_.push({callback:n["handleTech".concat(Fp[e],"_")].bind(n),event:t}):n["handleTech".concat(Fp[e],"_")](t)})}),this.on(this.tech_,"loadstart",function(e){return n.handleTechLoadStart_(e)}),this.on(this.tech_,"sourceset",function(e){return n.handleTechSourceset_(e)}),this.on(this.tech_,"waiting",function(e){return n.handleTechWaiting_(e)}),this.on(this.tech_,"ended",function(e){return n.handleTechEnded_(e)}),this.on(this.tech_,"seeking",function(e){return n.handleTechSeeking_(e)}),this.on(this.tech_,"play",function(e){return n.handleTechPlay_(e)}),this.on(this.tech_,"pause",function(e){return n.handleTechPause_(e)}),this.on(this.tech_,"durationchange",function(e){return n.handleTechDurationChange_(e)}),this.on(this.tech_,"fullscreenchange",function(e,t){return n.handleTechFullscreenChange_(e,t)}),this.on(this.tech_,"fullscreenerror",function(e,t){return n.handleTechFullscreenError_(e,t)}),this.on(this.tech_,"enterpictureinpicture",function(e){return n.handleTechEnterPictureInPicture_(e)}),this.on(this.tech_,"leavepictureinpicture",function(e){return n.handleTechLeavePictureInPicture_(e)}),this.on(this.tech_,"error",function(e){return n.handleTechError_(e)}),this.on(this.tech_,"posterchange",function(e){return n.handleTechPosterChange_(e)}),this.on(this.tech_,"textdata",function(e){return n.handleTechTextData_(e)}),this.on(this.tech_,"ratechange",function(e){return n.handleTechRateChange_(e)}),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Tl(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}},{key:"unloadTech_",value:function(){var e=this;xd.names.forEach(function(t){var n=xd[t];e[n.privateName]=e[n.getterName]()}),this.textTracksJson_=Jc(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}},{key:"tech",value:function(e){return void 0===e&&Iu.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}},{key:"version",value:function(){return{"video.js":_u}}},{key:"addTechControlsListeners_",value:function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}},{key:"removeTechControlsListeners_",value:function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}},{key:"handleTechReady_",value:function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}},{key:"handleTechLoadStart_",value:function(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}},{key:"manualAutoplay_",value:function(e){var t=this;if(this.tech_&&"string"==typeof e){var n,i=function(){var e=t.muted();t.muted(!0);var n=function(){t.muted(e)};t.playTerminatedQueue_.push(n);var i=t.play();if(Yc(i))return i.catch(function(e){throw n(),new Error("Rejection at manualAutoplay. Restoring muted value. ".concat(e||""))})};if("any"!==e||this.muted()?n="muted"!==e||this.muted()?this.play():i():Yc(n=this.play())&&(n=n.catch(i)),Yc(n))return n.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(){t.trigger({type:"autoplay-failure",autoplay:e})})}}},{key:"updateSourceCaches_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e,n="";"string"!=typeof t&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var n=e.cache_.sources.filter(function(e){return e.src===t});if(n.length)return n[0].type;for(var i=e.$$("source"),r=0;r<i.length;r++){var a=i[r];if(a.type&&a.src&&a.src===t)return a.type}return Vd(t)}(this,t)),this.cache_.source=Uu({},e,{src:t,type:n});for(var i=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=Al(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!i.length?this.cache_.sources=r:i.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}},{key:"handleTechSourceset_",value:function(e){var t=this;if(!this.changingSrc_){var n=function(e){return t.updateSourceCaches_(e)},i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(n=function(){}),n(r),e.src||this.tech_.any(["sourceset","loadstart"],function(e){if("sourceset"!==e.type){var n=t.techGet_("currentSrc");t.lastSource_.tech=n,t.updateSourceCaches_(n)}})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}},{key:"hasStarted",value:function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}},{key:"handleTechPlay_",value:function(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}},{key:"handleTechRateChange_",value:function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}},{key:"handleTechWaiting_",value:function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime(),n=function(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",n))};this.on("timeupdate",n)}},{key:"handleTechCanPlay_",value:function(){this.removeClass("vjs-waiting"),this.trigger("canplay")}},{key:"handleTechCanPlayThrough_",value:function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}},{key:"handleTechPlaying_",value:function(){this.removeClass("vjs-waiting"),this.trigger("playing")}},{key:"handleTechSeeking_",value:function(){this.addClass("vjs-seeking"),this.trigger("seeking")}},{key:"handleTechSeeked_",value:function(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}},{key:"handleTechPause_",value:function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}},{key:"handleTechEnded_",value:function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}},{key:"handleTechDurationChange_",value:function(){this.duration(this.techGet_("duration"))}},{key:"handleTechClick_",value:function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Qc(this.play()):this.pause()))}},{key:"handleTechDoubleClick_",value:function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!Ln.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}},{key:"handleTechTap_",value:function(){this.userActive(!this.userActive())}},{key:"handleTechTouchStart_",value:function(){this.userWasActive=this.userActive()}},{key:"handleTechTouchMove_",value:function(){this.userWasActive&&this.reportUserActivity()}},{key:"handleTechTouchEnd_",value:function(e){e.cancelable&&e.preventDefault()}},{key:"toggleFullscreenClass_",value:function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}},{key:"documentFullscreenChange_",value:function(e){var t=e.target.player;if(!t||t===this){var n=this.el(),i=Ln[this.fsApi_.fullscreenElement]===n;!i&&n.matches&&(i=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(i)}}},{key:"handleTechFullscreenChange_",value:function(e,t){var n=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",function(){n.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}},{key:"handleTechFullscreenError_",value:function(e,t){this.trigger("fullscreenerror",t)}},{key:"togglePictureInPictureClass_",value:function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}},{key:"handleTechEnterPictureInPicture_",value:function(e){this.isInPictureInPicture(!0)}},{key:"handleTechLeavePictureInPicture_",value:function(e){this.isInPictureInPicture(!1)}},{key:"handleTechError_",value:function(){var e=this.tech_.error();e&&this.error(e)}},{key:"handleTechTextData_",value:function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}},{key:"getCache",value:function(){return this.cache_}},{key:"resetCache_",value:function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}},{key:"techCall_",value:function(e,t){this.ready(function(){if(e in Md)return function(e,t,n,i){return t[n](e.reduce(jd(n),i))}(this.middleware_,this.tech_,e,t);if(e in Bd)return Nd(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(vy){throw Iu(vy),vy}},!0)}},{key:"techGet_",value:function(e){if(this.tech_&&this.tech_.isReady_){if(e in Ud)return function(e,t,n){return e.reduceRight(jd(n),t[n]())}(this.middleware_,this.tech_,e);if(e in Bd)return Nd(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(vy){if(void 0===this.tech_[e])throw Iu("Video.js: ".concat(e," method not defined for ").concat(this.techName_," playback technology."),vy),vy;if("TypeError"===vy.name)throw Iu("Video.js: ".concat(e," unavailable on ").concat(this.techName_," playback technology element."),vy),this.tech_.isReady_=!1,vy;throw Iu(vy),vy}}}},{key:"play",value:function(){var e=this;return new Promise(function(t){e.play_(t)})}},{key:"play_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qc;this.playCallbacks_.push(t);var n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(hl||dl);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!n)return this.waitToPlay_=function(t){e.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!n&&i&&this.load());var r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===r?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}},{key:"runPlayTerminatedQueue_",value:function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}},{key:"runPlayCallbacks_",value:function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})}},{key:"pause",value:function(){this.techCall_("pause")}},{key:"paused",value:function(){return!1!==this.techGet_("paused")}},{key:"played",value:function(){return this.techGet_("played")||Fc(0,0)}},{key:"scrubbing",value:function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}},{key:"currentTime",value:function(e){return void 0===e?(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime):(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,void(isFinite(e)&&(this.cache_.currentTime=Number(e)))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_)))}},{key:"applyInitTime_",value:function(){this.currentTime(this.cache_.initTime)}},{key:"duration",value:function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}},{key:"remainingTime",value:function(){return this.duration()-this.currentTime()}},{key:"remainingTimeDisplay",value:function(){return Math.floor(this.duration())-Math.floor(this.currentTime())}},{key:"buffered",value:function(){var e=this.techGet_("buffered");return e&&e.length||(e=Fc(0,0)),e}},{key:"seekable",value:function(){var e=this.techGet_("seekable");return e&&e.length||(e=Fc(0,0)),e}},{key:"seeking",value:function(){return this.techGet_("seeking")}},{key:"ended",value:function(){return this.techGet_("ended")}},{key:"networkState",value:function(){return this.techGet_("networkState")}},{key:"readyState",value:function(){return this.techGet_("readyState")}},{key:"bufferedPercent",value:function(){return Xc(this.buffered(),this.duration())}},{key:"bufferedEnd",value:function(){var e=this.buffered(),t=this.duration(),n=e.end(e.length-1);return n>t&&(n=t),n}},{key:"volume",value:function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}},{key:"muted",value:function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}},{key:"defaultMuted",value:function(e){return void 0!==e&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}},{key:"lastVolume_",value:function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}},{key:"supportsFullScreen",value:function(){return this.techGet_("supportsFullScreen")||!1}},{key:"isFullscreen",value:function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}},{key:"requestFullscreen",value:function(e){this.isInPictureInPicture()&&this.exitPictureInPicture();var t=this;return new Promise(function(n,i){function r(){t.off("fullscreenerror",s),t.off("fullscreenchange",a)}function a(){r(),n()}function s(e,t){r(),i(t)}t.one("fullscreenchange",a),t.one("fullscreenerror",s);var o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(n,i))})}},{key:"requestFullscreenHelper_",value:function(e){var t,n=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(function(){return n.isFullscreen(!0)},function(){return n.isFullscreen(!1)}),i}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}},{key:"exitFullscreen",value:function(){var e=this;return new Promise(function(t,n){function i(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){i(),t()}function a(e,t){i(),n(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);var s=e.exitFullscreenHelper_();s&&(s.then(i,i),s.then(t,n))})}},{key:"exitFullscreenHelper_",value:function(){var e=this;if(this.fsApi_.requestFullscreen){var t=Ln[this.fsApi_.exitFullscreen]();return t&&Qc(t.then(function(){return e.isFullscreen(!1)})),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}},{key:"enterFullWindow",value:function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=Ln.documentElement.style.overflow,uc(Ln,"keydown",this.boundFullWindowOnEscKey_),Ln.documentElement.style.overflow="hidden",Sl(Ln.body,"vjs-full-window"),this.trigger("enterFullWindow")}},{key:"fullWindowOnEscKey",value:function(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}},{key:"exitFullWindow",value:function(){this.isFullscreen(!1),this.isFullWindow=!1,lc(Ln,"keydown",this.boundFullWindowOnEscKey_),Ln.documentElement.style.overflow=this.docOrigOverflow,wl(Ln.body,"vjs-full-window"),this.trigger("exitFullWindow")}},{key:"disablePictureInPicture",value:function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}},{key:"isInPictureInPicture",value:function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}},{key:"requestPictureInPicture",value:function(){var e=this;if(this.options_.enableDocumentPictureInPicture&&wn.documentPictureInPicture){var t=Ln.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(_l("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),wn.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(function(n){return Wl(n),e.el_.parentNode.insertBefore(t,e.el_),n.document.body.appendChild(e.el_),n.document.body.classList.add("vjs-pip-window"),e.player_.isInPictureInPicture(!0),e.player_.trigger({type:"enterpictureinpicture",pipWindow:n}),n.addEventListener("pagehide",function(n){var i=n.target.querySelector(".video-js");t.parentNode.replaceChild(i,t),e.player_.isInPictureInPicture(!1),e.player_.trigger("leavepictureinpicture")}),n})}return"pictureInPictureEnabled"in Ln&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}},{key:"exitPictureInPicture",value:function(){return wn.documentPictureInPicture&&wn.documentPictureInPicture.window?(wn.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in Ln?Ln.exitPictureInPicture():void 0}},{key:"handleKeyDown",value:function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}}},{key:"handleHotkeys",value:function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},n=t.fullscreenKey,i=void 0===n?function(t){return"f"===e.key.toLowerCase()}:n,r=t.muteKey,a=void 0===r?function(t){return"m"===e.key.toLowerCase()}:r,s=t.playPauseKey,o=void 0===s?function(t){return"k"===e.key.toLowerCase()||" "===e.key.toLowerCase()}:s;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();var u=Mc.getComponent("FullscreenToggle");!1!==Ln[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),Mc.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),Mc.getComponent("PlayToggle").prototype.handleClick.call(this,e)}}},{key:"canPlayType",value:function(e){for(var t,n=0,i=this.options_.techOrder;n<i.length;n++){var r=i[n],a=Ld.getTech(r);if(a||(a=Mc.getComponent(r)),a){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else Iu.error('The "'.concat(r,'" tech is undefined. Skipped browser support check for that tech.'))}return""}},{key:"selectSource",value:function(e){var t,n,i=this,r=this.options_.techOrder.map(function(e){return[e,Ld.getTech(e)]}).filter(function(e){var t=S(e,2),n=t[0],i=t[1];return i?i.isSupported():(Iu.error('The "'.concat(n,'" tech is undefined. Skipped browser support check for that tech.')),!1)}),a=function(e,t,n){var i;return e.some(function(e){return t.some(function(t){if(i=n(e,t))return!0})}),i},s=function(e,t){var n=S(e,2),r=n[0];if(n[1].canPlaySource(t,i.options_[r.toLowerCase()]))return{source:t,tech:r}};return t=this.options_.sourceOrder?a(e,r,(n=s,function(e,t){return n(t,e)})):a(r,e,s),t||!1}},{key:"handleSrc_",value:function(e,t){var n=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var i=Hd(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Od(this,i[0],function(e,r){var a,s;if(n.middleware_=r,t||(n.cache_.sources=i),n.updateSourceCaches_(e),n.src_(e))return i.length>1?n.handleSrc_(i.slice(1)):(n.changingSrc_=!1,n.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void n.triggerReady());a=r,s=n.tech_,a.forEach(function(e){return e.setTech&&e.setTech(s)})}),i.length>1){var r=function(){n.error(null),n.handleSrc_(i.slice(1),!0)},a=function(){n.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){n.off("error",r),n.off("playing",a)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}},{key:"src",value:function(e){return this.handleSrc_(e,!1)}},{key:"src_",value:function(e){var t=this,n=this.selectSource([e]);return!n||(Nc(n.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(n.tech,n.source),this.tech_.ready(function(){t.changingSrc_=!1}),!1))}},{key:"addSourceElement",value:function(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}},{key:"removeSourceElement",value:function(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}},{key:"load",value:function(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}},{key:"reset",value:function(){var e=this;this.paused()?this.doReset_():Qc(this.play().then(function(){return e.doReset_()}))}},{key:"doReset_",value:function(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),kc(this)&&this.trigger("playerreset")}},{key:"resetControlBarUI_",value:function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}},{key:"resetProgressBar_",value:function(){this.currentTime(0);var e=this.controlBar||{},t=e.currentTimeDisplay,n=e.durationDisplay,i=e.progressControl,r=e.remainingTimeDisplay,a=(i||{}).seekBar;t&&t.updateContent(),n&&n.updateContent(),r&&r.updateContent(),a&&(a.update(),a.loadProgressBar&&a.loadProgressBar.update())}},{key:"resetPlaybackRate_",value:function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}},{key:"resetVolumeBar_",value:function(){this.volume(1),this.trigger("volumechange")}},{key:"currentSources",value:function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}},{key:"currentSource",value:function(){return this.cache_.source||{}}},{key:"currentSrc",value:function(){return this.currentSource()&&this.currentSource().src||""}},{key:"currentType",value:function(){return this.currentSource()&&this.currentSource().type||""}},{key:"preload",value:function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}},{key:"autoplay",value:function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}},{key:"playsinline",value:function(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}},{key:"loop",value:function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")}},{key:"poster",value:function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}},{key:"handleTechPosterChange_",value:function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}},{key:"controls",value:function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}},{key:"usingNativeControls",value:function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}},{key:"error",value:function(e){var t=this;if(void 0===e)return this.error_||null;if(Tu("beforeerror").forEach(function(n){var i=n(t,e);Ou(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:t.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&e&&4===e.code){var n=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],n),void this.one("loadstart",function(){this.off(["click","touchstart"],n)})}if(null===e)return this.error_=null,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Kc(e),this.addClass("vjs-error"),Iu.error("(CODE:".concat(this.error_.code," ").concat(Kc.errorTypes[this.error_.code],")"),this.error_.message,this.error_),this.trigger("error"),Tu("error").forEach(function(e){return e(t,t.error_)})}},{key:"reportUserActivity",value:function(e){this.userActivity_=!0}},{key:"userActive",value:function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}},{key:"listenForUserActivity_",value:function(){var e,t,n,i=gc(this,this.reportUserActivity),r=function(t){i(),this.clearInterval(e)};this.on("mousedown",function(){i(),this.clearInterval(e),e=this.setInterval(i,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===n||(t=e.screenX,n=e.screenY,i())}),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||dl||Gu||(s.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),s.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",i),this.on("keyup",i);this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)}},{key:"playbackRate",value:function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}},{key:"defaultPlaybackRate",value:function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}},{key:"isAudio",value:function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}},{key:"updatePlayerHeightOnAudioOnlyMode_",value:function(){var e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}},{key:"enableAudioOnlyUI_",value:function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),n=this.getChild("ControlBar"),i=n&&n.currentHeight();t.forEach(function(t){t!==n&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}},{key:"disableAudioOnlyUI_",value:function(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(function(e){return e.show()}),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}},{key:"audioOnlyMode",value:function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),Promise.all(n).then(function(){return t.enableAudioOnlyUI_()})}return Promise.resolve().then(function(){return t.disableAudioOnlyUI_()})}},{key:"enablePosterModeUI_",value:function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}},{key:"disablePosterModeUI_",value:function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}},{key:"audioPosterMode",value:function(e){var t=this;return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(function(){t.enablePosterModeUI_()}):Promise.resolve().then(function(){t.enablePosterModeUI_()}):Promise.resolve().then(function(){t.disablePosterModeUI_()}))}},{key:"addTextTrack",value:function(e,t,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}},{key:"addRemoteTextTrack",value:function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}},{key:"removeRemoteTextTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}},{key:"getVideoPlaybackQuality",value:function(){return this.techGet_("getVideoPlaybackQuality")}},{key:"videoWidth",value:function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}},{key:"videoHeight",value:function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}},{key:"language",value:function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),kc(this)&&this.trigger("languagechange"))}},{key:"languages",value:function(){return Uu(e.prototype.options_.languages,this.languages_)}},{key:"toJSON",value:function(){var e=Uu(this.options_),t=e.tracks;e.tracks=[];for(var n=0;n<t.length;n++){var i=t[n];(i=Uu(i)).player=void 0,e.tracks[n]=i}return e}},{key:"createModal",value:function(e,t){var n=this;(t=t||{}).content=e||"";var i=new td(this,t);return this.addChild(i),i.on("dispose",function(){n.removeChild(i)}),i.open(),i}},{key:"updateCurrentBreakpoint_",value:function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),n=0;n<qp.length;n++){var i=qp[n];if(t<=this.breakpoints_[i]){if(e===i)return;e&&this.removeClass(Vp[e]),this.addClass(Vp[i]),this.breakpoint_=i;break}}}},{key:"removeCurrentBreakpoint_",value:function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}},{key:"breakpoints",value:function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Object.assign({},Hp,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}},{key:"responsive",value:function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}},{key:"currentBreakpoint",value:function(){return this.breakpoint_}},{key:"currentBreakpointClass",value:function(){return Vp[this.breakpoint_]||""}},{key:"loadMedia",value:function(e,t){var n=this;if(e&&"object"===k(e)){var i=this.crossOrigin();this.reset(),this.cache_.media=Uu(e);var r=this.cache_.media,a=r.artist,s=r.artwork,o=r.description,u=r.poster,l=r.src,c=r.textTracks,d=r.title;!s&&u&&(this.cache_.media.artwork=[{src:u,type:Vd(u)}]),i&&this.crossOrigin(i),l&&this.src(l),u&&this.poster(u),Array.isArray(c)&&c.forEach(function(e){return n.addRemoteTextTrack(e,!1)}),this.titleBar&&this.titleBar.update({title:d,description:o||a||""}),this.ready(t)}}},{key:"getMedia",value:function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}})};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Vd(t.poster)}]),t}return Uu(this.cache_.media)}},{key:"debug",value:function(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}},{key:"playbackRates",value:function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every(function(e){return"number"==typeof e})&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}],[{key:"getTagSettings",value:function(e){var t={sources:[],tracks:[]},n=Al(e),i=n["data-setup"];if(kl(e,"vjs-fill")&&(n.fill=!0),kl(e,"vjs-fluid")&&(n.fluid=!0),null!==i)try{Object.assign(n,JSON.parse(i||"{}"))}catch(vy){Iu.error("data-setup",vy)}if(Object.assign(t,n),e.hasChildNodes())for(var r=e.childNodes,a=0,s=r.length;a<s;a++){var o=r[a],u=o.nodeName.toLowerCase();"source"===u?t.sources.push(Al(o)):"track"===u&&t.tracks.push(Al(o))}return t}}])}();xd.names.forEach(function(e){var t=xd[e];zp.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),zp.prototype.crossorigin=zp.prototype.crossOrigin,zp.players={};var Wp=wn.navigator;zp.prototype.options_={techOrder:Ld.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Wp&&(Wp.languages&&Wp.languages[0]||Wp.userLanguage||Wp.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1},jp.forEach(function(e){zp.prototype["handleTech".concat(Oc(e),"_")]=function(){return this.trigger(e)}}),Mc.registerComponent("Player",zp);var Gp="plugin",Xp="activePlugins_",Kp={},Yp=function(e){return Kp.hasOwnProperty(e)},Qp=function(e){return Yp(e)?Kp[e]:void 0},$p=function(e,t){e[Xp]=e[Xp]||{},e[Xp][t]=!0},Jp=function(e,t,n){var i=(n?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},Zp=function(e,n){return n.prototype.name=e,function(){Jp(this,{name:e,plugin:n,instance:null},!0);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];var s=t(n,[this].concat(r));return this[e]=function(){return s},Jp(this,s.getEventHash()),s}},ef=function(){function e(t){if(g(this,e),this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),Lc(this),delete this.trigger,Pc(this,this.constructor.defaultState),$p(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}return y(e,[{key:"version",value:function(){return this.constructor.VERSION}},{key:"getEventHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return cc(this.eventBusEl_,e,this.getEventHash(t))}},{key:"handleStateChanged",value:function(e){}},{key:"dispose",value:function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Xp][e]=!1,this.player=this.state=null,t[e]=Zp(e,Kp[e])}}],[{key:"isBasic",value:function(t){var n="string"==typeof t?Qp(t):t;return"function"==typeof n&&!e.prototype.isPrototypeOf(n.prototype)}},{key:"registerPlugin",value:function(t,n){if("string"!=typeof t)throw new Error('Illegal plugin name, "'.concat(t,'", must be a string, was ').concat(k(t),"."));if(Yp(t))Iu.warn('A plugin named "'.concat(t,'" already exists. You may want to avoid re-registering plugins!'));else if(zp.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'.concat(t,'", cannot share a name with an existing player method!'));if("function"!=typeof n)throw new Error('Illegal plugin for "'.concat(t,'", must be a function, was ').concat(k(n),"."));return Kp[t]=n,t!==Gp&&(e.isBasic(n)?zp.prototype[t]=function(e,t){var n=function(){Jp(this,{name:e,plugin:t,instance:null},!0);var n=t.apply(this,arguments);return $p(this,e),Jp(this,{name:e,plugin:t,instance:n}),n};return Object.keys(t).forEach(function(e){n[e]=t[e]}),n}(t,n):zp.prototype[t]=Zp(t,n)),n}},{key:"deregisterPlugin",value:function(e){if(e===Gp)throw new Error("Cannot de-register base plugin.");Yp(e)&&(delete Kp[e],delete zp.prototype[e])}},{key:"getPlugins",value:function(){var e;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object.keys(Kp)).forEach(function(t){var n=Qp(t);n&&((e=e||{})[t]=n)}),e}},{key:"getPluginVersion",value:function(e){var t=Qp(e);return t&&t.VERSION||""}}])}();function tf(e,t,n,i){return function(e,t){var n=!1;return function(){n||Iu.warn(e),n=!0;for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return t.apply(this,r)}}("".concat(t," is deprecated and will be removed in ").concat(e,".0; please use ").concat(n," instead."),i)}ef.getPlugin=Qp,ef.BASE_PLUGIN_NAME=Gp,ef.registerPlugin(Gp,ef),zp.prototype.usingPlugin=function(e){return!!this[Xp]&&!0===this[Xp][e]},zp.prototype.hasPlugin=function(e){return!!Yp(e)};var nf=function(e){return 0===e.indexOf("#")?e.slice(1):e};function rf(e,t,n){var i=rf.getPlayer(e);if(i)return t&&Iu.warn('Player "'.concat(e,'" is already initialised. Options will not be applied.')),n&&i.ready(n),i;var r="string"==typeof e?Vl("#"+nf(e)):e;if(!gl(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");var a="getRootNode"in r&&r.getRootNode()instanceof wn.ShadowRoot?r.getRootNode():r.ownerDocument.body;r.ownerDocument.defaultView&&a.contains(r)||Iu.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Tu("beforesetup").forEach(function(e){var n=e(r,Uu(t));Ou(n)&&!Array.isArray(n)?t=Uu(t,n):Iu.error("please return an object in beforesetup hooks")});var s=Mc.getComponent("Player");return i=new s(r,t,n),Tu("setup").forEach(function(e){return e(i)}),i}if(rf.hooks_=bu,rf.hooks=Tu,rf.hook=function(e,t){Tu(e,t)},rf.hookOnce=function(e,t){Tu(e,[].concat(t).map(function(t){var n=function(){return ku(e,n),t.apply(void 0,arguments)};return n}))},rf.removeHook=ku,!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE&&ml()){var af=Vl(".vjs-styles-defaults");if(!af){af=Zl("vjs-styles-defaults");var sf=Vl("head");sf&&sf.insertBefore(af,sf.firstChild),ec(af,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}Ql(1,rf),rf.VERSION=_u,rf.options=zp.prototype.options_,rf.getPlayers=function(){return zp.players},rf.getPlayer=function(e){var t,n=zp.players;if("string"==typeof e){var i=nf(e),r=n[i];if(r)return r;t=Vl("#"+i)}else t=e;if(gl(t)){var a=t,s=a.player,o=a.playerId;if(s||n[o])return s||n[o]}},rf.getAllPlayers=function(){return Object.keys(zp.players).map(function(e){return zp.players[e]}).filter(Boolean)},rf.players=zp.players,rf.getComponent=Mc.getComponent,rf.registerComponent=function(e,t){return Ld.isTech(t)&&Iu.warn("The ".concat(e," tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")),Mc.registerComponent.call(Mc,e,t)},rf.getTech=Ld.getTech,rf.registerTech=Ld.registerTech,rf.use=function(e,t){Dd[e]=Dd[e]||[],Dd[e].push(t)},Object.defineProperty(rf,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(rf.middleware,"TERMINATOR",{value:Rd,writeable:!1,enumerable:!0}),rf.browser=pl,rf.obj=Hu,rf.mergeOptions=tf(9,"videojs.mergeOptions","videojs.obj.merge",Uu),rf.defineLazyProperty=tf(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Bu),rf.bind=tf(9,"videojs.bind","native Function.prototype.bind",gc),rf.registerPlugin=ef.registerPlugin,rf.deregisterPlugin=ef.deregisterPlugin,rf.plugin=function(e,t){return Iu.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ef.registerPlugin(e,t)},rf.getPlugins=ef.getPlugins,rf.getPlugin=ef.getPlugin,rf.getPluginVersion=ef.getPluginVersion,rf.addLanguage=function(e,t){return e=(""+e).toLowerCase(),rf.options.languages=Uu(rf.options.languages,I({},e,t)),rf.options.languages[e]},rf.log=Iu,rf.createLogger=xu,rf.time=Gc,rf.createTimeRange=tf(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Fc),rf.createTimeRanges=tf(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Fc),rf.formatTime=tf(9,"videojs.formatTime","videojs.time.formatTime",Wc),rf.setFormatTime=tf(9,"videojs.setFormatTime","videojs.time.setFormatTime",Hc),rf.resetFormatTime=tf(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",zc),rf.parseUrl=tf(9,"videojs.parseUrl","videojs.url.parseUrl",gd),rf.isCrossOrigin=tf(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",_d),rf.EventTarget=bc,rf.any=hc,rf.on=uc,rf.one=dc,rf.off=lc,rf.trigger=cc,rf.xhr=Zn,rf.TextTrack=Sd,rf.AudioTrack=wd,rf.VideoTrack=Ed,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){rf[e]=function(){return Iu.warn("videojs.".concat(e,"() is deprecated; use videojs.dom.").concat(e,"() instead")),Xl[e].apply(null,arguments)}}),rf.computedStyle=tf(9,"videojs.computedStyle","videojs.dom.computedStyle",zl),rf.dom=Xl,rf.fn=_c,rf.num=vh,rf.str=Uc,rf.url=bd,rf.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};
22
- /*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
23
- var of=y(function e(t){g(this,e);var n=this;return n.id=t.id,n.label=n.id,n.width=t.width,n.height=t.height,n.bitrate=t.bandwidth,n.frameRate=t.frameRate,n.enabled_=t.enabled,Object.defineProperty(n,"enabled",{get:function(){return n.enabled_()},set:function(e){n.enabled_(e)}}),n}),uf=function(){function e(){var t;g(this,e);var n=t=c(this,e);return n.levels_=[],n.selectedIndex_=-1,Object.defineProperty(n,"selectedIndex",{get:function(){return n.selectedIndex_}}),Object.defineProperty(n,"length",{get:function(){return n.levels_.length}}),n[Symbol.iterator]=function(){return n.levels_.values()},d(t,n)}return f(e,rf.EventTarget),y(e,[{key:"addQualityLevel",value:function(e){var t=this.getQualityLevelById(e.id);if(t)return t;var n=this.levels_.length;return t=new of(e),""+n in this||Object.defineProperty(this,n,{get:function(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}},{key:"removeQualityLevel",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++)if(this[n]===e){t=this.levels_.splice(n,1)[0],this.selectedIndex_===n?this.selectedIndex_=-1:this.selectedIndex_>n&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}},{key:"getQualityLevelById",value:function(e){for(var t=0,n=this.length;t<n;t++){var i=this[t];if(i.id===e)return i}return null}},{key:"dispose",value:function(){this.selectedIndex_=-1,this.levels_.length=0}}])}();for(var lf in uf.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"},uf.prototype.allowedEvents_)uf.prototype["on"+lf]=null;var cf="4.1.0",df=function(e){return t=this,rf.obj.merge({},e),n=t.qualityLevels,i=new uf,r=function(){i.dispose(),t.qualityLevels=n,t.off("dispose",r)},t.on("dispose",r),t.qualityLevels=function(){return i},t.qualityLevels.VERSION=cf,i;var t,n,i,r};rf.registerPlugin("qualityLevels",df),df.VERSION=cf;
24
- /*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */
25
- var hf=Fi,pf=function(e,t){return t&&t.responseURL&&e!==t.responseURL?t.responseURL:e},ff=function(e){return rf.log.debug?rf.log.debug.bind(rf,"VHS:","".concat(e," >")):function(){}};function mf(){for(var e=rf.obj||rf,t=e.merge||e.mergeOptions,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.apply(e,i)}function gf(){for(var e=rf.time||rf,t=e.createTimeRanges||e.createTimeRanges,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.apply(e,i)}var vf=1/30,yf=.1,_f=function(e,t){var n,i=[];if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return gf(i)},bf=function(e,t){return _f(e,function(e,n){return e-yf<=t&&n+yf>=t})},Tf=function(e,t){return _f(e,function(e){return e-vf>=t})},kf=function(e){var t=[];if(!e||!e.length)return"";for(var n=0;n<e.length;n++)t.push(e.start(n)+" => "+e.end(n));return t.join(", ")},Sf=function(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t},wf=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},Ef=function(e,t){var n=0;if(!e||!e.length)return n;for(var i=0;i<e.length;i++){var r=e.start(i),a=e.end(i);t>a||(n+=t>r&&t<=a?a-t:a-r)}return n},Cf=function(e,t){if(!t.preload)return t.duration;var n=0;return(t.parts||[]).forEach(function(e){n+=e.duration}),(t.preloadHints||[]).forEach(function(t){"PART"===t.type&&(n+=e.partTargetDuration)}),n},Af=function(e){return(e.segments||[]).reduce(function(e,t,n){return t.parts?t.parts.forEach(function(i,r){e.push({duration:i.duration,segmentIndex:n,partIndex:r,part:i,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e},[])},If=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},xf=function(e){var t=e.preloadSegment;if(t){var n=t.parts,i=(t.preloadHints||[]).reduce(function(e,t){return e+("PART"===t.type?1:0)},0);return i+=n&&n.length?n.length:0}},Lf=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var n=If(t).length>0;return n&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:n&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Df=function(e,t,n){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;var i=function(e,t){var n=0,i=t-e.mediaSequence,r=e.segments[i];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;i--;){if(void 0!==(r=e.segments[i]).end)return{result:n+r.end,precise:!0};if(n+=Cf(e,r),void 0!==r.start)return{result:n+r.start,precise:!0}}return{result:n,precise:!1}}(e,t);if(i.precise)return i.result;var r=function(e,t){for(var n,i=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=Cf(e,n),void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:i.result+n},Pf=function(e,t,n){if(!e)return 0;if("number"!=typeof n&&(n=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return wn.Infinity}return Df(e,t,n)},Rf=function(e){var t=e.defaultDuration,n=e.durationList,i=e.startIndex,r=e.endIndex,a=0;if(i>r){var s=[r,i];i=s[0],r=s[1]}if(i<0){for(var o=i;o<Math.min(0,r);o++)a+=t;i=0}for(var u=i;u<r;u++)a+=n[u].duration;return a},Of=function(e,t,n,i){if(!e||!e.segments)return null;if(e.endList)return Pf(e);if(null===t)return null;t=t||0;var r=Df(e,e.mediaSequence+e.segments.length,t);return n&&(r-=i="number"==typeof i?i:Lf(null,e)),Math.max(0,r)},Nf=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Uf=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Mf=function(e){var t=Nf(e);return!e.disabled&&!t},Bf=function(e,t){return t.attributes&&t.attributes[e]},jf=function(e,t){if(1===e.playlists.length)return!0;var n=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!Mf(e)&&(e.attributes.BANDWIDTH||0)<n}).length},Ff=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},qf=function(e,t){var n=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},i=!1;for(var r in n){for(var a in n[r])if(i=t(n[r][a]))break;if(i)break}return!!i},Vf=function(e){if(!e||!e.playlists||!e.playlists.length)return qf(e,function(e){return e.playlists&&e.playlists.length||e.uri});for(var t,n=function(){var t=e.playlists[i],n=t.attributes&&t.attributes.CODECS;return n&&n.split(",").every(function(e){return vr(e)})||qf(e,function(e){return Ff(t,e)})?0:{v:!1}},i=0;i<e.playlists.length;i++)if(0!==(t=n())&&t)return t.v;return!0},Hf={liveEdgeDelay:Lf,duration:Pf,seekable:function(e,t,n){var i=t||0,r=Of(e,t,!0,n);return null===r?gf():(r<i&&(r=i),gf(i,r))},getMediaInfoForTime:function(e){for(var t=e.playlist,n=e.currentTime,i=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.exactManifestTimings,o=n-a,u=Af(t),l=0,c=0;c<u.length;c++){var d=u[c];if(i===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=c;break}}if(o<0){if(l>0)for(var h=l-1;h>=0;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+vf<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-Rf({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:n}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:n};l=0}for(var m=l;m<u.length;m++){var g=u[m];o-=g.duration;var v=g.duration>vf;if(!(0===o)&&!(v&&o+vf>=0)||m===u.length-1){if(s){if(o>0)continue}else if(o-vf>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+Rf({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:n}},isEnabled:Mf,isDisabled:function(e){return e.disabled},isExcluded:Nf,isIncompatible:Uf,playlistEnd:Of,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:Bf,estimateSegmentRequestTime:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Bf("BANDWIDTH",n)?(e*n.attributes.BANDWIDTH-8*i)/t:NaN},isLowestEnabledRendition:jf,isAudioOnly:Vf,playlistMatch:Ff,segmentDurationWithParts:Cf},zf=rf.log,Wf=function(e,t){return"".concat(e,"-").concat(t)},Gf=function(e,t,n){return"placeholder-uri-".concat(e,"-").concat(t,"-").concat(n)},Xf=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach(function(n){if(e.mediaGroups[n])for(var i in e.mediaGroups[n])for(var r in e.mediaGroups[n][i]){var a=e.mediaGroups[n][i][r];t(a,n,i,r)}})},Kf=function(e){var t=e.playlist,n=e.uri,i=e.id;t.id=i,t.playlistErrors_=0,n&&(t.uri=n),t.attributes=t.attributes||{}},Yf=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Gf;e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var r="placeholder-uri-".concat(i);e.playlists[i].uri=r}var a=Vf(e);Xf(e,function(t,i,r,s){if(!t.playlists||!t.playlists.length){if(a&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o];if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===r)return}t.playlists=[$({},t)]}t.playlists.forEach(function(t,a){var o=n(i,r,s,t),u=Wf(a,o);t.uri?t.resolvedUri=t.resolvedUri||hf(e.uri,t.uri):(t.uri=0===a?o:u,t.resolvedUri=t.uri),t.id=t.id||u,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t})}),function(e){for(var t=e.playlists.length;t--;){var n=e.playlists[t];Kf({playlist:n,id:Wf(t,n.uri)}),n.resolvedUri=hf(e.uri,n.uri),e.playlists[n.id]=n,e.playlists[n.uri]=n,n.attributes.BANDWIDTH||zf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){Xf(e,function(t){t.uri&&(t.resolvedUri=hf(e.uri,t.uri))})}(e)},Qf=function(){return y(function e(){g(this,e),this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map},[{key:"setOffset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null===this.offset_&&e.length){var t=S(e,1)[0];void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}}},{key:"setPendingDateRanges",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(e.length){var t=S(e,1)[0].startDate.getTime();this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce(function(e,t){return e.set(t.id,t),e},new Map)}}},{key:"processDateRange",value:function(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}},{key:"getDateRangesToProcess",value:function(){var e=this;if(null===this.offset_)return[];var t={},n=[];this.pendingDateRanges_.forEach(function(i,r){if(!e.processedDateRanges_.has(r)&&(i.startTime=i.startDate.getTime()/1e3-e.offset_,i.processDateRange=function(){return e.processDateRange(i)},n.push(i),i.class))if(t[i.class]){var a=t[i.class].push(i);i.classListIndex=a-1}else t[i.class]=[i],i.classListIndex=0});for(var i=0,r=n;i<r.length;i++){var a=r[i],s=t[a.class]||[];a.endDate?a.endTime=a.endDate.getTime()/1e3-this.offset_:a.endOnNext&&s[a.classListIndex+1]?a.endTime=s[a.classListIndex+1].startTime:a.duration?a.endTime=a.startTime+a.duration:a.plannedDuration?a.endTime=a.startTime+a.plannedDuration:a.endTime=a.startTime}return n}},{key:"trimProcessedDateRanges_",value:function(e){var t=this;new Map(this.processedDateRanges_).forEach(function(n,i){n.startDate.getTime()<e&&t.processedDateRanges_.delete(i)})}}])}(),$f=function(e){var t=e.requestType,n=e.request,i=e.error,r=e.parseFailure,a=n.status<200||n.status>299,s=n.status>=400&&n.status<=499,o={uri:n.uri,requestType:t},u=a&&!s||r;if(i&&s)o.error=$({},i),o.errorType=rf.Error.NetworkRequestFailed;else if(n.aborted)o.errorType=rf.Error.NetworkRequestAborted;else if(n.timedout)o.erroType=rf.Error.NetworkRequestTimeout;else if(u){var l=r?rf.Error.NetworkBodyParserFailed:rf.Error.NetworkBadStatus;o.errorType=l,o.status=n.status,o.headers=n.headers}return o},Jf=rf.EventTarget,Zf=function(e,t){if(!e)return t;var n=mf(e,t);if(e.preloadHints&&!t.preloadHints&&delete n.preloadHints,e.parts&&!t.parts)delete n.parts;else if(e.parts&&t.parts)for(var i=0;i<t.parts.length;i++)e.parts&&e.parts[i]&&(n.parts[i]=mf(e.parts[i],t.parts[i]));return!e.skipped&&t.skipped&&(n.skipped=!1),e.preload&&!t.preload&&(n.preload=!1),n},em=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=hf(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=hf(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=hf(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=hf(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(function(e){e.resolvedUri||(e.resolvedUri=hf(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(function(e){e.resolvedUri||(e.resolvedUri=hf(t,e.uri))})},tm=function(e){var t=e.segments||[],n=e.preloadSegment;if(n&&n.parts&&n.parts.length){if(n.preloadHints)for(var i=0;i<n.preloadHints.length;i++)if("MAP"===n.preloadHints[i].type)return t;n.duration=e.targetDuration,n.preload=!0,t.push(n)}return t},nm=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment},im=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nm,i=mf(e,{}),r=i.playlists[t.id];if(!r)return null;if(n(r,t))return null;t.segments=tm(t);var a=mf(r,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,n){var i=e.slice(),r=t.slice();n=n||0;for(var a,s=[],o=0;o<r.length;o++){var u=i[o+n],l=r[o];u?(a=u.map||a,s.push(Zf(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach(function(e){em(e,a.resolvedUri)});for(var o=0;o<i.playlists.length;o++)i.playlists[o].id===t.id&&(i.playlists[o]=a);return i.playlists[t.id]=a,i.playlists[t.uri]=a,Xf(e,function(e,n,i,r){if(e.playlists)for(var s=0;s<e.playlists.length;s++)t.id===e.playlists[s].id&&(e.playlists[s]=a)}),i},rm=function(e,t){var n=e.segments||[],i=n[n.length-1],r=i&&i.parts&&i.parts[i.parts.length-1],a=r&&r.duration||i&&i.duration;return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)},am=function(e,t,n){if(e){var i=[];return e.forEach(function(e){if(e.attributes){var t=e.attributes,n=t.BANDWIDTH,r=t.RESOLUTION,a=t.CODECS;i.push({id:e.id,bandwidth:n,resolution:r,codecs:a})}}),{type:t,isLive:n,renditions:i}}},sm=function(){function e(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(g(this,e),i=c(this,e),!t)throw new Error("A non-empty playlist URL or object is required");i.logger_=ff("PlaylistLoader");var a=r.withCredentials,s=void 0!==a&&a;i.src=t,i.vhs_=n,i.withCredentials=s,i.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;var o=n.options_;return i.customTagParsers=o&&o.customTagParsers||[],i.customTagMappers=o&&o.customTagMappers||[],i.llhls=o&&o.llhls,i.dateRangesStorage_=new Qf,i.state="HAVE_NOTHING",i.handleMediaupdatetimeout_=i.handleMediaupdatetimeout_.bind(i),i.on("mediaupdatetimeout",i.handleMediaupdatetimeout_),i.on("loadedplaylist",i.handleLoadedPlaylist_.bind(i)),i}return f(e,Jf),y(e,[{key:"handleLoadedPlaylist_",value:function(){var e=this.media();if(e){this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);var t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}}},{key:"handleMediaupdatetimeout_",value:function(){var e=this;if("HAVE_METADATA"===this.state){var t=this.media(),n=hf(this.main.uri,t.uri);this.llhls&&(n=function(e,t){if(t.endList||!t.serverControl)return e;var n={};if(t.serverControl.canBlockReload){var i=t.preloadSegment,r=t.mediaSequence+t.segments.length;if(i){var a=i.parts||[],s=xf(t)-1;s>-1&&s!==a.length-1&&(n._HLS_part=s),(s>-1||a.length)&&r--}n._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(n._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(n).length){var o=new wn.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){n.hasOwnProperty(e)&&o.searchParams.set(e,n[e])}),e=o.toString()}return e}(n,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:n,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(t,n){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})})}}},{key:"playlistRequestError",value:function(e,t,n){var i=t.uri,r=t.id;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[r],status:e.status,message:"HLS playlist request error at URL: ".concat(i,"."),responseText:e.responseText,code:e.status>=500?4:2,metadata:$f({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}},{key:"parseManifest_",value:function(e){var t=this,n=e.url,i=e.manifestString;try{return function(e){var t=e.onwarn,n=e.oninfo,i=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.llhls,l=new dr;t&&l.on("warn",t),n&&l.on("info",n),a.forEach(function(e){return l.addParser(e)}),o.forEach(function(e){return l.addTagMapper(e)}),l.push(i),l.end();var c=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){c.hasOwnProperty(e)&&delete c[e]}),c.segments&&c.segments.forEach(function(e){["parts","preloadHints"].forEach(function(t){e.hasOwnProperty(t)&&delete e[t]})})),!c.targetDuration){var d=10;c.segments&&c.segments.length&&(d=c.segments.reduce(function(e,t){return Math.max(e,t.duration)},0)),t&&t({message:"manifest has no targetDuration defaulting to ".concat(d)}),c.targetDuration=d}var h=If(c);if(h.length&&!c.partTargetDuration){var p=h.reduce(function(e,t){return Math.max(e,t.duration)},0);t&&(t({message:"manifest has no partTargetDuration defaulting to ".concat(p)}),zf.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),c.partTargetDuration=p}return c}({onwarn:function(e){var i=e.message;return t.logger_("m3u8-parser warn for ".concat(n,": ").concat(i))},oninfo:function(e){var i=e.message;return t.logger_("m3u8-parser info for ".concat(n,": ").concat(i))},manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:rf.Error.StreamingHlsPlaylistParserError,error:r}}}},{key:"haveMetadata",value:function(e){var t=e.playlistString,n=e.playlistObject,i=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:a});var s=n||this.parseManifest_({url:i,manifestString:t});s.lastRequest=Date.now(),Kf({playlist:s,uri:i,id:r});var o=im(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(rm(this.media(),!!o)),a.parsedPlaylist=am(this.main.playlists,a.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:a}),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.trigger("dispose"),this.stopRequest(),wn.clearTimeout(this.mediaUpdateTimeout),wn.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Qf,this.off()}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e,t){var n=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(wn.clearTimeout(this.finalRenditionTimeout),t){var i=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=wn.setTimeout(this.media.bind(this,e,!1),i)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(rm(e,!0)),a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;var o={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:o}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(t,i){if(n.request){if(e.lastRequest=Date.now(),e.resolvedUri=pf(e.resolvedUri,i),t)return n.playlistRequestError(n.request,e,r);n.trigger({type:"playlistrequestcomplete",metadata:o}),n.haveMetadata({playlistString:i.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===r?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}}},{key:"pause",value:function(){this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(e){var t=this;this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var n=this.media();if(e){var i=n?(n.partTargetDuration||n.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=wn.setTimeout(function(){t.mediaUpdateTimeout=null,t.load()},i)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"updateMediaUpdateTimeout_",value:function(e){var t=this;this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=wn.setTimeout(function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)},e))}},{key:"start",value:function(){var e=this;if(this.started=!0,"object"===k(this.src))return this.src.uri||(this.src.uri=wn.location.href),this.src.resolvedUri=this.src.uri,void setTimeout(function(){e.setupInitialPlaylist(e.src)},0);var t={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(n,i){if(e.request){if(e.request=null,n)return e.error={status:i.status,message:"HLS playlist request error at URL: ".concat(e.src,"."),responseText:i.responseText,code:2,metadata:$f({requestType:i.requestType,request:i,error:n})},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.trigger({type:"playlistrequestcomplete",metadata:t}),e.src=pf(e.src,i),e.trigger({type:"playlistparsestart",metadata:t});var r=e.parseManifest_({manifestString:i.responseText,url:e.src});t.parsedPlaylist=am(r.playlists,t.playlistInfo.type,!1),e.trigger({type:"playlistparsecomplete",metadata:t}),e.setupInitialPlaylist(r)}})}},{key:"srcUri",value:function(){return"string"==typeof this.src?this.src:this.src.uri}},{key:"setupInitialPlaylist",value:function(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,Yf(this.main,this.srcUri()),e.playlists.forEach(function(e){e.segments=tm(e),e.segments.forEach(function(t){em(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));var t=this.srcUri()||wn.location.href;this.main=function(e,t){var n=Wf(0,t),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:wn.location.href,resolvedUri:wn.location.href,playlists:[{uri:t,id:n,resolvedUri:t,attributes:{}}]};return i.playlists[n]=i.playlists[0],i.playlists[t]=i.playlists[0],i}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}},{key:"updateOrDeleteClone",value:function(e,t){for(var n=this.main,i=e.ID,r=n.playlists.length;r--;){var a=n.playlists[r];if(a.attributes["PATHWAY-ID"]===i){var s=a.resolvedUri,o=a.id;if(t){var u=this.createCloneURI_(a.resolvedUri,e),l=Wf(i,u),c=this.createCloneAttributes_(i,a.attributes),d=this.createClonePlaylist_(a,l,e,c);n.playlists[r]=d,n.playlists[l]=d,n.playlists[u]=d}else n.playlists.splice(r,1);delete n.playlists[o],delete n.playlists[s]}}this.updateOrDeleteCloneMedia(e,t)}},{key:"updateOrDeleteCloneMedia",value:function(e,t){var n=this.main,i=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){if(n.mediaGroups[e]&&n.mediaGroups[e][i])for(var t in n.mediaGroups[e])if(t===i){for(var r in n.mediaGroups[e][t]){n.mediaGroups[e][t][r].playlists.forEach(function(e,t){var i=n.playlists[e.id],r=i.id,a=i.resolvedUri;delete n.playlists[r],delete n.playlists[a]})}delete n.mediaGroups[e][t]}}),t&&this.createClonedMediaGroups_(e)}},{key:"addClonePathway",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.main,i=n.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=Wf(e.ID,r),s=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,a,e,s);n.playlists[i]=o,n.playlists[a]=o,n.playlists[r]=o,this.createClonedMediaGroups_(e)}},{key:"createClonedMediaGroups_",value:function(e){var t=this,n=e.ID,i=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(a){if(r.mediaGroups[a]&&!r.mediaGroups[a][n])for(var s in r.mediaGroups[a])if(s===i){r.mediaGroups[a][n]={};var o=function(i){var o=r.mediaGroups[a][s][i];r.mediaGroups[a][n][i]=$({},o);var u=r.mediaGroups[a][n][i],l=t.createCloneURI_(o.resolvedUri,e);u.resolvedUri=l,u.uri=l,u.playlists=[],o.playlists.forEach(function(s,o){var l=r.playlists[s.id],c=Gf(a,n,i),d=Wf(n,c);if(l&&!r.playlists[d]){var h=t.createClonePlaylist_(l,d,e),p=h.resolvedUri;r.playlists[d]=h,r.playlists[p]=h}u.playlists[o]=t.createClonePlaylist_(s,d,e)})};for(var u in r.mediaGroups[a][s])o(u)}})}},{key:"createClonePlaylist_",value:function(e,t,n,i){var r=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),i&&(a.attributes=i),mf(e,a)}},{key:"createCloneURI_",value:function(e,t){var n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;for(var i=t["URI-REPLACEMENT"].PARAMS,r=0,a=Object.keys(i);r<a.length;r++){var s=a[r];n.searchParams.set(s,i[s])}return n.href}},{key:"createCloneAttributes_",value:function(e,t){var n=I({},"PATHWAY-ID",e);return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(i){t[i]&&(n[i]=e)}),n}},{key:"getKeyIdSet",value:function(e){if(e.contentProtection){var t=new Set;for(var n in e.contentProtection){var i=e.contentProtection[n].attributes.keyId;i&&t.add(i.toLowerCase())}return t}}}])}(),om=function(e,t,n,i){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),n.headers&&(e.responseHeaders=n.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===n.statusCode||206===n.statusCode||0===n.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),i(t,e)},um=function(){var e=function e(t,n){t=mf({timeout:45e3},t);var i=e.beforeRequest||rf.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||rf.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||rf.Vhs.xhr._responseCallbackSet;i&&"function"==typeof i&&(rf.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(i));var s=!0===rf.Vhs.xhr.original?rf.xhr:rf.Vhs.xhr,o=function(e,t){if(e&&e.size){var n=t;return e.forEach(function(e){n=e(n)}),n}}(r,t);r.delete(i);var u=s(o||t,function(e,t){return function(e,t,n,i){e&&e.size&&e.forEach(function(e){e(t,n,i)})}(a,u,e,t),om(u,e,t,n)}),l=u.abort;return u.abort=function(){return u.aborted=!0,l.apply(u,arguments)},u.uri=t.uri,u.requestType=t.requestType,u.requestTime=Date.now(),u};return e.original=!0,e},lm=function(e){var t,n={};return e.byterange&&(n.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?wn.BigInt(t.offset)+wn.BigInt(t.length)-wn.BigInt(1):t.offset+t.length-1)),n},cm=function(e,t){return e.start(t)+"-"+e.end(t)},dm=function(e,t){var n=e.toString(16);return"00".substring(0,2-n.length)+n+(t%2?" ":"")},hm=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},pm=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];Er(i)?t[n]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:t[n]=i}),t},fm=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},mm=function(e){return e.resolvedUri},gm=function(e){for(var t=Array.prototype.slice.call(e),n=16,i="",r=0;r<t.length/n;r++)i+=t.slice(r*n,r*n+n).map(dm).join("")+" "+t.slice(r*n,r*n+n).map(hm).join("")+"\n";return i},vm=Object.freeze({__proto__:null,createTransferableMessage:pm,initSegmentId:fm,segmentKeyId:mm,hexDump:gm,tagDump:function(e){var t=e.bytes;return gm(t)},textRanges:function(e){var t,n="";for(t=0;t<e.length;t++)n+=cm(e,t)+" ";return n}}),ym=function(e){var t=e.playlist,n=e.time,i=void 0===n?void 0:n,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===i)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var n,i=0,r=0;r<t.segments.length&&!(e<=(i=(n=t.segments[r]).videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:i+n.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*a.duration)return null;n=a}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}}(i,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:i},o=function(e,t){if(!t.dateTimeObject)return null;var n=t.videoTimingInfo.transmuxerPrependedSeconds,i=e-(t.videoTimingInfo.transmuxedPresentationStart+n);return new Date(t.dateTimeObject.getTime()+1e3*i)}(i,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},_m=function(e){var t=e.programTime,n=e.playlist,i=e.retryCount,r=void 0===i?2:i,a=e.seekTo,s=e.pauseAfterSeek,o=void 0===s||s,u=e.tech,l=e.callback;if(!l)throw new Error("seekToProgramTime: callback must be provided");if(void 0===t||!n||!a)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!u.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return l({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var c=function(e,t){var n;try{n=new Date(e)}catch(vy){return null}if(!t||!t.segments||0===t.segments.length)return null;var i=t.segments[0];if(n<new Date(i.dateTimeObject))return null;for(var r=0;r<t.segments.length-1&&(i=t.segments[r],!(n<new Date(t.segments[r+1].dateTimeObject)));r++);var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return n>new Date(o.getTime()+1e3*u)?null:(n>new Date(o)&&(i=s),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Hf.duration(t,t.mediaSequence+t.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})}(t,n);if(!c)return l({message:"".concat(t," was not found in the stream")});var d=c.segment,h=function(e,t){var n,i;try{n=new Date(e),i=new Date(t)}catch(vy){}var r=n.getTime();return(i.getTime()-r)/1e3}(d.dateTimeObject,t);if("estimate"===c.type)return 0===r?l({message:"".concat(t," is not buffered yet. Try again")}):(a(c.estimatedStart+h),void u.one("seeked",function(){_m({programTime:t,playlist:n,retryCount:r-1,seekTo:a,pauseAfterSeek:o,tech:u,callback:l})}));var p=d.start+h;u.one("seeked",function(){return l(null,u.currentTime())}),o&&u.pause(),a(p)},bm=function(e,t){if(4===e.readyState)return t()},Tm=function(e,t,n,i){var r,a=[],s=!1,o=function(e,t,i,r){return t.abort(),s=!0,n(e,t,i,r)},u=function(e,t){if(!s){if(e)return e.metadata=$f({requestType:i,request:t,error:e}),o(e,t,"",a);var n=t.responseText.substring(a&&a.byteLength||0,t.responseText.length);if(a=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t=t.filter(function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}),t.length<=1)return Cr(t[0]);var i=t.reduce(function(e,t,n){return e+(t.byteLength||t.length)},0),r=new Uint8Array(i),a=0;return t.forEach(function(e){e=Cr(e),r.set(e,a),a+=e.byteLength}),r}(a,Dr(n,!0)),r=r||Xo(a),a.length<10||r&&a.length<r+2)return bm(t,function(){return o(e,t,"",a)});var u=mu(a);return"ts"===u&&a.length<188||!u&&a.length<376?bm(t,function(){return o(e,t,"",a)}):o(null,t,u,a)}},l=t({uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function(t){t.total,t.loaded;return om(e,null,{statusCode:e.status},u)})}},function(e,t){return om(l,e,t,u)});return l},km=rf.EventTarget,Sm=function(e,t){if(!nm(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var n=0;n<e.segments.length;n++){var i=e.segments[n],r=t.segments[n];if(i.uri!==r.uri)return!1;if(i.byterange||r.byterange){var a=i.byterange,s=r.byterange;if(a&&!s||!a&&s)return!1;if(a.offset!==s.offset||a.length!==s.length)return!1}}return!0},wm=function(e,t,n,i){var r=i.attributes.NAME||n;return"placeholder-uri-".concat(e,"-").concat(t,"-").concat(r)},Em=function(e,t,n){for(var i=!0,r=mf(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a<t.playlists.length;a++){var s=t.playlists[a];if(s.sidx){var o=uo(s.sidx);n&&n[o]&&n[o].sidx&&to(s,n[o].sidx,s.sidx.resolvedUri)}var u=im(r,s,Sm);u&&(r=u,i=!1)}return Xf(t,function(e,t,n,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=im(r,e.playlists[0],Sm);o&&(a in(r=o).mediaGroups[t][n]||(r.mediaGroups[t][n][a]=e),r.mediaGroups[t][n][a].playlists[0]=r.playlists[s],i=!1)}}),function(e,t){Xf(e,function(n,i,r,a){t.mediaGroups[i][r]&&a in t.mediaGroups[i][r]||delete e.mediaGroups[i][r][a]})}(r,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(i=!1),i?null:r},Cm=function(e,t){return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},Am=function(e,t){var n={};for(var i in e){var r=e[i].sidx;if(r){var a=uo(r);if(!t[a])break;var s=t[a].sidxInfo;Cm(s,r)&&(n[a]=t[a])}}return n},Im=function(){function e(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;g(this,e),(i=c(this,e)).isPaused_=!0,i.mainPlaylistLoader_=a||i,a||(i.isMain_=!0);var s=r.withCredentials,o=void 0!==s&&s;if(i.vhs_=n,i.withCredentials=o,i.addMetadataToTextTrack=r.addMetadataToTextTrack,!t)throw new Error("A non-empty playlist URL or object is required");return i.on("minimumUpdatePeriod",function(){i.refreshXml_()}),i.on("mediaupdatetimeout",function(){i.refreshMedia_(i.media().id)}),i.state="HAVE_NOTHING",i.loadedPlaylists_={},i.logger_=ff("DashPlaylistLoader"),i.isMain_?(i.mainPlaylistLoader_.srcUrl=t,i.mainPlaylistLoader_.sidxMapping_={}):i.childPlaylist_=t,i}return f(e,km),y(e,[{key:"isPaused",get:function(){return this.isPaused_}},{key:"requestErrored_",value:function(e,t,n){return!this.request||(this.request=null,e?(this.error="object"!==k(e)||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata}:e,n&&(this.state=n),this.trigger("error"),!0):void 0)}},{key:"addSidxSegments_",value:function(e,t,n){var i=this,r=e.sidx&&uo(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r])return wn.clearTimeout(this.mediaRequest_),void(this.mediaRequest_=wn.setTimeout(function(){return n(!1)},0));var a=pf(e.sidx.resolvedUri),s=function(a,s){if(!i.requestErrored_(a,s,t)){var o,u=i.mainPlaylistLoader_.sidxMapping_,l=s.requestType;try{o=Wo(Cr(s.response).subarray(8))}catch(vy){return vy.metadata=$f({requestType:l,request:s,parseFailure:!0}),void i.requestErrored_(vy,s,t)}return u[r]={sidxInfo:e.sidx,sidx:o},to(e,o,e.sidx.resolvedUri),n(!0)}};this.request=Tm(a,this.vhs_.xhr,function(t,n,r,o){if(t)return s(t,n);if(!r||"mp4"!==r){var u=r||"unknown";return s({status:n.status,message:"Unsupported ".concat(u," container type for sidx segment at URL: ").concat(a),response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},n)}var l=e.sidx.byterange,c=l.offset,d=l.length;if(o.length>=d+c)return s(t,{response:o.subarray(c,c+d),status:n.status,uri:n.uri});i.request=i.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:lm({byterange:e.sidx.byterange})},s)},"dash-sidx")}},{key:"dispose",value:function(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},wn.clearTimeout(this.minimumUpdatePeriodTimeout_),wn.clearTimeout(this.mediaRequest_),wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}var i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,n,function(i){t.haveMetadata({startingState:n,playlist:e})}))}},{key:"haveMetadata",value:function(e){var t=e.startingState,n=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[n.id]=n,wn.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(n.id),"HAVE_MAIN_MANIFEST"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(wn.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(e){var t=this;this.isPaused_=!1,wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var n=this.media();if(e){var i=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=wn.setTimeout(function(){return t.load()},i)}else this.started?n&&!n.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var e=this;if(this.started=!0,!this.isMain_)return wn.clearTimeout(this.mediaRequest_),void(this.mediaRequest_=wn.setTimeout(function(){return e.haveMain_()},0));this.requestMain_(function(t,n){e.haveMain_(),e.hasPendingRequest()||e.media_||e.media(e.mainPlaylistLoader_.main.playlists[0])})}},{key:"requestMain_",value:function(e){var t=this,n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},function(i,r){if(i){var a=r.requestType;i.metadata=$f({requestType:a,request:r,error:i})}if(!t.requestErrored_(i,r)){t.trigger({type:"manifestrequestcomplete",metadata:n});var s=r.responseText!==t.mainPlaylistLoader_.mainXml_;return t.mainPlaylistLoader_.mainXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?t.mainLoaded_=Date.parse(r.responseHeaders.date):t.mainLoaded_=Date.now(),t.mainPlaylistLoader_.srcUrl=pf(t.mainPlaylistLoader_.srcUrl,r),s?(t.handleMain_(),void t.syncClientServerClock_(function(){return e(r,s)})):e(r,s)}"HAVE_NOTHING"===t.state&&(t.started=!1)})}},{key:"syncClientServerClock_",value:function(e){var t=this,n=qo(this.mainPlaylistLoader_.mainXml_);return null===n?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:hf(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},function(i,r){if(t.request){if(i){var a=r.requestType;return t.error.metadata=$f({requestType:a,request:r,error:i}),t.mainPlaylistLoader_.clientOffset_=t.mainLoaded_-Date.now(),e()}var s;s="HEAD"===n.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.mainLoaded_:Date.parse(r.responseText),t.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()}}))}},{key:"haveMain_",value:function(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}},{key:"handleMain_",value:function(){wn.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;var e,t,n,i,r,a,s,o,u=this.mainPlaylistLoader_.main,l={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:l});try{t={mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:u},n=t.mainXml,i=t.srcUrl,r=t.clientOffset,a=t.sidxMapping,s=t.previousManifest,o=Fo(n,{manifestUri:i,clientOffset:r,sidxMapping:a,previousManifest:s}),Yf(o,i,wm),e=o}catch(g){this.error=g,this.error.metadata={errorType:rf.Error.StreamingDashManifestParserError,error:g},this.trigger("error")}u&&(e=Em(u,e,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=e||u;var c=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(c&&c!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=c),(!u||e&&e.minimumUpdatePeriod!==u.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(e),e){var d=e,h=d.duration,p=d.endList,f=[];e.playlists.forEach(function(e){f.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})});var m={duration:h,isLive:!p,renditions:f};l.parsedManifest=m,this.trigger({type:"manifestparsecomplete",metadata:l})}return Boolean(e)}},{key:"updateMinimumUpdatePeriodTimeout_",value:function(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(wn.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of ".concat(t,", not setting a timeout")):this.createMUPTimeout_(t)}},{key:"createMUPTimeout_",value:function(e){var t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=wn.setTimeout(function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}},{key:"refreshXml_",value:function(){var e=this;this.requestMain_(function(t,n){var i,r,a;n&&(e.media_&&(e.media_=e.mainPlaylistLoader_.main.playlists[e.media_.id]),e.mainPlaylistLoader_.sidxMapping_=(i=e.mainPlaylistLoader_.main,r=e.mainPlaylistLoader_.sidxMapping_,a=Am(i.playlists,r),Xf(i,function(e,t,n,i){if(e.playlists&&e.playlists.length){var s=e.playlists;a=mf(a,Am(s,r))}}),a),e.addSidxSegments_(e.media(),e.state,function(t){e.refreshMedia_(e.media().id)}))})}},{key:"refreshMedia_",value:function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var n=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==n[e];if(i?this.media_=n[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){var r=function(){t.media().endList||(t.mediaUpdateTimeout=wn.setTimeout(function(){t.trigger("mediaupdatetimeout"),r()},rm(t.media(),Boolean(i))))};r()}this.trigger("loadedplaylist")}},{key:"addEventStreamToMetadataTrack_",value:function(e){if(e&&this.mainPlaylistLoader_.main.eventStream){var t=this.mainPlaylistLoader_.main.eventStream.map(function(e){return{cueTime:e.start,frames:[{data:e.messageData}]}});this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}},{key:"getKeyIdSet",value:function(e){if(e.contentProtection){var t=new Set;for(var n in e.contentProtection){var i=e.contentProtection[n].attributes["cenc:default_KID"];i&&t.add(i.replace(/-/g,"").toLowerCase())}return t}}}])}(),xm={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},Lm=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Dm=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(vy){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),n=Lm(new Worker(t));n.objURL=t;var i=n.terminate;return n.on=n.addEventListener,n.off=n.removeEventListener,n.terminate=function(){return URL.revokeObjectURL(t),i.call(this)},n}},Pm=function(e){return"var browserWorkerPolyFill = ".concat(Lm.toString(),";\n")+"browserWorkerPolyFill(self);\n"+e},Rm=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},Om=Pm(Rm(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==U.global?U.global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var i;return!!e[t]&&(i=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(i,1),i>-1)},this.trigger=function(t){var n,i,r,a;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].apply(this,a)}},this.dispose=function(){e={}}}};t.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),this.on("partialdone",function(t){e.partialFlush(t)}),this.on("endedtimeline",function(t){e.endTimeline(t)}),this.on("reset",function(t){e.reset(t)}),e},t.prototype.push=function(e){this.trigger("data",e)},t.prototype.flush=function(e){this.trigger("done",e)},t.prototype.partialFlush=function(e){this.trigger("partialdone",e)},t.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},t.prototype.reset=function(e){this.trigger("reset",e)};var n,i,r,a,s,o,u,l,c,d,h,p,f,m,v,_,b,T,S,w,E,C,A,I,x,L,D,P,R,O,N,M,B,j,F,q,V,H,z,W,G=t,X=Math.pow(2,32),K={getUint64:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getBigUint64?(t=n.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:n.getUint32(0)*X+n.getUint32(4)},MAX_UINT32:X},Y=K.MAX_UINT32;!function(){var e;if(C={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in C)C.hasOwnProperty(e)&&(C[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);A=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),x=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),I=new Uint8Array([0,0,0,1]),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]),D=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]),P={video:L,audio:D},N=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),O=new Uint8Array([0,0,0,0,0,0,0,0]),M=new Uint8Array([0,0,0,0,0,0,0,0]),B=M,j=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F=M,R=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),n=function(e){var t,n,i=[],r=0;for(t=1;t<arguments.length;t++)i.push(arguments[t]);for(t=i.length;t--;)r+=i[t].byteLength;for(n=new Uint8Array(r+8),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,n.byteLength),n.set(e,4),t=0,r=8;t<i.length;t++)n.set(i[t],r),r+=i[t].byteLength;return n},i=function(){return n(C.dinf,n(C.dref,N))},r=function(e){return n(C.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},v=function(e){return n(C.hdlr,P[e])},m=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),n(C.mdhd,t)},f=function(e){return n(C.mdia,m(e),v(e.type),o(e))},s=function(e){return n(C.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return n(C.minf,"video"===e.type?n(C.vmhd,R):n(C.smhd,O),i(),b(e))},u=function(e,t){for(var i=[],r=t.length;r--;)i[r]=S(t[r]);return n.apply(null,[C.moof,s(e)].concat(i))},l=function(e){for(var t=e.length,i=[];t--;)i[t]=h(e[t]);return n.apply(null,[C.moov,d(4294967295)].concat(i).concat(c(e)))},c=function(e){for(var t=e.length,i=[];t--;)i[t]=w(e[t]);return n.apply(null,[C.mvex].concat(i))},d=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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 n(C.mvhd,t)},_=function(e){var t,i,r=e.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)t=r[i].flags,a[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return n(C.sdtp,a)},b=function(e){return n(C.stbl,T(e),n(C.stts,F),n(C.stsc,B),n(C.stsz,j),n(C.stco,M))},T=function(e){return n(C.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?q(e):V(e))},q=function(e){var t,i,r=e.sps||[],a=e.pps||[],s=[],o=[];for(t=0;t<r.length;t++)s.push((65280&r[t].byteLength)>>>8),s.push(255&r[t].byteLength),s=s.concat(Array.prototype.slice.call(r[t]));for(t=0;t<a.length;t++)o.push((65280&a[t].byteLength)>>>8),o.push(255&a[t].byteLength),o=o.concat(Array.prototype.slice.call(a[t]));if(i=[C.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(C.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),n(C.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];i.push(n(C.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return n.apply(null,i)},V=function(e){return n(C.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return n(C.tkhd,t)},S=function(e){var t,i,r,a,s,o;return t=n(C.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/Y),o=Math.floor(e.baseMediaDecodeTime%Y),i=n(C.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=E(e,92),n(C.traf,t,i,r)):(a=_(e),r=E(e,a.length+92),n(C.traf,t,i,r,a))},h=function(e){return e.duration=e.duration||4294967295,n(C.trak,p(e),f(e))},w=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),n(C.trex,t)},W=function(e,t){var n=0,i=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(i=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,n|i|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},z=function(e,t){var i,r,a,s,o,u;for(t+=20+16*(s=e.samples||[]).length,a=W(s,t),(r=new Uint8Array(a.length+16*s.length)).set(a),i=a.length,u=0;u<s.length;u++)o=s[u],r[i++]=(4278190080&o.duration)>>>24,r[i++]=(16711680&o.duration)>>>16,r[i++]=(65280&o.duration)>>>8,r[i++]=255&o.duration,r[i++]=(4278190080&o.size)>>>24,r[i++]=(16711680&o.size)>>>16,r[i++]=(65280&o.size)>>>8,r[i++]=255&o.size,r[i++]=o.flags.isLeading<<2|o.flags.dependsOn,r[i++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[i++]=61440&o.flags.degradationPriority,r[i++]=15&o.flags.degradationPriority,r[i++]=(4278190080&o.compositionTimeOffset)>>>24,r[i++]=(16711680&o.compositionTimeOffset)>>>16,r[i++]=(65280&o.compositionTimeOffset)>>>8,r[i++]=255&o.compositionTimeOffset;return n(C.trun,r)},H=function(e,t){var i,r,a,s,o,u;for(t+=20+8*(s=e.samples||[]).length,a=W(s,t),(i=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u<s.length;u++)o=s[u],i[r++]=(4278190080&o.duration)>>>24,i[r++]=(16711680&o.duration)>>>16,i[r++]=(65280&o.duration)>>>8,i[r++]=255&o.duration,i[r++]=(4278190080&o.size)>>>24,i[r++]=(16711680&o.size)>>>16,i[r++]=(65280&o.size)>>>8,i[r++]=255&o.size;return n(C.trun,i)},E=function(e,t){return"audio"===e.type?H(e,t):z(e,t)};var Q,$,J,Z,ee,te,ne,ie,re={ftyp:a=function(){return n(C.ftyp,A,I,A,x)},mdat:function(e){return n(C.mdat,e)},moof:u,moov:l,initSegment:function(e){var t,n=a(),i=l(e);return(t=new Uint8Array(n.byteLength+i.byteLength)).set(n),t.set(i,n.byteLength),t}},ae=function(e,t){var n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},se={groupNalsIntoFrames:function(e){var t,n,i=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,i.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(n=e[t]).nalUnitType?(i.length&&(i.duration=n.dts-i.dts,r.byteLength+=i.byteLength,r.nalCount+=i.length,r.duration+=i.duration,r.push(i)),(i=[n]).byteLength=n.data.byteLength,i.pts=n.pts,i.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(i.keyFrame=!0),i.duration=n.dts-i.dts,i.byteLength+=n.data.byteLength,i.push(n));return r.length&&(!i.duration||i.duration<=0)&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.length,r.duration+=i.duration,r.push(i),r},groupFramesIntoGops:function(e){var t,n,i=[],r=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=e[0].pts,i.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(n=e[t]).keyFrame?(i.length&&(r.push(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration),(i=[n]).nalCount=n.length,i.byteLength=n.byteLength,i.pts=n.pts,i.dts=n.dts,i.duration=n.duration):(i.duration+=n.duration,i.nalCount+=n.length,i.byteLength+=n.byteLength,i.push(n));return r.length&&i.duration<=0&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration,r.push(i),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var n,i,r,a,s,o=t||0,u=[];for(n=0;n<e.length;n++)for(a=e[n],i=0;i<a.length;i++)s=a[i],o+=(r=ae(s,o)).size,u.push(r);return u},concatenateNalData:function(e){var t,n,i,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],n=0;n<r.length;n++)for(a=r[n],i=0;i<a.length;i++)s=a[i],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},generateSampleTableForFrame:function(e,t){var n,i=[];return n=ae(e,t||0),i.push(n),i},concatenateNalDataForFrame:function(e){var t,n,i=0,r=e.byteLength,a=e.length,s=new Uint8Array(r+4*a),o=new DataView(s.buffer);for(t=0;t<e.length;t++)n=e[t],o.setUint32(i,n.data.byteLength),i+=4,s.set(n.data,i),i+=n.data.byteLength;return s}},oe=[33,16,5,32,164,27],ue=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],le=function(e){for(var t=[];e--;)t.push(0);return t},ce=9e4;te=function(e,t){return $(ee(e,t))},ne=function(e,t){return J(Z(e),t)},ie=function(e,t,n){return Z(n?e:e-t)};var de={ONE_SECOND_IN_TS:ce,secondsToVideoTs:$=function(e){return e*ce},secondsToAudioTs:J=function(e,t){return e*t},videoTsToSeconds:Z=function(e){return e/ce},audioTsToSeconds:ee=function(e,t){return e/t},audioTsToVideoTs:te,videoTsToAudioTs:ne,metadataTsToSeconds:ie},he=function(){if(!Q){var e={96e3:[oe,[227,64],le(154),[56]],88200:[oe,[231],le(170),[56]],64e3:[oe,[248,192],le(240),[56]],48e3:[oe,[255,192],le(268),[55,148,128],le(54),[112]],44100:[oe,[255,192],le(268),[55,163,128],le(84),[112]],32e3:[oe,[255,192],le(268),[55,234],le(226),[112]],24e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,112],le(126),[224]],16e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,255],le(269),[223,108],le(195),[1,192]],12e3:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,253,128],le(259),[56]],11025:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,255,192],le(268),[55,175,128],le(108),[112]],8e3:[ue,le(268),[3,121,16],le(47),[7]]};t=e,Q=Object.keys(t).reduce(function(e,n){return e[n]=new Uint8Array(t[n].reduce(function(e,t){return e.concat(t)},[])),e},{})}var t;return Q},pe=de,fe={prefixWithSilence:function(e,t,n,i){var r,a,s,o,u,l=0,c=0,d=0;if(t.length&&(r=pe.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(pe.ONE_SECOND_IN_TS/(e.samplerate/1024)),n&&i&&(l=r-Math.max(n,i),d=(c=Math.floor(l/a))*a),!(c<1||d>pe.ONE_SECOND_IN_TS/2))){for((s=he()[e.samplerate])||(s=t[0].data),o=0;o<c;o++)u=t[0],t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a});return e.baseMediaDecodeTime-=Math.floor(pe.videoTsToAudioTs(d,e.samplerate)),d}},trimAdtsFramesByEarliestDts:function(e,t,n){return t.minSegmentDts>=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){var t,n,i=[];for(t=0;t<e.length;t++)n=e[t],i.push({size:n.data.byteLength,duration:1024});return i},concatenateFrameData:function(e){var t,n,i=0,r=new Uint8Array(function(e){var t,n=0;for(t=0;t<e.length;t++)n+=e[t].data.byteLength;return n}(e));for(t=0;t<e.length;t++)n=e[t],r.set(n.data,i),i+=n.data.byteLength;return r}},me=de.ONE_SECOND_IN_TS,ge={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var n,i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),n=e.timelineStartInfo.baseMediaDecodeTime,n+=i,n=Math.max(0,n),"audio"===e.type&&(n*=e.samplerate/me,n=Math.floor(n)),n},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},ve={parseSei:function(e){for(var t=0,n={payloadType:-1,payloadSize:0},i=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)i+=255,t++;for(i+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!n.payload&&4===i){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){n.payloadType=i,n.payloadSize=r,n.payload=e.subarray(t,t+r);break}n.payload=void 0}t+=r,i=0,r=0}return n},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var n,i,r,a,s=[];if(!(64&t[0]))return s;for(i=31&t[0],n=0;n<i;n++)a={type:3&t[(r=3*n)+2],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},discardEmulationPreventionBytes:function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},USER_DATA_REGISTERED_ITU_T_T35:4},ye=G,_e=ve,be=function(e){e=e||{},be.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Le(0,0),new Le(0,1),new Le(1,0),new Le(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ee({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};be.prototype=new ye,be.prototype.push=function(e){var t,n,i;if("sei_rbsp"===e.nalUnitType&&(t=_e.parseSei(e.escapedRBSP)).payload&&t.payloadType===_e.USER_DATA_REGISTERED_ITU_T_T35&&(n=_e.parseUserData(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));i=_e.parseCaptionPackets(e.pts,n),this.captionPackets_=this.captionPackets_.concat(i),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},be.prototype.flushCCStreams=function(e){this.ccStreams_.forEach(function(t){return"flush"===e?t.flush():t.partialFlush()},this)},be.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)},this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},be.prototype.flush=function(){return this.flushStream("flush")},be.prototype.partialFlush=function(){return this.flushStream("partialFlush")},be.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},be.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},be.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},be.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},be.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},be.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Te={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},ke=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Se=function(e){this.windowNum=e,this.reset()};Se.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Se.prototype.getText=function(){return this.rows.join("\n")},Se.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Se.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Se.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Se.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Se.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var we=function(e,t,n){this.serviceNum=e,this.text="",this.currentWindow=new Se(-1),this.windows=[],this.stream=n,"string"==typeof t&&this.createTextDecoder(t)};we.prototype.init=function(e,t){this.startPts=e;for(var n=0;n<8;n++)this.windows[n]=new Se(n),"function"==typeof t&&(this.windows[n].beforeRowOverflow=t)},we.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},we.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ee=function(e){e=e||{},Ee.prototype.init.call(this);var t,n=this,i=e.captionServices||{},r={};Object.keys(i).forEach(function(e){t=i[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Ee.prototype=new ye,Ee.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ee.prototype.add708Bytes=function(e){var t=e.ccData,n=t>>>8,i=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(n),this.current708Packet.data.push(i)},Ee.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,n=null,i=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r<t.length;r++)i=31&(a=t[r++]),7===(n=a>>5)&&i>0&&(n=a=t[r++]),this.pushServiceBlock(n,r,i),i>0&&(r+=i-1)},Ee.prototype.pushServiceBlock=function(e,t,n){var i,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r<t+n&&r<a.length;r++)i=a[r],ke(i)?r=this.handleText(r,s):24===i?r=this.multiByteCharacter(r,s):16===i?r=this.extendedCommands(r,s):128<=i&&i<=135?r=this.setCurrentWindow(r,s):152<=i&&i<=159?r=this.defineWindow(r,s):136===i?r=this.clearWindows(r,s):140===i?r=this.deleteWindows(r,s):137===i?r=this.displayWindows(r,s):138===i?r=this.hideWindows(r,s):139===i?r=this.toggleWindows(r,s):151===i?r=this.setWindowAttributes(r,s):144===i?r=this.setPenAttributes(r,s):145===i?r=this.setPenColor(r,s):146===i?r=this.setPenLocation(r,s):143===i?s=this.reset(r,s):8===i?s.currentWindow.backspace():12===i?s.currentWindow.clearText():13===i?s.currentWindow.pendingNewLine=!0:14===i?s.currentWindow.clearText():141===i&&r++},Ee.prototype.extendedCommands=function(e,t){var n=this.current708Packet.data[++e];return ke(n)&&(e=this.handleText(e,t,{isExtended:!0})),e},Ee.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ee.prototype.initService=function(e,t){var n,i,r=this;return(n="SERVICE"+e)in this.serviceEncodings&&(i=this.serviceEncodings[n]),this.services[e]=new we(e,i,r),this.services[e].init(this.getPts(t),function(t){r.flushDisplayed(t,r.services[e])}),this.services[e]},Ee.prototype.handleText=function(e,t,n){var i,r,a,s,o=n&&n.isExtended,u=n&&n.isMultiByte,l=this.current708Packet.data,c=o?4096:0,d=l[e],h=l[e+1],p=t.currentWindow;if(u?(r=[d,h],e++):r=[d],t.textDecoder_&&!o)i=t.textDecoder_.decode(new Uint8Array(r));else if(u){var f=r.map(function(e){return("0"+(255&e).toString(16)).slice(-2)}).join("");i=String.fromCharCode(parseInt(f,16))}else s=Te[a=c|d]||a,i=4096&a&&a===s?"":String.fromCharCode(s);return p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(i),e},Ee.prototype.multiByteCharacter=function(e,t){var n=this.current708Packet.data,i=n[e+1],r=n[e+2];return ke(i)&&ke(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Ee.prototype.setCurrentWindow=function(e,t){var n=7&this.current708Packet.data[e];return t.setCurrentWindow(n),e},Ee.prototype.defineWindow=function(e,t){var n=this.current708Packet.data,i=n[e],r=7&i;t.setCurrentWindow(r);var a=t.currentWindow;return i=n[++e],a.visible=(32&i)>>5,a.rowLock=(16&i)>>4,a.columnLock=(8&i)>>3,a.priority=7&i,i=n[++e],a.relativePositioning=(128&i)>>7,a.anchorVertical=127&i,i=n[++e],a.anchorHorizontal=i,i=n[++e],a.anchorPoint=(240&i)>>4,a.rowCount=15&i,i=n[++e],a.columnCount=63&i,i=n[++e],a.windowStyle=(56&i)>>3,a.penStyle=7&i,a.virtualRowCount=a.rowCount+1,e},Ee.prototype.setWindowAttributes=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.winAttr;return i=n[++e],r.fillOpacity=(192&i)>>6,r.fillRed=(48&i)>>4,r.fillGreen=(12&i)>>2,r.fillBlue=3&i,i=n[++e],r.borderType=(192&i)>>6,r.borderRed=(48&i)>>4,r.borderGreen=(12&i)>>2,r.borderBlue=3&i,i=n[++e],r.borderType+=(128&i)>>5,r.wordWrap=(64&i)>>6,r.printDirection=(48&i)>>4,r.scrollDirection=(12&i)>>2,r.justify=3&i,i=n[++e],r.effectSpeed=(240&i)>>4,r.effectDirection=(12&i)>>2,r.displayEffect=3&i,e},Ee.prototype.flushDisplayed=function(e,t){for(var n=[],i=0;i<8;i++)t.windows[i].visible&&!t.windows[i].isEmpty()&&n.push(t.windows[i].getText());t.endPts=e,t.text=n.join("\n\n"),this.pushCaption(t),t.startPts=e},Ee.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ee.prototype.displayWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible=1);return e},Ee.prototype.hideWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible=0);return e},Ee.prototype.toggleWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible^=1);return e},Ee.prototype.clearWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&t.windows[r].clearText();return e},Ee.prototype.deleteWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&t.windows[r].reset();return e},Ee.prototype.setPenAttributes=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penAttr;return i=n[++e],r.textTag=(240&i)>>4,r.offset=(12&i)>>2,r.penSize=3&i,i=n[++e],r.italics=(128&i)>>7,r.underline=(64&i)>>6,r.edgeType=(56&i)>>3,r.fontStyle=7&i,e},Ee.prototype.setPenColor=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penColor;return i=n[++e],r.fgOpacity=(192&i)>>6,r.fgRed=(48&i)>>4,r.fgGreen=(12&i)>>2,r.fgBlue=3&i,i=n[++e],r.bgOpacity=(192&i)>>6,r.bgRed=(48&i)>>4,r.bgGreen=(12&i)>>2,r.bgBlue=3&i,i=n[++e],r.edgeRed=(48&i)>>4,r.edgeGreen=(12&i)>>2,r.edgeBlue=3&i,e},Ee.prototype.setPenLocation=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,i=n[++e],r.row=15&i,i=n[++e],r.column=63&i,e},Ee.prototype.reset=function(e,t){var n=this.getPts(e);return this.flushDisplayed(n,t),this.initService(t.serviceNum,e)};var Ce={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Ae=function(e){return null===e?"":(e=Ce[e]||e,String.fromCharCode(e))},Ie=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],xe=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},Le=function(e,t){Le.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,n,i,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),i=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),n=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=n,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=xe();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=xe();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=xe()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(i,r))a=Ae((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(i,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),a=Ae((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(i,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14&~r||this.addFormatting(e.pts,["i"]),1&~r||this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(i,r)){var s=3&r;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(i,r)){var o=Ie.indexOf(7968&t);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(e.pts,o)),o!==this.row_&&o>=0&&o<=14&&(this.clearFormatting(e.pts),this.row_=o),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),!(16&~t)){var u=(14&t)>>1;this.column_=4*u,this.nonDisplayed_[this.row_].indent+=u}this.isColorPAC(r)&&(14&~r||this.addFormatting(e.pts,["i"]))}else this.isNormalChar(i)&&(0===r&&(r=null),a=Ae(i),a+=Ae(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Le.prototype=new ye,Le.prototype.flushDisplayed=function(e){var t=this,n=function(e){t.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach(function(e,t){if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(vy){n(t)}e.text.length&&i.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&n(t)}),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},Le.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=xe(),this.nonDisplayed_=xe(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Le.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Le.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Le.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Le.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Le.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Le.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Le.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Le.prototype.isNormalChar=function(e){return e>=32&&e<=127},Le.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=xe(),this.displayed_=xe()),void 0!==t&&t!==this.row_)for(var n=0;n<this.rollUpRows_;n++)this.displayed_[t-n]=this.displayed_[this.row_-n],this.displayed_[this.row_-n]={text:"",indent:0,offset:0};void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Le.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var n=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,n)},Le.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[],this[this.mode_](e,t)}},Le.prototype.popOn=function(e,t){var n=this.nonDisplayed_[this.row_].text;n+=t,this.nonDisplayed_[this.row_].text=n},Le.prototype.rollUp=function(e,t){var n=this.displayed_[this.row_].text;n+=t,this.displayed_[this.row_].text=n},Le.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]={text:"",indent:0,offset:0};for(e=this.row_+1;e<15;e++)this.displayed_[e]={text:"",indent:0,offset:0};for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Le.prototype.paintOn=function(e,t){var n=this.displayed_[this.row_].text;n+=t,this.displayed_[this.row_].text=n};var De={CaptionStream:be,Cea608Stream:Le,Cea708Stream:Ee},Pe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Re=G,Oe="shared",Ne=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},Ue=function(e){var t,n;Ue.prototype.init.call(this),this.type_=e||Oe,this.push=function(e){"metadata"!==e.type?this.type_!==Oe&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ne(e.dts,n),e.pts=Ne(e.pts,n),t=e.dts,this.trigger("data",e)):this.trigger("data",e)},this.flush=function(){n=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ue.prototype=new Re;var Me,Be={TimestampRolloverStream:Ue,handleRollover:Ne},je=function(e,t,n){if(!e)return-1;for(var i=n;i<e.length;i++)if(e[i]===t)return i;return-1},Fe=3,qe=function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r},Ve=function(e,t,n){return decodeURIComponent(qe(e,t,n))},He=function(e,t,n){return unescape(qe(e,t,n))},ze=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},We={APIC:function(e){var t,n,i=1;e.data[0]===Fe&&((t=je(e.data,0,i))<0||(e.mimeType=He(e.data,i,t),i=t+1,e.pictureType=e.data[i],i++,(n=je(e.data,0,i))<0||(e.description=Ve(e.data,i,n),i=n+1,"--\x3e"===e.mimeType?e.url=He(e.data,i,e.data.length):e.pictureData=e.data.subarray(i,e.data.length))))},"T*":function(e){e.data[0]===Fe&&(e.value=Ve(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===Fe&&-1!==(t=je(e.data,0,1))&&(e.description=Ve(e.data,1,t),e.value=Ve(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=He(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===Fe&&-1!==(t=je(e.data,0,1))&&(e.description=Ve(e.data,1,t),e.url=He(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=He(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},Ge={parseId3Frames:function(e){var t,n=10,i=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){i=ze(e.subarray(6,10)),i+=10,64&e[5]&&(n+=4,n+=ze(e.subarray(10,14)),i-=ze(e.subarray(16,20)));do{if((t=ze(e.subarray(n+4,n+8)))<1)break;var a={id:String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),data:e.subarray(n+10,n+t+10)};a.key=a.id,We[a.id]?We[a.id](a):"T"===a.id[0]?We["T*"](a):"W"===a.id[0]&&We["W*"](a),r.push(a),n+=10,n+=t}while(n<i);return r}},parseSyncSafeInteger:ze,frameParsers:We},Xe=G,Ke=Pe,Ye=Ge;Me=function(e){var t,n={descriptor:e&&e.descriptor},i=0,r=[],a=0;if(Me.prototype.init.call(this),this.dispatchType=Ke.METADATA_STREAM_TYPE.toString(16),n.descriptor)for(t=0;t<n.descriptor.length;t++)this.dispatchType+=("00"+n.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,n,s,o,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),a+=e.data.byteLength,1===r.length&&(i=Ye.parseSyncSafeInteger(e.data.subarray(6,10)),i+=10),!(a<i)){for(t={data:new Uint8Array(i),frames:[],pts:r[0].pts,dts:r[0].dts},u=0;u<i;)t.data.set(r[0].data.subarray(0,i-u),u),u+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();n=10,64&t.data[5]&&(n+=4,n+=Ye.parseSyncSafeInteger(t.data.subarray(10,14)),i-=Ye.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((s=Ye.parseSyncSafeInteger(t.data.subarray(n+4,n+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if((o={id:String.fromCharCode(t.data[n],t.data[n+1],t.data[n+2],t.data[n+3]),data:t.data.subarray(n+10,n+s+10)}).key=o.id,Ye.frameParsers[o.id]?Ye.frameParsers[o.id](o):"T"===o.id[0]?Ye.frameParsers["T*"](o):"W"===o.id[0]&&Ye.frameParsers["W*"](o),"com.apple.streaming.transportStreamTimestamp"===o.owner){var l=o.data,c=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;c*=4,c+=3&l[7],o.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),n+=10,n+=s}while(n<i);this.trigger("data",t)}}},Me.prototype=new Xe;var Qe,$e,Je,Ze=Me,et=G,tt=De,nt=Pe,it=Be.TimestampRolloverStream,rt=188;(Qe=function(){var e=new Uint8Array(rt),t=0;Qe.prototype.init.call(this),this.push=function(n){var i,r=0,a=rt;for(t?((i=new Uint8Array(n.byteLength+t)).set(e.subarray(0,t)),i.set(n,t),t=0):i=n;a<i.byteLength;)71!==i[r]||71!==i[a]?(r++,a++):(this.trigger("data",i.subarray(r,a)),r+=rt,a+=rt);r<i.byteLength&&(e.set(i.subarray(r),0),t=i.byteLength-r)},this.flush=function(){t===rt&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new et,$e=function(){var e,t,n,i;$e.prototype.init.call(this),i=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,i){var r=0;i.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===i.type?t(e.subarray(r),i):n(e.subarray(r),i)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],i.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=i.pmtPid},n=function(e,t){var n,r;if(1&e[5]){for(i.programMapTable={video:null,audio:null,"timed-metadata":{}},n=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<n;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===nt.H264_STREAM_TYPE&&null===i.programMapTable.video?i.programMapTable.video=s:a===nt.ADTS_STREAM_TYPE&&null===i.programMapTable.audio?i.programMapTable.audio=s:a===nt.METADATA_STREAM_TYPE&&(i.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=i.programMapTable}},this.push=function(t){var n={},i=4;if(n.payloadUnitStartIndicator=!!(64&t[1]),n.pid=31&t[1],n.pid<<=8,n.pid|=t[2],(48&t[3])>>>4>1&&(i+=t[i]+1),0===n.pid)n.type="pat",e(t.subarray(i),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(i),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,n]):this.processPes_(t,i,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=nt.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=nt.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}},$e.prototype=new et,$e.STREAM_TYPES={h264:27,adts:15},Je=function(){var e,t=this,n=!1,i={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,n,i){var r,a,s=new Uint8Array(e.size),o={type:n},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)a=e.data[u],s.set(a.data,l),l+=a.data.byteLength;var c,d,h,p;d=o,p=(c=s)[0]<<16|c[1]<<8|c[2],d.data=new Uint8Array,1===p&&(d.packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=!!(4&c[6]),192&(h=c[7])&&(d.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8])),r="video"===n||o.packetLength<=e.size,(i||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};Je.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case nt.H264_STREAM_TYPE:e=i,t="video";break;case nt.ADTS_STREAM_TYPE:e=r,t="audio";break;case nt.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),n=!0,t.trigger("data",i)}})[o.type]()},this.reset=function(){i.size=0,i.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(i,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!n&&e){var i={type:"metadata",tracks:[]};null!==e.video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",i)}n=!1,this.flushStreams_(),this.trigger("done")}},Je.prototype=new et;var at={PAT_PID:0,MP2T_PACKET_LENGTH:rt,TransportPacketStream:Qe,TransportParseStream:$e,ElementaryStream:Je,TimestampRolloverStream:it,CaptionStream:tt.CaptionStream,Cea608Stream:tt.Cea608Stream,Cea708Stream:tt.Cea708Stream,MetadataStream:Ze};for(var st in nt)nt.hasOwnProperty(st)&&(at[st]=nt[st]);var ot,ut=at,lt=G,ct=de.ONE_SECOND_IN_TS,dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];ot=function(e){var t,n=0;ot.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes ".concat(e," to ").concat(t," in frame ").concat(n," outside syncword")})},this.push=function(i){var r,a,s,o,u,l=0;if(e||(n=0),"audio"===i.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+i.data.byteLength)).set(s),t.set(i.data,s.byteLength)):t=i.data;l+7<t.length;)if(255===t[l]&&240==(246&t[l+1])){if("number"==typeof c&&(this.skipWarn_(c,l),c=null),a=2*(1&~t[l+1]),r=(3&t[l+3])<<11|t[l+4]<<3|(224&t[l+5])>>5,u=(o=1024*(1+(3&t[l+6])))*ct/dt[(60&t[l+2])>>>2],t.byteLength-l<r)break;this.trigger("data",{pts:i.pts+n*u,dts:i.dts+n*u,sampleCount:o,audioobjecttype:1+(t[l+2]>>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:dt[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),n++,l+=r}else"number"!=typeof c&&(c=l),l++;"number"==typeof c&&(this.skipWarn_(c,l),c=null),t=t.subarray(l)}},this.flush=function(){n=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},ot.prototype=new lt;var ht,pt,ft,mt=ot,gt=G,vt=function(e){var t=e.byteLength,n=0,i=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+i},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),n=new DataView(a.buffer).getUint32(0),i=8*s,t-=s},this.skipBits=function(e){var r;i>e?(n<<=e,i-=e):(e-=i,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),n<<=e,i-=e)},this.readBits=function(e){var r=Math.min(i,e),a=n>>>32-r;return(i-=r)>0?n<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<i;++e)if(n&2147483648>>>e)return n<<=e,i-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};pt=function(){var e,t,n=0;pt.prototype.init.call(this),this.push=function(i){var r;t?((r=new Uint8Array(t.byteLength+i.data.byteLength)).set(t),r.set(i.data,t.byteLength),t=r):t=i.data;for(var a=t.byteLength;n<a-3;n++)if(1===t[n+2]){e=n+5;break}for(;e<a;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}n+3!==e-2&&this.trigger("data",t.subarray(n+3,e-2));do{e++}while(1!==t[e]&&e<a);n=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(n+3,e-2)),n=e-2,e+=3;break;default:e+=3}t=t.subarray(n),e-=n,n=0},this.reset=function(){t=null,n=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(n+3)),t=null,n=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},pt.prototype=new gt,ft={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ht=function(){var e,t,n,i,r,a,s,o=new pt;ht.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,i=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:n,dts:i,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),o.on("partialdone",function(){e.trigger("partialdone")}),o.on("reset",function(){e.trigger("reset")}),o.on("endedtimeline",function(){e.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var n,i=8,r=8;for(n=0;n<e;n++)0!==r&&(r=(i+t.readExpGolomb()+256)%256),i=0===r?i:r},r=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},a=function(e){var t,n,i,r,a,o,u,l,c,d,h,p,f=0,m=0,g=0,v=0,y=[1,1];if(n=(t=new vt(e)).readUnsignedByte(),r=t.readUnsignedByte(),i=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),ft[n]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),p=0;p<u;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(f=t.readUnsignedExpGolomb(),m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}y&&(y[0],y[1])}return{profileIdc:n,levelIdc:i,profileCompatibility:r,width:16*(l+1)-2*f-2*m,height:(2-d)*(c+1)*16-2*g-2*v,sarRatio:y}}},ht.prototype=new gt;var yt,_t={H264Stream:ht,NalByteStream:pt},bt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Tt=function(e,t){var n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return n=n>=0?n:0,(16&e[t+5])>>4?n+20:n+10},kt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=Tt(e,t),kt(e,t))},St=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},wt=function(e,t,n){return unescape(function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r}(e,t,n))},Et={isLikelyAacData:function(e){var t=kt(e,0);return e.length>=t+2&&!(255&~e[t])&&!(240&~e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Tt,parseAdtsSize:function(e,t){var n=(224&e[t+5])>>5,i=e[t+4]<<3;return 6144&e[t+3]|i|n},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&!(240&~e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return bt[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,n,i;t=10,64&e[5]&&(t+=4,t+=St(e.subarray(10,14)));do{if((n=St(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){i=e.subarray(t+10,t+n+10);for(var r=0;r<i.byteLength;r++)if(0===i[r]){if("com.apple.streaming.transportStreamTimestamp"===wt(i,0,r)){var a=i.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=n}while(t<e.byteLength);return null}},Ct=Et;(yt=function(){var e=new Uint8Array,t=0;yt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(n){var i,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(n.byteLength+s)).set(e.subarray(0,s)),e.set(n,s)):e=n;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255&~e[u]||240&~e[u+1])u++;else{if(e.length-u<7)break;if(u+(o=Ct.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=Ct.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}i=e.length-u,e=i>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new G;var At,It,xt,Lt,Dt=G,Pt=re,Rt=se,Ot=fe,Nt=ge,Ut=ut,Mt=de,Bt=mt,jt=_t.H264Stream,Ft=yt,qt=Et.isLikelyAacData,Vt=de.ONE_SECOND_IN_TS,Ht=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],zt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Wt=function(e,t){t.stream=e,this.trigger("log",t)},Gt=function(e,t){for(var n=Object.keys(t),i=0;i<n.length;i++){var r=n[i];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Wt.bind(e,r))}},Xt=function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Kt=function(e,t,n,i,r,a){return{start:{dts:e,pts:e+(n-t)},end:{dts:e+(i-t),pts:e+(r-n)},prependedContentDuration:a,baseMediaDecodeTime:e}};(It=function(e,t){var n,i=[],r=0,a=0,s=1/0;n=(t=t||{}).firstSequenceNumber||0,It.prototype.init.call(this),this.push=function(t){Nt.collectDtsInfo(e,t),e&&Ht.forEach(function(n){e[n]=t[n]}),i.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c,d,h,p;0!==i.length?(o=Ot.trimAdtsFramesByEarliestDts(i,e,r),e.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=Ot.prefixWithSilence(e,o,a,s),e.samples=Ot.generateSampleTable(o),l=Pt.mdat(Ot.concatenateFrameData(o)),i=[],u=Pt.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),Nt.clearDtsInfo(e),d=Math.ceil(1024*Vt/e.samplerate),o.length&&(h=o.length*d,this.trigger("segmentTimingInfo",Kt(Mt.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+h,o[0].pts+h,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+h})),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Nt.clearDtsInfo(e),i=[],this.trigger("reset")}}).prototype=new Dt,At=function(e,t){var n,i,r,a=[],s=[];n=(t=t||{}).firstSequenceNumber||0,At.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){Nt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],zt.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,r,o,u,l,c,d,h,p=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=Rt.groupNalsIntoFrames(a),(o=Rt.groupFramesIntoGops(i))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(p=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=Rt.extendFirstKeyFrame(o)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Nt.clearDtsInfo(e),o=f}Nt.collectDtsInfo(e,o),e.samples=Rt.generateSampleTable(o),l=Pt.mdat(Rt.concatenateNalData(o)),e.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",Kt(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=Pt.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),a=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){Nt.clearDtsInfo(e),i=void 0,r=void 0},this.getGopForFusion_=function(t){var n,i,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&Xt(e.pps[0],a.pps[0])&&e.sps&&Xt(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(n=t.dts-r.dts-r.duration)>=-1e4&&n<=45e3&&(!i||o>n)&&(i=a,o=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){var t,n,i,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(i=s[t],r=e[n],i.pts!==r.pts);)r.pts>i.pts?t++:(n++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===n?e:n===e.length?null:((l=e.slice(n)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,n,i,r,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(i=s[t],r=e[n],i.pts===r.pts){o=!0;break}i.pts>r.pts?t--:(t===s.length-1&&(a=n),n--)}if(!o&&null===a)return null;if(0===(u=o?n:a))return e;var l=e.slice(u),c=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}},At.prototype=new Dt,(Lt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Lt.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new Dt,Lt.prototype.flush=function(e){var t,n,i,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,zt.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Ht.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,i=Pt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(i.byteLength),s.initSegment.set(i),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=Mt.metadataTsToSeconds(t.startPts,o,this.keepOriginalTimestamps),t.endTime=Mt.metadataTsToSeconds(t.endPts,o,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(n=this.pendingMetadata[r]).cueTime=Mt.metadataTsToSeconds(n.pts,o,this.keepOriginalTimestamps),s.metadata.push(n);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)n=s.metadata[r],this.trigger("id3Frame",n)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Lt.prototype.setRemux=function(e){this.remuxTracks=e},xt=function(e){var t,n,i=this,r=!0;xt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Ut.MetadataStream,r.aacStream=new Ft,r.audioTimestampRolloverStream=new Ut.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Ut.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Bt,r.coalesceStream=new Lt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",function(e){r.aacStream.setTimestamp(e.timeStamp)}),r.aacStream.on("data",function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(n,e),r.audioSegmentStream.on("log",i.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),i.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t}))}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Gt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Ut.MetadataStream,r.packetStream=new Ut.TransportPacketStream,r.parseStream=new Ut.TransportParseStream,r.elementaryStream=new Ut.ElementaryStream,r.timestampRolloverStream=new Ut.TimestampRolloverStream,r.adtsStream=new Bt,r.h264Stream=new jt,r.captionStream=new Ut.CaptionStream(e),r.coalesceStream=new Lt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?n||"audio"!==a.tracks[s].type||((n=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new At(t,e),r.videoSegmentStream.on("log",i.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",function(t){n&&!e.keepOriginalTimestamps&&(n.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-i.baseMediaDecodeTime))}),r.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.videoSegmentStream.on("timingInfo",i.trigger.bind(i,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),n&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(n,e),r.audioSegmentStream.on("log",i.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),i.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t})}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",function(e){e.dispatchType=r.metadataStream.dispatchType,i.trigger("id3Frame",e)}),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Gt(this,r)},this.setBaseMediaDecodeTime=function(i){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=i),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var n=this.transmuxPipeline_;e.remux=t,n&&n.coalesceStream&&n.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(n){n.stream=e,t.trigger("log",n)}},this.push=function(e){if(r){var t=qt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},xt.prototype=new Dt;var Yt,Qt,$t={Transmuxer:xt,VideoSegmentStream:At,AudioSegmentStream:It,AUDIO_PROPERTIES:Ht,VIDEO_PROPERTIES:zt,generateSegmentTimingInfo:Kt},Jt=function(e){return e>>>0},Zt=function(e){return("00"+e.toString(16)).slice(-2)},en=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},tn=Jt,nn=en,rn=function(e,t){var n,i,r,a,s,o=[];if(!t.length)return null;for(n=0;n<e.byteLength;)i=tn(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),r=nn(e.subarray(n+4,n+8)),a=i>1?n+i:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(n+8,a)):(s=rn(e.subarray(n+8,a),t.slice(1))).length&&(o=o.concat(s))),n=a;return o},an=rn,sn=Jt,on=K.getUint64,un=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=on(e.subarray(4)):t.baseMediaDecodeTime=sn(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},ln=function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:n.getUint32(4)},r=1&i.flags[2],a=2&i.flags[2],s=8&i.flags[2],o=16&i.flags[2],u=32&i.flags[2],l=65536&i.flags[0],c=131072&i.flags[0];return t=8,r&&(t+=4,i.baseDataOffset=n.getUint32(12),t+=4),a&&(i.sampleDescriptionIndex=n.getUint32(t),t+=4),s&&(i.defaultSampleDuration=n.getUint32(t),t+=4),o&&(i.defaultSampleSize=n.getUint32(t),t+=4),u&&(i.defaultSampleFlags=n.getUint32(t)),l&&(i.durationIsEmpty=!0),!r&&c&&(i.baseDataOffsetIsMoof=!0),i},cn=K.getUint64,dn=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},i=12;0===n.version?(n.earliestPresentationTime=t.getUint32(i),n.firstOffset=t.getUint32(i+4),i+=8):(n.earliestPresentationTime=cn(e.subarray(i)),n.firstOffset=cn(e.subarray(i+8)),i+=16),i+=2;var r=t.getUint16(i);for(i+=2;r>0;i+=12,r--)n.references.push({referenceType:(128&e[i])>>>7,referencedSize:2147483647&t.getUint32(i),subsegmentDuration:t.getUint32(i+4),startsWithSap:!!(128&e[i+8]),sapType:(112&e[i+8])>>>4,sapDeltaTime:268435455&t.getUint32(i+8)});return n},hn=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},pn=function(e){var t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&n.flags[2],a=4&n.flags[2],s=1&n.flags[1],o=2&n.flags[1],u=4&n.flags[1],l=8&n.flags[1],c=i.getUint32(4),d=8;for(r&&(n.dataOffset=i.getInt32(d),d+=4),a&&c&&(t={flags:hn(e.subarray(d,d+4))},d+=4,s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),l&&(1===n.version?t.compositionTimeOffset=i.getInt32(d):t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t),c--);c--;)t={},s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),u&&(t.flags=hn(e.subarray(d,d+4)),d+=4),l&&(1===n.version?t.compositionTimeOffset=i.getInt32(d):t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t);return n},fn=K.getUint64,mn=function(e){return new Date(1e3*e-20828448e5)},gn=en,vn=function(e){var t,n,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=n)if(n=i.getUint32(t),t+=4,n<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r},yn={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:Yt(e.subarray(78,e.byteLength))}},avcC:function(e){var t,n,i,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(i=6,r=0;r<o;r++)n=a.getUint16(i),i+=2,s.sps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;for(t=e[i],i++,r=0;r<t;r++)n=a.getUint16(i),i+=2,s.pps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},edts:function(e){return{boxes:Yt(e)}},elst:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),edits:[]},r=n.getUint32(4);for(t=8;r;r--)0===i.version?(i.edits.push({segmentDuration:n.getUint32(t),mediaTime:n.getInt32(t+4),mediaRate:n.getUint16(t+8)+n.getUint16(t+10)/65536}),t+=12):(i.edits.push({segmentDuration:fn(e.subarray(t)),mediaTime:fn(e.subarray(t+8)),mediaRate:n.getUint16(t+16)+n.getUint16(t+18)/65536}),t+=20);return i},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={majorBrand:gn(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},i=8;i<e.byteLength;)n.compatibleBrands.push(gn(e.subarray(i,i+4))),i+=4;return n},dinf:function(e){return{boxes:Yt(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:Yt(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:gn(e.subarray(8,12)),name:""},n=8;for(n=24;n<e.byteLength;n++){if(0===e[n]){n++;break}t.name+=String.fromCharCode(e[n])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:vn(e)}},mdhd:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(i+=4,r.creationTime=mn(n.getUint32(i)),i+=8,r.modificationTime=mn(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=8,r.duration=n.getUint32(i)):(r.creationTime=mn(n.getUint32(i)),i+=4,r.modificationTime=mn(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=4,r.duration=n.getUint32(i)),i+=4,t=n.getUint16(i),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:Yt(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Yt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(n.streamDescriptor=Yt(e.subarray(28))[0]),n},moof:function(e){return{boxes:Yt(e)}},moov:function(e){return{boxes:Yt(e)}},mvex:function(e){return{boxes:Yt(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=mn(t.getUint32(n)),n+=8,i.modificationTime=mn(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=8,i.duration=t.getUint32(n)):(i.creationTime=mn(t.getUint32(n)),n+=4,i.modificationTime=mn(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=4,i.duration=t.getUint32(n)),n+=4,i.rate=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,n+=8,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,n+=24,i.nextTrackId=t.getUint32(n),i},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)n.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return n},sidx:dn,smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Yt(e)}},ctts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),compositionOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.compositionOffsets.push({sampleCount:n.getUint32(t),sampleOffset:n[0===i.version?"getUint32":"getInt32"](t+4)});return i},stss:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),syncSamples:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.syncSamples.push(n.getUint32(t));return i},stco:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.chunkOffsets.push(n.getUint32(t));return i},stsc:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;i;t+=12,i--)r.sampleToChunks.push({firstChunk:n.getUint32(t),samplesPerChunk:n.getUint32(t+4),sampleDescriptionIndex:n.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Yt(e.subarray(8))}},stsz:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:n.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)i.entries.push(n.getUint32(t));return i},stts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.timeToSamples.push({sampleCount:n.getUint32(t),sampleDelta:n.getUint32(t+4)});return i},styp:function(e){return yn.ftyp(e)},tfdt:un,tfhd:ln,tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=mn(t.getUint32(n)),n+=8,i.modificationTime=mn(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=8,i.duration=t.getUint32(n)):(i.creationTime=mn(t.getUint32(n)),n+=4,i.modificationTime=mn(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=4,i.duration=t.getUint32(n)),n+=4,n+=8,i.layer=t.getUint16(n),n+=2,i.alternateGroup=t.getUint16(n),n+=2,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,i.width=t.getUint16(n)+t.getUint16(n+2)/65536,n+=4,i.height=t.getUint16(n)+t.getUint16(n+2)/65536,i},traf:function(e){return{boxes:Yt(e)}},trak:function(e){return{boxes:Yt(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:pn,"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};Yt=function(e){for(var t,n,i,r,a,s=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);s<e.byteLength;)n=t.getUint32(s),i=gn(e.subarray(s+4,s+8)),r=n>1?s+n:e.byteLength,(a=(yn[i]||function(e){return{data:e}})(e.subarray(s+8,r))).size=n,a.type=i,o.push(a),s=r;return o};var _n,bn,Tn,kn,Sn,wn,En,Cn,An={inspect:Yt,textify:Qt=function(e,t){var n;return t=t||0,n=new Array(2*t+1).join(" "),e.map(function(e,i){return n+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var i=n+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?i+"<"+a.join("").slice(1)+">":i+"<\n"+a.map(function(e){return n+" "+e}).join("\n")+"\n"+n+" >":i+"<>"}return i+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:n+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+Qt(e.boxes,t+1):"")}).join("\n")},parseType:gn,findBox:an,parseTraf:yn.traf,parseTfdt:yn.tfdt,parseHdlr:yn.hdlr,parseTfhd:yn.tfhd,parseTrun:yn.trun,parseSidx:yn.sidx},In=function(e){for(var t=0,n=String.fromCharCode(e[t]),i="";"\0"!==n;)i+=n,t++,n=String.fromCharCode(e[t]);return i+=n},xn=K.getUint64,Ln=function(e,t){var n="\0"!==t.scheme_id_uri,i=0===e&&Dn(t.presentation_time_delta)&&n,r=1===e&&Dn(t.presentation_time)&&n;return!(e>1)&&i||r},Dn=function(e){return void 0!==e||null!==e},Pn={parseEmsgBox:function(e){var t,n,i,r,a,s,o,u=4,l=e[0];if(0===l)u+=(t=In(e.subarray(u))).length,u+=(n=In(e.subarray(u))).length,i=(c=new DataView(e.buffer)).getUint32(u),u+=4,a=c.getUint32(u),u+=4,s=c.getUint32(u),u+=4,o=c.getUint32(u),u+=4;else if(1===l){var c;i=(c=new DataView(e.buffer)).getUint32(u),u+=4,r=xn(e.subarray(u)),u+=8,s=c.getUint32(u),u+=4,o=c.getUint32(u),u+=4,u+=(t=In(e.subarray(u))).length,u+=(n=In(e.subarray(u))).length}var d={scheme_id_uri:t,value:n,timescale:i||1,presentation_time:r,presentation_time_delta:a,event_duration:s,id:o,message_data:new Uint8Array(e.subarray(u,e.byteLength))};return Ln(l,d)?d:void 0},scaleTime:function(e,t,n,i){return e||0===e?e/t:i+n/t}},Rn=(_n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Jt),On=Zt,Nn=an,Un=en,Mn=Pn,Bn=ln,jn=pn,Fn=un,qn=K.getUint64,Vn=_n,Hn=Ge.parseId3Frames;bn=function(e){return Nn(e,["moov","trak"]).reduce(function(e,t){var n,i,r,a,s;return(n=Nn(t,["tkhd"])[0])?(i=n[0],a=Rn(n[r=0===i?12:20]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3]),(s=Nn(t,["mdia","mdhd"])[0])?(r=0===(i=s[0])?12:20,e[a]=Rn(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),e):null):null},{})},Tn=function(e,t){var n=Nn(t,["moof","traf"]).reduce(function(t,n){var i,r,a=Nn(n,["tfhd"])[0],s=Rn(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,u=Nn(n,["tfdt"])[0],l=new DataView(u.buffer,u.byteOffset,u.byteLength);return"bigint"==typeof(i=1===u[0]?qn(u.subarray(4,12)):l.getUint32(4))?r=i/Vn.BigInt(o):"number"!=typeof i||isNaN(i)||(r=i/o),r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),r<t&&(t=r),t},1/0);return"bigint"==typeof n||isFinite(n)?n:0},kn=function(e,t){var n,i=Nn(t,["moof","traf"]),r=0,a=0;if(i&&i.length){var s=Nn(i[0],["tfhd"])[0],o=Nn(i[0],["trun"])[0],u=Nn(i[0],["tfdt"])[0];if(s)n=Bn(s).trackId;if(u)r=Fn(u).baseMediaDecodeTime;if(o){var l=jn(o);l.samples&&l.samples.length&&(a=l.samples[0].compositionTimeOffset||0)}}var c=e[n]||9e4;"bigint"==typeof r&&(a=Vn.BigInt(a),c=Vn.BigInt(c));var d=(r+a)/c;return"bigint"==typeof d&&d<Number.MAX_SAFE_INTEGER&&(d=Number(d)),d},Sn=function(e){var t=Nn(e,["moov","trak"]),n=[];return t.forEach(function(e){var t=Nn(e,["mdia","hdlr"]),i=Nn(e,["tkhd"]);t.forEach(function(e,t){var r,a,s=Un(e.subarray(8,12)),o=i[t];"vide"===s&&(a=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),n.push(a))})}),n},wn=function(e){var t=Nn(e,["moov","trak"]),n=[];return t.forEach(function(e){var t,i,r={},a=Nn(e,["tkhd"])[0];a&&(i=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===i?t.getUint32(12):t.getUint32(20));var s=Nn(e,["mdia","hdlr"])[0];if(s){var o=Un(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Nn(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Un(l.subarray(4,8));var c,d=Nn(l,[r.codec])[0];d&&(/^[asm]vc[1-9]$/i.test(r.codec)?(c=d.subarray(78),"avcC"===Un(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=On(c[9]),r.codec+=On(c[10]),r.codec+=On(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=d.subarray(28),"esds"===Un(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+On(c[19]),r.codec+="."+On(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=Nn(e,["mdia","mdhd"])[0];h&&(r.timescale=En(h)),n.push(r)}),n},Cn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Nn(e,["emsg"]).map(function(e){var n=Mn.parseEmsgBox(new Uint8Array(e)),i=Hn(n.message_data);return{cueTime:Mn.scaleTime(n.presentation_time,n.timescale,n.presentation_time_delta,t),duration:Mn.scaleTime(n.event_duration,n.timescale),frames:i}})};var zn={findBox:Nn,parseType:Un,timescale:bn,startTime:Tn,compositionStartTime:kn,videoTrackIds:Sn,tracks:wn,getTimescaleFromMediaHeader:En=function(e){var t=0===e[0]?12:20;return Rn(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},getEmsgID3:Cn},Wn=An.parseTrun,Gn=zn.findBox,Xn=_n,Kn=function(e){var t=Gn(e,["moof","traf"]),n=Gn(e,["mdat"]),i=[];return n.forEach(function(e,n){var r=t[n];i.push({mdat:e,traf:r})}),i},Yn=function(e,t,n){var i=t,r=n.defaultSampleDuration||0,a=n.defaultSampleSize||0,s=n.trackId,o=[];return e.forEach(function(e){var t=Wn(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof i?(e.pts=i+Xn.BigInt(e.compositionTimeOffset),i+=Xn.BigInt(e.duration)):(e.pts=i+e.compositionTimeOffset,i+=e.duration)}),o=o.concat(t)}),o},Qn=ve.discardEmulationPreventionBytes,$n=De.CaptionStream,Jn=an,Zn=un,ei=ln,ti=Kn,ni=Yn,ii=function(e,t){for(var n=e,i=0;i<t.length;i++){var r=t[i];if(n<r.size)return r;n-=r.size}return null},ri=function(e,t){var n={};return ti(e).forEach(function(e){var i,r=e.mdat,a=e.traf,s=Jn(a,["tfhd"]),o=ei(s[0]),u=o.trackId,l=Jn(a,["tfdt"]),c=l.length>0?Zn(l[0]).baseMediaDecodeTime:0,d=Jn(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,n){var i,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=ii(r,t);if(i={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Qn(l),trackId:n},c)i.pts=c.pts,i.dts=c.dts,s=c;else{if(!s){u.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+n+". See mux.js#223."});break}i.pts=s.pts,i.dts=s.dts}u.seiNals.push(i)}return u}(r,ni(d,c,o),u),n[u]||(n[u]={seiNals:[],logs:[]}),n[u].seiNals=n[u].seiNals.concat(i.seiNals),n[u].logs=n[u].logs.concat(i.logs))}),n},ai=function(){var e,t,n,i,r,a,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new $n,s=!0,a=!!t&&t.isPartial,e.on("data",function(e){e.startTime=e.startPts/i,e.endTime=e.endPts/i,r.captions.push(e),r.captionStreams[e.stream]=!0}),e.on("log",function(e){r.logs.push(e)})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"===k(t)&&0===Object.keys(t).length)&&(n!==e[0]||i!==t[n])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))n=a[0],i=s[n];else if(null===n||!i)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return o=function(e,t,n){if(null===t)return null;var i=ri(e,t)[t]||{};return{seiNals:i.seiNals,logs:i.logs,timescale:n}}(e,n,i),o&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=null,i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},si=An.parseTfdt,oi=an,ui=zn.getTimescaleFromMediaHeader,li=Yn,ci=Kn,di=function(){var e=9e4;this.init=function(t){var n=oi(t,["moov","trak","mdia","mdhd"])[0];n&&(e=ui(n))},this.parseSegment=function(t){var n=[],i=ci(t),r=0;return i.forEach(function(t){var i=t.mdat,a=t.traf,s=oi(a,["tfdt"])[0],o=oi(a,["tfhd"])[0],u=oi(a,["trun"]);if(s){var l=si(s);r=l.baseMediaDecodeTime}if(u.length&&o){var c=li(u,r,o),d=0;c.forEach(function(t){var r=new TextDecoder("utf-8"),a=i.slice(d,d+t.size);oi(a,["vtte"])[0]?d+=t.size:(oi(a,["vttc"]).forEach(function(i){var a,s,o=oi(i,["payl"])[0],u=oi(i,["sttg"])[0],l=t.pts/e,c=(t.pts+t.duration)/e;if(o)try{a=r.decode(o)}catch(vy){console.error(vy)}if(u)try{s=r.decode(u)}catch(vy){console.error(vy)}t.duration&&a&&n.push({cueText:a,start:l,end:c,settings:s})}),d+=t.size)})}}),n}},hi=Pe,pi=function(e){var t=31&e[1];return t<<=8,t|=e[2]},fi=function(e){return!!(64&e[1])},mi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},gi=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},vi={parseType:function(e,t){var n=pi(e);return 0===n?"pat":n===t?"pmt":t?"pes":null},parsePat:function(e){var t=fi(e),n=4+mi(e);return t&&(n+=e[n]+1),(31&e[n+10])<<8|e[n+11]},parsePmt:function(e){var t={},n=fi(e),i=4+mi(e);if(n&&(i+=e[i]+1),1&e[i+5]){var r;r=3+((15&e[i+1])<<8|e[i+2])-4;for(var a=12+((15&e[i+10])<<8|e[i+11]);a<r;){var s=i+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:fi,parsePesType:function(e,t){switch(t[pi(e)]){case hi.H264_STREAM_TYPE:return"video";case hi.ADTS_STREAM_TYPE:return"audio";case hi.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!fi(e))return null;var t=4+mi(e);if(t>=e.byteLength)return null;var n,i=null;return 192&(n=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&n&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1)),i},videoPacketContainsKeyFrame:function(e){for(var t=4+mi(e),n=e.subarray(t),i=0,r=0,a=!1;r<n.byteLength-3;r++)if(1===n[r+2]){i=r+5;break}for(;i<n.byteLength;)switch(n[i]){case 0:if(0!==n[i-1]){i+=2;break}if(0!==n[i-2]){i++;break}r+3!==i-2&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0);do{i++}while(1!==n[i]&&i<n.length);r=i-2,i+=3;break;case 1:if(0!==n[i-1]||0!==n[i-2]){i+=3;break}"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0),r=i-2,i+=3;break;default:i+=3}return n=n.subarray(r),i-=r,r=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0),a}},yi=Pe,_i=Be.handleRollover,bi={};bi.ts=vi,bi.aac=Et;var Ti=de.ONE_SECOND_IN_TS,ki=188,Si=71,wi=function(e,t,n){for(var i,r,a,s,o=0,u=ki,l=!1;u<=e.byteLength;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o++,u++;else{if(i=e.subarray(o,u),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="audio",n.audio.push(s),l=!0);if(l)break;o+=ki,u+=ki}for(o=(u=e.byteLength)-ki,l=!1;o>=0;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o--,u--;else{if(i=e.subarray(o,u),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="audio",n.audio.push(s),l=!0);if(l)break;o-=ki,u-=ki}},Ei=function(e,t,n){for(var i,r,a,s,o,u,l,c=0,d=ki,h=!1,p={data:[],size:0};d<e.byteLength;)if(e[c]!==Si||e[d]!==Si)c++,d++;else{if(i=e.subarray(c,d),"pes"===bi.ts.parseType(i,t.pid))if(r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"video"===r&&(a&&!h&&(s=bi.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0),!n.firstKeyFrame)){if(a&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(bi.ts.videoPacketContainsKeyFrame(o)){var f=bi.ts.parsePesTime(o);f?(n.firstKeyFrame=f,n.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(i),p.size+=i.byteLength}if(h&&n.firstKeyFrame)break;c+=ki,d+=ki}for(c=(d=e.byteLength)-ki,h=!1;c>=0;)if(e[c]!==Si||e[d]!==Si)c--,d--;else{if(i=e.subarray(c,d),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"video"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0);if(h)break;c-=ki,d-=ki}},Ci=function(e){var t={pid:null,table:null},n={};for(var i in function(e,t){for(var n,i=0,r=ki;r<e.byteLength;)if(e[i]!==Si||e[r]!==Si)i++,r++;else{switch(n=e.subarray(i,r),bi.ts.parseType(n,t.pid)){case"pat":t.pid=bi.ts.parsePat(n);break;case"pmt":var a=bi.ts.parsePmt(n);t.table=t.table||{},Object.keys(a).forEach(function(e){t.table[e]=a[e]})}i+=ki,r+=ki}}(e,t),t.table){if(t.table.hasOwnProperty(i))switch(t.table[i]){case yi.H264_STREAM_TYPE:n.video=[],Ei(e,t,n),0===n.video.length&&delete n.video;break;case yi.ADTS_STREAM_TYPE:n.audio=[],wi(e,t,n),0===n.audio.length&&delete n.audio}}return n},Ai=function(e,t){var n;return n=bi.aac.isLikelyAacData(e)?function(e){for(var t,n=!1,i=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(bi.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){n=!0;break}if((s=bi.aac.parseId3TagSize(e,o))>e.length){n=!0;break}null===a&&(t=e.subarray(o,o+s),a=bi.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){n=!0;break}if((s=bi.aac.parseAdtsSize(e,o))>e.length){n=!0;break}null===r&&(t=e.subarray(o,o+s),r=bi.aac.parseSampleRate(t)),i++,o+=s;break;default:o++}if(n)return null}if(null===r||null===a)return null;var u=Ti/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*i*u,pts:a+1024*i*u}]}}(e):Ci(e),n&&(n.audio||n.video)?(function(e,t){if(e.audio&&e.audio.length){var n=t;(void 0===n||isNaN(n))&&(n=e.audio[0].dts),e.audio.forEach(function(e){e.dts=_i(e.dts,n),e.pts=_i(e.pts,n),e.dtsTime=e.dts/Ti,e.ptsTime=e.pts/Ti})}if(e.video&&e.video.length){var i=t;if((void 0===i||isNaN(i))&&(i=e.video[0].dts),e.video.forEach(function(e){e.dts=_i(e.dts,i),e.pts=_i(e.pts,i),e.dtsTime=e.dts/Ti,e.ptsTime=e.pts/Ti}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=_i(r.dts,i),r.pts=_i(r.pts,i),r.dtsTime=r.dts/Ti,r.ptsTime=r.pts/Ti}}}(n,t),n):null},Ii=function(){return y(function e(t,n){g(this,e),this.options=n||{},this.self=t,this.init()},[{key:"init",value:function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new $t.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",function(t){var n=t.initSegment;t.initSegment={data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength};var i=t.data;t.data=i.buffer,e.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){var n={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:n})}),t.on("audioSegmentTimingInfo",function(t){var n={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:n})}),t.on("id3Frame",function(t){e.postMessage({action:"id3Frame",id3Frame:t})}),t.on("caption",function(t){e.postMessage({action:"caption",caption:t})}),t.on("trackinfo",function(t){e.postMessage({action:"trackinfo",trackInfo:t})}),t.on("audioTimingInfo",function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})}},{key:"pushMp4Captions",value:function(e){this.captionParser||(this.captionParser=new ai,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),n=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:n&&n.captions||[],logs:n&&n.logs||[],data:t.buffer},[t.buffer])}},{key:"initMp4WebVttParser",value:function(e){this.webVttParser||(this.webVttParser=new di);var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.webVttParser.init(t)}},{key:"getMp4WebVttText",value:function(e){this.webVttParser||(this.webVttParser=new di);var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),n=this.webVttParser.parseSegment(t);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:n||[],data:t.buffer},[t.buffer])}},{key:"probeMp4StartTime",value:function(e){var t=e.timescales,n=e.data,i=zn.startTime(t,n);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:n},[n.buffer])}},{key:"probeMp4Tracks",value:function(e){var t=e.data,n=zn.tracks(t);this.self.postMessage({action:"probeMp4Tracks",tracks:n,data:t},[t.buffer])}},{key:"probeEmsgID3",value:function(e){var t=e.data,n=e.offset,i=zn.getEmsgID3(t,n);this.self.postMessage({action:"probeEmsgID3",id3Frames:i,emsgData:t},[t.buffer])}},{key:"probeTs",value:function(e){var t=e.data,n=e.baseStartTime,i="number"!=typeof n||isNaN(n)?void 0:n*de.ONE_SECOND_IN_TS,r=Ai(t,i),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])}},{key:"clearAllMp4Captions",value:function(){this.captionParser&&this.captionParser.clearAllCaptions()}},{key:"clearParsedMp4Captions",value:function(){this.captionParser&&this.captionParser.clearParsedCaptions()}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.transmuxer.reset()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(de.secondsToVideoTs(t)))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(de.secondsToVideoTs(e.appendStart)))}},{key:"setRemux",value:function(e){this.transmuxer.setRemux(e.remux)}},{key:"flush",value:function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}},{key:"endTimeline",value:function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}])}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Ii(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Ii(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})),Nm=Dm(Om),Um=function(e){var t=e.transmuxer,n=e.bytes,i=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,v=e.isEndOfTimeline,y=e.segment,_=e.triggerSegmentEventFn,b={buffer:[]},T=v;if(t.onmessage=function(n){t.currentTransmux===e&&("data"===n.data.action&&function(e,t,n){var i=e.data.segment,r=i.type,a=i.initSegment,s=i.captions,o=i.captionStreams,u=i.metadata,l=i.videoFrameDtsTime,c=i.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==c&&(h.videoFramePtsTime=c),n(h)}(n,b,s),"trackinfo"===n.data.action&&o(n.data.trackInfo),"gopInfo"===n.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(n,b),"audioTimingInfo"===n.data.action&&u(n.data.audioTimingInfo),"videoTimingInfo"===n.data.action&&l(n.data.videoTimingInfo),"videoSegmentTimingInfo"===n.data.action&&c(n.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===n.data.action&&d(n.data.audioSegmentTimingInfo),"id3Frame"===n.data.action&&h([n.data.id3Frame],n.data.id3Frame.dispatchType),"caption"===n.data.action&&p(n.data.caption),"endedtimeline"===n.data.action&&(T=!1,m()),"log"===n.data.action&&g(n.data.log),"transmuxed"===n.data.type&&(T||(t.onmessage=null,function(e){var t=e.transmuxedData,n=e.callback;t.buffer=[],n(t)}({transmuxedData:b,callback:f}),Mm(t))))},t.onerror=function(){var e={message:"Received an error message from the transmuxer worker",metadata:{errorType:rf.Error.StreamingFailedToTransmuxSegment,segmentInfo:Dg({segment:y})}};f(null,e)},i&&t.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),n.byteLength){var k=n instanceof ArrayBuffer?n:n.buffer,S=n instanceof ArrayBuffer?0:n.byteOffset;_({type:"segmenttransmuxingstart",segment:y}),t.postMessage({action:"push",data:k,byteOffset:S,byteLength:n.byteLength},[k])}v&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Mm=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Um(e.currentTransmux))},Bm=function(e,t){e.postMessage({action:t}),Mm(e)},jm=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Bm(t,e);t.transmuxQueue.push(Bm.bind(null,t,e))},Fm=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Um(e);e.transmuxer.transmuxQueue.push(e)},qm=function(e){jm("reset",e)},Vm=function(e){var t=new Nm;t.currentTransmux=null,t.transmuxQueue=[];var n=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,n.call(t)},t.postMessage({action:"init",options:e}),t},Hm=function(e){var t=e.transmuxer,n=e.endAction||e.action,i=e.callback,r=$({},e,{endAction:null,transmuxer:null,callback:null}),a=function(r){r.data.action===n&&(t.removeEventListener("message",a),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),i(r.data))};if(t.addEventListener("message",a),e.data){var s=e.data instanceof ArrayBuffer;r.byteOffset=s?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var o=[s?e.data:e.data.buffer];t.postMessage(r,o)}else t.postMessage(r)},zm=2,Wm=-101,Gm=-102,Xm="wvtt",Km=function(e){e.forEach(function(e){e.abort()})},Ym=function(e,t){var n=t.requestType,i=$f({requestType:n,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Wm,xhr:t,metadata:i}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Gm,xhr:t,metadata:i}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:zm,xhr:t,metadata:i}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:zm,xhr:t,metadata:i}:null},Qm=function(e,t,n,i){return function(r,a){var s=a.response,o=Ym(r,a);if(o)return n(o,e);if(16!==s.byteLength)return n({status:a.status,message:"Invalid HLS key at URL: "+a.uri,code:zm,xhr:a},e);for(var u=new DataView(s),l=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]),c=0;c<t.length;c++)t[c].bytes=l;var d={uri:a.uri};return i({type:"segmentkeyloadcomplete",segment:e,keyInfo:d}),n(null,e)}},$m=function(e,t){var n=mu(e.map.bytes);if("mp4"!==n){var i=e.map.resolvedUri||e.map.uri,r=n||"unknown";return t({internal:!0,message:"Found unsupported ".concat(r," container for initialization segment at URL: ").concat(i),code:zm,metadata:{mediaType:r}})}Hm({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(n){var i=n.tracks,r=n.data;return e.map.bytes=r,i.forEach(function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale),"text"===t.type&&function(e,t){t===Xm&&e.transmuxer.postMessage({action:"initMp4WebVttParser",data:e.map.bytes})}(e,t.codec))}),t(null)}})},Jm=function(e){var t=e.segment,n=e.finishProcessingFn,i=e.responseType,r=e.triggerSegmentEventFn;return function(e,a){var s=Ym(e,a);if(s)return n(s,t);r({type:"segmentloaded",segment:t});var o="arraybuffer"!==i&&a.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t.buffer}(a.responseText.substring(t.lastReachedChar||0)):a.response;return t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(a),t.key?t.encryptedBytes=new Uint8Array(o):t.bytes=new Uint8Array(o),n(null,t)}},Zm=function(e){var t=e.segment,n=e.bytes,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=t.map&&t.map.tracks||{},g=Boolean(m.audio&&m.video),v=r.bind(null,t,"audio","start"),y=r.bind(null,t,"audio","end"),_=r.bind(null,t,"video","start"),b=r.bind(null,t,"video","end");Hm({action:"probeTs",transmuxer:t.transmuxer,data:n,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=n=e.data;var r=e.result;r&&(i(t,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:g}),i=null),Fm({bytes:n,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:g,onData:function(e){e.type="combined"===e.type?"video":e.type,d(t,e)},onTrackInfo:function(e){i&&(g&&(e.isMuxed=!0),i(t,e))},onAudioTimingInfo:function(e){v&&void 0!==e.start&&(v(e.start),v=null),y&&void 0!==e.end&&y(e.end)},onVideoTimingInfo:function(e){_&&void 0!==e.start&&(_(e.start),_=null),b&&void 0!==e.end&&b(e.end)},onVideoSegmentTimingInfo:function(e){var n={pts:{start:e.start.presentation,end:e.end.presentation},dts:{start:e.start.decode,end:e.end.decode}};f({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:n}),a(e)},onAudioSegmentTimingInfo:function(e){var n={pts:{start:e.start.pts,end:e.end.pts},dts:{start:e.start.dts,end:e.end.dts}};f({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:n}),s(e)},onId3:function(e,n){o(t,e,n)},onCaptions:function(e){u(t,[e])},isEndOfTimeline:l,onEndedTimeline:function(){c()},onTransmuxerLog:p,onDone:function(e,n){h&&(e.type="combined"===e.type?"video":e.type,f({type:"segmenttransmuxingcomplete",segment:t}),h(n,t,e))},segment:t,triggerSegmentEventFn:f})}})},eg=function(e){var t=e.segment,n=e.bytes,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=new Uint8Array(n);if(function(e){return Yo(e,["moof"]).length>0}(m)){t.isFmp4=!0;var g=t.map.tracks;if(g.text&&(!g.audio||!g.video))return d(t,{data:m,type:"text"}),void function(e,t,n){t===Xm&&Hm({action:"getMp4WebVttText",data:e.bytes,transmuxer:e.transmuxer,callback:function(t){var i=t.data,r=t.mp4VttCues;e.bytes=i,n(null,e,{mp4VttCues:r})}})}(t,g.text.codec,h);var v={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio};g.audio&&g.audio.codec&&"enca"!==g.audio.codec&&(v.audioCodec=g.audio.codec),g.video&&g.video.codec&&"encv"!==g.video.codec&&(v.videoCodec=g.video.codec),g.video&&g.audio&&(v.isMuxed=!0),i(t,v);var y=function(e,n){d(t,{data:m,type:v.hasAudio&&!v.isMuxed?"audio":"video"}),n&&n.length&&o(t,n),e&&e.length&&u(t,e),h(null,t,{})};Hm({action:"probeMp4StartTime",timescales:t.map.timescales,data:m,transmuxer:t.transmuxer,callback:function(e){var i=e.data,a=e.startTime;n=i.buffer,t.bytes=m=i,v.hasAudio&&!v.isMuxed&&r(t,"audio","start",a),v.hasVideo&&r(t,"video","start",a),Hm({action:"probeEmsgID3",data:m,transmuxer:t.transmuxer,offset:a,callback:function(e){var i=e.emsgData,r=e.id3Frames;n=i.buffer,t.bytes=m=i,g.video&&i.byteLength&&t.transmuxer?Hm({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:m,timescales:t.map.timescales,trackIds:[g.video.id],callback:function(e){n=e.data.buffer,t.bytes=m=e.data,e.logs.forEach(function(e){p(mf(e,{stream:"mp4CaptionParser"}))}),y(e.captions,r)}}):y(void 0,r)}})}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=mu(m)),"ts"!==t.container&&"aac"!==t.container)return i(t,{hasAudio:!1,hasVideo:!1}),void h(null,t,{});Zm({segment:t,bytes:n,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})}else h(null,t,{})},tg=function(e,t){var n,i=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker,o=e.segment,u=e.doneFn,l=function(e){if(e.data.source===i){s.removeEventListener("message",l);var n=e.data.decrypted;t(new Uint8Array(n.bytes,n.byteOffset,n.byteLength))}};s.onerror=function(){var e="An error occurred in the decryption worker",t=Dg({segment:o}),n={message:e,metadata:{error:new Error(e),errorType:rf.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(n,o)},s.addEventListener("message",l),n=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(pm({source:i,encrypted:a,key:n,iv:r.iv}),[a.buffer,n.buffer])},ng=function(e){var t=e.activeXhrs,n=e.decryptionWorker,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=0,g=!1;return function(e,v){if(!g){if(e)return g=!0,Km(t),h(e,v);if((m+=1)===t.length){var y=function(){if(v.encryptedBytes)return function(e){var t=e.decryptionWorker,n=e.segment,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn;f({type:"segmentdecryptionstart"}),tg({id:n.requestId,key:n.key,encryptedBytes:n.encryptedBytes,decryptionWorker:t,segment:n,doneFn:h},function(e){n.bytes=e,f({type:"segmentdecryptioncomplete",segment:n}),eg({segment:n,bytes:n.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})})}({decryptionWorker:n,segment:v,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f});eg({segment:v,bytes:v.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})};if(v.endOfAllRequests=Date.now(),v.map&&v.map.encryptedBytes&&!v.map.bytes)return f({type:"segmentdecryptionstart",segment:v}),tg({decryptionWorker:n,id:v.requestId+"-init",encryptedBytes:v.map.encryptedBytes,key:v.map.key,segment:v,doneFn:h},function(e){v.map.bytes=e,f({type:"segmentdecryptioncomplete",segment:v}),$m(v,function(e){if(e)return Km(t),h(e,v);y()})});y()}}}},ig=function(e){var t=e.segment,n=e.progressFn;e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn;return function(e){if(!e.target.aborted)return t.stats=mf(t.stats,function(e){var t=e.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return n.bytesReceived=e.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),n(e,t)}},rg=function(e){var t=e.xhr,n=e.xhrOptions,i=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,d=e.id3Fn,h=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,y=e.triggerSegmentEventFn,_=[],b=ng({activeXhrs:_,decryptionWorker:i,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v,triggerSegmentEventFn:y});if(r.key&&!r.key.bytes){var T=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&T.push(r.map.key);var k=mf(n,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),S=Qm(r,T,b,y);y({type:"segmentkeyloadstart",segment:r,keyInfo:{uri:r.key.resolvedUri}});var w=t(k,S);_.push(w)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var E=mf(n,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),C=Qm(r,[r.map.key],b,y);y({type:"segmentkeyloadstart",segment:r,keyInfo:{uri:r.map.key.resolvedUri}});var A=t(E,C);_.push(A)}var I=mf(n,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:lm(r.map),requestType:"segment-media-initialization"}),x=function(e){var t=e.segment,n=e.finishProcessingFn,i=e.triggerSegmentEventFn;return function(e,r){var a=Ym(e,r);if(a)return n(a,t);var s=new Uint8Array(r.response);if(i({type:"segmentloaded",segment:t}),t.map.key)return t.map.encryptedBytes=s,n(null,t);t.map.bytes=s,$m(t,function(e){if(e)return e.xhr=r,e.status=r.status,n(e,t);n(null,t)})}}({segment:r,finishProcessingFn:b,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:r});var L=t(I,x);_.push(L)}var D=mf(n,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:lm(r),requestType:"segment"}),P=Jm({segment:r,finishProcessingFn:b,responseType:D.responseType,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:r});var R=t(D,P);R.addEventListener("progress",ig({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m})),_.push(R);var O={};return _.forEach(function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,n=e.abortFn;return function(e){e.target.aborted&&n&&!t.calledAbortFn&&(n(),t.calledAbortFn=!0)}}({loadendState:O,abortFn:a}))}),function(){return Km(_)}},ag=ff("CodecUtils"),sg=function(e,t){var n=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&n.AUDIO&&e.mediaGroups.AUDIO[n.AUDIO]},og=function(e){var t={};return e.forEach(function(e){var n=e.mediaType,i=e.type,r=e.details;t[n]=t[n]||[],t[n].push(mr("".concat(i).concat(r)))}),Object.keys(t).forEach(function(e){if(t[e].length>1)return ag("multiple ".concat(e," codecs found as attributes: ").concat(t[e].join(", "),". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.")),void(t[e]=null);t[e]=t[e][0]}),t},ug=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},lg=function(e,t){var n=t.attributes||{},i=og(function(e){var t=e.attributes||{};if(t.CODECS)return gr(t.CODECS)}(t)||[]);if(sg(e,t)&&!i.audio&&!function(e,t){if(!sg(e,t))return!0;var n=t.attributes||{},i=e.mediaGroups.AUDIO[n.AUDIO];for(var r in i)if(!i[r].uri&&!i[r].playlists)return!0;return!1}(e,t)){var r=og(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var n=e.mediaGroups.AUDIO[t];if(!n)return null;for(var i in n){var r=n[i];if(r.default&&r.playlists)return gr(r.playlists[0].attributes.CODECS)}return null}(e,n.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},cg=ff("PlaylistSelector"),dg=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},hg=function(e,t){if(!e)return"";var n=wn.getComputedStyle(e);return n?n[t]:""},pg=function(e,t){var n=e.slice();e.sort(function(e,i){var r=t(e,i);return 0===r?n.indexOf(e)-n.indexOf(i):r})},fg=function(e,t){var n,i;return e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||wn.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),n-(i=i||wn.Number.MAX_VALUE)},mg=function(e,t,n,i,r,a){if(e){var s={bandwidth:t,width:n,height:i,limitRenditionByPlayerDimensions:r},o=e.playlists;Hf.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map(function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||wn.Number.MAX_VALUE,width:t,height:n,playlist:e}});pg(u,function(e,t){return e.bandwidth-t.bandwidth});var l=(u=u.filter(function(e){return!Hf.isIncompatible(e.playlist)})).filter(function(e){return Hf.isEnabled(e.playlist)});l.length||(l=u.filter(function(e){return!Hf.isDisabled(e.playlist)}));var c=l.filter(function(e){return e.bandwidth*xm.BANDWIDTH_VARIANCE<t}),d=c[c.length-1],h=c.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(!1===r){var p=h||l[0]||u[0];if(p&&p.playlist){var f="sortedPlaylistReps";return h&&(f="bandwidthBestRep"),l[0]&&(f="enabledPlaylistReps"),cg("choosing ".concat(dg(p)," using ").concat(f," with options"),s),p.playlist}return cg("could not choose a playlist with options",s),null}var m=c.filter(function(e){return e.width&&e.height});pg(m,function(e,t){return e.width-t.width});var g=m.filter(function(e){return e.width===n&&e.height===i});d=g[g.length-1];var v,y,_,b,T=g.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(T||(y=(v=m.filter(function(e){return e.width>n||e.height>i})).filter(function(e){return e.width===v[0].width&&e.height===v[0].height}),d=y[y.length-1],_=y.filter(function(e){return e.bandwidth===d.bandwidth})[0]),a.leastPixelDiffSelector){var k=m.map(function(e){return e.pixelDiff=Math.abs(e.width-n)+Math.abs(e.height-i),e});pg(k,function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff}),b=k[0]}var S=b||_||T||h||l[0]||u[0];if(S&&S.playlist){var w="sortedPlaylistReps";return b?w="leastPixelDiffRep":_?w="resolutionPlusOneRep":T?w="resolutionBestRep":h?w="bandwidthBestRep":l[0]&&(w="enabledPlaylistReps"),cg("choosing ".concat(dg(S)," using ").concat(w," with options"),s),S.playlist}return cg("could not choose a playlist with options",s),null}},gg=function(){var e=this.useDevicePixelRatio&&wn.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),mg(this.playlists.main,this.systemBandwidth,parseInt(hg(this.tech_.el(),"width"),10)*e,parseInt(hg(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)};function vg(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(vy){return""}}var yg=function(e){var t=e.inbandTextTracks,n=e.metadataArray,i=e.timestampOffset,r=e.videoDuration;if(n){var a=wn.WebKitDataCue||wn.VTTCue,s=t.metadataTrack_;if(s&&(n.forEach(function(e){var t=e.cueTime+i;!("number"!=typeof t||wn.isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach(function(e){var n=new a(t,t,e.value||e.url||e.data||"");n.frame=e,n.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return rf.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return rf.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return rf.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(n),s.addCue(n)})}),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var c=u.reduce(function(e,t){var n=e[t.startTime]||[];return n.push(t),e[t.startTime]=n,e},{}),d=Object.keys(c).sort(function(e,t){return Number(e)-Number(t)});d.forEach(function(e,t){var n=c[e],i=isFinite(r)?r:e,a=Number(d[t+1])||i;n.forEach(function(e){e.endTime=a})})}}},_g={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},bg=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Tg=function(e,t,n){e.metadataTrack_||(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,rf.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},kg=function(e,t,n){var i,r;if(n&&n.cues)for(i=n.cues.length;i--;)(r=n.cues[i]).startTime>=e&&r.endTime<=t&&n.removeCue(r)},Sg=function(e){return"number"==typeof e&&isFinite(e)},wg=1/60,Eg=function(e){var t=e.startOfSegment,n=e.duration,i=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,c=e.mediaIndex,d=e.partIndex,h=e.timeline,p=l.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime (".concat(e.getMediaInfoForTime,")"):e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent ".concat(e.independent));var m="number"==typeof d,g=e.segment.uri?"segment":"pre-segment",v=m?xf({preloadSegment:i})-1:0;return"".concat(g," [").concat(s+c,"/").concat(s+p,"]")+(m?" part [".concat(d,"/").concat(v,"]"):"")+" segment start/end [".concat(i.start," => ").concat(i.end,"]")+(m?" part start/end [".concat(r.start," => ").concat(r.end,"]"):"")+" startOfSegment [".concat(t,"]")+" duration [".concat(n,"]")+" timeline [".concat(h,"]")+" selected by [".concat(f,"]")+" playlist [".concat(o,"]")},Cg=function(e){return"".concat(e,"TimingInfo")},Ag=function(e){var t=e.timelineChangeController,n=e.currentTimeline,i=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(n===i)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==i}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==i}return!1},Ig=function(e){var t=e.pendingSegment_;if(t&&(Ag({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:t.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&function(e){if(!e)return!1;var t=e.pendingTimelineChange({type:"audio"}),n=e.pendingTimelineChange({type:"main"}),i=t&&n,r=i&&t.to!==n.to;return!(!i||-1===t.from||-1===n.from||!r)}(e.timelineChangeController_))){if(function(e){var t=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),n=e.timelineChangeController_.pendingTimelineChange({type:"main"});return t&&n&&t.to<n.to}(e))return void e.timelineChangeController_.trigger("audioTimelineBehind");e.timelineChangeController_.trigger("fixBadTimelineChange")}},xg=function(e){var t=e.segmentDuration,n=e.maxDuration;return!!t&&Math.round(t)>n+vf},Lg=function(e,t){if("hls"!==t)return null;var n,i,r=(n={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},i=0,["video","audio"].forEach(function(e){var t=n["".concat(e,"TimingInfo")];if(t){var r,a=t.start,s=t.end;"bigint"==typeof a||"bigint"==typeof s?r=wn.BigInt(s)-wn.BigInt(a):"number"==typeof a&&"number"==typeof s&&(r=s-a),void 0!==r&&r>i&&(i=r)}}),"bigint"==typeof i&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),i);if(!r)return null;var a=e.playlist.targetDuration,s=xg({segmentDuration:r,maxDuration:2*a}),o=xg({segmentDuration:r,maxDuration:a}),u="Segment with index ".concat(e.mediaIndex," ")+"from playlist ".concat(e.playlist.id," ")+"has a duration of ".concat(r," ")+"when the reported duration is ".concat(e.duration," ")+"and the target duration is ".concat(a,". ")+"For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return s||o?{severity:s?"warn":"info",message:u}:null},Dg=function(e){var t=e.type,n=e.segment;if(n){var i=Boolean(n.key||n.map&&n.map.ke),r=Boolean(n.map&&!n.map.bytes),a=void 0===n.startOfSegment?n.start:n.startOfSegment;return{type:t||n.type,uri:n.resolvedUri||n.uri,start:a,duration:n.duration,isEncrypted:i,isMediaInitialization:r}}},Pg=function(){function e(t){var n;if(g(this,e),n=c(this,e),!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.exactManifestTimings=t.exactManifestTimings,n.addMetadataToTextTrack=t.addMetadataToTextTrack,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.shouldForceTimestampOffsetAfterResync_=!1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=!1,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",function(){n.isEndOfStream_()||(n.ended_=!1)}),n.fetchAtBuffer_=!1,n.logger_=ff("SegmentLoader[".concat(n.loaderType_,"]")),Object.defineProperty(n,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_("".concat(this.state_," -> ").concat(e)),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",function(){n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),n.sourceUpdater_.on("codecschange",function(e){n.trigger($({type:"codecschange"},e))}),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",function(){n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",function(e){n.trigger($({type:"timelinechange"},e)),n.hasEnoughInfoToLoad_()?n.processLoadQueue_():Ig(n),n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),n}return f(e,rf.EventTarget),y(e,[{key:"mediaSequenceSync_",get:function(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}},{key:"createTransmuxer_",value:function(){return Vm({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}},{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}},{key:"dispose",value:function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}},{key:"setAudio",value:function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}},{key:"abort",value:function(){if("WAITING"!==this.state)return this.pendingSegment_&&(this.pendingSegment_=null),void this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,wn.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}},{key:"checkForAbort_",value:function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}},{key:"error",value:function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.transmuxer_&&qm(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return gf();if("main"===this.loaderType_){var t=e.hasAudio,n=e.hasVideo,i=e.isMuxed;if(n&&t&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}},{key:"initSegmentForMap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=fm(e),i=this.initSegments_[n];return t&&!i&&e.bytes&&(this.initSegments_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),i||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=mm(e),i=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!i&&e.bytes&&(this.keyCache_[n]=i={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(i||e).resolvedUri};return i&&(r.bytes=i.bytes),r}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&!(this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)){var n=this.playlist_,i=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(n&&(n.id?r=n.id:n.uri&&(r=n.uri)),this.logger_("playlist update [".concat(r," => ").concat(e.id||e.uri,"]")),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_("Playlist update:\ncurrentTime: ".concat(this.currentTime_(),"\nbufferedEnd: ").concat(wf(this.buffered_()),"\n"),this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri){if(null!==this.mediaIndex)!e.endList&&"number"==typeof e.partTargetDuration?this.resetLoader():this.resyncLoader();return this.currentMediaInfo_=void 0,void this.trigger("playlistupdate")}var a=e.mediaSequence-n.mediaSequence;if(this.logger_("live window shift [".concat(a,"]")),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index ".concat(this.partIndex,") no longer exists.")),this.resetLoader(),this.mediaIndex=o}}i&&(i.mediaIndex-=a,i.mediaIndex<0?(i.mediaIndex=null,i.partIndex=null):(i.mediaIndex>=0&&(i.segment=e.segments[i.mediaIndex]),i.partIndex>=0&&i.segment.parts&&(i.part=i.segment.parts[i.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"resetEverything",value:function(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}},{key:"resyncLoader",value:function(){this.transmuxer_&&qm(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"===this.sourceType_&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}},{key:"remove",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&n()};for(var s in!i&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(i||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,n,i){for(var r=Math.ceil((t-i)*yu),a=Math.ceil((n-i)*yu),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)kg(e,t,this.inbandTextTracks_[s]);kg(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=wn.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=wn.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();if(e){var t={segmentInfo:Dg({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),"number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}}}},{key:"isEndOfStream_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.mediaIndex,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.partIndex;if(!t||!this.mediaSource_)return!1;var i="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!i||!i.parts||n+1===i.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a}},{key:"chooseNextRequest_",value:function(){var e=this.buffered_(),t=wf(e)||0,n=Ef(e,this.currentTime_()),i=!this.hasPlayed_()&&n>=1,r=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||i||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,n){t=t||[];for(var i=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(i.push(a),(r+=s.duration)>n))return a}return 0===i.length?0:i[i.length-1]}(this.currentTimeline_,a,t),this.logger_("choose next request. Can not find sync point. Fallback to media Index: ".concat(s.mediaIndex));else if(null!==this.mediaIndex){var o=a[this.mediaIndex],u="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[u+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=u+1):s.mediaIndex=this.mediaIndex+1}else{var l,c,d,h=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_("chooseNextRequest_ request after Quality Switch:\nFor TargetTime: ".concat(h,".\nCurrentTime: ").concat(this.currentTime_(),"\nBufferedEnd: ").concat(t,"\nFetch At Buffer: ").concat(this.fetchAtBuffer_,"\n"),this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){var p=this.getSyncInfoFromMediaSequenceSync_(h);if(!p){var f="No sync info found while using media sequence sync";return this.error({message:f,metadata:{errorType:rf.Error.StreamingFailedToSelectNextSegment,error:new Error(f)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_("chooseNextRequest_ mediaSequence syncInfo (".concat(p.start," --\x3e ").concat(p.end,")")),l=p.segmentIndex,c=p.partIndex,d=p.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");var m=Hf.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:h,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});l=m.segmentIndex,c=m.partIndex,d=m.startTime}s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd ".concat(h):"currentTime ".concat(h),s.mediaIndex=l,s.startOfSegment=d,s.partIndex=c,this.logger_("choose next request. Playlist switched and we have a sync point. Media Index: ".concat(s.mediaIndex," "))}var g=a[s.mediaIndex],v=g&&"number"==typeof s.partIndex&&g.parts&&g.parts[s.partIndex];if(!g||"number"==typeof s.partIndex&&!v)return null;"number"!=typeof s.partIndex&&g.parts&&(s.partIndex=0,v=g.parts[0]);var y=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&v&&!y&&!v.independent)if(0===s.partIndex){var _=a[s.mediaIndex-1],b=_.parts&&_.parts.length&&_.parts[_.parts.length-1];b&&b.independent&&(s.mediaIndex-=1,s.partIndex=_.parts.length-1,s.independent="previous segment")}else g.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var T=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,s.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(s))}},{key:"getSyncInfoFromMediaSequenceSync_",value:function(e){if(!this.mediaSequenceSync_)return null;var t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_("getSyncInfoFromMediaSequenceSync_. Pulled target time from ".concat(e," to ").concat(t));var n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;var i=this.mediaSequenceSync_.getSyncInfoForTime(n.end);return i?(i.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),i):null}},{key:"generateSegmentInfo_",value:function(e){var t=e.independent,n=e.playlist,i=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=n.segments[i],c="number"==typeof s&&l.parts[s],d={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:c?s:null,isSyncRequest:a,startOfSegment:r,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:c&&c.duration||l.duration,segment:l,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},h=void 0!==o?o:this.isPendingTimestampOffset_;d.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=wf(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(d.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(d.gopsToAlignWith=function(e,t,n){if(null==t||!e.length)return[];var i,r=Math.ceil((t-n+3)*yu);for(i=0;i<e.length&&!(e[i].pts>r);i++);return e.slice(i)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),d}},{key:"timestampOffsetForSegment_",value:function(e){return n=(t=e).segmentTimeline,i=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||n!==i?n<i?r:a.length?a.end(a.length-1):r:null;var t,n,i,r,a}},{key:"earlyAbortWhenNeeded_",value:function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),n=e.bandwidth,i=this.pendingSegment_.duration,r=Hf.estimateSegmentRequestTime(i,n,this.playlist_,e.bytesReceived),a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/n}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=a)){var s=function(e){var t=e.main,n=e.currentTime,i=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter(function(e){return!Hf.isIncompatible(e)}),c=l.filter(Hf.isEnabled);c.length||(c=l.filter(function(e){return!Hf.isDisabled(e)}));var d=c.filter(Hf.hasAttribute.bind(null,"BANDWIDTH")).map(function(e){var t=u.getSyncPoint(e,r,o,n)?1:2;return{playlist:e,rebufferingImpact:Hf.estimateSegmentRequestTime(a,i,e)*t-s}}),h=d.filter(function(e){return e.rebufferingImpact<=0});return pg(h,function(e,t){return fg(t.playlist,e.playlist)}),h.length?h[0]:(pg(d,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),d[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:i,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;a<=vf&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u||(this.bandwidth=s.playlist.attributes.BANDWIDTH*xm.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}}},{key:"handleAbort_",value:function(e){this.logger_("Aborting ".concat(Eg(e))),this.mediaRequestsAborted+=1}},{key:"handleProgress_",value:function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}},{key:"handleTrackInfo_",value:function(e,t){var n=t,i=n.hasAudio,r=n.hasVideo,a={segmentInfo:Dg({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:a}),this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var n=Object.keys(e).sort(),i=Object.keys(t).sort();if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++){var a=n[r];if(a!==i[r])return!1;if(e[a]!==t[a])return!1}return!0}(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ig(this)))}},{key:"handleTimingInfo_",value:function(e,t,n,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var r=this.pendingSegment_,a=Cg(t);r[a]=r[a]||{},r[a][n]=i,this.logger_("timinginfo: ".concat(t," - ").concat(n," - ").concat(i)),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ig(this)}}},{key:"handleCaptions_",value:function(e,t){var n=this;if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0!==t.length)if(this.pendingSegment_.hasAppendedData_){var i=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(function(e){r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)}),Object.keys(r).forEach(function(e){var t=r[e],a=t.startTime,s=t.endTime,o=t.captions,u=n.inbandTextTracks_;n.logger_("adding cues from ".concat(a," -> ").concat(s," for ").concat(e)),function(e,t,n){if(!e[n]){t.trigger({type:"usage",name:"vhs-608"});var i=n;/^cc708_/.test(n)&&(i="SERVICE"+n.split("_")[1]);var r=t.textTracks().getTrackById(i);if(r)e[n]=r;else{var a=n,s=n,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[i];u&&(a=u.label,s=u.language,o=u.default),e[n]=t.addRemoteTextTrack({kind:"captions",id:i,default:o,label:a,language:s},!1).track}}}(u,n.vhs_.tech_,e),kg(a,s,u[e]),function(e){var t=e.inbandTextTracks,n=e.captionArray,i=e.timestampOffset;if(n){var r=wn.WebKitDataCue||wn.VTTCue;n.forEach(function(e){var n=e.stream;e.content?e.content.forEach(function(a){var s=new r(e.startTime+i,e.endTime+i,a.text);s.line=a.line,s.align="left",s.position=a.position,s.positionAlign="line-left",t[n].addCue(s)}):t[n].addCue(new r(e.startTime+i,e.endTime+i,e.text))})}}({captionArray:o,inbandTextTracks:u,timestampOffset:i})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")}},{key:"handleId3_",value:function(e,t,n){(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(n,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n)))}},{key:"processMetadataQueue_",value:function(){this.metadataQueue_.id3.forEach(function(e){return e()}),this.metadataQueue_.caption.forEach(function(e){return e()}),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}},{key:"processCallQueue_",value:function(){var e=this.callQueue_;this.callQueue_=[],e.forEach(function(e){return e()})}},{key:"processLoadQueue_",value:function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(function(e){return e()})}},{key:"hasEnoughInfoToLoad_",value:function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Ag({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}},{key:"getCurrentMediaInfo_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pendingSegment_;return e&&e.trackInfo||this.currentMediaInfo_}},{key:"getMediaInfo_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pendingSegment_;return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}},{key:"getPendingSegmentPlaylist",value:function(){return this.pendingSegment_?this.pendingSegment_.playlist:null}},{key:"hasEnoughInfoToAppend_",value:function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var n=t.hasAudio,i=t.hasVideo,r=t.isMuxed;return!(i&&!e.videoTimingInfo)&&(!(n&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!Ag({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}},{key:"handleData_",value:function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return Ig(this),void this.callQueue_.push(this.handleData_.bind(this,e,t));var n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Cg(t.type)].start;else{var i,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(i=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:i,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==n.mediaIndex||s.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}}},{key:"updateAppendInitSegmentStatus",value:function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}},{key:"getInitSegmentAndUpdateState_",value:function(e){var t=e.type,n=e.initSegment,i=e.map,r=e.playlist;if(i){var a=fm(i);if(this.activeInitSegmentId_===a)return null;n=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=a}return n&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,n):null}},{key:"handleQuotaExceededError_",value:function(e,t){var n=this,i=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Sf(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Sf(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=o.length?o.start(0):0,d=o.length?o.end(o.length-1):0;if(l-u<=1&&d-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. "+"Appended byte length: ".concat(a.byteLength,", ")+"audio buffer: ".concat(Sf(s).join(", "),", ")+"video buffer: ".concat(Sf(o).join(", "),", ")),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:i,type:r,bytes:a}));var h=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ".concat(h)),this.remove(0,h,function(){n.logger_("On QUOTA_EXCEEDED_ERR, retrying append in ".concat(1,"s")),n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=wn.setTimeout(function(){n.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),n.quotaExceededErrorRetryTimeout_=null,n.processCallQueue_()},1e3)},!0)}},{key:"handleAppendError_",value:function(e,t){var n=e.segmentInfo,i=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error({message:"".concat(i," append of ").concat(r.length,"b failed for segment ")+"#".concat(n.mediaIndex," in playlist ").concat(n.playlist.id),metadata:{errorType:rf.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:n,type:i,bytes:r}))}},{key:"appendToSourceBuffer_",value:function(e){var t,n,i,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],c=o.byteLength;s&&(l.unshift(s),c+=s.byteLength),i=0,(t={bytes:c,segments:l}).bytes&&(n=new Uint8Array(t.bytes),t.segments.forEach(function(e){n.set(e,i),i+=e.byteLength})),u=n}var d={segmentInfo:Dg({type:this.loaderType_,segment:r})};this.trigger({type:"segmentappendstart",metadata:d}),this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))}},{key:"handleSegmentTimingInfo_",value:function(e,t,n){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment,r="".concat(e,"TimingInfo");i[r]||(i[r]={}),i[r].transmuxerPrependedSeconds=n.prependedContentDuration||0,i[r].transmuxedPresentationStart=n.start.presentation,i[r].transmuxedDecodeStart=n.start.decode,i[r].transmuxedPresentationEnd=n.end.presentation,i[r].transmuxedDecodeEnd=n.end.decode,i[r].baseMediaDecodeTime=n.baseMediaDecodeTime}}},{key:"appendData_",value:function(e,t){var n=t.type,i=t.data;if(i&&i.byteLength&&("audio"!==n||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:r,data:i})}}},{key:"loadSegment_",value:function(e){var t=this;if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_())return Ig(this),void this.loadQueue_.push(function(){var n=$({},e,{forceTimestampOffset:!0});$(e,t.generateSegmentInfo_(n)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)});this.updateTransmuxerAndRequestSegment_(e)}},{key:"updateTransmuxerAndRequestSegment_",value:function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var n=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=i||r&&a;this.logger_("Requesting\n".concat(vg(e.uri),"\n").concat(Eg(e))),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=rg({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:n,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(n){var i=n.message,r=n.level,a=n.stream;t.logger_("".concat(Eg(e)," logged from transmuxer stream ").concat(a," as a ").concat(r,": ").concat(i))},triggerSegmentEventFn:function(e){var n=e.type,i=e.segment,r=e.keyInfo,a=e.trackInfo,s=e.timingInfo,o={segmentInfo:Dg({segment:i})};r&&(o.keyInfo=r),a&&(o.trackInfo=a),s&&(o.timingInfo=s),t.trigger({type:n,metadata:o})}})}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,n){var i=t-xm.BACK_BUFFER_LENGTH;e.length&&(i=Math.max(i,e.start(0)));var r=t-n;return Math.min(r,i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,n=e.part,i=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:i,isMediaInitialization:r},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?a.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(a.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){var o=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=o}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}},{key:"saveTransferStats_",value:function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}},{key:"saveBandwidthRelatedStats_",value:function(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<wg)this.logger_("Ignoring segment's bandwidth because its duration of ".concat(e)+" is less than the min to record ".concat(wg));else{var n={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:n}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}}},{key:"handleTimeout_",value:function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}},{key:"segmentRequestFinished_",value:function(e,t,n){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Gm)return;return this.pause(),e.code===Wm?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var i=this.pendingSegment_;this.saveBandwidthRelatedStats_(i.duration,t.stats),i.endOfAllRequests=t.endOfAllRequests,n.gopInfo&&(this.gopBuffer_=function(e,t,n){if(!t.length)return e;if(n)return t.slice();for(var i=t[0].pts,r=0;r<e.length&&!(e[r].pts>=i);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,n.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(i)}}},{key:"setTimeMapping_",value:function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}},{key:"updateMediaSecondsLoaded_",value:function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}},{key:"shouldUpdateTransmuxerTimestampOffset_",value:function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}},{key:"trueSegmentStart_",value:function(e){var t=e.currentStart,n=e.playlist,i=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=n.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===r+a?o.start:r}},{key:"waitForAppendsToComplete_",value:function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");var n=t.hasAudio,i=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&i,s=!this.audioDisabled_&&n&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}},{key:"checkAppendsDone_",value:function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}},{key:"checkForIllegalMediaSwitch",value:function(e){var t=function(e,t,n){return"main"===e&&t&&n?n.hasAudio||n.hasVideo?t.hasVideo&&!n.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&n.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}},{key:"updateSourceBufferTimestampOffset_",value:function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}}},{key:"getSegmentStartTimeForTimestampOffsetCalculation_",value:function(e){var t=e.videoTimingInfo,n=e.audioTimingInfo,i=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:n&&"number"==typeof n.transmuxedDecodeStart?n.transmuxedDecodeStart:i.start:i.start}},{key:"updateTimingInfoEnd_",value:function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),n="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end="number"==typeof n.end?n.end:n.start+e.duration)}},{key:"handleAppendsDone_",value:function(){if(this.pendingSegment_){var e={segmentInfo:Dg({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:e})}if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var t=this.pendingSegment_;t.part&&t.part.syncInfo?t.part.syncInfo.markAppended():t.segment.syncInfo&&t.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(t),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:"main"===this.loaderType_});var n=Lg(t,this.sourceType_);if(n&&("warn"===n.severity?rf.log.warn(n.message):this.logger_(n.message)),this.recordThroughput_(t),this.pendingSegment_=null,this.state="READY",!t.isSyncRequest||(this.trigger("syncinfoupdate"),t.hasAppendedData_)){this.logger_("Appended ".concat(Eg(t))),this.addSegmentMetadataCue_(t),this.fetchAtBuffer_=!0,this.currentTimeline_!==t.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:t.timeline})),this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate");var i=t.segment,r=t.part,a=i.end&&this.currentTime_()-i.end>3*t.playlist.targetDuration,s=r&&r.end&&this.currentTime_()-r.end>3*t.playlist.partTargetDuration;if(a||s)return this.logger_("bad ".concat(a?"segment":"part"," ").concat(Eg(t))),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=t.mediaIndex,this.partIndex=t.partIndex,this.isEndOfStream_(t.mediaIndex,t.playlist,t.partIndex)&&this.endOfStream(),this.trigger("appended"),t.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request ".concat(Eg(t)))}},{key:"recordThroughput_",value:function(e){if(e.duration<wg)this.logger_("Ignoring segment's throughput because its duration of ".concat(e.duration)+" is less than the min to record ".concat(wg));else{var t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,i=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(i-t)/++this.throughput.count}}},{key:"addSegmentMetadataCue_",value:function(e){if(this.segmentMetadataTrack_){var t=e.segment,n=t.start,i=t.end;if(Sg(n)&&Sg(i)){kg(n,i,this.segmentMetadataTrack_);var r=wn.WebKitDataCue||wn.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:n,end:i},s=new r(n,i,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}}}])}();function Rg(){}var Og,Ng=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})},Ug=["video","audio"],Mg=function(e,t){var n=t["".concat(e,"Buffer")];return n&&n.updating||t.queuePending[e]},Bg=function(e,t){if(0!==t.queue.length){var n=0,i=t.queue[n];if("mediaSource"!==i.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Mg(e,t)){if(i.type!==e){if(n=function(e,t){for(var n=0;n<t.length;n++){var i=t[n];if("mediaSource"===i.type)return null;if(i.type===e)return n}return null}(e,t.queue),null===n)return;i=t.queue[n]}return t.queue.splice(n,1),t.queuePending[e]=i,i.action(e,t),i.doneFn?void 0:(t.queuePending[e]=null,void Bg(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),i.action(t),i.doneFn&&i.doneFn(),Bg("audio",t),Bg("video",t))}},jg=function(e,t){var n=t["".concat(e,"Buffer")],i=Ng(e);n&&(n.removeEventListener("updateend",t["on".concat(i,"UpdateEnd_")]),n.removeEventListener("error",t["on".concat(i,"Error_")]),t.codecs[e]=null,t["".concat(e,"Buffer")]=null)},Fg=function(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)},qg=function(e,t,n){return function(i,r){var a=r["".concat(i,"Buffer")];if(Fg(r.mediaSource,a)){r.logger_("Appending segment ".concat(t.mediaIndex,"'s ").concat(e.length," bytes to ").concat(i,"Buffer"));try{a.appendBuffer(e)}catch(vy){r.logger_("Error with code ".concat(vy.code," ")+(22===vy.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment ".concat(t.mediaIndex," to ").concat(i,"Buffer")),r.queuePending[i]=null,n(vy)}}}},Vg=function(e,t){return function(n,i){var r=i["".concat(n,"Buffer")];if(Fg(i.mediaSource,r)){i.logger_("Removing ".concat(e," to ").concat(t," from ").concat(n,"Buffer"));try{r.remove(e,t)}catch(vy){i.logger_("Remove ".concat(e," to ").concat(t," from ").concat(n,"Buffer failed"))}}}},Hg=function(e){return function(t,n){var i=n["".concat(t,"Buffer")];Fg(n.mediaSource,i)&&(n.logger_("Setting ".concat(t,"timestampOffset to ").concat(e)),i.timestampOffset=e)}},zg=function(e){return function(t,n){e()}},Wg=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream(".concat(e||"",")"));try{t.mediaSource.endOfStream(e)}catch(vy){rf.log.warn("Failed to call media source endOfStream",vy)}}}},Gg=function(e){return function(t){t.logger_("Setting mediaSource duration to ".concat(e));try{t.mediaSource.duration=e}catch(vy){rf.log.warn("Failed to set media source duration",vy)}}},Xg=function(){return function(e,t){if("open"===t.mediaSource.readyState){var n=t["".concat(e,"Buffer")];if(Fg(t.mediaSource,n)){t.logger_("calling abort on ".concat(e,"Buffer"));try{n.abort()}catch(vy){rf.log.warn("Failed to abort on ".concat(e,"Buffer"),vy)}}}}},Kg=function(e,t){return function(n){var i=Ng(e),r=yr(t);n.logger_("Adding ".concat(e,"Buffer with codec ").concat(t," to mediaSource"));var a=n.mediaSource.addSourceBuffer(r);a.addEventListener("updateend",n["on".concat(i,"UpdateEnd_")]),a.addEventListener("error",n["on".concat(i,"Error_")]),n.codecs[e]=t,n["".concat(e,"Buffer")]=a}},Yg=function(e){return function(t){var n=t["".concat(e,"Buffer")];if(jg(e,t),Fg(t.mediaSource,n)){t.logger_("Removing ".concat(e,"Buffer with codec ").concat(t.codecs[e]," from mediaSource"));try{t.mediaSource.removeSourceBuffer(n)}catch(vy){rf.log.warn("Failed to removeSourceBuffer ".concat(e,"Buffer"),vy)}}}},Qg=function(e){return function(t,n){var i=n["".concat(t,"Buffer")],r=yr(e);if(Fg(n.mediaSource,i)){var a=e.substring(0,e.indexOf(".")),s=n.codecs[t];if(s.substring(0,s.indexOf("."))!==a){var o={codecsChangeInfo:{from:s,to:e}};n.trigger({type:"codecschange",metadata:o}),n.logger_("changing ".concat(t,"Buffer codec from ").concat(s," to ").concat(e));try{i.changeType(r),n.codecs[t]=e}catch(vy){o.errorType=rf.Error.StreamingCodecsChangeError,o.error=vy,vy.metadata=o,n.error_=vy,n.trigger("error"),rf.log.warn("Failed to changeType on ".concat(t,"Buffer"),vy)}}}}},$g=function(e){var t=e.type,n=e.sourceUpdater,i=e.action,r=e.doneFn,a=e.name;n.queue.push({type:t,action:i,doneFn:r,name:a}),Bg(t,n)},Jg=function(e,t){return function(n){var i=function(e){if(0===e.length)return"Buffered Ranges are empty";for(var t="Buffered Ranges: \n",n=0;n<e.length;n++){var i=e.start(n),r=e.end(n);t+="".concat(i," --\x3e ").concat(r,". Duration (").concat(r-i,")\n")}return t}(t["".concat(e,"Buffered")]());if(t.logger_('received "updateend" event for '.concat(e," Source Buffer: "),i),t.queuePending[e]){var r=t.queuePending[e].doneFn;t.queuePending[e]=null,r&&r(t["".concat(e,"Error_")])}Bg(e,t)}},Zg=function(){function e(t){var n;return g(this,e),(n=c(this,e)).mediaSource=t,n.sourceopenListener_=function(){return Bg("mediaSource",n)},n.mediaSource.addEventListener("sourceopen",n.sourceopenListener_),n.logger_=ff("SourceUpdater"),n.audioTimestampOffset_=0,n.videoTimestampOffset_=0,n.queue=[],n.queuePending={audio:null,video:null},n.delayedAudioAppendQueue_=[],n.videoAppendQueued_=!1,n.codecs={},n.onVideoUpdateEnd_=Jg("video",n),n.onAudioUpdateEnd_=Jg("audio",n),n.onVideoError_=function(e){n.videoError_=e},n.onAudioError_=function(e){n.audioError_=e},n.createdSourceBuffers_=!1,n.initializedEme_=!1,n.triggeredReady_=!1,n}return f(e,rf.EventTarget),y(e,[{key:"initializedEme",value:function(){this.initializedEme_=!0,this.triggerReady()}},{key:"hasCreatedSourceBuffers",value:function(){return this.createdSourceBuffers_}},{key:"hasInitializedAnyEme",value:function(){return this.initializedEme_}},{key:"ready",value:function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}},{key:"createSourceBuffers",value:function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}},{key:"triggerReady",value:function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}},{key:"addSourceBuffer",value:function(e,t){$g({type:"mediaSource",sourceUpdater:this,action:Kg(e,t),name:"addSourceBuffer"})}},{key:"abort",value:function(e){$g({type:e,sourceUpdater:this,action:Xg(e),name:"abort"})}},{key:"removeSourceBuffer",value:function(e){this.canRemoveSourceBuffer()?$g({type:"mediaSource",sourceUpdater:this,action:Yg(e),name:"removeSourceBuffer"}):rf.log.error("removeSourceBuffer is not supported!")}},{key:"canRemoveSourceBuffer",value:function(){return!rf.browser.IS_FIREFOX&&wn.MediaSource&&wn.MediaSource.prototype&&"function"==typeof wn.MediaSource.prototype.removeSourceBuffer}},{key:"canChangeType",value:function(){return this.constructor.canChangeType()}},{key:"changeType",value:function(e,t){this.canChangeType()?$g({type:e,sourceUpdater:this,action:Qg(t),name:"changeType"}):rf.log.error("changeType is not supported!")}},{key:"addOrChangeSourceBuffers",value:function(e){var t=this;if(!e||"object"!==k(e)||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(function(n){var i=e[n];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(n,i);t.canChangeType()&&t.changeType(n,i)})}},{key:"appendBuffer",value:function(e,t){var n=this,i=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of ".concat(a.length," until video append"));if($g({type:r,sourceUpdater:this,action:qg(a,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio ".concat(s.length," appendBuffers")),this.delayedAudioAppendQueue_.length=0,s.forEach(function(e){n.appendBuffer.apply(n,e)})}}},{key:"audioBuffered",value:function(){return Fg(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:gf()}},{key:"videoBuffered",value:function(){return Fg(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:gf()}},{key:"buffered",value:function(){var e=Fg(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Fg(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var n=null,i=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return gf();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),o=0;o<a.length;o++)"start"===a[o].type?2===++r&&(n=a[o].time):"end"===a[o].type&&1===--r&&(i=a[o].time),null!==n&&null!==i&&(s.push([n,i]),n=null,i=null);return gf(s)}(this.audioBuffered(),this.videoBuffered())}},{key:"setDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rg;$g({type:"mediaSource",sourceUpdater:this,action:Gg(e),name:"duration",doneFn:t})}},{key:"endOfStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rg;"string"!=typeof e&&(e=void 0),$g({type:"mediaSource",sourceUpdater:this,action:Wg(e),name:"endOfStream",doneFn:t})}},{key:"removeAudio",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rg;this.audioBuffered().length&&0!==this.audioBuffered().end(0)?$g({type:"audio",sourceUpdater:this,action:Vg(e,t),doneFn:n,name:"remove"}):n()}},{key:"removeVideo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rg;this.videoBuffered().length&&0!==this.videoBuffered().end(0)?$g({type:"video",sourceUpdater:this,action:Vg(e,t),doneFn:n,name:"remove"}):n()}},{key:"updating",value:function(){return!(!Mg("audio",this)&&!Mg("video",this))}},{key:"audioTimestampOffset",value:function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&($g({type:"audio",sourceUpdater:this,action:Hg(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}},{key:"videoTimestampOffset",value:function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset_!==e&&($g({type:"video",sourceUpdater:this,action:Hg(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}},{key:"audioQueueCallback",value:function(e){this.audioBuffer&&$g({type:"audio",sourceUpdater:this,action:zg(e),name:"callback"})}},{key:"videoQueueCallback",value:function(e){this.videoBuffer&&$g({type:"video",sourceUpdater:this,action:zg(e),name:"callback"})}},{key:"dispose",value:function(){var e=this;this.trigger("dispose"),Ug.forEach(function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e["".concat(t,"QueueCallback")](function(){return jg(t,e)})}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}],[{key:"canChangeType",value:function(){return wn.SourceBuffer&&wn.SourceBuffer.prototype&&"function"==typeof wn.SourceBuffer.prototype.changeType}}])}(),ev=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},tv=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),nv=function(){function t(){return g(this,t),c(this,t,["Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded."])}return f(t,e(Error)),y(t)}(),iv=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).mediaSource_=null,n.subtitlesTrack_=null,n.featuresNativeTextTracks_=t.featuresNativeTextTracks,n.loadVttJs=t.loadVttJs,n.shouldSaveSegmentTimingInfo_=!1,n}return f(e,Pg),y(e,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return gf();var e=this.subtitlesTrack_.cues;return gf([[e[0].startTime,e[e.length-1].startTime]])}},{key:"initSegmentForMap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=fm(e),i=this.initSegments_[n];if(t&&!i&&e.bytes){var r=tv.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(tv,e.bytes.byteLength),this.initSegments_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return i||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(e,t){kg(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",function(){e.state="READY",e.paused()||e.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"timestampOffsetForSegment_",value:function(){return null}},{key:"chooseNextRequest_",value:function(){return this.skipEmptySegments_(n(e,"chooseNextRequest_",this,3)([]))}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}},{key:"stopForError",value:function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}},{key:"segmentRequestFinished_",value:function(e,t,n){var i=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Wm&&this.handleTimeout_(),e.code===Gm?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_,a=n.mp4VttCues&&n.mp4VttCues.length;a&&(r.mp4VttCues=n.mp4VttCues),this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var s=r.segment;if(s.map&&(s.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof wn.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then(function(){return i.segmentRequestFinished_(e,t,n)},function(){return i.stopForError({message:"Error loading vtt.js"})});s.requested=!0;try{this.parseVTTCues_(r)}catch(vy){return void this.stopForError({message:vy.message,metadata:{errorType:rf.Error.StreamingVttParserError,error:vy}})}if(a||this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(function(e){i.subtitlesTrack_.addCue(i.featuresNativeTextTracks_?new wn.VTTCue(e.startTime,e.endTime,e.text):e)}),function(e){var t=e.cues;if(t)for(var n={},i=t.length-1;i>=0;i--){var r=t[i],a="".concat(r.startTime,"-").concat(r.endTime,"-").concat(r.text);n[a]?e.removeCue(r):n[a]=r}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"}},{key:"handleData_",value:function(t,i){var r=t&&"vtt"===t.type,a=i&&"text"===i.type;r&&a&&n(e,"handleData_",this,3)([t,i])}},{key:"updateTimingInfoEnd_",value:function(){}},{key:"parseMp4VttCues_",value:function(e){var t=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(function(n){var i=n.start+t,r=n.end+t,a=new wn.VTTCue(i,r,n.cueText);n.settings&&n.settings.split(" ").forEach(function(e){var t=e.split(":"),n=t[0],i=t[1];a[n]=isNaN(i)?i:Number(i)}),e.cues.push(a)})}},{key:"parseVTTCues_",value:function(e){var t,n=!1;if("function"!=typeof wn.WebVTT)throw new nv;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues)this.parseMp4VttCues_(e);else{"function"==typeof wn.TextDecoder?t=new wn.TextDecoder("utf8"):(t=wn.WebVTT.StringDecoder(),n=!0);var i=new wn.WebVTT.Parser(wn,wn.vttjs,t);if(i.oncue=e.cues.push.bind(e.cues),i.ontimestampmap=function(t){e.timestampmap=t},i.onparsingerror=function(e){rf.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;n&&(r=ev(r)),i.parse(r)}var a=e.bytes;n&&(a=ev(a)),i.parse(a),i.flush()}}},{key:"updateTimeMapping_",value:function(e,t,n){var i=this,r=e.segment;if(t)if(e.cues.length){var a=e.timestampmap,s=a.MPEGTS,o=a.LOCAL,u=s/yu-o+t.mapping;if(e.cues.forEach(function(e){var n=e.endTime-e.startTime,r=i.handleRollover_(e.startTime+u,t.time);e.startTime=Math.max(r,0),e.endTime=Math.max(r+n,0)}),!n.syncInfo){var l=e.cues[0].startTime,c=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(l,c-r.duration)}}}else r.empty=!0}},{key:"handleRollover_",value:function(e,t){if(null===t)return e;var n,i=e*yu,r=t*yu;for(n=r<i?-8589934592:8589934592;Math.abs(i-r)>4294967296;)i+=n;return i/yu}}])}(),rv=function(e,t){for(var n=e.cues,i=0;i<n.length;i++){var r=n[i];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},av=function(){return y(function e(t){var n=t.start,i=t.end,r=t.segmentIndex,a=t.partIndex,s=void 0===a?null:a,o=t.appended,u=void 0!==o&&o;g(this,e),this.start_=n,this.end_=i,this.segmentIndex_=r,this.partIndex_=s,this.appended_=u},[{key:"isInRange",value:function(e){return e>=this.start&&e<this.end}},{key:"markAppended",value:function(){this.appended_=!0}},{key:"resetAppendedStatus",value:function(){this.appended_=!1}},{key:"isAppended",get:function(){return this.appended_}},{key:"start",get:function(){return this.start_}},{key:"end",get:function(){return this.end_}},{key:"segmentIndex",get:function(){return this.segmentIndex_}},{key:"partIndex",get:function(){return this.partIndex_}}])}(),sv=function(){return y(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];g(this,e),this.segmentSyncInfo_=t,this.partsSyncInfo_=n},[{key:"segmentSyncInfo",get:function(){return this.segmentSyncInfo_}},{key:"partsSyncInfo",get:function(){return this.partsSyncInfo_}},{key:"hasPartsSyncInfo",get:function(){return this.partsSyncInfo_.length>0}},{key:"resetAppendStatus",value:function(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(function(e){return e.resetAppendedStatus()})}}])}(),ov=function(){return y(function e(){g(this,e),this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0},[{key:"start",get:function(){return this.start_}},{key:"end",get:function(){return this.end_}},{key:"diagnostics",get:function(){return this.diagnostics_}},{key:"isReliable",get:function(){return this.isReliable_}},{key:"resetAppendedStatus",value:function(){this.storage_.forEach(function(e){return e.resetAppendStatus()})}},{key:"update",value:function(e,t){var n=e.mediaSequence,i=e.segments;if(this.isReliable_=this.isReliablePlaylist_(n,i),this.isReliable_)return this.updateStorage_(i,n,this.calculateBaseTime_(n,i,t))}},{key:"getSyncInfoForTime",value:function(e){var t,n=_(this.storage_.values());try{for(n.s();!(t=n.n()).done;){var i=t.value,r=i.segmentSyncInfo,a=i.partsSyncInfo;if(a.length){var s,o=_(a);try{for(o.s();!(s=o.n()).done;){var u=s.value;if(u.isInRange(e))return u}}catch(l){o.e(l)}finally{o.f()}}else if(r.isInRange(e))return r}}catch(l){n.e(l)}finally{n.f()}return null}},{key:"getSyncInfoForMediaSequence",value:function(e){return this.storage_.get(e)}},{key:"updateStorage_",value:function(e,t,n){var i=this,r=new Map,a="\n",s=n,o=t;this.start_=s,e.forEach(function(e,t){var n=i.storage_.get(o),u=s,l=u+e.duration,c=Boolean(n&&n.segmentSyncInfo&&n.segmentSyncInfo.isAppended),d=new av({start:u,end:l,appended:c,segmentIndex:t});e.syncInfo=d;var h=s,p=(e.parts||[]).map(function(e,i){var r=h,s=h+e.duration,u=Boolean(n&&n.partsSyncInfo&&n.partsSyncInfo[i]&&n.partsSyncInfo[i].isAppended),l=new av({start:r,end:s,appended:u,segmentIndex:t,partIndex:i});return h=s,a+="Media Sequence: ".concat(o,".").concat(i," | Range: ").concat(r," --\x3e ").concat(s," | Appended: ").concat(u,"\n"),e.syncInfo=l,l});r.set(o,new sv(d,p)),a+="".concat(vg(e.resolvedUri)," | Media Sequence: ").concat(o," | Range: ").concat(u," --\x3e ").concat(l," | Appended: ").concat(c,"\n"),o++,s=l}),this.end_=s,this.storage_=r,this.diagnostics_=a}},{key:"calculateBaseTime_",value:function(e,t,n){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;var i=Math.min.apply(Math,b(this.storage_.keys()));if(e<i){for(var r=i-e,a=this.storage_.get(i).segmentSyncInfo.start,s=0;s<r;s++){a-=t[s].duration}return a}return n}},{key:"isReliablePlaylist_",value:function(e,t){return null!=e&&Array.isArray(t)&&t.length}}])}(),uv=function(){function e(t){var n;return g(this,e),(n=c(this,e)).parent_=t,n}return f(e,ov),y(e,[{key:"calculateBaseTime_",value:function(t,i,r){if(!this.storage_.size){var a=this.parent_.getSyncInfoForMediaSequence(t);return a?a.segmentSyncInfo.start:0}return n(e,"calculateBaseTime_",this,3)([t,i,r])}}])}(),lv=[{name:"VOD",run:function(e,t,n,i,r){if(n!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"MediaSequence",run:function(e,t,n,i,r,a){var s=e.getMediaSequenceSync(a);if(!s)return null;if(!s.isReliable)return null;var o=s.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:function(e,t,n,i,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=Af(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=e.timelineToDatetimeMappings[c.timeline];if(d&&c.dateTimeObject){var h=c.dateTimeObject.getTime()/1e3+d;if(c.parts&&"number"==typeof l.partIndex)for(var p=0;p<l.partIndex;p++)h+=c.parts[p].duration;var f=Math.abs(r-h);if(null!==s&&(0===f||s<f))break;s=f,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,n,i,r){var a=null,s=null;r=r||0;for(var o=Af(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=l.part&&l.part.start||c&&c.start;if(c.timeline===i&&void 0!==d){var h=Math.abs(r-d);if(null!==s&&s<h)break;(!a||null===s||s>=h)&&(s=h,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,n,i,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var d=Math.abs(r-c.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,n,i,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],cv=function(){function e(){var t;g(this,e),(t=c(this,e)).timelines=[],t.discontinuities=[],t.timelineToDatetimeMappings={};var n=new ov,i=new uv(n),r=new uv(n);return t.mediaSequenceStorage_={main:n,audio:i,vtt:r},t.logger_=ff("SyncController"),t}return f(e,rf.EventTarget),y(e,[{key:"getMediaSequenceSync",value:function(e){return this.mediaSequenceStorage_[e]||null}},{key:"getSyncPoint",value:function(e,t,n,i,r){if(t!==1/0)return lv.find(function(e){return"VOD"===e.name}).run(this,e,t);var a=this.runStrategies_(e,t,n,i,r);if(!a.length)return null;var s,o=_(a);try{for(o.s();!(s=o.n()).done;){var u=s.value,l=u.syncPoint,c=u.strategy,d=l.segmentIndex,h=l.time;if(!(d<0)){var p=e.segments[d],f=h,m=f+p.duration;if(this.logger_("Strategy: ".concat(c,". Current time: ").concat(i,". selected segment: ").concat(d,". Time: [").concat(f," -> ").concat(m,"]}")),i>=f&&i<m)return this.logger_("Found sync point with exact match: ",l),l}}}catch(g){o.e(g)}finally{o.f()}return this.selectSyncPoint_(a,{key:"time",value:i})}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;var i=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+Rf({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}},{key:"runStrategies_",value:function(e,t,n,i,r){for(var a=[],s=0;s<lv.length;s++){var o=lv[s],u=o.run(this,e,t,n,i,r);u&&(u.strategy=o.name,a.push({strategy:o.name,syncPoint:u}))}return a}},{key:"selectSyncPoint_",value:function(e,t){for(var n=e[0].syncPoint,i=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<i&&(i=s,n=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for [".concat(t.key,": ").concat(t.value,"] chosen with strategy")+" [".concat(r,"]: [time:").concat(n.time,",")+" segmentIndex:".concat(n.segmentIndex)+("number"==typeof n.partIndex?",partIndex:".concat(n.partIndex):"")+"]"),n}},{key:"saveExpiredSegmentInfo",value:function(e,t){var n=t.mediaSequence-e.mediaSequence;if(n>86400)rf.log.warn("Not saving expired segment info. Media sequence gap ".concat(n," is too large."));else for(var i=n-1;i>=0;i--){var r=e.segments[i];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:r.start},this.logger_("playlist refresh sync: [time:".concat(t.syncInfo.time,",")+" mediaSequence: ".concat(t.syncInfo.mediaSequence,"]")),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMappingForStart",value:function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}},{key:"saveSegmentTimingInfo",value:function(e){var t=e.segmentInfo,n=e.shouldSaveTimelineMapping,i=this.calculateSegmentTimeMapping_(t,t.timingInfo,n),r=t.segment;i&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t,n){var i,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline ".concat(e.timeline,": ")+"[time: ".concat(o.time,"] [mapping: ").concat(o.mapping,"]"))),i=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;i=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=i,s.end=r),(!a.start||i<a.start)&&(a.start=i),a.end=r,!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var i=0;i<t.discontinuityStarts.length;i++){var r=t.discontinuityStarts[i],a=t.discontinuitySequence+i+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?n.start-Rf({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):n.end+Rf({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}}},{key:"dispose",value:function(){this.trigger("dispose"),this.off()}}])}(),dv=function(){function e(){var t;return g(this,e),(t=c(this,e)).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}return f(e,rf.EventTarget),y(e,[{key:"clearPendingTimelineChange",value:function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}},{key:"pendingTimelineChange",value:function(e){var t=e.type,n=e.from,i=e.to;return"number"==typeof n&&"number"==typeof i&&(this.pendingTimelineChanges_[t]={type:t,from:n,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]}},{key:"lastTimelineChange",value:function(e){var t=e.type,n=e.from,i=e.to;if("number"==typeof n&&"number"==typeof i){this.lastTimelineChanges_[t]={type:t,from:n,to:i},delete this.pendingTimelineChanges_[t];var r={timelineChangeInfo:{from:n,to:i}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[t]}},{key:"dispose",value:function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}])}(),hv=Pm(Rm(function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var n=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}();
26
- /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
27
- /*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */
28
- var t,n=null,i=function(){return y(function e(t){var i,r,a;g(this,e),n||(n=function(){var e,t,n,i,r,a,s,o,u=[[[],[],[],[],[]],[[],[],[],[],[]]],l=u[0],c=u[1],d=l[4],h=c[4],p=[],f=[];for(e=0;e<256;e++)f[(p[e]=e<<1^283*(e>>7))^e]=e;for(t=n=0;!d[t];t^=i||1,n=f[n]||1)for(a=(a=n^n<<1^n<<2^n<<3^n<<4)>>8^255&a^99,d[t]=a,h[a]=t,o=16843009*p[r=p[i=p[t]]]^65537*r^257*i^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,c[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),c[e]=c[e].slice(0);return u}()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];var s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");var c=t.slice(0),d=[];for(this._key=[c,d],i=u;i<4*u+28;i++)a=c[i-1],(i%u===0||8===u&&i%u===4)&&(a=s[a>>>24]<<24^s[a>>16&255]<<16^s[a>>8&255]<<8^s[255&a],i%u===0&&(a=a<<8^a>>>24^l<<24,l=l<<1^283*(l>>7))),c[i]=c[i-u]^a;for(r=0;i;r++,i--)a=c[3&r?i:i-4],d[r]=i<=4||r<4?a:o[0][s[a>>>24]]^o[1][s[a>>16&255]]^o[2][s[a>>8&255]]^o[3][s[255&a]]},[{key:"decrypt",value:function(e,t,n,i,r,a){var s,o,u,l,c=this._key[1],d=e^c[0],h=i^c[1],p=n^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],k=v[4];for(l=0;l<m;l++)s=y[d>>>24]^_[h>>16&255]^b[p>>8&255]^T[255&f]^c[g],o=y[h>>>24]^_[p>>16&255]^b[f>>8&255]^T[255&d]^c[g+1],u=y[p>>>24]^_[f>>16&255]^b[d>>8&255]^T[255&h]^c[g+2],f=y[f>>>24]^_[d>>16&255]^b[h>>8&255]^T[255&p]^c[g+3],g+=4,d=s,h=o,p=u;for(l=0;l<4;l++)r[(3&-l)+a]=k[d>>>24]<<24^k[h>>16&255]<<16^k[p>>8&255]<<8^k[255&f]^c[g++],s=d,d=h,h=p,p=f,f=s}}])}(),r=function(t){function n(){var t;return g(this,n),(t=c(this,n,[e])).jobs=[],t.delay=1,t.timeout_=null,t}return f(n,t),y(n,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}])}(e),a=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s=function(){return y(function e(t,n,i,s){g(this,e);var o=e.STEP,u=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(u.subarray(c,c+o),n,i,l)),c=o;c<u.length;c+=o)i=new Uint32Array([a(u[c-4]),a(u[c-3]),a(u[c-2]),a(u[c-1])]),this.asyncStream_.push(this.decryptChunk_(u.subarray(c,c+o),n,i,l));this.asyncStream_.push(function(){var e;s(null,(e=l).subarray(0,e.byteLength-e[e.byteLength-1]))})},[{key:"decryptChunk_",value:function(e,t,n,r){return function(){var s=function(e,t,n){var r,s,o,u,l,c,d,h,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new i(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(r=n[0],s=n[1],o=n[2],u=n[3],p=0;p<f.length;p+=4)l=a(f[p]),c=a(f[p+1]),d=a(f[p+2]),h=a(f[p+3]),m.decrypt(l,c,d,h,v,p),v[p]=a(v[p]^r),v[p+1]=a(v[p+1]^s),v[p+2]=a(v[p+2]^o),v[p+3]=a(v[p+3]^u),r=l,s=c,o=d,u=h;return g}(e,t,n);r.set(s,e.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}])}(),o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==U.global?U.global:"undefined"!=typeof self?self:{};t="undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof self?self:{};var u=t.BigInt||Number;u("0x1"),u("0x100"),u("0x10000"),u("0x1000000"),u("0x100000000"),u("0x10000000000"),u("0x1000000000000"),u("0x100000000000000"),u("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();var l=function(e){var t={};return Object.keys(e).forEach(function(n){var i,r=e[n];i=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer)?t[n]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[n]=r}),t};self.onmessage=function(e){var t=e.data,n=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),i=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new s(n,i,r,function(e,n){self.postMessage(l({source:t.source,decrypted:n}),[n.buffer])})}})),pv=Dm(hv),fv=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},mv=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},gv=function(e,t){t.activePlaylistLoader=e,e.load()},vv={AUDIO:function(e,t){return function(){var n=t.mediaTypes[e],i=t.excludePlaylist,r=n.activeTrack(),a=n.activeGroup(),s=(a.filter(function(e){return e.default})[0]||a[0]).id,o=n.tracks[s];if(r!==o){for(var u in rf.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[u].enabled=n.tracks[u]===o;n.onTrackChanged()}else i({error:{message:"Problem encountered loading the default audio track."}})}},SUBTITLES:function(e,t){return function(){var n=t.mediaTypes[e];rf.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");var i=n.activeTrack();i&&(i.mode="disabled"),n.onTrackChanged()}}},yv={AUDIO:function(e,t,n){if(t){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",vv[e](e,n))}},SUBTITLES:function(e,t,n){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e],s=n.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",vv[e](e,n))}},_v={AUDIO:function(e,t){var n=t.vhs,i=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.main.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,d=t.mainPlaylistLoader,h=Vf(d.main);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=d.main.playlists)),s[e])for(var f in u[p]||(u[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(c("AUDIO group '".concat(p,"' label '").concat(f,"' is a main playlist")),m.isMainPlaylist=!0,g=null):g="vhs-json"===i&&m.playlists?new sm(m.playlists[0],n,a):m.resolvedUri?new sm(m.resolvedUri,n,a):m.playlists&&"dash"===i?new Im(m.playlists[0],n,a,d):null,m=mf({id:f,playlistLoader:g},m),yv[e](e,m.playlistLoader,t),u[p].push(m),void 0===l[f]){var v=new rf.AudioTrack({id:f,kind:fv(m),enabled:!1,language:m.language,default:m.default,label:f});l[f]=v}}r.on("error",vv[e](e,t))},SUBTITLES:function(e,t){var n=t.tech,i=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.main.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.mainPlaylistLoader;for(var h in o[e])for(var p in l[h]||(l[h]=[]),o[e][h])if(i.options_.useForcedSubtitles||!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new sm(f.resolvedUri,i,s);else if("dash"===r){if(!f.playlists.filter(function(e){return e.excludeUntil!==1/0}).length)return;m=new Im(f.playlists[0],i,s,d)}else"vhs-json"===r&&(m=new sm(f.playlists?f.playlists[0]:f.resolvedUri,i,s));if(f=mf({id:p,playlistLoader:m},f),yv[e](e,f.playlistLoader,t),l[h].push(f),void 0===c[p]){var g=n.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",vv[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var n=t.tech,i=t.main.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in i[e])for(var u in a[o]||(a[o]=[]),i[e][o]){var l=i[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=n.options_.vhs&&n.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[d.instreamId]&&(d=mf(d,c[d.instreamId])),void 0===d.default&&delete d.default,a[o].push(mf({id:u},l)),void 0===s[u]){var h=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;s[u]=h}}}}},bv=function(e,t){for(var n=0;n<e.length;n++){if(Ff(t,e[n]))return!0;if(e[n].playlists&&bv(e[n].playlists,t))return!0}return!1},Tv={AUDIO:function(e,t){return function(){var n=t.mediaTypes[e].tracks;for(var i in n)if(n[i].enabled)return n[i];return null}},SUBTITLES:function(e,t){return function(){var n=t.mediaTypes[e].tracks;for(var i in n)if("showing"===n[i].mode||"hidden"===n[i].mode)return n[i];return null}}},kv=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){_v[t](t,e)});var t=e.mediaTypes,n=e.mainPlaylistLoader,i=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach(function(n){t[n].activeGroup=function(e,t){return function(n){var i=t.mainPlaylistLoader,r=t.mediaTypes[e].groups,a=i.media();if(!a)return null;var s=null;a.attributes[e]&&(s=r[a.attributes[e]]);var o=Object.keys(r);if(!s)if("AUDIO"===e&&o.length>1&&Vf(t.main))for(var u=0;u<o.length;u++){var l=r[o[u]];if(bv(l,a)){s=l;break}}else r.main?s=r.main:1===o.length&&(s=r[o[0]]);return void 0===n?s:null!==n&&s&&s.filter(function(e){return e.id===n.id})[0]||null}}(n,e),t[n].activeTrack=Tv[n](n,e),t[n].onGroupChanged=function(e,t){return function(){var n=t.segmentLoaders,i=n[e],r=n.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),u=a.activePlaylistLoader,l=a.lastGroup_;o&&l&&o.id===l.id||(a.lastGroup_=o,a.lastTrack_=s,mv(i,a),o&&!o.isMainPlaylist&&(o.playlistLoader?(i.resyncLoader(),gv(o.playlistLoader,a)):u&&r.resetEverything()))}}(n,e),t[n].onGroupChanging=function(e,t){return function(){var n=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,n.abort(),n.pause()}}(n,e),t[n].onTrackChanged=function(e,t){return function(){var n=t.mainPlaylistLoader,i=t.segmentLoaders,r=i[e],a=i.main,s=t.mediaTypes[e],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_;if((!c||!o||c.id!==o.id)&&(s.lastGroup_=u,s.lastTrack_=o,mv(r,s),u)){if(u.isMainPlaylist){if(!o||!c||o.id===c.id)return;var d=t.vhs.playlistController_,h=d.selectPlaylist();if(d.media()===h)return;return s.logger_("track change. Switching main audio from ".concat(c.id," to ").concat(o.id)),n.pause(),a.resetEverything(),void d.fastQualityChange_(h)}if("AUDIO"===e){if(!u.playlistLoader)return a.setAudio(!0),void a.resetEverything();r.setAudio(!0),a.setAudio(!1)}l!==u.playlistLoader?(r.track&&r.track(o),r.resetEverything(),gv(u.playlistLoader,s)):gv(u.playlistLoader,s)}}}(n,e),t[n].getActiveGroup=function(e,t){var n=t.mediaTypes;return function(){var t=n[e].activeTrack();return t?n[e].activeGroup(t):null}}(n,e)});var u=t.AUDIO.activeGroup();if(u){var l=(u.filter(function(e){return e.default})[0]||u[0]).id;t.AUDIO.tracks[l].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(o.setAudio(!1),s.setAudio(!0)):o.setAudio(!0)}n.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})}),n.on("mediachanging",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanging()})});var c=function(){t.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};for(var d in i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",function(){i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),t.AUDIO.tracks)i.audioTracks().addTrack(t.AUDIO.tracks[d])},Sv=function(){return y(function e(){g(this,e),this.priority_=[],this.pathwayClones_=new Map},[{key:"version",get:function(){return this.version_},set:function(e){1===e&&(this.version_=e)}},{key:"ttl",get:function(){return this.ttl_},set:function(e){this.ttl_=e||300}},{key:"reloadUri",get:function(){return this.reloadUri_},set:function(e){e&&(this.reloadUri_=hf(this.reloadUri_,e))}},{key:"priority",get:function(){return this.priority_},set:function(e){e&&e.length&&(this.priority_=e)}},{key:"pathwayClones",get:function(){return this.pathwayClones_},set:function(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(function(e){return[e.ID,e]})))}}])}(),wv=function(){function e(t,n){var i;return g(this,e),(i=c(this,e)).currentPathway=null,i.defaultPathway=null,i.queryBeforeStart=!1,i.availablePathways_=new Set,i.steeringManifest=new Sv,i.proxyServerUrl_=null,i.manifestType_=null,i.ttlTimeout_=null,i.request_=null,i.currentPathwayClones=new Map,i.nextPathwayClones=new Map,i.excludedSteeringManifestURLs=new Set,i.logger_=ff("Content Steering"),i.xhr_=t,i.getBandwidth_=n,i}return f(e,rf.EventTarget),y(e,[{key:"assignTagProperties",value:function(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var n=t.serverUri||t.serverURL;if(!n)return this.logger_("steering manifest URL is ".concat(n,", cannot request steering manifest.")),void this.trigger("error");n.startsWith("data:")?this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1)):(this.steeringManifest.reloadUri=hf(e,n),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"))}},{key:"requestSteeringManifest",value:function(e){var t=this,n=this.steeringManifest.reloadUri;if(n){var i=e?n:this.getRequestURI(n);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();var r={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},function(e,n){if(e){if(410===n.status)return t.logger_("manifest request 410 ".concat(e,".")),t.logger_("There will be no more content steering requests to ".concat(i," this session.")),void t.excludedSteeringManifestURLs.add(i);if(429===n.status){var a=n.responseHeaders["retry-after"];return t.logger_("manifest request 429 ".concat(e,".")),t.logger_("content steering will retry in ".concat(a," seconds.")),void t.startTTLTimeout_(parseInt(a,10))}return t.logger_("manifest failed to load ".concat(e,".")),void t.startTTLTimeout_()}var s;t.trigger({type:"contentsteeringloadcomplete",metadata:r});try{s=JSON.parse(t.request_.responseText)}catch(l){var o={errorType:rf.Error.StreamingContentSteeringParserError,error:l};t.trigger({type:"error",metadata:o})}t.assignSteeringProperties_(s);var u={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:t.steeringManifest.version,reloadUri:t.steeringManifest.reloadUri,priority:t.steeringManifest.priority}};t.trigger({type:"contentsteeringparsed",metadata:u}),t.startTTLTimeout_()})}}},{key:"setProxyServerUrl_",value:function(e){var t=new wn.URL(e),n=new wn.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}},{key:"decodeDataUriManifest_",value:function(e){var t=JSON.parse(wn.atob(e));this.assignSteeringProperties_(t)}},{key:"setSteeringParams_",value:function(e){var t=new wn.URL(e),n=this.getPathway(),i=this.getBandwidth_();if(n){var r="_".concat(this.manifestType_,"_pathway");t.searchParams.set(r,n)}if(i){var a="_".concat(this.manifestType_,"_throughput");t.searchParams.set(a,i)}return t.toString()}},{key:"assignSteeringProperties_",value:function(e){var t=this;if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_("manifest version is ".concat(e.VERSION,", which is not supported.")),void this.trigger("error");this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());var n=function(e){var n,i=_(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(t.availablePathways_.has(r))return r}}catch(a){i.e(a)}finally{i.f()}return b(t.availablePathways_)[0]}(this.steeringManifest.priority);this.currentPathway!==n&&(this.currentPathway=n,this.trigger("content-steering"))}},{key:"getPathway",value:function(){return this.currentPathway||this.defaultPathway}},{key:"getRequestURI",value:function(e){var t=this;if(!e)return null;var n=function(e){return t.excludedSteeringManifestURLs.has(e)};if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!n(i))return i}var r=this.setSteeringParams_(e);return n(r)?null:r}},{key:"startTTLTimeout_",value:function(){var e=this,t=1e3*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.steeringManifest.ttl);this.ttlTimeout_=wn.setTimeout(function(){e.requestSteeringManifest()},t)}},{key:"clearTTLTimeout_",value:function(){wn.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}},{key:"abort",value:function(){this.request_&&this.request_.abort(),this.request_=null}},{key:"dispose",value:function(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Sv}},{key:"addAvailablePathway",value:function(e){e&&this.availablePathways_.add(e)}},{key:"clearAvailablePathways",value:function(){this.availablePathways_.clear()}},{key:"excludePathway",value:function(e){return this.availablePathways_.delete(e)}},{key:"didDASHTagChange",value:function(e,t){return!t&&this.steeringManifest.reloadUri||t&&(hf(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}},{key:"getAvailablePathways",value:function(){return this.availablePathways_}}])}(),Ev=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Cv=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Av=function(){function e(t){var n,i,r,a;g(this,e),(n=c(this,e)).fastQualityChange_=(i=n.fastQualityChange_.bind(n),r=100,a=null,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];clearTimeout(a),a=setTimeout(function(){i.apply(null,t)},r)});var s=t.src,o=t.withCredentials,u=t.tech,l=t.bandwidth,d=t.externVhs,h=t.useCueTags,p=t.playlistExclusionDuration,f=t.enableLowInitialPlaylist,m=t.sourceType,v=t.cacheEncryptionKeys,y=t.bufferBasedABR,_=t.leastPixelDiffSelector,b=t.captionServices,T=t.experimentalUseMMS;if(!s)throw new Error("A non-empty playlist URL or JSON manifest string is required");var k,S=t.maxPlaylistRetries;null==S&&(S=1/0),Og=d,n.bufferBasedABR=Boolean(y),n.leastPixelDiffSelector=Boolean(_),n.withCredentials=o,n.tech_=u,n.vhs_=u.vhs,n.player_=t.player_,n.sourceType_=m,n.useCueTags_=h,n.playlistExclusionDuration=p,n.maxPlaylistRetries=S,n.enableLowInitialPlaylist=f,n.usingManagedMediaSource_=!1,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:o,maxPlaylistRetries:S,timeout:null},n.on("error",n.pauseLoading),n.mediaTypes_=(k={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){k[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Rg,activeTrack:Rg,getActiveGroup:Rg,onGroupChanged:Rg,onTrackChanged:Rg,lastTrack_:null,logger_:ff("MediaGroups[".concat(e,"]"))}}),k),T&&wn.ManagedMediaSource?(n.tech_.el_.disableRemotePlayback=!0,n.mediaSource=new wn.ManagedMediaSource,n.usingManagedMediaSource_=!0,rf.log("Using ManagedMediaSource")):wn.MediaSource&&(n.mediaSource=new wn.MediaSource),n.handleDurationChange_=n.handleDurationChange_.bind(n),n.handleSourceOpen_=n.handleSourceOpen_.bind(n),n.handleSourceEnded_=n.handleSourceEnded_.bind(n),n.load=n.load.bind(n),n.pause=n.pause.bind(n),n.mediaSource.addEventListener("durationchange",n.handleDurationChange_),n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_),n.mediaSource.addEventListener("sourceended",n.handleSourceEnded_),n.mediaSource.addEventListener("startstreaming",n.load),n.mediaSource.addEventListener("endstreaming",n.pause),n.seekable_=gf(),n.hasPlayed_=!1,n.syncController_=new cv(t),n.segmentMetadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new pv,n.sourceUpdater_=new Zg(n.mediaSource),n.inbandTextTracks_={},n.timelineChangeController_=new dv,n.keyStatusMap_=new Map;var w={vhs:n.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:b,mediaSource:n.mediaSource,currentTime:n.tech_.currentTime.bind(n.tech_),seekable:function(){return n.seekable()},seeking:function(){return n.tech_.seeking()},duration:function(){return n.duration()},hasPlayed:function(){return n.hasPlayed_},goalBufferLength:function(){return n.goalBufferLength()},bandwidth:l,syncController:n.syncController_,decrypter:n.decrypter_,sourceType:n.sourceType_,inbandTextTracks:n.inbandTextTracks_,cacheEncryptionKeys:v,sourceUpdater:n.sourceUpdater_,timelineChangeController:n.timelineChangeController_,exactManifestTimings:t.exactManifestTimings,addMetadataToTextTrack:n.addMetadataToTextTrack.bind(n)};n.mainPlaylistLoader_="dash"===n.sourceType_?new Im(s,n.vhs_,mf(n.requestOptions_,{addMetadataToTextTrack:n.addMetadataToTextTrack.bind(n)})):new sm(s,n.vhs_,mf(n.requestOptions_,{addDateRangesToTextTrack:n.addDateRangesToTextTrack_.bind(n)})),n.setupMainPlaylistLoaderListeners_(),n.mainSegmentLoader_=new Pg(mf(w,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),t),n.audioSegmentLoader_=new Pg(mf(w,{loaderType:"audio"}),t),n.subtitleSegmentLoader_=new iv(mf(w,{loaderType:"vtt",featuresNativeTextTracks:n.tech_.featuresNativeTextTracks,loadVttJs:function(){return new Promise(function(e,t){function n(){u.off("vttjserror",i),e()}function i(){u.off("vttjsloaded",n),t()}u.one("vttjsloaded",n),u.one("vttjserror",i),u.addWebVttScript_()})}}),t);n.contentSteeringController_=new wv(n.vhs_.xhr,function(){return n.mainSegmentLoader_.bandwidth}),n.setupSegmentLoaderListeners_(),n.bufferBasedABR&&(n.mainPlaylistLoader_.one("loadedplaylist",function(){return n.startABRTimer_()}),n.tech_.on("pause",function(){return n.stopABRTimer_()}),n.tech_.on("play",function(){return n.startABRTimer_()})),Ev.forEach(function(e){n[e+"_"]=Cv.bind(n,e)}),n.logger_=ff("pc"),n.triggeredFmp4Usage=!1,"none"===n.tech_.preload()?(n.loadOnPlay_=function(){n.loadOnPlay_=null,n.mainPlaylistLoader_.load()},n.tech_.one("play",n.loadOnPlay_)):n.mainPlaylistLoader_.load(),n.timeToLoadedData__=-1,n.mainAppendsToLoadedData__=-1,n.audioAppendsToLoadedData__=-1;var E="none"===n.tech_.preload()?"play":"loadstart";return n.tech_.one(E,function(){var e=Date.now();n.tech_.one("loadeddata",function(){n.timeToLoadedData__=Date.now()-e,n.mainAppendsToLoadedData__=n.mainSegmentLoader_.mediaAppends,n.audioAppendsToLoadedData__=n.audioSegmentLoader_.mediaAppends})}),n}return f(e,rf.EventTarget),y(e,[{key:"mainAppendsToLoadedData_",value:function(){return this.mainAppendsToLoadedData__}},{key:"audioAppendsToLoadedData_",value:function(){return this.audioAppendsToLoadedData__}},{key:"appendsToLoadedData_",value:function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}},{key:"timeToLoadedData_",value:function(){return this.timeToLoadedData__}},{key:"checkABR_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"abr",t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}},{key:"switchMedia_",value:function(e,t,n){var i=this.media(),r=i&&(i.id||i.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_("switch media ".concat(r," -> ").concat(a," from ").concat(t));var s={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-".concat(t)})}this.mainPlaylistLoader_.media(e,n)}},{key:"switchMediaForDASHContentSteering_",value:function(){var e=this;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){var n=e.mediaTypes_[t],i=n?n.activeGroup():null,r=e.contentSteeringController_.getPathway();if(i&&r){var a=(i.length?i[0].playlists:i.playlists).filter(function(e){return e.attributes.serviceLocation===r});a.length&&e.mediaTypes_[t].activePlaylistLoader.media(a[0])}})}},{key:"startABRTimer_",value:function(){var e=this;this.stopABRTimer_(),this.abrTimer_=wn.setInterval(function(){return e.checkABR_()},250)}},{key:"stopABRTimer_",value:function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(wn.clearInterval(this.abrTimer_),this.abrTimer_=null)}},{key:"getAudioTrackPlaylists_",value:function(){var e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var n,i=e.mediaGroups.AUDIO,r=Object.keys(i);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{var a=i.main||r.length&&i[r[0]];for(var s in a)if(a[s].default){n={label:s};break}}if(!n)return t;var o=[];for(var u in i)if(i[u][n.label]){var l=i[u][n.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var d=e.playlists[c];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===u&&o.push(d)}}return o.length?o:t}},{key:"setupMainPlaylistLoaderListeners_",value:function(){var e=this;this.mainPlaylistLoader_.on("loadedmetadata",function(){var t=e.mainPlaylistLoader_.media(),n=1.5*t.targetDuration*1e3;jf(e.mainPlaylistLoader_.main,e.mainPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),kv({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,mainPlaylistLoader:e.mainPlaylistLoader_,vhs:e.vhs_,main:e.main(),mediaTypes:e.mediaTypes_,excludePlaylist:e.excludePlaylist.bind(e)}),e.triggerPresenceUsage_(e.main(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){e.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t=e.mainPlaylistLoader_.media();if(!t){var n;if(e.attachContentSteeringListeners_(),e.initContentSteeringController_(),e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(n=e.selectInitialPlaylist()),n||(n=e.selectPlaylist()),!n||!e.shouldSwitchToMedia_(n))return;if(e.initialMedia_=n,e.switchMedia_(e.initialMedia_,"initial"),!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",function(){var t=e.mainPlaylistLoader_.error;e.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",function(){var t=e.mainPlaylistLoader_.media(),n=1.5*t.targetDuration*1e3;jf(e.mainPlaylistLoader_.main,e.mainPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,"dash"===e.sourceType_&&e.mainPlaylistLoader_.isPaused&&e.mainPlaylistLoader_.load(),e.mainSegmentLoader_.pause(),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.waitingForFastQualityPlaylistReceived_?e.runFastQualitySwitch_():e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",function(){var t=e.mainPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&(e.stuckAtPlaylistEnd_(t)&&(e.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),e.tech_.trigger("playliststuck")))}),this.mainPlaylistLoader_.on("renditiondisabled",function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})});["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(function(t){e.mainPlaylistLoader_.on(t,function(t){e.player_.trigger($({},t))})})}},{key:"handleUpdatedMediaPlaylist",value:function(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}},{key:"triggerPresenceUsage_",value:function(e,t){var n=e.mediaGroups||{},i=!0,r=Object.keys(n.AUDIO);for(var a in n.AUDIO)for(var s in n.AUDIO[a]){n.AUDIO[a][s].uri||(i=!1)}i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Og.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(n.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}},{key:"shouldSwitchToMedia_",value:function(e){var t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),i=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,n=e.buffered,i=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.bufferBasedABR,l=e.log;if(!r)return rf.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch ".concat(t&&t.id||"null"," -> ").concat(r.id);if(!t)return l("".concat(c," as current playlist is not set")),!0;if(r.id===t.id)return!1;var d=Boolean(bf(n,i).length);if(!t.endList)return d||"number"!=typeof t.partTargetDuration?(l("".concat(c," as current playlist is live")),!0):(l("not ".concat(c," as current playlist is live llhls, but currentTime isn't in buffered.")),!1);var h=Ef(n,i),p=u?xm.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:xm.MAX_BUFFER_LOW_WATER_LINE;if(o<p)return l("".concat(c," as duration < max low water line (").concat(o," < ").concat(p,")")),!0;var f=r.attributes.BANDWIDTH,m=t.attributes.BANDWIDTH;if(f<m&&(!u||h<s)){var g="".concat(c," as next bandwidth < current bandwidth (").concat(f," < ").concat(m,")");return u&&(g+=" and forwardBuffer < bufferHighWaterLine (".concat(h," < ").concat(s,")")),l(g),!0}if((!u||f>m)&&h>=a){var v="".concat(c," as forwardBuffer >= bufferLowWaterLine (").concat(h," >= ").concat(a,")");return u&&(v+=" and next bandwidth > current bandwidth (".concat(f," > ").concat(m,")")),l(v),!0}return l("not ".concat(c," as no switching criteria met")),!1}({buffered:this.tech_.buffered(),currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){e.checkABR_("bandwidthupdate"),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",function(){e.bufferBasedABR&&e.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){var t=e.mainSegmentLoader_.error();e.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("ended",function(){e.logger_("main segment loader ended"),e.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",function(){var t=e.audioSegmentLoader_.pendingSegment_;if(t&&t.segment&&t.segment.syncInfo){var n=t.segment.syncInfo.end+.01;e.tech_.setCurrentTime(n)}}),this.timelineChangeController_.on("fixBadTimelineChange",function(){e.logger_("Fix bad timeline change. Restarting al segment loaders..."),e.mainSegmentLoader_.pause(),e.mainSegmentLoader_.resetEverything(),e.mediaTypes_.AUDIO.activePlaylistLoader&&(e.audioSegmentLoader_.pause(),e.audioSegmentLoader_.resetEverything()),e.mediaTypes_.SUBTITLES.activePlaylistLoader&&(e.subtitleSegmentLoader_.pause(),e.subtitleSegmentLoader_.resetEverything()),e.load()}),this.mainSegmentLoader_.on("earlyabort",function(t){e.bufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()});["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(function(t){e.mainSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))}),e.audioSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))}),e.subtitleSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))})})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"pause",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"fastQualityChange_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectPlaylist();e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}},{key:"runFastQualitySwitch_",value:function(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){var t=this.seekable();if(!t.length)return!1;var n=t.end(0),i=n;if(e.start){var r=e.start.timeOffset;i=r<0?Math.max(n+r,t.start(0)):Math.min(n,r)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}},{key:"handleSourceOpen_",value:function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,function(e){})}this.trigger("sourceopen")}},{key:"handleSourceEnded_",value:function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}}},{key:"handleDurationChange_",value:function(){this.tech_.trigger("durationchange")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var n=Og.Playlist.playlistEnd(e,t),i=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return n-i<=yf;var a=r.end(r.length-1);return a-i<=yf&&n-a<=yf}},{key:"excludePlaylist",value:function(e){var t=this,n=e.playlistToExclude,i=void 0===n?this.mainPlaylistLoader_.media():n,r=e.error,a=void 0===r?{}:r,s=e.playlistExclusionDuration;if(i=i||this.mainPlaylistLoader_.media(),s=s||a.playlistExclusionDuration||this.playlistExclusionDuration,!i)return this.error=a,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var o,u=this.mainPlaylistLoader_.main.playlists,l=u.filter(Mf),c=1===l.length&&l[0]===i;if(1===u.length&&s!==1/0)return rf.log.warn("Problem encountered with playlist ".concat(i.id,". ")+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(c);if(c){if(this.main().contentSteering){var d=this.pathwayAttribute_(i),h=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(d),this.excludeThenChangePathway_(),void setTimeout(function(){t.contentSteeringController_.addAvailablePathway(d)},h)}var p=!1;u.forEach(function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(p=!0,delete e.excludeUntil)}}),p&&(rf.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}o=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*s,i.excludeUntil=o,a.reason&&(i.lastExcludeReason_=a.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});var f=this.selectPlaylist();if(!f)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var m=a.internal?this.logger_:rf.log.warn,g=a.message?" "+a.message:"";m("".concat(a.internal?"Internal problem":"Problem"," encountered with playlist ").concat(i.id,".")+"".concat(g," Switching to playlist ").concat(f.id,".")),f.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),f.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var v=f.targetDuration/2*1e3||5e3,y="number"==typeof f.lastRequest&&Date.now()-f.lastRequest<=v;return this.switchMedia_(f,"exclude",c||y)}},{key:"pauseLoading",value:function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}},{key:"delegateLoaders_",value:function(e,t){var n=this,i=[],r="all"===e;(r||"main"===e)&&i.push(this.mainPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(function(e){var t=n.mediaTypes_[e]&&n.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(function(t){var r=n["".concat(t,"SegmentLoader_")];!r||e!==t&&"all"!==e||i.push(r)}),i.forEach(function(e){return t.forEach(function(t){"function"==typeof e[t]&&e[t]()})})}},{key:"setCurrentTime",value:function(e){var t=bf(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}},{key:"duration",value:function(){if(!this.mainPlaylistLoader_)return 0;var e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Og.Playlist.duration(e):1/0:0}},{key:"seekable",value:function(){return this.seekable_}},{key:"getSeekableRange_",value:function(e,t){var n=e.media();if(!n)return null;var i=this.syncController_.getMediaSequenceSync(t);if(i&&i.isReliable){var r=i.start,a=i.end;if(!isFinite(r)||!isFinite(a))return null;var s=Og.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n),o=Math.max(0,a-s);return o<r?null:gf([[r,o]])}var u=this.syncController_.getExpiredTime(n,this.duration());if(null===u)return null;var l=Og.Playlist.seekable(n,u,Og.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n));return l.length?l:null}},{key:"computeFinalSeekable_",value:function(e,t){if(!t)return e;var n=e.start(0),i=e.end(0),r=t.start(0),a=t.end(0);return r>i||n>a?e:gf([[Math.max(n,r),Math.min(i,a)]])}},{key:"onSyncInfoUpdate_",value:function(){if(this.mainPlaylistLoader_){var e,t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(t)if(!this.mediaTypes_.AUDIO.activePlaylistLoader||(e=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"))){var n=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,e),this.seekable_&&!(n&&n.length&&this.seekable_.length&&n.start(0)===this.seekable_.start(0)&&n.end(0)===this.seekable_.end(0))){this.logger_("seekable updated [".concat(kf(this.seekable_),"]"));var i={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:i}),this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var n=this.tech_.buffered(),i=Og.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(i=Math.max(i,n.end(n.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}}},{key:"dispose",value:function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(function(t){var n=e.mediaTypes_[t].groups;for(var i in n)n[i].forEach(function(e){e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}},{key:"main",value:function(){return this.mainPlaylistLoader_.main}},{key:"media",value:function(){return this.mainPlaylistLoader_.media()||this.initialMedia_}},{key:"areMediaTypesKnown_",value:function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!n)}},{key:"getCodecsOrExclude_",value:function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;var i=lg(this.main(),n),r={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(r.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(r.video+=",".concat(i.audio||t.main.audioCodec||Tr)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||a)&&(r.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||Tr,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),r.audio||r.video){var s,o={};if(["video","audio"].forEach(function(n){if(r.hasOwnProperty(n)&&(a=t[n].isFmp4,u=r[n],!(a?_r(u,e.usingManagedMediaSource_):br(u)))){var i=t[n].isFmp4?"browser":"muxer";o[i]=o[i]||[],o[i].push(r[n]),"audio"===n&&(s=i)}var a,u}),a&&s&&n.attributes.AUDIO){var u=n.attributes.AUDIO;this.main().playlists.forEach(function(e){(e.attributes&&e.attributes.AUDIO)===u&&e!==n&&(e.excludeUntil=1/0)}),this.logger_("excluding audio group ".concat(u," as ").concat(s,' does not support codec(s): "').concat(r.audio,'"'))}if(!Object.keys(o).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach(function(t){var n=(gr(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,i=(gr(r[t]||"")[0]||{}).type;n&&i&&n.toLowerCase()!==i.toLowerCase()&&l.push('"'.concat(e.sourceUpdater_.codecs[t],'" -> "').concat(r[t],'"'))}),l.length)return void this.excludePlaylist({playlistToExclude:n,error:{message:"Codec switching not supported: ".concat(l.join(", "),"."),internal:!0},playlistExclusionDuration:1/0})}return r}var c=Object.keys(o).reduce(function(e,t){return e&&(e+=", "),e+="".concat(t,' does not support codec(s): "').concat(o[t].join(","),'"')},"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:c},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}},{key:"tryToCreateSourceBuffers_",value:function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}}},{key:"excludeUnsupportedVariants_",value:function(){var e=this,t=this.main().playlists,n=[];Object.keys(t).forEach(function(i){var r=t[i];if(-1===n.indexOf(r.id)){n.push(r.id);var a=lg(e.main,r),s=[];!a.audio||br(a.audio)||_r(a.audio,e.usingManagedMediaSource_)||s.push("audio codec ".concat(a.audio)),!a.video||br(a.video)||_r(a.video,e.usingManagedMediaSource_)||s.push("video codec ".concat(a.video)),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec ".concat(a.text)),s.length&&(r.excludeUntil=1/0,e.logger_("excluding ".concat(r.id," for unsupported: ").concat(s.join(", "))))}})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=this,n=[],i=this.main().playlists,r=og(gr(e)),a=ug(r),s=r.video&&gr(r.video)[0]||null,o=r.audio&&gr(r.audio)[0]||null;Object.keys(i).forEach(function(e){var r=i[e];if(-1===n.indexOf(r.id)&&r.excludeUntil!==1/0){n.push(r.id);var u=[],l=lg(t.mainPlaylistLoader_.main,r),c=ug(l);if(l.audio||l.video){if(c!==a&&u.push('codec count "'.concat(c,'" !== "').concat(a,'"')),!t.sourceUpdater_.canChangeType()){var d=l.video&&gr(l.video)[0]||null,h=l.audio&&gr(l.audio)[0]||null;d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'.concat(d.type,'" !== "').concat(s.type,'"')),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'.concat(h.type,'" !== "').concat(o.type,'"'))}u.length&&(r.excludeUntil=1/0,t.logger_("excluding ".concat(r.id,": ").concat(u.join(" && "))))}}})}},{key:"updateAdCues_",value:function(e){var t=0,n=this.seekable();n.length&&(t=n.start(0)),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.segments)for(var i,r=n,a=0;a<e.segments.length;a++){var s=e.segments[a];if(i||(i=rv(t,r+s.duration/2)),i){if("cueIn"in s){i.endTime=r,i.adEndTime=r,r+=s.duration,i=null;continue}if(r<i.endTime){r+=s.duration;continue}i.endTime+=s.duration}else if("cueOut"in s&&((i=new wn.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r,i.adEndTime=r+parseFloat(s.cueOut),t.addCue(i)),"cueOutCont"in s){var o=S(s.cueOutCont.split("/").map(parseFloat),2),u=o[0],l=o[1];(i=new wn.VTTCue(r,r+s.duration,"")).adStartTime=r-u,i.adEndTime=i.adStartTime+l,t.addCue(i)}r+=s.duration}}(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=xm.GOAL_BUFFER_LENGTH,n=xm.GOAL_BUFFER_LENGTH_RATE,i=Math.max(t,xm.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,i)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=xm.BUFFER_LOW_WATER_LINE,n=xm.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(t,xm.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,xm.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?r:i)}},{key:"bufferHighWaterLine",value:function(){return xm.BUFFER_HIGH_WATER_LINE}},{key:"addDateRangesToTextTrack_",value:function(e){Tg(this.inbandTextTracks_,"com.apple.streaming",this.tech_),function(e){var t=e.inbandTextTracks,n=e.dateRanges,i=t.metadataTrack_;if(i){var r=wn.WebKitDataCue||wn.VTTCue;n.forEach(function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var a=n[t];if(!bg.has(a)){var s=new r(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:_g[a],data:e[a]},"scte35Out"!==a&&"scte35In"!==a||(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}}e.processDateRange()})}}({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}},{key:"addMetadataToTextTrack",value:function(e,t,n){var i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Tg(this.inbandTextTracks_,e,this.tech_),yg({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:i,videoDuration:n})}},{key:"pathwayAttribute_",value:function(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}},{key:"initContentSteeringController_",value:function(){var e=this,t=this.main();if(t.contentSteering){var n,i=_(t.playlists);try{for(i.s();!(n=i.n()).done;){var r=n.value;this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(r))}}catch(a){i.e(a)}finally{i.f()}this.contentSteeringController_.assignTagProperties(t.uri,t.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):this.tech_.one("canplay",function(){e.contentSteeringController_.requestSteeringManifest()})}}},{key:"resetContentSteeringController_",value:function(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}},{key:"attachContentSteeringListeners_",value:function(){var e=this;this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this));["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(function(t){e.contentSteeringController_.on(t,function(t){e.trigger($({},t))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",function(){var t=e.main();(e.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||function(){var n,i=e.contentSteeringController_.getAvailablePathways(),r=[],a=_(t.playlists);try{for(a.s();!(n=a.n()).done;){var s=n.value.attributes.serviceLocation;if(s&&(r.push(s),!i.has(s)))return!0}}catch(o){a.e(o)}finally{a.f()}return!(r.length||!i.size)}())&&e.resetContentSteeringController_()})}},{key:"excludeThenChangePathway_",value:function(){var e=this,t=this.contentSteeringController_.getPathway();if(t){this.handlePathwayClones_();var n=this.main().playlists,i=new Set,r=!1;Object.keys(n).forEach(function(a){var s=n[a],o=e.pathwayAttribute_(s),u=o&&t!==o;s.excludeUntil===1/0&&"content-steering"===s.lastExcludeReason_&&!u&&(delete s.excludeUntil,delete s.lastExcludeReason_,r=!0);var l=!s.excludeUntil&&s.excludeUntil!==1/0;!i.has(s.id)&&u&&l&&(i.add(s.id),s.excludeUntil=1/0,s.lastExcludeReason_="content-steering",e.logger_("excluding ".concat(s.id," for ").concat(s.lastExcludeReason_)))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(function(n){var i=e.mediaTypes_[n];if(i.activePlaylistLoader){var a=i.activePlaylistLoader.media_;a&&a.attributes.serviceLocation!==t&&(r=!0)}}),r&&this.changeSegmentPathway_()}}},{key:"handlePathwayClones_",value:function(){var e=this,t=this.main().playlists,n=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(n&&n.size||i&&i.size){var r,a=_(n.entries());try{for(a.s();!(r=a.n()).done;){var s=S(r.value,2),o=s[0],u=s[1];i.get(o)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(o))}}catch(h){a.e(h)}finally{a.f()}var l,c=_(i.entries());try{var d=function(){var i=S(l.value,2),r=i[0],a=i[1],s=n.get(r);return s?e.equalPathwayClones_(s,a)?0:(e.mainPlaylistLoader_.updateOrDeleteClone(a,!0),void e.contentSteeringController_.addAvailablePathway(r)):(t.filter(function(e){return e.attributes["PATHWAY-ID"]===a["BASE-ID"]}).forEach(function(t){e.mainPlaylistLoader_.addClonePathway(a,t)}),e.contentSteeringController_.addAvailablePathway(r),0)};for(c.s();!(l=c.n()).done;)d()}catch(h){c.e(h)}finally{c.f()}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify(b(i))))}}},{key:"equalPathwayClones_",value:function(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;var n=e["URI-REPLACEMENT"].PARAMS,i=t["URI-REPLACEMENT"].PARAMS;for(var r in n)if(n[r]!==i[r])return!1;for(var a in i)if(n[a]!==i[a])return!1;return!0}},{key:"changeSegmentPathway_",value:function(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}},{key:"excludeNonUsablePlaylistsByKeyId_",value:function(){var e=this;if(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.main){var t=0,n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(function(i){var r=e.mainPlaylistLoader_.getKeyIdSet(i);r&&r.size&&r.forEach(function(r){var a="usable",s=e.keyStatusMap_.has(r)&&e.keyStatusMap_.get(r)===a,o=i.lastExcludeReason_===n&&i.excludeUntil===1/0;s?s&&o&&(delete i.excludeUntil,delete i.lastExcludeReason_,e.logger_("enabling playlist ".concat(i.id," because key ID ").concat(r," is ").concat(a))):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==n&&(i.excludeUntil=1/0,i.lastExcludeReason_=n,e.logger_("excluding playlist ".concat(i.id," because the key ID ").concat(r," doesn't exist in the keyStatusMap or is not ").concat(a))),t++)})}),t>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(function(e){var t=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,i=e.excludeUntil===1/0&&e.lastExcludeReason_===n;t&&i&&(delete e.excludeUntil,rf.log.warn("enabling non-HD playlist ".concat(e.id," because all playlists were excluded due to ").concat(n," key IDs")))})}}},{key:"addKeyStatus_",value:function(e,t){var n,i=("string"==typeof e?e:(n=new Uint8Array(e),Array.from(n).map(function(e){return e.toString(16).padStart(2,"0")}).join(""))).slice(0,32).toLowerCase();this.logger_("KeyStatus '".concat(t,"' with key ID ").concat(i," added to the keyStatusMap")),this.keyStatusMap_.set(i,t)}},{key:"updatePlaylistByKeyStatus",value:function(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}},{key:"excludeNonUsableThenChangePlaylist_",value:function(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}])}(),Iv=y(function e(t,n,i){g(this,e);var r,a,s,o=t.playlistController_,u=o.fastQualityChange_.bind(o);if(n.attributes){var l=n.attributes.RESOLUTION;this.width=l&&l.width,this.height=l&&l.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=lg(o.main(),n),this.playlist=n,this.id=i,this.enabled=(r=t.playlists,a=n.id,s=u,function(e){var t=r.main.playlists[a],n=Uf(t),i=Mf(t);if(void 0===e)return i;e?delete t.disabled:t.disabled=!0;var o={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===i||n||(e?(s(t),r.trigger({type:"renditionenabled",metadata:o})):r.trigger({type:"renditiondisabled",metadata:o})),e})}),xv=["seeking","seeked","pause","playing","error"],Lv=function(){function e(t){var n;g(this,e),(n=c(this,e)).playlistController_=t.playlistController,n.tech_=t.tech,n.seekable=t.seekable,n.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,n.liveRangeSafeTimeDelta=t.liveRangeSafeTimeDelta,n.media=t.media,n.playedRanges_=[],n.consecutiveUpdates=0,n.lastRecordedTime=null,n.checkCurrentTimeTimeout_=null,n.logger_=ff("PlaybackWatcher"),n.logger_("initialize");var i=function(){return n.monitorCurrentTime_()},r=function(){return n.monitorCurrentTime_()},a=function(){return n.techWaiting_()},s=function(){return n.resetTimeUpdate_()},o=n.playlistController_,u=["main","subtitle","audio"],l={};u.forEach(function(e){l[e]={reset:function(){return n.resetSegmentDownloads_(e)},updateend:function(){return n.checkSegmentDownloads_(e)}},o["".concat(e,"SegmentLoader_")].on("appendsdone",l[e].updateend),o["".concat(e,"SegmentLoader_")].on("playlistupdate",l[e].reset),n.tech_.on(["seeked","seeking"],l[e].reset)});var d=function(e){["main","audio"].forEach(function(t){o["".concat(t,"SegmentLoader_")][e]("appended",n.seekingAppendCheck_)})};return n.seekingAppendCheck_=function(){n.fixesBadSeeks_()&&(n.consecutiveUpdates=0,n.lastRecordedTime=n.tech_.currentTime(),d("off"))},n.clearSeekingAppendCheck_=function(){return d("off")},n.watchForBadSeeking_=function(){n.clearSeekingAppendCheck_(),d("on")},n.tech_.on("seeked",n.clearSeekingAppendCheck_),n.tech_.on("seeking",n.watchForBadSeeking_),n.tech_.on("waiting",a),n.tech_.on(xv,s),n.tech_.on("canplay",r),n.tech_.one("play",i),n.dispose=function(){n.clearSeekingAppendCheck_(),n.logger_("dispose"),n.tech_.off("waiting",a),n.tech_.off(xv,s),n.tech_.off("canplay",r),n.tech_.off("play",i),n.tech_.off("seeking",n.watchForBadSeeking_),n.tech_.off("seeked",n.clearSeekingAppendCheck_),u.forEach(function(e){o["".concat(e,"SegmentLoader_")].off("appendsdone",l[e].updateend),o["".concat(e,"SegmentLoader_")].off("playlistupdate",l[e].reset),n.tech_.off(["seeked","seeking"],l[e].reset)}),n.checkCurrentTimeTimeout_&&wn.clearTimeout(n.checkCurrentTimeTimeout_),n.resetTimeUpdate_()},n}return f(e,rf.EventTarget),y(e,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&wn.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=wn.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"resetSegmentDownloads_",value:function(e){var t=this.playlistController_["".concat(e,"SegmentLoader_")];this["".concat(e,"StalledDownloads_")]>0&&this.logger_("resetting possible stalled download count for ".concat(e," loader")),this["".concat(e,"StalledDownloads_")]=0,this["".concat(e,"Buffered_")]=t.buffered_()}},{key:"checkSegmentDownloads_",value:function(e){var t=this.playlistController_,n=t["".concat(e,"SegmentLoader_")],i=n.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var n=0;n<e.length;n++)if(e.start(n)!==t.start(n)||e.end(n)!==t.end(n))return!0;return!1}(this["".concat(e,"Buffered_")],i);if(this["".concat(e,"Buffered_")]=i,r){var a={bufferedRanges:i};return t.trigger({type:"bufferedrangeschanged",metadata:a}),void this.resetSegmentDownloads_(e)}this["".concat(e,"StalledDownloads_")]++,this.logger_("found #".concat(this["".concat(e,"StalledDownloads_")]," ").concat(e," appends that did not increase buffer (possible stalled download)"),{playlistId:n.playlist_&&n.playlist_.id,buffered:Sf(i)}),this["".concat(e,"StalledDownloads_")]<10||(this.logger_("".concat(e," loader stalled download exclusion")),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-".concat(e,"-download-exclusion")}),"subtitle"!==e&&t.excludePlaylist({error:{message:"Excessive ".concat(e," segment downloading detected.")},playlistExclusionDuration:1/0}))}},{key:"checkCurrentTime_",value:function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+yf>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(gf([this.lastRecordedTime,e]));var n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}}},{key:"resetTimeUpdate_",value:function(){this.consecutiveUpdates=0}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),n=this.tech_.currentTime();this.afterSeekableWindow_(t,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,n)){var i=t.start(0);e=i+(i===t.end(0)?0:yf)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time ".concat(n," with ")+"seekable range ".concat(kf(t),". Seeking to ")+"".concat(e,".")),this.tech_.setCurrentTime(e),!0;for(var r=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-vf),c=[s,o],d=0;d<c.length;d++){if(c[d])if(Ef(c[d],n)<l)return!1}var h=Tf(a,n);return 0!==h.length&&(e=h.start(0)+yf,this.logger_("Buffered region starts (".concat(h.start(0),") ")+" just beyond seek point (".concat(n,"). Seeking to ").concat(e,".")),this.tech_.setCurrentTime(e),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),n=bf(t,e);return n.length&&e+3<=n.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at ".concat(e," while inside a buffered region ")+"[".concat(n.start(0)," -> ").concat(n.end(0),"]. Attempting to resume ")+"playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){var n=e.end(e.length-1);return this.logger_("Fell out of live window at time ".concat(t,". Seeking to ")+"live point (seekable end) ".concat(n)),this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}var i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;var a=Tf(r,t);return a.length>0&&(this.logger_("Stopped at ".concat(t," and seeking to ").concat(a.start(0))),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}},{key:"afterSeekableWindow_",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+yf,a=!n.endList,s="number"==typeof n.partTargetDuration;return a&&(s||i)&&(r=e.end(e.length-1)+3*n.targetDuration),t>r}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}},{key:"videoUnderflow_",value:function(e){var t=e.videoBuffered,n=e.audioBuffered,i=e.currentTime;if(t){var r;if(t.length&&n.length){var a=bf(t,i-3),s=bf(t,i),o=bf(n,i);o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else{Tf(t,i).length||(r=this.gapFromVideoUnderflow_(t,i))}return!!r&&(this.logger_("Encountered a gap in video from ".concat(r.start," to ").concat(r.end,". ")+"Seeking to current time ".concat(i)),!0)}}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),n=this.tech_.currentTime(),i=Tf(t,n);if(this.resetTimeUpdate_(),0!==i.length&&n===e){this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+vf);var r={gapInfo:{from:n,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:r}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var n=function(e){if(e.length<2)return gf();for(var t=[],n=1;n<e.length;n++){var i=e.end(n-1),r=e.start(n);t.push([i,r])}return gf(t)}(e),i=0;i<n.length;i++){var r=n.start(i),a=n.end(i);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}}])}(),Dv={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Pv=function(e,t){var n=0,i=0,r=mf(Dv,t);e.ready(function(){e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});var a=function(){i&&e.currentTime(i)},s=function(t){null!=t&&(i=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",a),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-n<1e3*r.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(r.getSource&&"function"==typeof r.getSource)return n=Date.now(),r.getSource.call(e,s);rf.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},u=function(){e.off("loadedmetadata",a),e.off("error",o),e.off("dispose",u)};e.on("error",o),e.on("dispose",u),e.reloadSourceOnError=function(t){u(),Pv(e,t)}},Rv="3.16.2",Ov={PlaylistLoader:sm,Playlist:Hf,utils:vm,STANDARD_PLAYLIST_SELECTOR:gg,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.main.playlists.filter(Hf.isEnabled);return pg(t,function(e,t){return fg(e,t)}),t.filter(function(t){return!!lg(e.playlists.main,t).video})[0]||null},lastBandwidthSelector:gg,movingAverageBandwidthSelector:function(e){var t=-1,n=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var i=this.useDevicePixelRatio&&wn.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),t<0&&(t=this.systemBandwidth,n=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==n&&(t=e*this.systemBandwidth+(1-e)*t,n=this.systemBandwidth),mg(this.playlists.main,t,parseInt(hg(this.tech_.el(),"width"),10)*i,parseInt(hg(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:fg,comparePlaylistResolution:function(e,t){var n,i;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||wn.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),n===(i=i||wn.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:n-i},xhr:um()};Object.keys(xm).forEach(function(e){Object.defineProperty(Ov,e,{get:function(){return rf.log.warn("using Vhs.".concat(e," is UNSAFE be sure you know what you are doing")),xm[e]},set:function(t){rf.log.warn("using Vhs.".concat(e," is UNSAFE be sure you know what you are doing")),"number"!=typeof t||t<0?rf.log.warn("value of Vhs.".concat(e," must be greater than or equal to 0")):xm[e]=t}})});var Nv="videojs-vhs",Uv=function(e,t){for(var n=t.media(),i=-1,r=0;r<e.length;r++)if(e[r].id===n.id){i=r;break}e.selectedIndex_=i,e.trigger({selectedIndex:i,type:"change"})};Ov.canPlaySource=function(){return rf.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};var Mv=function(e){var t=e.player,n=e.sourceKeySystems,i=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var a=function(e,t){return e.reduce(function(e,n){if(!n.contentProtection)return e;var i=t.reduce(function(e,t){var i=n.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{});return Object.keys(i).length&&e.push(i),e},[])}(i?r.concat([i]):r,Object.keys(n)),s=[],o=[];return a.forEach(function(e){o.push(new Promise(function(e,n){t.tech_.one("keysessioncreated",e)})),s.push(new Promise(function(n,i){t.eme.initializeMediaKeys({keySystems:e},function(e){e?i(e):n()})}))}),Promise.race([Promise.all(s),Promise.race(o)])},Bv=function(e){var t=e.player,n=function(e,t,n){if(!e)return e;var i={};t&&t.attributes&&t.attributes.CODECS&&(i=og(gr(t.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(i.audio=n.attributes.CODECS);var r=yr(i.video),a=yr(i.audio),s={};for(var o in e)s[o]={},a&&(s[o].audioContentType=a),r&&(s[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return mf(e,s)}(e.sourceKeySystems,e.media,e.audioMedia);return!!n&&(t.currentSource().keySystems=n,!(n&&!t.eme)||(rf.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},jv=function(){if(!wn.localStorage)return null;var e=wn.localStorage.getItem(Nv);if(!e)return null;try{return JSON.parse(e)}catch(vy){return null}},Fv=function(e,t){e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},qv=function(e,t){e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Vv=function(e,t){e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Hv=function(e,t){e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};Ov.supportsNativeHls=function(){if(!Ln||!Ln.createElement)return!1;var e=Ln.createElement("video");if(!rf.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),Ov.supportsNativeDash=!!(Ln&&Ln.createElement&&rf.getTech("Html5").isSupported())&&/maybe|probably/i.test(Ln.createElement("video").canPlayType("application/dash+xml")),Ov.supportsTypeNatively=function(e){return"hls"===e?Ov.supportsNativeHls:"dash"===e&&Ov.supportsNativeDash},Ov.isSupported=function(){return rf.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Ov.xhr.onRequest=function(e){Fv(Ov.xhr,e)},Ov.xhr.onResponse=function(e){qv(Ov.xhr,e)},Ov.xhr.offRequest=function(e){Vv(Ov.xhr,e)},Ov.xhr.offResponse=function(e){Hv(Ov.xhr,e)};var zv=rf.getComponent("Component"),Wv=function(){function e(t,n,i){var r;if(g(this,e),r=c(this,e,[n,i.vhs]),"number"==typeof i.initialBandwidth&&(r.options_.bandwidth=i.initialBandwidth),r.logger_=ff("VhsHandler"),n.options_&&n.options_.playerId){var a=rf.getPlayer(n.options_.playerId);r.player_=a}if(r.tech_=n,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");return r.on(Ln,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=Ln.fullscreenElement||Ln.webkitFullscreenElement||Ln.mozFullScreenElement||Ln.msFullscreenElement;t&&t.contains(r.tech_.el())?r.playlistController_.fastQualityChange_():r.playlistController_.checkABR_()}),r.on(r.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),r.on(r.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),r.on(r.tech_,"play",r.play),r}return f(e,zv),y(e,[{key:"setOptions_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.options_=mf(this.options_,t),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var n=jv();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=xm.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===xm.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;var i=this.options_.customPixelRatio;"number"==typeof i&&i>=0&&(this.customPixelRatio=i)}},{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setOptions_(e)}},{key:"src",value:function(e,t){var n=this;if(e){var i;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=Ov,this.options_.sourceType=wr(t),this.options_.seekTo=function(e){n.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Av(this.options_);var r=mf({liveRangeSafeTimeDelta:yf},this.options_,{seekable:function(){return n.seekable()},media:function(){return n.playlistController_.media()},playlistController:this.playlistController_});this.playbackWatcher_=new Lv(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",function(){var e=rf.players[n.tech_.options_.playerId],t=n.playlistController_.error;"object"!==k(t)||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});var a=this.options_.bufferBasedABR?Ov.movingAverageBandwidthSelector(.55):Ov.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Ov.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.playlistController_.selectPlaylist},set:function(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.playlistController_.mainSegmentLoader_.bandwidth,t=wn.navigator.connection||wn.navigator.mozConnection||wn.navigator.webkitConnection,n=1e7;if(this.options_.useNetworkInformationApi&&t){var i=1e3*t.downlink*1e3;e=i>=n&&e>=n?Math.max(e,i):i}return e},set:function(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){rf.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.playlistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.playlistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.playlistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.playlistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.playlistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.playlistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.playlistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return n.playlistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return n.playlistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return n.playlistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return n.playlistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return n.playlistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return Sf(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},main:{get:function(){return n.playlists.main},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Sf(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(e){if(!wn.localStorage)return!1;var t=jv();t=t?mf(t,e):e;try{wn.localStorage.setItem(Nv,JSON.stringify(t))}catch(vy){return!1}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})}),this.playlistController_.on("selectedinitialmedia",function(){var e;(e=n).representations=function(){var t=e.playlistController_.main(),n=Vf(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return n?n.filter(function(e){return!Uf(e)}).map(function(t,n){return new Iv(e,t,t.id)}):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",function(){n.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=wn.URL.createObjectURL(this.playlistController_.mediaSource),(rf.browser.IS_ANY_SAFARI||rf.browser.IS_IOS)&&this.options_.overrideNative&&"hls"===this.options_.sourceType&&"function"==typeof this.tech_.addSourceElement?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}}},{key:"createKeySessions_",value:function(){var e=this,t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Mv({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.main.playlists}).then(function(){e.logger_("created EME key session"),e.playlistController_.sourceUpdater_.initializedEme()}).catch(function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})})}},{key:"handleWaitingForKey_",value:function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}},{key:"setupEme_",value:function(){var e=this,t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=Bv({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",function(t){e.playlistController_.updatePlaylistByKeyStatus(t.keyId,t.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),n?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}},{key:"setupQualityLevels_",value:function(){var e=this,t=rf.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.playlistController_.on("selectedinitialmedia",function(){var t,n;t=e.qualityLevels_,(n=e).representations().forEach(function(e){t.addQualityLevel(e)}),Uv(t,n.playlists)}),this.playlists.on("mediachange",function(){Uv(e.qualityLevels_,e.playlists)}))}},{key:"version",value:function(){return this.constructor.version()}},{key:"canChangeType",value:function(){return Zg.canChangeType()}},{key:"play",value:function(){this.playlistController_.play()}},{key:"setCurrentTime",value:function(e){this.playlistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.playlistController_.duration()}},{key:"seekable",value:function(){return this.playlistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&wn.URL.revokeObjectURL&&(wn.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),n(e,"dispose",this,3)([])}},{key:"convertToProgramTime",value:function(e,t){return ym({playlist:this.playlistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return _m({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}},{key:"setupXhrHooks_",value:function(){var e=this;this.xhr.onRequest=function(t){Fv(e.xhr,t)},this.xhr.onResponse=function(t){qv(e.xhr,t)},this.xhr.offRequest=function(t){Vv(e.xhr,t)},this.xhr.offResponse=function(t){Hv(e.xhr,t)},this.player_.trigger("xhr-hooks-ready")}},{key:"attachStreamingEventListeners_",value:function(){var e=this;["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(function(t){e.playlistController_.on(t,function(t){e.player_.trigger($({},t))})}),["gapjumped","playedrangeschanged"].forEach(function(t){e.playbackWatcher_.on(t,function(t){e.player_.trigger($({},t))})})}}],[{key:"version",value:function(){return{"@videojs/http-streaming":Rv,"mux.js":"7.1.0","mpd-parser":"1.3.1","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}}])}(),Gv={name:"videojs-http-streaming",VERSION:Rv,canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=mf(rf.options,t);return!(!n.vhs.experimentalUseMMS&&!_r("avc1.4d400d,mp4a.40.2",!1))&&Gv.canPlayType(e.type,n)},handleSource:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=mf(rf.options,n);return t.vhs=new Wv(e,t,i),t.vhs.xhr=um(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){var n=wr(e);if(!n)return"";var i=Gv.getOverrideNative(t);return!Ov.supportsTypeNatively(n)||i?"maybe":""},getOverrideNative:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).vhs,t=void 0===e?{}:e,n=!(rf.browser.IS_ANY_SAFARI||rf.browser.IS_IOS),i=t.overrideNative;return void 0===i?n:i}};_r("avc1.4d400d,mp4a.40.2",!0)&&rf.getTech("Html5").registerSourceHandler(Gv,0),rf.VhsHandler=Wv,rf.VhsSourceHandler=Gv,rf.Vhs=Ov,rf.use||rf.registerComponent("Vhs",Ov),rf.options.vhs=rf.options.vhs||{},rf.getPlugin&&rf.getPlugin("reloadSourceOnError")||rf.registerPlugin("reloadSourceOnError",function(e){Pv(this,e)});var Xv=y(function e(t){for(var n in g(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[n];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function Kv(e,t){var n=[];for(var i in e.childNodes){var r=e.childNodes[i];r.nodeName!==t&&t!=="vmap:".concat(r.nodeName)&&r.nodeName!=="vmap:".concat(t)||n.push(r)}return n}function Yv(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,n=[];for(var i in t){var r=t[i];"#cdata-section"===r.nodeName&&n.push(r)}if(n&&n.length>0)try{return JSON.parse(n[0].data)}catch(vy){}var a="";for(var s in t){var o=t[s];switch(o.nodeName){case"#text":a+=o.textContent.trim();break;case"#cdata-section":a+=o.data}}return a}(e);var n=e.attributes;if(n)for(var i in n){var r=n[i];r.nodeName&&void 0!==r.nodeValue&&null!==r.nodeValue&&(t.attributes[r.nodeName]=r.nodeValue)}var a=e.childNodes;if(a)for(var s in a){var o=a[s];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=Yv(o))}return t}var Qv=function(){return y(function e(t){for(var n in g(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[n];switch(i.localName){case"AdSource":this.adSource=new Xv(i);break;case"TrackingEvents":for(var r in i.childNodes){var a=i.childNodes[r];"Tracking"===a.localName&&this.trackingEvents.push({event:a.getAttribute("event"),uri:(a.textContent||a.text||"").trim()})}break;case"Extensions":this.extensions=Kv(i,"Extension").map(function(e){return Yv(e)})}}},[{key:"track",value:function(e,t){for(var n in this.trackingEvents){var i=this.trackingEvents[n];if(i.event===e){var r=i.uri;"error"===i.event&&(r=r.replace("[ERRORCODE]",t)),this.tracker(r)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}])}(),$v=y(function e(t){if(g(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var n in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[n];switch(i.localName){case"AdBreak":this.adBreaks.push(new Qv(i));break;case"Extensions":this.extensions=Kv(i,"Extension").map(function(e){return Yv(e)})}}}),Jv=new Tn,Zv=function(e){return e.creatives.find(function(e){return e.mediaFiles})},ey=function(e){var t,n=null==e?void 0:e.mediaFiles;return null!=n&&n.length&&(null==(t=n.find(function(e){return e.fileURL}))?void 0:t.fileURL)||""},ty=R.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),ny=function(e,t){var n=S(O.useState(),2),i=n[0],a=n[1],s=O.useRef(Date.now()),u=O.useRef(Date.now());return O.useEffect(function(){if(t&&null!=e&&e.current){var n=function(e,t){var n=goog.pal,i=new n.ConsentSettings;i.allowStorage=!1;var a=new n.NonceLoader(i);return o(r().m(function i(){var s,o,u,l,c,d;return r().w(function(i){for(;;)switch(i.p=i.n){case 0:return i.p=0,s=new URL(t),o=new n.NonceRequest,u=localStorage.getItem("sl-device-id")||U.v4(),(l=sessionStorage.getItem("sl-ad-session-id"))||(l=U.v4(),sessionStorage.setItem("sl-ad-session-id",l)),z(u)||(u=Q("https://".concat(u),Q.URL)),s.searchParams.get("url")||s.searchParams.set("url","https://streamlayer.io"),s.searchParams.get("description_url")||s.searchParams.set("description_url","https://streamlayer.io"),o.adWillAutoPlay="auto"===s.searchParams.get("vpa"),o.adWillPlayMuted="1"===s.searchParams.get("vpmute"),o.continuousPlayback=!0,o.descriptionUrl=s.searchParams.get("description_url"),o.iconsSupported=!0,o.sessionId=u,o.supportedApiFrameworks="2,7,9",o.videoHeight=e.clientHeight,o.videoWidth=e.clientWidth,i.n=1,a.loadNonceManager(o);case 1:return c=i.v,i.a(2,("[placeholder]"===s.searchParams.get("is_lat")&&s.searchParams.set("is_lat","1"),"[placeholder]"===s.searchParams.get("rdid")&&s.searchParams.set("rdid",u),"[placeholder]"===s.searchParams.get("correlator")&&s.searchParams.set("correlator",l),s.searchParams.set("wta","1"),s.searchParams.set("givn",c.getNonce()),{url:s,manager:c}));case 2:return i.p=2,d=i.v,console.log("AdsManager could not be started",d),i.a(2)}},i,null,[[0,2]])}))}(e.current,t),i=Date.now();s.current=i,ty.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),n().then(function(e){s.current===i&&e&&(a(e.url),ty.set({ads:[],autoplay:!0,muted:!1,nonceManager:e.manager}))}).catch(function(e){console.error(e)})}},[e,t]),O.useEffect(function(){var e=function(){var e=o(r().m(function e(t,n){var i,a,s,o,c,d,h,p;return r().w(function(e){for(;;)switch(e.n){case 0:if(i=[],"vmap"!==t.searchParams.get("output")){e.n=3;break}return e.n=1,fetch(t.toString());case 1:return a=e.v,s=new DOMParser,e.n=2,a.text();case 2:o=e.v,c=s.parseFromString(o,"text/xml"),i=new $v(c).adBreaks.map(function(e){return e.adSource.adTagURI.uri}),e.n=4;break;case 3:i=[t.toString()];case 4:return e.n=5,Promise.all(i.map(function(e,t){return Jv.get(e).then(function(e){if(u.current===n){var i=e.ads.find(function(e){return e.creatives.length>0});if(!i)return;var r=Zv(i),a=ey(r);return{creative:r,order:t,mediaFileUrl:a,ad:i,raw:e}}})}));case 5:d=e.v,h="click"!==t.searchParams.get("vpa"),p="1"===t.searchParams.get("vpmute"),ty.set(l(l({},ty.get()),{},{ads:d.filter(function(e){return!!e}),autoplay:h,muted:p}));case 6:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}();if(i){var t=Date.now();u.current=t,e(i,t)}return function(){u.current=0}},[i]),ty},iy={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:function(){},whyThisAd:null,hasAdUrl:!1,adAction:function(e){},playMuted:!1,muted:!1,autoplay:!0},ry=R.f(iy),ay=function(e){if(!e)return 0;var t=e.duration(),n=e.currentTime();return void 0===t||isNaN(t)||void 0===n||isNaN(n)?0:Math.round(t-n)},sy=function(e,t){var n=ny(e,t),i=function(e){var t=O.useRef();return O.useEffect(function(){if(!t.current&&e.current){var n=document.createElement("video-js");n.classList.add("vjs-big-play-centered"),e.current.appendChild(n),t.current=rf(n,{controls:!1,playsinline:!0})}return function(){t.current&&(t.current.dispose(),t.current=void 0)}},[]),t}(e),r=O.useRef(),a=O.useRef(!1),s=O.useRef(!1),o=O.useCallback(function(){if(!s.current){var e=n.get().nonceManager;if(e&&a.current)try{e.sendPlaybackEnd()}catch(t){console.warn("[PAL] sendPlaybackEnd failed",t)}s.current=!0}},[n]),u=O.useCallback(function(){o(),i.current&&(i.current.pause(),i.current.src(void 0)),r.current=void 0,ry.set(l(l({},iy),{},{reset:u}))},[i,o]);O.useEffect(function(){ry.setKey("reset",u)},[u]);var c=O.useCallback(function(){var e,t,a,s=ry.get(),o=s.adPosition,l=s.adCount;if(i.current){if(o<l){var c=o+1,d=n.get(),h=d.ads,p=d.muted,f=d.autoplay,m=d.nonceManager,g=h[c-1];if(g)return null==(e=r.current)||e.complete(),r.current=new kn(null,g.ad,g.creative),r.current.on("clickthrough",function(e){if(m)try{m.sendAdClick()}catch(t){console.warn("[PAL] sendAdClick failed",t)}window.open(e,"_blank")}),ry.setKey("adPosition",c),ry.setKey("playMuted",p),ry.setKey("skipDelay",g.creative.skipDelay||0),ry.setKey("time",0),ry.setKey("adAction",function(e){r.current&&r.current.click(null,{CLICKPOS:[e.clientX,e.clientY]})}),ry.setKey("whyThisAd",g.creative.icons.find(function(e){return"GoogleWhyThisAd"===e.program})||null),ry.setKey("hasAdUrl",!(null==(t=g.creative.videoClickThroughURLTemplate)||!t.url)),i.current.src(g.mediaFileUrl),ry.setKey("playing",!0),void(0===o?(ry.setKey("muted",p),ry.setKey("autoplay",f),p&&i.current.muted(!0),f?i.current.play():(i.current.pause(),ry.setKey("paused",!0))):i.current.play())}null==(a=r.current)||a.complete(),u()}},[i,u,n]),d=O.useCallback(function(){if(i.current){var e=i.current.muted();i.current.muted(!e),ry.setKey("muted",!e),r.current&&r.current.setMuted(!e)}},[i]),h=O.useCallback(function(){i.current&&(i.current.paused()?(i.current.play(),r.current&&r.current.setPaused(!1)):(i.current.pause(),r.current&&r.current.setPaused(!0)))},[i]),p=O.useCallback(function(){i.current&&(r.current&&r.current.skip(),c())},[c,i]);return O.useEffect(function(){var e=i.current;if(!e)return function(){};var t=function(e){if(ry.setKey("playing",!0),ry.setKey("paused",!1),ry.setKey("time",ay(e.target.player)),!a.current){var t=n.get().nonceManager;if(t)try{t.sendPlaybackStart(),a.current=!0,s.current=!1}catch(Ki){console.warn("[PAL] sendPlaybackStart failed",Ki)}}},o=function(){var e;null==(e=r.current)||e.complete(),c()},l=function(e){ry.setKey("muted",e.target.player.muted())},d=function(){ry.setKey("paused",!0)},p=function(e){"VIDEO"===e.target.tagName&&(ry.get().autoplay||h())},f=function(e){ry.setKey("time",ay(e.target.player)),r.current&&r.current.setProgress(e.target.player.currentTime())},m=function(){u()};return e.on("play",t),e.on("ended",o),e.on("muted",l),e.on("pause",d),e.on("click",p),e.on("timeupdate",f),e.on("error",m),function(){e.off("play",t),e.off("ended",o),e.off("muted",l),e.off("pause",d),e.off("click",p),e.off("timeupdate",f),e.off("error",m)}},[h,c,i,u,n]),O.useEffect(function(){return n.subscribe(function(e){e&&(a.current=!1,s.current=!1,ry.setKey("adCount",e.ads.length),ry.setKey("adPosition",0),c())})},[n,i,c]),O.useEffect(function(){return function(){u()}},[u]),[ry,d,h,p,r]},oy=function(e){var t,n,i,r,a,s=e.promotion,o=e.onClose,u=e.promotionId,l=e.externalAd,c=e.skipAutoClose,d=O.useRef(null),h=S(sy(d,null==l?void 0:l.url),4),p=h[0],f=h[1],m=h[2],g=h[3],v=P.useStore(p),y=v.time,_=v.adCount,b=v.adPosition,T=v.skipDelay,k=v.playing,w=v.paused,E=v.reset,C=v.muted,A=v.playMuted,I=v.autoplay,x=v.whyThisAd,D=v.hasAdUrl,R=v.adAction,N=(null==(t=s.sponsor)?void 0:t.logo)&&s.logoMode===U.PromotionLogoMode.CENTER;return L.jsxs(Qe,{className:"PromoOverlay",children:[L.jsxs($e,{children:[L.jsx(Je,{className:P.cx_default(!N&&Ze),children:L.jsx(ut,{style:{transform:"scale(1.5)"},children:"Ad"})}),L.jsxs(wt,{children:[L.jsx(gt,{time:y,adCount:_,adPosition:b}),!!T&&k&&L.jsx(j.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:function(){g()},duration:T,isPlaying:!w,skipIcon:!0}),c&&L.jsx(j.y,{className:"ClosePromoIcon",close:function(){E(),null==o||o()}})]})]}),L.jsx(nt,{className:P.cx_default(Et,k&&Ct,!k&&At),children:L.jsxs(St,{ref:d,children:[x&&L.jsx(yt,{whyThisAd:x}),L.jsxs(_t,{style:"right"===(null==x?void 0:x.xPosition)?{left:"8px"}:{right:"8px"},children:[A&&L.jsx(Tt,{className:P.cx_default(!C&&"muted"),onClick:function(){return f()}}),w&&!I&&L.jsx(kt,{onClick:function(){return m()}})]})]})}),D&&L.jsx(ct,{className:P.cx_default(Et,k&&Ct,!k&&At),children:L.jsx(dt,{as:"button",onClick:R,style:{backgroundColor:(null==(i=null==(n=s.banner)?void 0:n.ctaButton)?void 0:i.color)||"#009dc4",color:(null==(a=null==(r=s.banner)?void 0:r.ctaButton)?void 0:a.textColor)||"#fff"},"data-a":"button","data-promo-id":u,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},uy=function(e){var t,n,i,r,a,s,o,u,c,d,h,p,f,m,g,v,y,_,b,T,k,S,w,E,C,A,I,x,D,R,M=e.promotion,B=e.open,F=e.advertisementPaused,q=e.togglePause,V=e.controlVideo,H=e.skipAutoClose,z=e.promotionId,W=e.onClose,G=e.markAsViewed,X=e.externalAd,K=e.isEventFired,Y=e.fireEvent,Q=e.muted,$=M.type===U.PromotionType.INGAME_IAB11_LBAR||M.type===U.PromotionType.INGAME_IAB11||M.type===U.PromotionType.INGAME_IAB11_SIDEBAR,J=(null==(t=M.sponsor)?void 0:t.logo)&&M.logoMode===U.PromotionLogoMode.CENTER,Z=!(null==(i=null==(n=M.banner)?void 0:n.video)||!i.url),ee=M.autoPlayVideo===U.AutoPlayVideo.ENABLED,te=M.playVideoMuted===U.PlayVideoMuted.ENABLED;if(O.useEffect(function(){null==q||q(Z||ee),null==B||B()},[]),O.useEffect(function(){z&&M.type&&G&&G()},[z,M.type,G]),O.useEffect(function(){return function(){null==V||V({muted:!1})}},[V]),X)return L.jsx(oy,l(l({},e),{},{externalAd:X}));var ne=null==(r=M.banner)?void 0:r.url;ne&&0!==ne.indexOf("http")&&(ne="https://".concat(ne));var ie=!0;return Z&&(ie=!F||!ee),L.jsxs(Qe,{className:"PromoOverlay",children:[L.jsxs("div",{children:[L.jsxs($e,{children:[L.jsxs(Je,{className:P.cx_default(!J&&Ze),children:[(null==(a=M.sponsor)?void 0:a.logo)&&M.logoMode===U.PromotionLogoMode.LEFT&&L.jsx(et,{className:"PromoSponsorLogo",src:null==(s=M.sponsor)?void 0:s.logo,alt:"promo"}),L.jsxs(st,{style:{paddingLeft:null!=(o=M.sponsor)&&o.logo&&M.logoMode===U.PromotionLogoMode.LEFT?"0px":"8px"},children:[(null==(u=M.sponsor)?void 0:u.logo)&&M.logoMode===U.PromotionLogoMode.LEFT&&L.jsx(tt,{children:null==(c=M.sponsor)?void 0:c.name}),L.jsxs(ot,{className:"SponsorText",children:[L.jsx(ut,{children:"AD"}),L.jsx(lt,{children:"SPONSORED"})]})]})]}),L.jsx(j.y,{className:"ClosePromoIcon",close:W,autoClose:null==(d=M.closeTimer)?void 0:d.auto,duration:H?0:null==(h=M.closeTimer)?void 0:h.seconds,isPlaying:ie})]}),L.jsxs(nt,{children:[J&&L.jsx(et,{className:"s1nmch9k",src:null==(p=M.sponsor)?void 0:p.logo,alt:"promo"}),L.jsx(rt,{children:null!=(m=null==(f=M.banner)?void 0:f.video)&&m.url?L.jsx(j.Et,{source:null==(v=null==(g=M.banner)?void 0:g.video)?void 0:v.url,poster:null==(_=null==(y=M.banner)?void 0:y.video)?void 0:_.thumbnailUrl,aspectRatio:$?"1/1":"2/1",onRender:function(){null!=K&&K("video-rendered")||(N.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:z,type:M.type}}),null==Y||Y("video-rendered"))},onQuartile:function(e){null!=K&&K("video-quartile-".concat(e))||(N.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:z,type:M.type,quartile:e}}),null==Y||Y("video-quartile-".concat(e)))},onMute:function(e){var t=e?"muted":"unmuted";null!=K&&K(t)||(N.eventBus.emit("advertisement",{action:e?"videoMuted":"videoUnmuted",payload:{id:z,type:M.type}}),null==Y||Y(t))},onPause:function(){ee&&(null==q||q(!0))},onReplay:function(){null!=K&&K("replayed")||(N.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:z,type:M.type}}),null==Y||Y("replayed"))},onPlay:function(){null!=K&&K("played")||(N.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:z,type:M.type}}),null==Y||Y("played")),null==q||q(!1),null!=K&&K("played")&&null!=K&&K("ended")&&(null==K||!K("replayed"))&&(N.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:z,type:M.type}}),null==Y||Y("replayed"))},onEnd:function(){null!=K&&K("ended")||(N.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:z,type:M.type}}),null==Y||Y("ended"))},controlVideo:V,autoPlay:ee,playMuted:te,muted:Q}):null!=(b=M.banner)&&b.imageUrl?L.jsx(it,{style:$?{aspectRatio:"1/1"}:{},src:null==(T=M.banner)?void 0:T.imageUrl,alt:"promo"}):null}),!$&&L.jsxs(rt,{children:[(null==(k=M.banner)?void 0:k.title)&&L.jsx(ht,{className:P.cx_default("AdvTitle",J&&"h17rwbtk"),children:null==(S=M.banner)?void 0:S.title}),(null==(w=M.banner)?void 0:w.body)&&L.jsx(at,{className:"AdvDescription",children:null==(E=M.banner)?void 0:E.body})]})]})]}),M.buttonType===U.PromotionButtonType.BASIC&&L.jsx(ct,{children:L.jsx(dt,{href:ne,style:{backgroundColor:(null==(A=null==(C=M.banner)?void 0:C.ctaButton)?void 0:A.color)||"#009dc4",color:(null==(x=null==(I=M.banner)?void 0:I.ctaButton)?void 0:x.textColor)||"#fff"},"data-a":"button","data-promo-id":z,"data-promo-type":M.type,target:"_blank",children:null==(R=null==(D=M.banner)?void 0:D.ctaButton)?void 0:R.label})})]})},ly=P.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),cy=function(e){var t=e.children,n=e.direction,i=e.style,r=e.className,a=e.hiding;return L.jsx(ne,{direction:n,style:i,hiding:a,className:r,children:L.jsx(ly,{children:t})})},dy=function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11_LBAR||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21_LBAR},hy=function(e){var t=e.advertisement,n=e.close,i=e.skipTypeCheck,r=e.skipAutoClose,a=(e.layoutMode,e.sidebar),s=e.isNotification,o=e.banner,u=e.markAsViewed,l=e.open,c=e.externalAd,d=e.controlVideo,h=e.advertisementPaused,p=e.togglePause,f=e.isEventFired,m=e.fireEvent,g=e.muted;return t.promotion?s&&t.notification?L.jsx(Ke,{open:function(){return null==l?void 0:l({fromNotification:!0})},notification:t.notification,promotionId:t.question.id,close:n}):a||o||!i&&!function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21}(t.promotion)?a&&(i||dy(t.promotion)||function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11_SIDEBAR||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21_SIDEBAR}(t.promotion)||c)?L.jsx(cy,{className:"PromoSidebarContainer",direction:a,hiding:!1,children:L.jsx(uy,{markAsViewed:u,promotionId:t.question.id,promotion:t.promotion,externalAd:c,onClose:n,open:l,controlVideo:d,skipAutoClose:r,advertisementPaused:h,togglePause:p,isEventFired:f,fireEvent:m,muted:g})}):o&&dy(t.promotion)?L.jsx(se,{promotionId:t.question.id,hiding:!1,promotion:t.promotion,direction:o,isEventFired:f,fireEvent:m}):null:L.jsx(Ye,{className:"PromoOverlayContainer",children:L.jsx(uy,{markAsViewed:u,promotionId:t.question.id,promotion:t.promotion,onClose:n,open:l,skipAutoClose:r,externalAd:c,controlVideo:d,advertisementPaused:h,togglePause:p,isEventFired:f,fireEvent:m,muted:g})}):null},py=P.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),fy=function(e){var t=e.target;if(t instanceof HTMLAnchorElement&&"_blank"===t.target){var n=t.getAttribute("data-promo-id")||"",i=t.getAttribute("data-promo-type")||U.PromotionType.UNSET;"button"===t.getAttribute("data-a")&&N.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:n,type:i}}),"banner"===t.getAttribute("data-a")&&N.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:n,type:i}})}},my=function(e){var t,n,i,r,a,s,o,u,c,d,h,p,f,m,g,v,y,_,b,T,k,S=e.gamification,w=e.advertisement,E=e.layoutMode,C=e.skipAutoClose,A=e.skipTypeCheck,I=e.sidebar,x=e.banner,D=e.notification,N=e.isMobileScreen,M=e.persistent,B=e.containerId,j=e.externalAd,F=e.controlVideo,V=e.muted,H=O.useRef(null),z=P.useStore(w.$store),W=P.useStore(S.openedQuestion.$store);R.b(H,{enabled:!!z.data,event:"click",listener:fy});var G=(null==(i=null==(n=null==(t=z.data)?void 0:t.question)?void 0:n.backgroundImage)?void 0:i.landscapeUrl)||(null==(a=null==(r=z.data)?void 0:r.promotion)?void 0:a.backgroundImageLandscapeUrl),X=(null==(u=null==(o=null==(s=z.data)?void 0:s.question)?void 0:o.backgroundImage)?void 0:u.portraitUrl)||(null==(d=null==(c=z.data)?void 0:c.promotion)?void 0:d.backgroundImagePortraitUrl),K=q.y({containerId:B,landscapeUrl:G,portraitUrl:X});if((null==(h=null==W?void 0:W.attributes)?void 0:h.adUnit)===U.AdUnit.STANDART&&null!=(m=null==(f=null==(p=null==W?void 0:W.attributes)?void 0:p.adPromotion)?void 0:f.banner)&&m.imageUrl)return x?L.jsx(py,{ref:H,style:{height:"100%"},className:P.cx_default("SL-AdvertisementUIWrap",N&&"mobile-view"),children:L.jsx(oe,{cardId:W.id,promotion:l(l({},null==(g=null==W?void 0:W.attributes)?void 0:g.adPromotion),{},{adUnit:null==(v=null==W?void 0:W.attributes)?void 0:v.adUnit})})}):null;var Y=!x&&!I;if(void 0===z.data||!M&&z.isViewed)return null;var Q=(null==(b=null==(_=null==(y=null==z?void 0:z.data)?void 0:y.notification)?void 0:_.promotion)?void 0:b.mode)===U.NotificationPromotionMode.LOWER_THIRD;return L.jsxs(py,{ref:H,style:{height:Y?"auto":"100%"},className:P.cx_default("SL-AdvertisementUIWrap",N&&"mobile-view",Q&&"SL-AdvertisementUIWrap--lower-third"),children:[!D&&K,L.jsx(hy,{skipTypeCheck:A,sidebar:I,banner:x,advertisement:z.data,advertisementPaused:!!z.isPaused,togglePause:z.togglePause,isEventFired:z.isEventFired,fireEvent:z.fireEvent,close:z.close,externalAd:j?z.externalAd:void 0,markAsViewed:null==(T=S.advertisement)?void 0:T.markAsViewed,open:null==(k=S.advertisement)?void 0:k.open,layoutMode:E,isNotification:D,skipAutoClose:C,controlVideo:F,muted:V})]})},gy=function(e){var t=e.sdk,n=e.sidebar,i=e.externalAd,r=e.banner,a=e.skipAutoClose,s=e.skipTypeCheck,o=e.layoutMode,u=e.isMobileScreen,l=e.persistent,c=e.notification,d=e.muted,h=P.useStore(t.featuresList.getStore()),p=S(O.useState(!i),2),f=p[0],m=p[1],g=P.useStore(t.options);if(O.useEffect(function(){if(i){var e=document.createElement("script");e.async=!0,e.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(e),e.onload=function(){m(!0)}}},[i]),n&&r)return L.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&i)return L.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!h)return null;var v=t.getFeature(U.SdkOverlayType.GAMES);return null==v||!v.advertisement||i&&!f?null:L.jsx(my,{gamification:v,advertisement:v.advertisement,sidebar:n,banner:r,layoutMode:o,isMobileScreen:u,persistent:l,notification:c,skipTypeCheck:s,skipAutoClose:a,externalAd:i,controlVideo:t.controlVideoPlayer,containerId:g.containerId,muted:d})};exports.StreamLayerSDKAdvertisement=function(e){var t=e.event,n=e.sidebar,i=e.banner,r=e.isMobileScreen,a=e.skipAutoClose,s=e.persistent,o=e.theme,u=e.notification,l=e.skipTypeCheck,c=e.externalAd,d=e.muted,h=void 0!==d&&d,p=V.B(),f=V.F(),m=V.z();return p?c&&!f.promotionExternalAd||!c&&f.promotionExternalAd||n&&!f.promotionSidebar||i&&!f.promotionBanner||u&&!f.promotionNotification?void 0!==t&&L.jsx(V.j,{event:t}):i||n||u||f.promotionOverlay||l?L.jsxs("div",{className:"StreamLayerSDK",children:[L.jsx(D.h,{customTheme:null!=o?o:m.theme,themeMode:m.themeMode,children:L.jsx(gy,{sdk:p,sidebar:n,banner:i,isMobileScreen:r,persistent:s,notification:u,skipTypeCheck:l,skipAutoClose:a,layoutMode:"side-by-side",externalAd:c,muted:h})}),void 0!==t&&L.jsx(V.j,{event:t})]}):void 0!==t&&L.jsx(V.j,{event:t}):null},exports.StreamLayerSDKAdvertisementUI=gy;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("react/jsx-runtime"),_g=require("./index7.js"),ge=require("./sl-types.js"),Uo=require("./analytics.js"),Fe=require("react"),_i=require("./index3.js"),Ce=require("./useStreamLayerApp2.js"),Vn=require("./index9.js"),Tg=require("./index8.js"),vn=require("./index15.js"),ui=require("./index12.js"),cs=require("uuid"),vg=require("./utils.js"),gi=require("./hooks-n9ax4LRT.js");function bg(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in r)){const n=Object.getOwnPropertyDescriptor(i,s);n&&Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function ot(){return ot=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},ot.apply(null,arguments)}const xg=ge.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Sg="a1rlj479",Eg="s35f1di",Cg="sj4471g",Ag="b12050d8",wg="b1d5ybek",Dg=r=>r==="left"||r==="right"?Eg:Ag,Ig=r=>r==="left"||r==="right"?Cg:wg,kg=r=>r==="left"?"avdxyl3":r==="right"?"a1bisd08":r==="top"?"a1u9y2aj":"a1qqaks",$o=({children:r,style:e,className:t,enabled:i=!0,hiding:s,direction:n="left",onAnimationEnd:a})=>ae.jsx(xg,{style:e,className:ge.cx_default(t,Sg,kg(n),i&&!s&&Dg(n),i&&s&&Ig(n)),onAnimationEnd:a,children:r}),Pg=ge.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),Rg=ge.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Lg=()=>Pg,Ng=ge.styled_default(Lg())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),_d=({promotion:r,promotionId:e,hiding:t,isEventFired:i,fireEvent:s,direction:n="bottom"})=>{const a=r?.adUnit===Ce.AdUnit.STANDART,o=a?r.banner:r.additionalBanner;if(Fe.useEffect(()=>{o?.imageUrl&&r.type&&e&&(i?.("banner-showed")||(_i.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:r.type}}),s?.("banner-showed")))},[o?.imageUrl,s,i,r.type,e]),!o?.imageUrl)return null;let u=o?.url;return u&&u.indexOf("http")!==0&&(u=`https://${u}`),ae.jsx($o,{direction:n,hiding:t,children:ae.jsx(Rg,{className:"BannerContainer","data-is-ad":a,children:ae.jsx(Ng,{as:u?"a":"span",className:"BannerLink",href:u,style:{backgroundImage:`url(${o.imageUrl})`,cursor:u?"pointer":"default"},"data-promo-id":e,"data-promo-type":r.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},Og=({cardId:r,promotion:e,direction:t="bottom"})=>ae.jsx(_d,{promotion:e,promotionId:r,direction:t,hiding:!1}),Bg=ge.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Mg=ge.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Fg=ge.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Ug=ge.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),Tr=ge.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),$g=()=>Tr,jg=ge.styled_default($g())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),yu=ge.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),qg=ge.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),Vg=ge.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Hg=ge.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),zg=ge.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Td=ge.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Wg=()=>Td,Gg=ge.styled_default(Wg())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Kg=()=>Td,vd=ge.styled_default(Kg())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),Xg={[Ce.NotificationPromotionImagePosition.UNSET]:Tr,[Ce.NotificationPromotionImagePosition.FIT]:Tr,[Ce.NotificationPromotionImagePosition.CENTERED]:Tr,[Ce.NotificationPromotionImagePosition.SOLID]:Tr,[Ce.NotificationPromotionImagePosition.BOTTOM]:Tr,[Ce.NotificationPromotionImagePosition.MIDDLE]:jg},Yg=({src:r,imagePosition:e})=>{const t=Xg[e];return ae.jsx(t,{children:ae.jsx("img",{src:r,alt:""})})},Qg=Vn.b(Gg),Jg=Vn.b(vd),Zg=({notification:r,open:e,close:t,webos:i})=>{if(!r||!r.promotion||r.enabled!==Ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:n,image:a,promotion:o}=r,{sponsorLogo:u,sponsorLogoMode:d,imagePosition:p,ctaButton:T}=o;return ae.jsxs(zg,{"data-webos":i,className:"SL_Lower_Third_Notification",onClick:i?void 0:e,children:[ae.jsxs(Bg,{children:[ae.jsx(Yg,{src:a,imagePosition:p}),ae.jsxs(Mg,{children:[s&&ae.jsx(Fg,{children:s}),n&&ae.jsx(Ug,{children:n})]})]}),ae.jsxs(Vg,{children:[d!==Ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&ae.jsxs(ae.Fragment,{children:[ae.jsx(qg,{children:ae.jsx("img",{src:u,alt:s})}),ae.jsx(Hg,{})]}),i?ae.jsxs(ae.Fragment,{children:[ae.jsx(Qg,{webos:!0,onClick:t,children:"Dismiss"}),ae.jsxs(Jg,{webos:!0,autoFocus:!0,style:{color:T?.textColor,backgroundColor:T?.color},onClick:e,children:[T?.ctaIcon&&T?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(yu,{src:T?.ctaIcon,alt:"cta-icon"}),T?.label||"Open"]})]}):ae.jsxs(vd,{name:"promo-button",style:{color:T?.textColor,backgroundColor:T?.color},children:[T?.ctaIcon&&T?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(yu,{src:T?.ctaIcon,alt:"cta-icon"}),T?.label||"Open"]})]})]})},e0=ge.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),t0=ge.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),i0=ge.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),r0=ge.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),s0=ge.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Hn=ge.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),n0=()=>Hn,_u=ge.styled_default(n0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),a0=()=>Hn,bd=ge.styled_default(a0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),o0=()=>bd,l0=ge.styled_default(o0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),u0=()=>Hn,c0=ge.styled_default(u0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),d0=()=>Hn,h0=ge.styled_default(d0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),f0=ge.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),p0=()=>Tg.B1,m0=ge.styled_default(p0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),g0=ge.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),xd=ge.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),y0=()=>xd,_0=ge.styled_default(y0())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),T0=()=>xd,v0=ge.styled_default(T0())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),b0={[Ce.NotificationPromotionImagePosition.UNSET]:_u,[Ce.NotificationPromotionImagePosition.FIT]:_u,[Ce.NotificationPromotionImagePosition.CENTERED]:bd,[Ce.NotificationPromotionImagePosition.BOTTOM]:l0,[Ce.NotificationPromotionImagePosition.SOLID]:c0,[Ce.NotificationPromotionImagePosition.MIDDLE]:h0},x0=({src:r,imagePosition:e})=>{const t=b0[e];return ae.jsx(t,{children:ae.jsx("img",{src:r,alt:""})})},S0=Vn.b(_0),E0=Vn.b(v0),C0=({notification:r,open:e,promotionId:t,hiding:i,direction:s="left",close:n,webos:a})=>{if(!r||!r.promotion||r.enabled!==Ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(r.promotion.mode===Ce.NotificationPromotionMode.LOWER_THIRD)return ae.jsx(Zg,{notification:r,open:e,close:n,webos:a});const{title:o,body:u,image:d,promotion:p}=r,{sponsorLogo:T,sponsorLogoMode:A,imagePosition:b,ctaButton:k}=p,v=L=>{L.stopPropagation(),n?.()};return ae.jsx($o,{className:"SL_Rich_Notification",direction:s,hiding:i,children:ae.jsxs(t0,{onClick:a?()=>{}:e,children:[A!==Ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&T&&ae.jsx(g0,{children:ae.jsx("img",{src:T,alt:o})}),ae.jsxs(e0,{children:[ae.jsx(x0,{src:d,imagePosition:b}),ae.jsxs(i0,{children:[o&&ae.jsx(r0,{children:o}),u&&ae.jsx(s0,{children:u})]}),a&&ae.jsx(S0,{webos:!0,onClick:v,children:"Dismiss"}),ae.jsxs(E0,{webos:a,autoFocus:a,onClick:a?e:()=>{},name:"promo-button",style:{color:k?.textColor,backgroundColor:k?.color},children:[k?.ctaIcon&&k?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(f0,{src:k?.ctaIcon,alt:"cta-icon"}),k?.label||"Open"]}),ae.jsx(m0,{name:"chevronRight"})]})]})})},A0=ge.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Sd=ge.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Ed=ge.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Cd=ge.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ad="h10toh7",Tu=ge.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),w0=ge.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),wd=ge.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),D0=ge.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),I0="s1nmch9k",vu=ge.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),k0=ge.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),P0=ge.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),R0=ge.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Dd=ge.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),L0=ge.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Id=ge.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),kd=ge.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),N0=ge.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),O0="h17rwbtk",B0=ge.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),bu=ge.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),M0=ge.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),F0=({time:r,adCount:e,adPosition:t})=>{const i=Math.floor(r/60),s=r-i*60;return i===0&&s===0&&e===t?null:ae.jsxs(B0,{children:[e>1&&ae.jsxs(ae.Fragment,{children:[ae.jsxs(bu,{children:[t," of ",e]}),ae.jsx(M0,{})]}),ae.jsxs(bu,{children:[i,":",s<10?`0${s}`:s]})]})},U0=ge.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),$0=({whyThisAd:r})=>{const[e,t]=Fe.useState(!1);return!r.iconClickThroughURLTemplate||!r.staticResource?null:ae.jsxs(U0,{style:{width:r.width,height:r.height,[r.xPosition]:3,[r.yPosition]:11},href:r.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&ae.jsx("img",{alt:"ad choice",src:r.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&ae.jsx("span",{children:"ad choice"})]})},j0=ge.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Pd=ge.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),q0=()=>Pd,V0=ge.styled_default(q0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),H0=()=>Pd,z0=ge.styled_default(H0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),W0=ge.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),G0=ge.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),xu="m12n261r",Su="m16vcml8",Eu="m1078nk6";function jo(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:r.id||null,adId:r.adId||null,sequence:r.sequence||null,apiFramework:r.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const K0=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function Cu(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=[],s=Ld(r);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Bd(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const n in e)e[n]=Od(e[n]);for(const n in s){const a=s[n];typeof a=="string"&&i.push(Rd(a,e))}return i}function Rd(r,e){const t=(r=Au(r,e)).match(/[^[\]]+(?=])/g);if(!t)return r;let i=t.filter((s=>K0.indexOf(s)>-1));return i.length===0?r:(i=i.reduce(((s,n)=>(s[n]=-1,s)),{}),Au(r,i))}function Au(r,e){let t=r;for(const i in e){const s=e[i];t=t.replace(new RegExp("(?:\\[|%%)(".concat(i,")(?:\\]|%%)"),"g"),s)}return t}function Ld(r){return Array.isArray(r)?r.map((e=>e&&e.hasOwnProperty("url")?e.url:e)):r}function wu(r){return/^(https?:\/\/|\/\/)/.test(r)}function Du(r,e){for(let t=0;t<e.length;t++)if(Nd(e[t],r))return!0;return!1}function Nd(r,e){if(r&&e){const t=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(e);return t.length===i.length&&r.id===e.id&&r.url===e.url}return!1}function Od(r){return encodeURIComponent(r).replace(/[!'()*]/g,(e=>"%".concat(e.charCodeAt(0).toString(16))))}function Bd(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return r.toString().padStart(e,"0")}const Ve={track:function(r,e,t){Cu(r,e,t).forEach((i=>{typeof window<"u"&&window!==null&&(new Image().src=i)}))},resolveURLTemplates:Cu,extractURLsFromTemplates:Ld,filterUrlTemplates:function(r){return r.reduce(((e,t)=>{const i=t.url||t;return wu(i)?e.validUrls.push(i):e.invalidUrls.push(i),e}),{validUrls:[],invalidUrls:[]})},containsTemplateObject:Du,isTemplateObjectEqual:Nd,encodeURIComponentRFC3986:Od,replaceUrlMacros:Rd,isNumeric:function(r){return!isNaN(parseFloat(r))&&isFinite(r)},flatten:function r(e){return e.reduce(((t,i)=>t.concat(Array.isArray(i)?r(i):i)),[])},joinArrayOfUniqueTemplateObjs:function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(r)?r:[],i=Array.isArray(e)?e:[];return t.concat(i).reduce(((s,n)=>(Du(n,s)||s.push(n),s)),[])},isValidTimeValue:function(r){return Number.isFinite(r)&&r>=-2},addLeadingZeros:Bd,isValidUrl:wu,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(r){return typeof r!="object"?r:JSON.stringify(r)}};function Iu(r){return["true","TRUE","True","1"].includes(r)}function X0(r){if(r==null)return-1;if(Ve.isNumeric(r))return parseInt(r);const e=r.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let i=parseInt(t[0]);t.length===2&&(i+=parseFloat("0.".concat(t[1])));const s=parseInt(60*e[1]),n=parseInt(60*e[0]*60);return isNaN(n)||isNaN(s)||isNaN(i)||s>3600||i>60?-1:n+s+i}const J={childByName:function(r,e){return Array.from(r.childNodes).find((t=>t.nodeName===e))},childrenByName:function(r,e){return Array.from(r.childNodes).filter((t=>t.nodeName===e))},resolveVastAdTagURI:function(r,e){if(!e)return r;if(r.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(r)}if(!r.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(r)}return r},parseBoolean:Iu,parseNodeText:function(r){return r&&(r.textContent||r.text||"").trim()},copyNodeAttribute:function(r,e,t){const i=e.getAttribute(r);i&&t.setAttribute(r,i)},parseAttributes:function(r){return Array.from(r.attributes).reduce(((e,t)=>(e[t.nodeName]=t.nodeValue,e)),{})},parseDuration:X0,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter((r=>!parseInt(r.sequence,10)))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter((r=>parseInt(r.sequence,10))).sort(((r,e)=>r.sequence-e.sequence))},assignAttributes:function(r,e){r&&Array.from(r).forEach((t=>{let{nodeName:i,nodeValue:s}=t;if(i&&s&&e.hasOwnProperty(i)){let n=s;typeof e[i]=="boolean"&&(n=Iu(n)),e[i]=n}}))},mergeWrapperAdData:function(r,e){var t;r.errorURLTemplates=e.errorURLTemplates.concat(r.errorURLTemplates),r.impressionURLTemplates=e.impressionURLTemplates.concat(r.impressionURLTemplates),r.extensions=e.extensions.concat(r.extensions),e.viewableImpression.length>0&&(r.viewableImpression=[...r.viewableImpression,...e.viewableImpression]),r.followAdditionalWrappers=e.followAdditionalWrappers,r.allowMultipleAds=e.allowMultipleAds,r.fallbackOnNoAd=e.fallbackOnNoAd;const i=(e.creatives||[]).filter((o=>o&&o.type==="companion")),s=i.reduce(((o,u)=>((u.variations||[]).forEach((d=>{(d.companionClickTrackingURLTemplates||[]).forEach((p=>{Ve.containsTemplateObject(p,o)||o.push(p)}))})),o)),[]);r.creatives=i.concat(r.creatives);const n=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(r.creatives.forEach((o=>{if(e.trackingEvents&&e.trackingEvents[o.type])for(const u in e.trackingEvents[o.type]){const d=e.trackingEvents[o.type][u];Array.isArray(o.trackingEvents[u])||(o.trackingEvents[u]=[]),o.trackingEvents[u]=o.trackingEvents[u].concat(d)}o.type==="linear"&&(n&&(o.videoClickTrackingURLTemplates=o.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(o.videoCustomClickURLTemplates=o.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||o.videoClickThroughURLTemplate!==null&&o.videoClickThroughURLTemplate!==void 0||(o.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),o.type==="companion"&&s.length&&(o.variations||[]).forEach((u=>{u.companionClickTrackingURLTemplates=Ve.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,s)}))})),e.adVerifications&&(r.adVerifications=r.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(r.blockedAdCategories=r.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const o=e.creatives.filter((u=>{var d;return((d=u.icons)===null||d===void 0?void 0:d.length)&&!u.mediaFiles.length}));o.length&&(r.creatives=r.creatives.concat(o))}}};function Y0(r,e){const t=(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:o}=jo(i);return{id:s,adId:n,sequence:a,apiFramework:o,type:"companion",required:null,variations:[]}})(e);return t.required=r.getAttribute("required")||null,t.variations=J.childrenByName(r,"Companion").map((i=>{const s=(function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:o.id||null,adType:"companionAd",width:o.width||0,height:o.height||0,assetWidth:o.assetWidth||null,assetHeight:o.assetHeight||null,expandedWidth:o.expandedWidth||null,expandedHeight:o.expandedHeight||null,apiFramework:o.apiFramework||null,adSlotId:o.adSlotId||null,pxratio:o.pxratio||"1",renderingMode:o.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}})(J.parseAttributes(i));s.htmlResources=J.childrenByName(i,"HTMLResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat(d):o}),[]),s.iframeResources=J.childrenByName(i,"IFrameResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat(d):o}),[]),s.staticResources=J.childrenByName(i,"StaticResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat({url:d,creativeType:u.getAttribute("creativeType")||null}):o}),[]),s.altText=J.parseNodeText(J.childByName(i,"AltText"))||null;const n=J.childByName(i,"TrackingEvents");n&&J.childrenByName(n,"Tracking").forEach((o=>{const u=o.getAttribute("event"),d=J.parseNodeText(o);u&&d&&(Array.isArray(s.trackingEvents[u])||(s.trackingEvents[u]=[]),s.trackingEvents[u].push(d))})),s.companionClickTrackingURLTemplates=J.childrenByName(i,"CompanionClickTracking").map((o=>({id:o.getAttribute("id")||null,url:J.parseNodeText(o)}))),s.companionClickThroughURLTemplate=J.parseNodeText(J.childByName(i,"CompanionClickThrough"))||null;const a=J.childByName(i,"AdParameters");return a&&(s.adParameters={value:J.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),s})),t}function Q0(r,e){let t;const i=(function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:d,adId:p,sequence:T,apiFramework:A}=jo(u);return{id:d,adId:p,sequence:T,apiFramework:A,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}})(e);i.duration=J.parseDuration(J.parseNodeText(J.childByName(r,"Duration")));const s=r.getAttribute("skipoffset");if(s==null)i.skipDelay=null;else if(s.charAt(s.length-1)==="%"&&i.duration!==-1){const u=parseInt(s,10);i.skipDelay=i.duration*(u/100)}else i.skipDelay=J.parseDuration(s);const n=J.childByName(r,"VideoClicks");if(n){const u=J.childByName(n,"ClickThrough");i.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:J.parseNodeText(u)}:null,J.childrenByName(n,"ClickTracking").forEach((d=>{i.videoClickTrackingURLTemplates.push({id:d.getAttribute("id")||null,url:J.parseNodeText(d)})})),J.childrenByName(n,"CustomClick").forEach((d=>{i.videoCustomClickURLTemplates.push({id:d.getAttribute("id")||null,url:J.parseNodeText(d)})}))}const a=J.childByName(r,"AdParameters");a&&(i.adParameters={value:J.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),J.childrenByName(r,"TrackingEvents").forEach((u=>{J.childrenByName(u,"Tracking").forEach((d=>{let p=d.getAttribute("event");const T=J.parseNodeText(d);if(p&&T){if(p==="progress"){if(t=d.getAttribute("offset"),!t)return;p=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(J.parseDuration(t))}Array.isArray(i.trackingEvents[p])||(i.trackingEvents[p]=[]),i.trackingEvents[p].push(T)}}))})),J.childrenByName(r,"MediaFiles").forEach((u=>{J.childrenByName(u,"MediaFile").forEach((b=>{i.mediaFiles.push((function(k){const v={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};v.id=k.getAttribute("id"),v.fileURL=J.parseNodeText(k),v.deliveryType=k.getAttribute("delivery"),v.codec=k.getAttribute("codec"),v.mimeType=k.getAttribute("type"),v.mediaType=k.getAttribute("mediaType")||"2D",v.apiFramework=k.getAttribute("apiFramework"),v.fileSize=parseInt(k.getAttribute("fileSize")||0),v.bitrate=parseInt(k.getAttribute("bitrate")||0),v.minBitrate=parseInt(k.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(k.getAttribute("maxBitrate")||0),v.width=parseInt(k.getAttribute("width")||0),v.height=parseInt(k.getAttribute("height")||0);const L=k.getAttribute("scalable");L&&typeof L=="string"&&(v.scalable=J.parseBoolean(L));const U=k.getAttribute("maintainAspectRatio");return U&&typeof U=="string"&&(v.maintainAspectRatio=J.parseBoolean(U)),v})(b))}));const d=J.childByName(u,"InteractiveCreativeFile");d&&(i.interactiveCreativeFile=(function(b){const k=(function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,apiFramework:v.apiFramework||null,variableDuration:J.parseBoolean(v.variableDuration),fileURL:null}})(J.parseAttributes(b));return k.fileURL=J.parseNodeText(b),k})(d));const p=J.childByName(u,"ClosedCaptionFiles");p&&J.childrenByName(p,"ClosedCaptionFile").forEach((b=>{const k=(function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,language:v.language||null,fileURL:null}})(J.parseAttributes(b));k.fileURL=J.parseNodeText(b),i.closedCaptionFiles.push(k)}));const T=J.childByName(u,"Mezzanine"),A=(function(b,k){const v={};let L=!1;return k.forEach((U=>{b&&b.getAttribute(U)?v[U]=b.getAttribute(U):L=!0})),L?null:v})(T,["delivery","type","width","height"]);if(A){const b={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};b.id=T.getAttribute("id"),b.fileURL=J.parseNodeText(T),b.delivery=A.delivery,b.codec=T.getAttribute("codec"),b.type=A.type,b.width=parseInt(A.width,10),b.height=parseInt(A.height,10),b.fileSize=parseInt(T.getAttribute("fileSize"),10),b.mediaType=T.getAttribute("mediaType")||"2D",i.mezzanine=b}}));const o=J.childByName(r,"Icons");return o&&J.childrenByName(o,"Icon").forEach((u=>{i.icons.push((function(d){const p={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};p.program=d.getAttribute("program"),p.height=parseInt(d.getAttribute("height")||0),p.width=parseInt(d.getAttribute("width")||0),p.xPosition=(function(A){return["left","right"].indexOf(A)!==-1?A:parseInt(A||0)})(d.getAttribute("xPosition")),p.yPosition=(function(A){return["top","bottom"].indexOf(A)!==-1?A:parseInt(A||0)})(d.getAttribute("yPosition")),p.apiFramework=d.getAttribute("apiFramework"),p.pxratio=d.getAttribute("pxratio")||"1",p.offset=J.parseDuration(d.getAttribute("offset")),p.duration=J.parseDuration(d.getAttribute("duration")),p.altText=d.getAttribute("altText"),p.hoverText=d.getAttribute("hoverText"),J.childrenByName(d,"HTMLResource").forEach((A=>{p.type=A.getAttribute("creativeType")||"text/html",p.htmlResource=J.parseNodeText(A)})),J.childrenByName(d,"IFrameResource").forEach((A=>{p.type=A.getAttribute("creativeType")||0,p.iframeResource=J.parseNodeText(A)})),J.childrenByName(d,"StaticResource").forEach((A=>{p.type=A.getAttribute("creativeType")||0,p.staticResource=J.parseNodeText(A)}));const T=J.childByName(d,"IconClicks");if(T){p.iconClickThroughURLTemplate=J.parseNodeText(J.childByName(T,"IconClickThrough")),J.childrenByName(T,"IconClickTracking").forEach((b=>{p.iconClickTrackingURLTemplates.push({id:b.getAttribute("id")||null,url:J.parseNodeText(b)})}));const A=J.childByName(T,"IconClickFallbackImages");A&&J.childrenByName(A,"IconClickFallbackImage").forEach((b=>{p.iconClickFallbackImages.push({url:J.parseNodeText(b)||null,width:b.getAttribute("width")||null,height:b.getAttribute("height")||null})}))}return p.iconViewTrackingURLTemplate=J.parseNodeText(J.childByName(d,"IconViewTracking")),p})(u))})),i}function J0(r,e){const t=(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:o}=jo(i);return{id:s,adId:n,sequence:a,apiFramework:o,type:"nonlinear",variations:[],trackingEvents:{}}})(e);return J.childrenByName(r,"TrackingEvents").forEach((i=>{let s,n;J.childrenByName(i,"Tracking").forEach((a=>{s=a.getAttribute("event"),n=J.parseNodeText(a),s&&n&&(Array.isArray(t.trackingEvents[s])||(t.trackingEvents[s]=[]),t.trackingEvents[s].push(n))}))})),J.childrenByName(r,"NonLinear").forEach((i=>{const s={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};s.id=i.getAttribute("id")||null,s.width=i.getAttribute("width"),s.height=i.getAttribute("height"),s.expandedWidth=i.getAttribute("expandedWidth"),s.expandedHeight=i.getAttribute("expandedHeight"),s.scalable=J.parseBoolean(i.getAttribute("scalable")),s.maintainAspectRatio=J.parseBoolean(i.getAttribute("maintainAspectRatio")),s.minSuggestedDuration=J.parseDuration(i.getAttribute("minSuggestedDuration")),s.apiFramework=i.getAttribute("apiFramework"),J.childrenByName(i,"HTMLResource").forEach((a=>{s.type=a.getAttribute("creativeType")||"text/html",s.htmlResource=J.parseNodeText(a)})),J.childrenByName(i,"IFrameResource").forEach((a=>{s.type=a.getAttribute("creativeType")||0,s.iframeResource=J.parseNodeText(a)})),J.childrenByName(i,"StaticResource").forEach((a=>{s.type=a.getAttribute("creativeType")||0,s.staticResource=J.parseNodeText(a)}));const n=J.childByName(i,"AdParameters");n&&(s.adParameters={value:J.parseNodeText(n),xmlEncoded:n.getAttribute("xmlEncoded")||null}),s.nonlinearClickThroughURLTemplate=J.parseNodeText(J.childByName(i,"NonLinearClickThrough")),J.childrenByName(i,"NonLinearClickTracking").forEach((a=>{s.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:J.parseNodeText(a)})})),t.variations.push(s)})),t}function ku(r){const e=[];return r.forEach((t=>{const i=Md(t);i&&e.push(i)})),e}function Md(r){if(r.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=r.attributes,i=r.childNodes;if(e.name=r.nodeName,r.attributes){for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const n in i)if(i.hasOwnProperty(n)){const a=Md(i[n]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const n=J.parseNodeText(r);n!==""&&(e.value=n),e.children=[]}return(s=e).value===null&&Object.keys(s.attributes).length===0&&s.children.length===0?null:e;var s}function Z0(r){return r.getAttribute("AdID")||r.getAttribute("adID")||r.getAttribute("adId")||null}const gn={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Pu(r,e){if(!gn[r.nodeName]||!gn[r.nodeName].attributes)return;const t=gn[r.nodeName].attributes.filter((i=>!r.getAttribute(i)));t.length>0&&As({name:r.nodeName,parentName:r.parentNode.nodeName,attributes:t},e)}function Ru(r,e,t){const i=gn[r.nodeName],s=!t&&r.nodeName!=="Wrapper";if(!(!i||s)){if(i.subElements){const n=i.subElements.filter((a=>!J.childByName(r,a)));n.length>0&&As({name:r.nodeName,parentName:r.parentNode.nodeName,subElements:n},e)}!t||!i.oneOfinLineResources||i.oneOfinLineResources.some((n=>J.childByName(r,n)))||As({name:r.nodeName,parentName:r.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},e)}}function Lu(r){return r.children&&r.children.length!==0}function As(r,e){let{name:t,parentName:i,attributes:s,subElements:n,oneOfResources:a}=r,o="Element '".concat(t,"'");o+=s?" missing required attribute(s) '".concat(s.join(", "),"' "):n?" missing required sub element(s) '".concat(n.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const ey={verifyRequiredValues:function r(e,t,i){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(i=!0),Pu(e,t),Lu(e)){Ru(e,t,i);for(let s=0;s<e.children.length;s++)r(e.children[s],t,i)}else J.parseNodeText(e).length===0&&As({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Lu,emitMissingValueWarning:As,verifyRequiredAttributes:Pu,verifyRequiredSubElements:Ru};function ty(r,e){let{allowMultipleAds:t,followAdditionalWrappers:i}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=Array.from(r.childNodes).filter((n=>{const a=n.nodeName.toLowerCase();return a==="inline"||i!==!1&&a==="wrapper"}));for(const n of s){if(J.copyNodeAttribute("id",r,n),J.copyNodeAttribute("sequence",r,n),J.copyNodeAttribute("adType",r,n),n.nodeName==="Wrapper")return{ad:ry(n,e),type:"WRAPPER"};if(n.nodeName==="InLine")return{ad:iy(n,e,{allowMultipleAds:t}),type:"INLINE"};const a=n.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(n.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:n})}}function iy(r,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&r.getAttribute("sequence")?null:Fd(r,e)}function Fd(r,e){let t=[];e&&ey.verifyRequiredValues(r,e);const i=Array.from(r.childNodes),s=(function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:n.id||null,sequence:n.sequence||null,adType:n.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}})(J.parseAttributes(r));return i.forEach((n=>{switch(n.nodeName){case"Error":s.errorURLTemplates.push(J.parseNodeText(n));break;case"Impression":s.impressionURLTemplates.push({id:n.getAttribute("id")||null,url:J.parseNodeText(n)});break;case"Creatives":s.creatives=(function(a){const o=[];return a.forEach((u=>{const d={id:u.getAttribute("id")||null,adId:Z0(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},p=[];let T;J.childrenByName(u,"UniversalAdId").forEach((b=>{const k={idRegistry:b.getAttribute("idRegistry")||"unknown",value:J.parseNodeText(b)};p.push(k)}));const A=J.childByName(u,"CreativeExtensions");A&&(T=ku(J.childrenByName(A,"CreativeExtension")));for(const b in u.childNodes){const k=u.childNodes[b];let v;switch(k.nodeName){case"Linear":v=Q0(k,d);break;case"NonLinearAds":v=J0(k,d);break;case"CompanionAds":v=Y0(k,d)}v&&(p&&(v.universalAdIds=p),T&&(v.creativeExtensions=T),o.push(v))}})),o})(J.childrenByName(n,"Creative"));break;case"Extensions":{const a=J.childrenByName(n,"Extension");s.extensions=ku(a),s.adVerifications.length||(t=(function(o){let u=null,d=[];return o.some((p=>u=J.childByName(p,"AdVerifications"))),u&&(d=Nu(J.childrenByName(u,"Verification"))),d})(a));break}case"AdVerifications":s.adVerifications=Nu(J.childrenByName(n,"Verification"));break;case"AdSystem":s.system={value:J.parseNodeText(n),version:n.getAttribute("version")||null};break;case"AdTitle":s.title=J.parseNodeText(n);break;case"AdServingId":s.adServingId=J.parseNodeText(n);break;case"Category":s.categories.push({authority:n.getAttribute("authority")||null,value:J.parseNodeText(n)});break;case"Expires":s.expires=parseInt(J.parseNodeText(n),10);break;case"ViewableImpression":s.viewableImpression.push((function(a){const o=(u,d)=>{const p=J.parseNodeText(d);return p&&u.push(p),u};return{id:a.getAttribute("id")||null,viewable:J.childrenByName(a,"Viewable").reduce(o,[]),notViewable:J.childrenByName(a,"NotViewable").reduce(o,[]),viewUndetermined:J.childrenByName(a,"ViewUndetermined").reduce(o,[])}})(n));break;case"Description":s.description=J.parseNodeText(n);break;case"Advertiser":s.advertiser={id:n.getAttribute("id")||null,value:J.parseNodeText(n)};break;case"Pricing":s.pricing={value:J.parseNodeText(n),model:n.getAttribute("model")||null,currency:n.getAttribute("currency")||null};break;case"Survey":s.survey={value:J.parseNodeText(n),type:n.getAttribute("type")||null};break;case"BlockedAdCategories":s.blockedAdCategories.push({authority:n.getAttribute("authority")||null,value:J.parseNodeText(n)})}})),t.length&&(s.adVerifications=s.adVerifications.concat(t)),s}function ry(r,e){const t=Fd(r,e),i=r.getAttribute("followAdditionalWrappers"),s=r.getAttribute("allowMultipleAds"),n=r.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!i||J.parseBoolean(i),t.allowMultipleAds=!!s&&J.parseBoolean(s),t.fallbackOnNoAd=n?J.parseBoolean(n):null;let a=J.childByName(r,"VASTAdTagURI");if(a?t.nextWrapperURL=J.parseNodeText(a):(a=J.childByName(r,"VASTAdTagURL"),a&&(t.nextWrapperURL=J.parseNodeText(J.childByName(a,"URL")))),t.creatives.forEach((o=>{if(["linear","nonlinear"].includes(o.type)){if(o.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[o.type]||(t.trackingEvents[o.type]={});for(const u in o.trackingEvents){const d=o.trackingEvents[u];Array.isArray(t.trackingEvents[o.type][u])||(t.trackingEvents[o.type][u]=[]),d.forEach((p=>{t.trackingEvents[o.type][u].push(p)}))}}o.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),o.videoClickTrackingURLTemplates.forEach((u=>{t.videoClickTrackingURLTemplates.push(u)}))),o.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=o.videoClickThroughURLTemplate),o.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),o.videoCustomClickURLTemplates.forEach((u=>{t.videoCustomClickURLTemplates.push(u)})))}})),t.nextWrapperURL)return t}function Nu(r){const e=[];return r.forEach((t=>{const i={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},s=Array.from(t.childNodes);J.assignAttributes(t.attributes,i),s.forEach((a=>{let{nodeName:o,textContent:u,attributes:d}=a;switch(o){case"JavaScriptResource":case"ExecutableResource":i.resource=u.trim(),J.assignAttributes(d,i);break;case"VerificationParameters":i.parameters=u.trim()}}));const n=J.childByName(t,"TrackingEvents");n&&J.childrenByName(n,"Tracking").forEach((a=>{const o=a.getAttribute("event"),u=J.parseNodeText(a);o&&u&&(Array.isArray(i.trackingEvents[o])||(i.trackingEvents[o]=[]),i.trackingEvents[o].push(u))})),e.push(i)})),e}let Ud=class{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,(function(i,s,n){const a={fired:!1,wrapFn:void 0};function o(){a.fired||(i.off(s,a.wrapFn),a.fired=!0,n.bind(i)(...arguments))}return a.wrapFn=o,o})(this,e,t))}off(e,t){return this._handlers=this._handlers.filter((i=>i.event!==e||i.handler!==t)),this}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];let n=!1;return this._handlers.forEach((a=>{a.event==="*"&&(n=!0,a.handler(e,...i)),a.event===e&&(n=!0,a.handler(...i))})),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter((t=>t.event!==e)),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter((t=>t.event===e)).length}listeners(e){return this._handlers.reduce(((t,i)=>(i.event===e&&t.push(i.handler),t)),[])}eventNames(){return this._handlers.map((e=>e.event))}},Ou=0,co=0;const $d=(r,e)=>{!r||!e||r<=0||e<=0||(co=(co*Ou+8*r/e)/++Ou)},sy={ERRORCODE:900,extensions:[]},Bu="VAST response version not supported";class ny extends Ud{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),n=2;n<i;n++)s[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},sy,t,...s)),Ve.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return co}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),$d(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then((i=>this.buildVASTResponse(i)))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then((i=>this.buildVASTResponse(i)))}buildVASTResponse(e){const t=(function(i){let{ads:s,errorURLTemplates:n,version:a}=i;return{ads:s||[],errorURLTemplates:n||[],version:a||null}})({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:i=!1,url:s=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:o}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:s,wrapperDepth:n});const A=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(A?Bu:"Invalid VAST XMLDocument")}const d=[],p=e.documentElement.childNodes,T=e.documentElement.getAttribute("version");i&&T&&(this.vastVersion=T);for(const A in p){const b=p[A];if(b.nodeName==="Error"){const k=J.parseNodeText(b);i?this.rootErrorURLTemplates.push(k):this.errorURLTemplates.push(k)}else if(b.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&d.length>1)break;const k=ty(b,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:o});k.ad?(d.push(k.ad),this.emit("VAST-ad-parsed",{type:k.type,url:s,wrapperDepth:n,adIndex:d.length-1,vastVersion:T})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return d}parse(e){let{url:t=null,resolveAll:i=!0,wrapperSequence:s=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:o=!1,followAdditionalWrappers:u,allowMultipleAds:d}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&o&&(d=!0);try{p=this.parseVastXml(e,{isRootVAST:o,url:t,wrapperDepth:a,allowMultipleAds:d,followAdditionalWrappers:u})}catch(T){return Promise.reject(T)}if(p.length===1&&s!=null&&(p[0].sequence=s),i===!1){const T=J.getSortedAdPods(p),A=J.getStandAloneAds(p);T.length?p=T:A.length&&(p=[A.shift()]),this.remainingAds=A}return this.resolveAds(p,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:i,url:s}=arguments.length>1?arguments[1]:void 0;const n=[];return i=s,e.forEach((a=>{const o=this.resolveWrappers(a,t,i);n.push(o)})),Promise.all(n).then((a=>Ve.flatten(a)))}resolveWrappers(e,t,i){const s={...e};return new Promise((n=>{var a;if(t++,!s.nextWrapperURL)return delete s.nextWrapperURL,n(s);if(!this.fetcher)return s.VASTAdTagURI=s.nextWrapperURL,delete s.nextWrapperURL,n(s);if(t>=this.maxWrapperDepth)return s.errorCode=302,delete s.nextWrapperURL,n(s);s.nextWrapperURL=J.resolveVastAdTagURI(s.nextWrapperURL,i);const o=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:s.allowMultipleAds,u=s.sequence;this.fetcher.fetchVAST({url:s.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then((d=>this.parse(d,{url:s.nextWrapperURL,previousUrl:i,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:s.followAdditionalWrappers,allowMultipleAds:o}).then((p=>{if(delete s.nextWrapperURL,p.length===0)return s.creatives=[],n(s);p.forEach((T=>{T&&J.mergeWrapperAdData(T,s)})),n(p)})))).catch((d=>{s.errorCode=d.message===Bu?102:301,s.errorMessage=d.message,n(s)}))}))}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const i=e.ads[t],s=!i.creatives.some((n=>{var a,o;return((a=n.mediaFiles)===null||a===void 0?void 0:a.length)>0||((o=n.variations)===null||o===void 0?void 0:o.length)>0}));!i.errorCode&&!s||i.VASTAdTagURI||(this.trackVastError(i.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:i.errorCode||303},{ERRORMESSAGE:i.errorMessage||""},{extensions:i.extensions},{system:i.system}),this.keepFailedAdPod&&i.sequence?i.hasFailed=!0:e.ads.splice(t,1))}}}let Pi=null;const ay={data:{},length:0,getItem(r){return this.data[r]},setItem(r,e){this.data[r]=e,this.length=Object.keys(this.data).length},removeItem(r){delete this.data[r],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class oy{constructor(){this.storage=this.initStorage()}initStorage(){if(Pi)return Pi;try{Pi=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{Pi=null}return Pi&&!this.isStorageDisabled(Pi)||(Pi=ay,Pi.clear()),Pi}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const ho=12e4,ly={get:async function(r,e){try{const t=new AbortController,i=setTimeout((()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||ho," ms (408)"))}),e.timeout||ho),s=await fetch(r,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally((()=>{clearTimeout(i)})),n=(function(a){return Ve.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")})(s);return n?{error:new Error(n),statusCode:s.status}:(async function(a){const o=await a.text();let u;return u=Ve.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>u_)).DOMParser,{xml:u.parseFromString(o,"text/xml"),details:{byteLength:o.length,statusCode:a.status,rawXml:o}}})(s)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let uy=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||ly,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||ho,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:i,maxWrapperDepth:s,emitter:n,wrapperDepth:a=0,previousUrl:o=null,wrapperAd:u=null}=e;const d=Date.now();this.URLTemplateFilters.forEach((A=>{i=A(i)})),n("VAST-resolving",{url:i,previousUrl:o,wrapperDepth:a,maxWrapperDepth:s,timeout:this.fetchingOptions.timeout,wrapperAd:u});const p=await this.urlHandler.get(i,this.fetchingOptions),T=Math.round(Date.now()-d);if(n("VAST-resolved",{url:i,previousUrl:o,wrapperDepth:a,error:p?.error||null,duration:T,statusCode:p?.statusCode||null,...p?.details}),$d(p==null||(t=p.details)===null||t===void 0?void 0:t.byteLength,T),p.error)throw new Error(p.error);return p.xml}},cy=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new oy;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new uy,this.vastParser=new ny({fetcher:this.fetcher}),this.storage=i,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<i?(this.totalCalls=1,this.totalCallsTimeout=i+36e5):this.totalCalls++,new Promise(((s,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=i-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then((o=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(o,t).then((u=>{const d=this.vastParser.buildVASTResponse(u);s(d)}))))).catch((o=>n(o)))}))}};class dy extends Ud{constructor(e,t,i){var s;let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=i,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const o in this.creative.trackingEvents){const u=this.creative.trackingEvents[o];this.trackingEvents[o]=u.slice(0)}this.viewableImpressionTrackers=((s=this.ad.viewableImpression)===null||s===void 0?void 0:s.reduce(((o,u)=>(o.notViewable.push(...u.notViewable),o.viewUndetermined.push(...u.viewUndetermined),o.viewable.push(...u.viewable),o)),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach((o=>{let[u,d]=o;d.length&&(this.trackingEvents[u]=d)})),(function(o){return o.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",(()=>{e.lastSuccessfulAd=Date.now()}))}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):(function(e){return e.adType==="companionAd"})(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ve.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ve.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))});const s=this.skipDelay||-1;if(s===-1||this.skippable||(s>e?this.emit("skip-countdown",s-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const n=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let o=this.lastPercentage;o<n;o++)a.push("progress-".concat(o+1,"%"));a.push("progress-".concat(e));for(const o in this.quartiles)this.isQuartileReached(o,this.quartiles[o],e)&&(a.push(o),this._alreadyTriggeredQuartiles[o]=!0);this.lastPercentage=n}a.forEach((o=>{this.track(o,{macros:t,once:i})})),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,i){let s=!1;return t<=i&&!this._alreadyTriggeredQuartiles[e]&&(s=!0),s}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))})}setSkipDelay(e){Ve.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ve.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const i=this.ad.adVerifications.find((n=>n.vendor===e));if(!i)throw new Error("No associated verification element found for vendor: ".concat(e));const s=i.trackingEvents;if(s&&s.verificationNotExecuted){const n=s.verificationNotExecuted;this.trackURLs(n,t),this.emit("verificationNotExecuted",{trackingURLTemplates:n})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Ve.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const i=this.clickThroughURLTemplate||e,s={...t};if(i){this.progress&&(s.ADPLAYHEAD=this.progressFormatted());const n=Ve.resolveURLTemplates([i],s)[0];this.emit("clickthrough",n)}}trackProgressEvents(e,t,i){const s=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter((n=>{let[a]=n;return a.startsWith("progress-")})).map((n=>{let[a,o]=n;return{name:a,time:parseFloat(a.split("-")[1]),urls:o}})).filter((n=>{let{time:a}=n;return a<=s&&a>this.progress})).forEach((n=>{let{name:a,urls:o}=n;!i&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:o}),this.trackURLs(o,t),i?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))}))}track(e){let{macros:t={},once:i=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,i);const s=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,t)):n&&this.emit(e,null),i&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:n,invalidUrls:a}=Ve.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const o={...i};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map((u=>u.idRegistry.concat(" ",u.value))).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map((u=>u.value)).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map((u=>u.value)).join(","))),Ve.track(n,o,s)}convertToTimecode(e){if(!Ve.isValidTimeValue(e))return"";const t=1e3*e,i=Math.floor(t/36e5),s=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ve.addLeadingZeros(i,2),":").concat(Ve.addLeadingZeros(s,2),":").concat(Ve.addLeadingZeros(n,2),".").concat(Ve.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var Ia,Mu;function zn(){if(Mu)return Ia;Mu=1;var r;return typeof window<"u"?r=window:typeof ui.commonjsGlobal<"u"?r=ui.commonjsGlobal:typeof self<"u"?r=self:r={},Ia=r,Ia}var hy=zn();const N=ui.getDefaultExportFromCjs(hy),fy={},py=Object.freeze(Object.defineProperty({__proto__:null,default:fy},Symbol.toStringTag,{value:"Module"})),my=ui.getAugmentedNamespace(py);var ka,Fu;function jd(){if(Fu)return ka;Fu=1;var r=typeof ui.commonjsGlobal<"u"?ui.commonjsGlobal:typeof window<"u"?window:{},e=my,t;return typeof document<"u"?t=document:(t=r["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=r["__GLOBAL_DOCUMENT_CACHE@4"]=e)),ka=t,ka}var gy=jd();const he=ui.getDefaultExportFromCjs(gy);var ln={exports:{}},Pa={exports:{}},Uu;function yy(){return Uu||(Uu=1,(function(r){function e(){return r.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},r.exports.__esModule=!0,r.exports.default=r.exports,e.apply(null,arguments)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(Pa)),Pa.exports}var Ra,$u;function _y(){if($u)return Ra;$u=1,Ra=e;var r=Object.prototype.toString;function e(t){if(!t)return!1;var i=r.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return Ra}var La,ju;function Ty(){if(ju)return La;ju=1;function r(s,n){var a=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(a)return(a=a.call(s)).next.bind(a);if(Array.isArray(s)||(a=e(s))||n){a&&(s=a);var o=0;return function(){return o>=s.length?{done:!0}:{done:!1,value:s[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(s,n){if(s){if(typeof s=="string")return t(s,n);var a=Object.prototype.toString.call(s).slice(8,-1);if(a==="Object"&&s.constructor&&(a=s.constructor.name),a==="Map"||a==="Set")return Array.from(s);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(s,n)}}function t(s,n){(n==null||n>s.length)&&(n=s.length);for(var a=0,o=new Array(n);a<n;a++)o[a]=s[a];return o}var i=(function(){function s(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=s.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(o,u){this.typeToInterceptorsMap_.has(o)||this.typeToInterceptorsMap_.set(o,new Set);var d=this.typeToInterceptorsMap_.get(o);return d.has(u)?!1:(d.add(u),!0)},n.removeInterceptor=function(o,u){var d=this.typeToInterceptorsMap_.get(o);return d&&d.has(u)?(d.delete(u),!0):!1},n.clearInterceptorsByType=function(o){var u=this.typeToInterceptorsMap_.get(o);return u?(this.typeToInterceptorsMap_.delete(o),this.typeToInterceptorsMap_.set(o,new Set),!0):!1},n.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},n.getForType=function(o){return this.typeToInterceptorsMap_.get(o)||new Set},n.execute=function(o,u){for(var d=this.getForType(o),p=r(d),T;!(T=p()).done;){var A=T.value;try{u=A(u)}catch{}}return u},s})();return La=i,La}var Na,qu;function vy(){if(qu)return Na;qu=1;var r=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(n){this.maxAttempts_=n},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(n){this.delayFactor_=n},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(n){this.fuzzFactor_=n},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(n){this.initialDelay_=n},i.createRetry=function(n){var a=n===void 0?{}:n,o=a.maxAttempts,u=a.delayFactor,d=a.fuzzFactor,p=a.initialDelay;return new e({maxAttempts:o||this.maxAttempts_,delayFactor:u||this.delayFactor_,fuzzFactor:d||this.fuzzFactor_,initialDelay:p||this.initialDelay_})},t})(),e=(function(){function t(s){this.maxAttempts_=s.maxAttempts,this.delayFactor_=s.delayFactor,this.fuzzFactor_=s.fuzzFactor,this.currentDelay_=s.initialDelay,this.currentAttempt_=1}var i=t.prototype;return i.moveToNextAttempt=function(){this.currentAttempt_++;var n=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+n},i.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},i.getCurrentDelay=function(){return this.currentDelay_},i.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},i.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},i.getCurrentFuzzedDelay=function(){var n=this.getCurrentMinPossibleDelay(),a=this.getCurrentMaxPossibleDelay();return n+Math.random()*(a-n)},t})();return Na=r,Na}var Oa,Vu;function by(){if(Vu)return Oa;Vu=1;var r=zn(),e=function(s,n){return n===void 0&&(n=!1),function(a,o,u){if(a){s(a);return}if(o.statusCode>=400&&o.statusCode<=599){var d=u;if(n)if(r.TextDecoder){var p=t(o.headers&&o.headers["content-type"]);try{d=new TextDecoder(p).decode(u)}catch{}}else d=String.fromCharCode.apply(null,new Uint8Array(u));s({cause:d});return}s(null,u)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(s,n){var a=n.split("="),o=a[0],u=a[1];return o.trim()==="charset"?u.trim():s},"utf-8")}return Oa=e,Oa}var Hu;function xy(){if(Hu)return ln.exports;Hu=1;var r=zn(),e=yy(),t=_y(),i=Ty(),s=vy();d.httpHandler=by(),d.requestInterceptorsStorage=new i,d.responseInterceptorsStorage=new i,d.retryManager=new s;var n=function(k){var v={};return k&&k.trim().split(`
3
+ `).forEach(function(L){var U=L.indexOf(":"),$=L.slice(0,U).trim().toLowerCase(),F=L.slice(U+1).trim();typeof v[$]>"u"?v[$]=F:Array.isArray(v[$])?v[$].push(F):v[$]=[v[$],F]}),v};ln.exports=d,ln.exports.default=d,d.XMLHttpRequest=r.XMLHttpRequest||A,d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:r.XDomainRequest,a(["get","put","post","patch","head","delete"],function(b){d[b==="delete"?"del":b]=function(k,v,L){return v=u(k,v,L),v.method=b.toUpperCase(),p(v)}});function a(b,k){for(var v=0;v<b.length;v++)k(b[v])}function o(b){for(var k in b)if(b.hasOwnProperty(k))return!1;return!0}function u(b,k,v){var L=b;return t(k)?(v=k,typeof b=="string"&&(L={uri:b})):L=e({},k,{uri:b}),L.callback=v,L}function d(b,k,v){return k=u(b,k,v),p(k)}function p(b){if(typeof b.callback>"u")throw new Error("callback argument missing");if(b.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var k={uri:b.uri||b.url,headers:b.headers||{},body:b.body,metadata:b.metadata||{},retry:b.retry,timeout:b.timeout},v=d.requestInterceptorsStorage.execute(b.requestType,k);b.uri=v.uri,b.headers=v.headers,b.body=v.body,b.metadata=v.metadata,b.retry=v.retry,b.timeout=v.timeout}var L=!1,U=function(le,oe,ce){L||(L=!0,b.callback(le,oe,ce))};function $(){V.readyState===4&&!d.responseInterceptorsStorage.getIsEnabled()&&setTimeout(B,0)}function F(){var te=void 0;if(V.response?te=V.response:te=V.responseText||T(V),ne)try{te=JSON.parse(te)}catch{}return te}function H(te){if(clearTimeout(de),clearTimeout(b.retryTimeout),te instanceof Error||(te=new Error(""+(te||"Unknown XMLHttpRequest Error"))),te.statusCode=0,!ie&&d.retryManager.getIsEnabled()&&b.retry&&b.retry.shouldRetry()){b.retryTimeout=setTimeout(function(){b.retry.moveToNextAttempt(),b.xhr=V,p(b)},b.retry.getCurrentFuzzedDelay());return}if(b.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var le={headers:fe.headers||{},body:fe.body,responseUrl:V.responseURL,responseType:V.responseType},oe=d.responseInterceptorsStorage.execute(b.requestType,le);fe.body=oe.body,fe.headers=oe.headers}return U(te,fe)}function B(){if(!ie){var te;clearTimeout(de),clearTimeout(b.retryTimeout),b.useXDR&&V.status===void 0?te=200:te=V.status===1223?204:V.status;var le=fe,oe=null;if(te!==0?(le={body:F(),statusCode:te,method:I,headers:{},url:C,rawRequest:V},V.getAllResponseHeaders&&(le.headers=n(V.getAllResponseHeaders()))):oe=new Error("Internal XMLHttpRequest Error"),b.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var ce={headers:le.headers||{},body:le.body,responseUrl:V.responseURL,responseType:V.responseType},ue=d.responseInterceptorsStorage.execute(b.requestType,ce);le.body=ue.body,le.headers=ue.headers}return U(oe,le,le.body)}}var V=b.xhr||null;V||(b.cors||b.useXDR?V=new d.XDomainRequest:V=new d.XMLHttpRequest);var G,ie,C=V.url=b.uri||b.url,I=V.method=b.method||"GET",W=b.body||b.data,Y=V.headers=b.headers||{},X=!!b.sync,ne=!1,de,fe={body:void 0,headers:{},statusCode:0,method:I,url:C,rawRequest:V};if("json"in b&&b.json!==!1&&(ne=!0,Y.accept||Y.Accept||(Y.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(Y["content-type"]||Y["Content-Type"]||(Y["Content-Type"]="application/json"),W=JSON.stringify(b.json===!0?W:b.json))),V.onreadystatechange=$,V.onload=B,V.onerror=H,V.onprogress=function(){},V.onabort=function(){ie=!0,clearTimeout(b.retryTimeout)},V.ontimeout=H,V.open(I,C,!X,b.username,b.password),X||(V.withCredentials=!!b.withCredentials),!X&&b.timeout>0&&(de=setTimeout(function(){if(!ie){ie=!0,V.abort("timeout");var te=new Error("XMLHttpRequest timeout");te.code="ETIMEDOUT",H(te)}},b.timeout)),V.setRequestHeader)for(G in Y)Y.hasOwnProperty(G)&&V.setRequestHeader(G,Y[G]);else if(b.headers&&!o(b.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in b&&(V.responseType=b.responseType),"beforeSend"in b&&typeof b.beforeSend=="function"&&b.beforeSend(V),V.send(W||null),V}function T(b){try{if(b.responseType==="document")return b.responseXML;var k=b.responseXML&&b.responseXML.documentElement.nodeName==="parsererror";if(b.responseType===""&&!k)return b.responseXML}catch{}return null}function A(){}return ln.exports}var Sy=xy();const qd=ui.getDefaultExportFromCjs(Sy);var Ba={exports:{}},Ma,zu;function Ey(){if(zu)return Ma;zu=1;var r=jd(),e=Object.create||(function(){function C(){}return function(I){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return C.prototype=I,new C}})();function t(C,I){this.name="ParsingError",this.code=C.code,this.message=I||C.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(C){function I(Y,X,ne,de){return(Y|0)*3600+(X|0)*60+(ne|0)+(de|0)/1e3}var W=C.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return W?W[3]?I(W[1],W[2],W[3].replace(":",""),W[4]):W[1]>59?I(W[1],W[2],0,W[4]):I(0,W[1],W[2],W[4]):null}function s(){this.values=e(null)}s.prototype={set:function(C,I){!this.get(C)&&I!==""&&(this.values[C]=I)},get:function(C,I,W){return W?this.has(C)?this.values[C]:I[W]:this.has(C)?this.values[C]:I},has:function(C){return C in this.values},alt:function(C,I,W){for(var Y=0;Y<W.length;++Y)if(I===W[Y]){this.set(C,I);break}},integer:function(C,I){/^-?\d+$/.test(I)&&this.set(C,parseInt(I,10))},percent:function(C,I){return I.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(I=parseFloat(I),I>=0&&I<=100)?(this.set(C,I),!0):!1}};function n(C,I,W,Y){var X=Y?C.split(Y):[C];for(var ne in X)if(typeof X[ne]=="string"){var de=X[ne].split(W);if(de.length===2){var fe=de[0].trim(),te=de[1].trim();I(fe,te)}}}function a(C,I,W){var Y=C;function X(){var fe=i(C);if(fe===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+Y);return C=C.replace(/^[^\sa-zA-Z-]+/,""),fe}function ne(fe,te){var le=new s;n(fe,function(oe,ce){switch(oe){case"region":for(var ue=W.length-1;ue>=0;ue--)if(W[ue].id===ce){le.set(oe,W[ue].region);break}break;case"vertical":le.alt(oe,ce,["rl","lr"]);break;case"line":var Ee=ce.split(","),Ae=Ee[0];le.integer(oe,Ae),le.percent(oe,Ae)&&le.set("snapToLines",!1),le.alt(oe,Ae,["auto"]),Ee.length===2&&le.alt("lineAlign",Ee[1],["start","center","end"]);break;case"position":Ee=ce.split(","),le.percent(oe,Ee[0]),Ee.length===2&&le.alt("positionAlign",Ee[1],["start","center","end"]);break;case"size":le.percent(oe,ce);break;case"align":le.alt(oe,ce,["start","center","end","left","right"]);break}},/:/,/\s/),te.region=le.get("region",null),te.vertical=le.get("vertical","");try{te.line=le.get("line","auto")}catch{}te.lineAlign=le.get("lineAlign","start"),te.snapToLines=le.get("snapToLines",!0),te.size=le.get("size",100);try{te.align=le.get("align","center")}catch{te.align=le.get("align","middle")}try{te.position=le.get("position","auto")}catch{te.position=le.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},te.align)}te.positionAlign=le.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},te.align)}function de(){C=C.replace(/^\s+/,"")}if(de(),I.startTime=X(),de(),C.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+Y);C=C.substr(3),de(),I.endTime=X(),de(),ne(C,I)}var o=r.createElement&&r.createElement("textarea"),u={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},p={v:"title",lang:"lang"},T={rt:"ruby"};function A(C,I){function W(){if(!I)return null;function Ae(_e){return I=I.substr(_e.length),_e}var Te=I.match(/^([^<]*)(<[^>]*>?)?/);return Ae(Te[1]?Te[1]:Te[2])}function Y(Ae){return o.innerHTML=Ae,Ae=o.textContent,o.textContent="",Ae}function X(Ae,Te){return!T[Te.localName]||T[Te.localName]===Ae.localName}function ne(Ae,Te){var _e=u[Ae];if(!_e)return null;var lt=C.document.createElement(_e),dt=p[Ae];return dt&&Te&&(lt[dt]=Te.trim()),lt}for(var de=C.document.createElement("div"),fe=de,te,le=[];(te=W())!==null;){if(te[0]==="<"){if(te[1]==="/"){le.length&&le[le.length-1]===te.substr(2).replace(">","")&&(le.pop(),fe=fe.parentNode);continue}var oe=i(te.substr(1,te.length-2)),ce;if(oe){ce=C.document.createProcessingInstruction("timestamp",oe),fe.appendChild(ce);continue}var ue=te.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!ue||(ce=ne(ue[1],ue[3]),!ce)||!X(fe,ce))continue;if(ue[2]){var Ee=ue[2].split(".");Ee.forEach(function(Ae){var Te=/^bg_/.test(Ae),_e=Te?Ae.slice(3):Ae;if(d.hasOwnProperty(_e)){var lt=Te?"background-color":"color",dt=d[_e];ce.style[lt]=dt}}),ce.className=Ee.join(" ")}le.push(ue[1]),fe.appendChild(ce),fe=ce;continue}fe.appendChild(C.document.createTextNode(Y(te)))}return de}var b=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function k(C){for(var I=0;I<b.length;I++){var W=b[I];if(C>=W[0]&&C<=W[1])return!0}return!1}function v(C){var I=[],W="",Y;if(!C||!C.childNodes)return"ltr";function X(fe,te){for(var le=te.childNodes.length-1;le>=0;le--)fe.push(te.childNodes[le])}function ne(fe){if(!fe||!fe.length)return null;var te=fe.pop(),le=te.textContent||te.innerText;if(le){var oe=le.match(/^.*(\n|\r)/);return oe?(fe.length=0,oe[0]):le}if(te.tagName==="ruby")return ne(fe);if(te.childNodes)return X(fe,te),ne(fe)}for(X(I,C);W=ne(I);)for(var de=0;de<W.length;de++)if(Y=W.charCodeAt(de),k(Y))return"rtl";return"ltr"}function L(C){if(typeof C.line=="number"&&(C.snapToLines||C.line>=0&&C.line<=100))return C.line;if(!C.track||!C.track.textTrackList||!C.track.textTrackList.mediaElement)return-1;for(var I=C.track,W=I.textTrackList,Y=0,X=0;X<W.length&&W[X]!==I;X++)W[X].mode==="showing"&&Y++;return++Y*-1}function U(){}U.prototype.applyStyles=function(C,I){I=I||this.div;for(var W in C)C.hasOwnProperty(W)&&(I.style[W]=C[W])},U.prototype.formatStyle=function(C,I){return C===0?0:C+I};function $(C,I,W){U.call(this),this.cue=I,this.cueDiv=A(C,I.text);var Y={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:I.vertical===""?"horizontal-tb":I.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(Y,this.cueDiv),this.div=C.document.createElement("div"),Y={direction:v(this.cueDiv),writingMode:I.vertical===""?"horizontal-tb":I.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:I.align==="middle"?"center":I.align,font:W.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(Y),this.div.appendChild(this.cueDiv);var X=0;switch(I.positionAlign){case"start":case"line-left":X=I.position;break;case"center":X=I.position-I.size/2;break;case"end":case"line-right":X=I.position-I.size;break}I.vertical===""?this.applyStyles({left:this.formatStyle(X,"%"),width:this.formatStyle(I.size,"%")}):this.applyStyles({top:this.formatStyle(X,"%"),height:this.formatStyle(I.size,"%")}),this.move=function(ne){this.applyStyles({top:this.formatStyle(ne.top,"px"),bottom:this.formatStyle(ne.bottom,"px"),left:this.formatStyle(ne.left,"px"),right:this.formatStyle(ne.right,"px"),height:this.formatStyle(ne.height,"px"),width:this.formatStyle(ne.width,"px")})}}$.prototype=e(U.prototype),$.prototype.constructor=$;function F(C){var I,W,Y,X;if(C.div){W=C.div.offsetHeight,Y=C.div.offsetWidth,X=C.div.offsetTop;var ne=(ne=C.div.childNodes)&&(ne=ne[0])&&ne.getClientRects&&ne.getClientRects();C=C.div.getBoundingClientRect(),I=ne?Math.max(ne[0]&&ne[0].height||0,C.height/ne.length):0}this.left=C.left,this.right=C.right,this.top=C.top||X,this.height=C.height||W,this.bottom=C.bottom||X+(C.height||W),this.width=C.width||Y,this.lineHeight=I!==void 0?I:C.lineHeight}F.prototype.move=function(C,I){switch(I=I!==void 0?I:this.lineHeight,C){case"+x":this.left+=I,this.right+=I;break;case"-x":this.left-=I,this.right-=I;break;case"+y":this.top+=I,this.bottom+=I;break;case"-y":this.top-=I,this.bottom-=I;break}},F.prototype.overlaps=function(C){return this.left<C.right&&this.right>C.left&&this.top<C.bottom&&this.bottom>C.top},F.prototype.overlapsAny=function(C){for(var I=0;I<C.length;I++)if(this.overlaps(C[I]))return!0;return!1},F.prototype.within=function(C){return this.top>=C.top&&this.bottom<=C.bottom&&this.left>=C.left&&this.right<=C.right},F.prototype.overlapsOppositeAxis=function(C,I){switch(I){case"+x":return this.left<C.left;case"-x":return this.right>C.right;case"+y":return this.top<C.top;case"-y":return this.bottom>C.bottom}},F.prototype.intersectPercentage=function(C){var I=Math.max(0,Math.min(this.right,C.right)-Math.max(this.left,C.left)),W=Math.max(0,Math.min(this.bottom,C.bottom)-Math.max(this.top,C.top)),Y=I*W;return Y/(this.height*this.width)},F.prototype.toCSSCompatValues=function(C){return{top:this.top-C.top,bottom:C.bottom-this.bottom,left:this.left-C.left,right:C.right-this.right,height:this.height,width:this.width}},F.getSimpleBoxPosition=function(C){var I=C.div?C.div.offsetHeight:C.tagName?C.offsetHeight:0,W=C.div?C.div.offsetWidth:C.tagName?C.offsetWidth:0,Y=C.div?C.div.offsetTop:C.tagName?C.offsetTop:0;C=C.div?C.div.getBoundingClientRect():C.tagName?C.getBoundingClientRect():C;var X={left:C.left,right:C.right,top:C.top||Y,height:C.height||I,bottom:C.bottom||Y+(C.height||I),width:C.width||W};return X};function H(C,I,W,Y){function X(_e,lt){for(var dt,tt=new F(_e),ht=1,Ct=0;Ct<lt.length;Ct++){for(;_e.overlapsOppositeAxis(W,lt[Ct])||_e.within(W)&&_e.overlapsAny(Y);)_e.move(lt[Ct]);if(_e.within(W))return _e;var Qe=_e.intersectPercentage(W);ht>Qe&&(dt=new F(_e),ht=Qe),_e=new F(tt)}return dt||tt}var ne=new F(I),de=I.cue,fe=L(de),te=[];if(de.snapToLines){var le;switch(de.vertical){case"":te=["+y","-y"],le="height";break;case"rl":te=["+x","-x"],le="width";break;case"lr":te=["-x","+x"],le="width";break}var oe=ne.lineHeight,ce=oe*Math.round(fe),ue=W[le]+oe,Ee=te[0];Math.abs(ce)>ue&&(ce=ce<0?-1:1,ce*=Math.ceil(ue/oe)*oe),fe<0&&(ce+=de.vertical===""?W.height:W.width,te=te.reverse()),ne.move(Ee,ce)}else{var Ae=ne.lineHeight/W.height*100;switch(de.lineAlign){case"center":fe-=Ae/2;break;case"end":fe-=Ae;break}switch(de.vertical){case"":I.applyStyles({top:I.formatStyle(fe,"%")});break;case"rl":I.applyStyles({left:I.formatStyle(fe,"%")});break;case"lr":I.applyStyles({right:I.formatStyle(fe,"%")});break}te=["+y","-x","+x","-y"],ne=new F(I)}var Te=X(ne,te);I.move(Te.toCSSCompatValues(W))}function B(){}B.StringDecoder=function(){return{decode:function(C){if(!C)return"";if(typeof C!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(C))}}},B.convertCueToDOMTree=function(C,I){return!C||!I?null:A(C,I)};var V=.05,G="sans-serif",ie="1.5%";return B.processCues=function(C,I,W){if(!C||!I||!W)return null;for(;W.firstChild;)W.removeChild(W.firstChild);var Y=C.document.createElement("div");Y.style.position="absolute",Y.style.left="0",Y.style.right="0",Y.style.top="0",Y.style.bottom="0",Y.style.margin=ie,W.appendChild(Y);function X(oe){for(var ce=0;ce<oe.length;ce++)if(oe[ce].hasBeenReset||!oe[ce].displayState)return!0;return!1}if(!X(I)){for(var ne=0;ne<I.length;ne++)Y.appendChild(I[ne].displayState);return}var de=[],fe=F.getSimpleBoxPosition(Y),te=Math.round(fe.height*V*100)/100,le={font:te+"px "+G};(function(){for(var oe,ce,ue=0;ue<I.length;ue++)ce=I[ue],oe=new $(C,ce,le),Y.appendChild(oe.div),H(C,oe,fe,de),ce.displayState=oe.div,de.push(F.getSimpleBoxPosition(oe))})()},B.Parser=function(C,I,W){W||(W=I,I={}),I||(I={}),this.window=C,this.vttjs=I,this.state="INITIAL",this.buffer="",this.decoder=W||new TextDecoder("utf8"),this.regionList=[]},B.Parser.prototype={reportOrThrowError:function(C){if(C instanceof t)this.onparsingerror&&this.onparsingerror(C);else throw C},parse:function(C){var I=this;C&&(I.buffer+=I.decoder.decode(C,{stream:!0}));function W(){for(var oe=I.buffer,ce=0;ce<oe.length&&oe[ce]!=="\r"&&oe[ce]!==`
4
+ `;)++ce;var ue=oe.substr(0,ce);return oe[ce]==="\r"&&++ce,oe[ce]===`
5
+ `&&++ce,I.buffer=oe.substr(ce),ue}function Y(oe){var ce=new s;if(n(oe,function(Ee,Ae){switch(Ee){case"id":ce.set(Ee,Ae);break;case"width":ce.percent(Ee,Ae);break;case"lines":ce.integer(Ee,Ae);break;case"regionanchor":case"viewportanchor":var Te=Ae.split(",");if(Te.length!==2)break;var _e=new s;if(_e.percent("x",Te[0]),_e.percent("y",Te[1]),!_e.has("x")||!_e.has("y"))break;ce.set(Ee+"X",_e.get("x")),ce.set(Ee+"Y",_e.get("y"));break;case"scroll":ce.alt(Ee,Ae,["up"]);break}},/=/,/\s/),ce.has("id")){var ue=new(I.vttjs.VTTRegion||I.window.VTTRegion);ue.width=ce.get("width",100),ue.lines=ce.get("lines",3),ue.regionAnchorX=ce.get("regionanchorX",0),ue.regionAnchorY=ce.get("regionanchorY",100),ue.viewportAnchorX=ce.get("viewportanchorX",0),ue.viewportAnchorY=ce.get("viewportanchorY",100),ue.scroll=ce.get("scroll",""),I.onregion&&I.onregion(ue),I.regionList.push({id:ce.get("id"),region:ue})}}function X(oe){var ce=new s;n(oe,function(ue,Ee){switch(ue){case"MPEGT":ce.integer(ue+"S",Ee);break;case"LOCA":ce.set(ue+"L",i(Ee));break}},/[^\d]:/,/,/),I.ontimestampmap&&I.ontimestampmap({MPEGTS:ce.get("MPEGTS"),LOCAL:ce.get("LOCAL")})}function ne(oe){oe.match(/X-TIMESTAMP-MAP/)?n(oe,function(ce,ue){ce==="X-TIMESTAMP-MAP"&&X(ue)},/=/):n(oe,function(ce,ue){ce==="Region"&&Y(ue)},/:/)}try{var de;if(I.state==="INITIAL"){if(!/\r\n|\n/.test(I.buffer))return this;de=W();var fe=de.match(/^WEBVTT([ \t].*)?$/);if(!fe||!fe[0])throw new t(t.Errors.BadSignature);I.state="HEADER"}for(var te=!1;I.buffer;){if(!/\r\n|\n/.test(I.buffer))return this;switch(te?te=!1:de=W(),I.state){case"HEADER":/:/.test(de)?ne(de):de||(I.state="ID");continue;case"NOTE":de||(I.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(de)){I.state="NOTE";break}if(!de)continue;I.cue=new(I.vttjs.VTTCue||I.window.VTTCue)(0,0,"");try{I.cue.align="center"}catch{I.cue.align="middle"}if(I.state="CUE",de.indexOf("-->")===-1){I.cue.id=de;continue}case"CUE":try{a(de,I.cue,I.regionList)}catch(oe){I.reportOrThrowError(oe),I.cue=null,I.state="BADCUE";continue}I.state="CUETEXT";continue;case"CUETEXT":var le=de.indexOf("-->")!==-1;if(!de||le&&(te=!0)){I.oncue&&I.oncue(I.cue),I.cue=null,I.state="ID";continue}I.cue.text&&(I.cue.text+=`
6
+ `),I.cue.text+=de.replace(/\u2028/g,`
7
+ `).replace(/u2029/g,`
8
+ `);continue;case"BADCUE":de||(I.state="ID");continue}}}catch(oe){I.reportOrThrowError(oe),I.state==="CUETEXT"&&I.cue&&I.oncue&&I.oncue(I.cue),I.cue=null,I.state=I.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var C=this;try{if(C.buffer+=C.decoder.decode(),(C.cue||C.state==="HEADER")&&(C.buffer+=`
9
+
10
+ `,C.parse()),C.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(I){C.reportOrThrowError(I)}return C.onflush&&C.onflush(),this}},Ma=B,Ma}var Fa,Wu;function Cy(){if(Wu)return Fa;Wu=1;var r="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(a){if(typeof a!="string")return!1;var o=e[a.toLowerCase()];return o?a.toLowerCase():!1}function s(a){if(typeof a!="string")return!1;var o=t[a.toLowerCase()];return o?a.toLowerCase():!1}function n(a,o,u){this.hasBeenReset=!1;var d="",p=!1,T=a,A=o,b=u,k=null,v="",L=!0,U="auto",$="start",F="auto",H="auto",B=100,V="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return d},set:function(G){d=""+G}},pauseOnExit:{enumerable:!0,get:function(){return p},set:function(G){p=!!G}},startTime:{enumerable:!0,get:function(){return T},set:function(G){if(typeof G!="number")throw new TypeError("Start time must be set to a number.");T=G,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return A},set:function(G){if(typeof G!="number")throw new TypeError("End time must be set to a number.");A=G,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return b},set:function(G){b=""+G,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return k},set:function(G){k=G,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return v},set:function(G){var ie=i(G);if(ie===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");v=ie,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return L},set:function(G){L=!!G,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return U},set:function(G){if(typeof G!="number"&&G!==r)throw new SyntaxError("Line: an invalid number or illegal string was specified.");U=G,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return $},set:function(G){var ie=s(G);ie?($=ie,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return F},set:function(G){if(G<0||G>100)throw new Error("Position must be between 0 and 100.");F=G,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return H},set:function(G){var ie=s(G);ie?(H=ie,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return B},set:function(G){if(G<0||G>100)throw new Error("Size must be between 0 and 100.");B=G,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return V},set:function(G){var ie=s(G);if(!ie)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");V=ie,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Fa=n,Fa}var Ua,Gu;function Ay(){if(Gu)return Ua;Gu=1;var r={"":!0,up:!0};function e(s){if(typeof s!="string")return!1;var n=r[s.toLowerCase()];return n?s.toLowerCase():!1}function t(s){return typeof s=="number"&&s>=0&&s<=100}function i(){var s=100,n=3,a=0,o=100,u=0,d=100,p="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return s},set:function(T){if(!t(T))throw new Error("Width must be between 0 and 100.");s=T}},lines:{enumerable:!0,get:function(){return n},set:function(T){if(typeof T!="number")throw new TypeError("Lines must be set to a number.");n=T}},regionAnchorY:{enumerable:!0,get:function(){return o},set:function(T){if(!t(T))throw new Error("RegionAnchorX must be between 0 and 100.");o=T}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(T){if(!t(T))throw new Error("RegionAnchorY must be between 0 and 100.");a=T}},viewportAnchorY:{enumerable:!0,get:function(){return d},set:function(T){if(!t(T))throw new Error("ViewportAnchorY must be between 0 and 100.");d=T}},viewportAnchorX:{enumerable:!0,get:function(){return u},set:function(T){if(!t(T))throw new Error("ViewportAnchorX must be between 0 and 100.");u=T}},scroll:{enumerable:!0,get:function(){return p},set:function(T){var A=e(T);A===!1?console.warn("Scroll: an invalid or illegal string was specified."):p=A}}})}return Ua=i,Ua}var Ku;function wy(){if(Ku)return Ba.exports;Ku=1;var r=zn(),e=Ba.exports={WebVTT:Ey(),VTTCue:Cy(),VTTRegion:Ay()};r.vttjs=e,r.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,s=r.VTTCue,n=r.VTTRegion;return e.shim=function(){r.VTTCue=t,r.VTTRegion=i},e.restore=function(){r.VTTCue=s,r.VTTRegion=n},r.VTTCue||e.shim(),Ba.exports}var Dy=wy();const Xu=ui.getDefaultExportFromCjs(Dy);var Yu="https://example.com",Wn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=N.location&&N.location.href||"");var i=/^\/\//.test(e),s=!N.location&&!/\/\//i.test(e);e=new N.URL(e,N.location||Yu);var n=new URL(t,e);return s?n.href.slice(Yu.length):i?n.href.slice(n.protocol.length):n.href},qo=(function(){function r(){this.listeners={}}var e=r.prototype;return e.on=function(i,s){this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(s)},e.off=function(i,s){if(!this.listeners[i])return!1;var n=this.listeners[i].indexOf(s);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(n,1),n>-1},e.trigger=function(i){var s=this.listeners[i];if(s)if(arguments.length===2)for(var n=s.length,a=0;a<n;++a)s[a].call(this,arguments[1]);else for(var o=Array.prototype.slice.call(arguments,1),u=s.length,d=0;d<u;++d)s[d].apply(this,o)},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(s){i.push(s)})},r})(),Vd={},Gn={};Gn.byteLength=Py;Gn.toByteArray=Ly;Gn.fromByteArray=By;var bi=[],Xt=[],Iy=typeof Uint8Array<"u"?Uint8Array:Array,$a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var mr=0,ky=$a.length;mr<ky;++mr)bi[mr]=$a[mr],Xt[$a.charCodeAt(mr)]=mr;Xt[45]=62;Xt[95]=63;function Hd(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function Py(r){var e=Hd(r),t=e[0],i=e[1];return(t+i)*3/4-i}function Ry(r,e,t){return(e+t)*3/4-t}function Ly(r){var e,t=Hd(r),i=t[0],s=t[1],n=new Iy(Ry(r,i,s)),a=0,o=s>0?i-4:i,u;for(u=0;u<o;u+=4)e=Xt[r.charCodeAt(u)]<<18|Xt[r.charCodeAt(u+1)]<<12|Xt[r.charCodeAt(u+2)]<<6|Xt[r.charCodeAt(u+3)],n[a++]=e>>16&255,n[a++]=e>>8&255,n[a++]=e&255;return s===2&&(e=Xt[r.charCodeAt(u)]<<2|Xt[r.charCodeAt(u+1)]>>4,n[a++]=e&255),s===1&&(e=Xt[r.charCodeAt(u)]<<10|Xt[r.charCodeAt(u+1)]<<4|Xt[r.charCodeAt(u+2)]>>2,n[a++]=e>>8&255,n[a++]=e&255),n}function Ny(r){return bi[r>>18&63]+bi[r>>12&63]+bi[r>>6&63]+bi[r&63]}function Oy(r,e,t){for(var i,s=[],n=e;n<t;n+=3)i=(r[n]<<16&16711680)+(r[n+1]<<8&65280)+(r[n+2]&255),s.push(Ny(i));return s.join("")}function By(r){for(var e,t=r.length,i=t%3,s=[],n=16383,a=0,o=t-i;a<o;a+=n)s.push(Oy(r,a,a+n>o?o:a+n));return i===1?(e=r[t-1],s.push(bi[e>>2]+bi[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],s.push(bi[e>>10]+bi[e>>4&63]+bi[e<<2&63]+"=")),s.join("")}var Vo={};Vo.read=function(r,e,t,i,s){var n,a,o=s*8-i-1,u=(1<<o)-1,d=u>>1,p=-7,T=t?s-1:0,A=t?-1:1,b=r[e+T];for(T+=A,n=b&(1<<-p)-1,b>>=-p,p+=o;p>0;n=n*256+r[e+T],T+=A,p-=8);for(a=n&(1<<-p)-1,n>>=-p,p+=i;p>0;a=a*256+r[e+T],T+=A,p-=8);if(n===0)n=1-d;else{if(n===u)return a?NaN:(b?-1:1)*(1/0);a=a+Math.pow(2,i),n=n-d}return(b?-1:1)*a*Math.pow(2,n-i)};Vo.write=function(r,e,t,i,s,n){var a,o,u,d=n*8-s-1,p=(1<<d)-1,T=p>>1,A=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=i?0:n-1,k=i?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+T>=1?e+=A/u:e+=A*Math.pow(2,1-T),e*u>=2&&(a++,u/=2),a+T>=p?(o=0,a=p):a+T>=1?(o=(e*u-1)*Math.pow(2,s),a=a+T):(o=e*Math.pow(2,T-1)*Math.pow(2,s),a=0));s>=8;r[t+b]=o&255,b+=k,o/=256,s-=8);for(a=a<<s|o,d+=s;d>0;r[t+b]=a&255,b+=k,a/=256,d-=8);r[t+b-k]|=v*128};(function(r){const e=Gn,t=Vo,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=p,r.SlowBuffer=B,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s;const{Uint8Array:n,ArrayBuffer:a,SharedArrayBuffer:o}=globalThis;p.TYPED_ARRAY_SUPPORT=u(),!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{const S=new n(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,n.prototype),Object.setPrototypeOf(S,g),S.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function d(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const g=new n(S);return Object.setPrototypeOf(g,p.prototype),g}function p(S,g,y){if(typeof S=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return k(S)}return T(S,g,y)}p.poolSize=8192;function T(S,g,y){if(typeof S=="string")return v(S,g);if(a.isView(S))return U(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(pt(S,a)||S&&pt(S.buffer,a)||typeof o<"u"&&(pt(S,o)||S&&pt(S.buffer,o)))return $(S,g,y);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const P=S.valueOf&&S.valueOf();if(P!=null&&P!==S)return p.from(P,g,y);const j=F(S);if(j)return j;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return p.from(S[Symbol.toPrimitive]("string"),g,y);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}p.from=function(S,g,y){return T(S,g,y)},Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n);function A(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function b(S,g,y){return A(S),S<=0?d(S):g!==void 0?typeof y=="string"?d(S).fill(g,y):d(S).fill(g):d(S)}p.alloc=function(S,g,y){return b(S,g,y)};function k(S){return A(S),d(S<0?0:H(S)|0)}p.allocUnsafe=function(S){return k(S)},p.allocUnsafeSlow=function(S){return k(S)};function v(S,g){if((typeof g!="string"||g==="")&&(g="utf8"),!p.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const y=V(S,g)|0;let P=d(y);const j=P.write(S,g);return j!==y&&(P=P.slice(0,j)),P}function L(S){const g=S.length<0?0:H(S.length)|0,y=d(g);for(let P=0;P<g;P+=1)y[P]=S[P]&255;return y}function U(S){if(pt(S,n)){const g=new n(S);return $(g.buffer,g.byteOffset,g.byteLength)}return L(S)}function $(S,g,y){if(g<0||S.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<g+(y||0))throw new RangeError('"length" is outside of buffer bounds');let P;return g===void 0&&y===void 0?P=new n(S):y===void 0?P=new n(S,g):P=new n(S,g,y),Object.setPrototypeOf(P,p.prototype),P}function F(S){if(p.isBuffer(S)){const g=H(S.length)|0,y=d(g);return y.length===0||S.copy(y,0,0,g),y}if(S.length!==void 0)return typeof S.length!="number"||ri(S.length)?d(0):L(S);if(S.type==="Buffer"&&Array.isArray(S.data))return L(S.data)}function H(S){if(S>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return S|0}function B(S){return+S!=S&&(S=0),p.alloc(+S)}p.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==p.prototype},p.compare=function(g,y){if(pt(g,n)&&(g=p.from(g,g.offset,g.byteLength)),pt(y,n)&&(y=p.from(y,y.offset,y.byteLength)),!p.isBuffer(g)||!p.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===y)return 0;let P=g.length,j=y.length;for(let Q=0,se=Math.min(P,j);Q<se;++Q)if(g[Q]!==y[Q]){P=g[Q],j=y[Q];break}return P<j?-1:j<P?1:0},p.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(g,y){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return p.alloc(0);let P;if(y===void 0)for(y=0,P=0;P<g.length;++P)y+=g[P].length;const j=p.allocUnsafe(y);let Q=0;for(P=0;P<g.length;++P){let se=g[P];if(pt(se,n))Q+se.length>j.length?(p.isBuffer(se)||(se=p.from(se)),se.copy(j,Q)):n.prototype.set.call(j,se,Q);else if(p.isBuffer(se))se.copy(j,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=se.length}return j};function V(S,g){if(p.isBuffer(S))return S.length;if(a.isView(S)||pt(S,a))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const y=S.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&y===0)return 0;let j=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return Ie(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return ii(S).length;default:if(j)return P?-1:Ie(S).length;g=(""+g).toLowerCase(),j=!0}}p.byteLength=V;function G(S,g,y){let P=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((y===void 0||y>this.length)&&(y=this.length),y<=0)||(y>>>=0,g>>>=0,y<=g))return"";for(S||(S="utf8");;)switch(S){case"hex":return Ee(this,g,y);case"utf8":case"utf-8":return te(this,g,y);case"ascii":return ce(this,g,y);case"latin1":case"binary":return ue(this,g,y);case"base64":return fe(this,g,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ae(this,g,y);default:if(P)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),P=!0}}p.prototype._isBuffer=!0;function ie(S,g,y){const P=S[g];S[g]=S[y],S[y]=P}p.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;y<g;y+=2)ie(this,y,y+1);return this},p.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let y=0;y<g;y+=4)ie(this,y,y+3),ie(this,y+1,y+2);return this},p.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let y=0;y<g;y+=8)ie(this,y,y+7),ie(this,y+1,y+6),ie(this,y+2,y+5),ie(this,y+3,y+4);return this},p.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?te(this,0,g):G.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(g){if(!p.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:p.compare(this,g)===0},p.prototype.inspect=function(){let g="";const y=r.INSPECT_MAX_BYTES;return g=this.toString("hex",0,y).replace(/(.{2})/g,"$1 ").trim(),this.length>y&&(g+=" ... "),"<Buffer "+g+">"},i&&(p.prototype[i]=p.prototype.inspect),p.prototype.compare=function(g,y,P,j,Q){if(pt(g,n)&&(g=p.from(g,g.offset,g.byteLength)),!p.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(y===void 0&&(y=0),P===void 0&&(P=g?g.length:0),j===void 0&&(j=0),Q===void 0&&(Q=this.length),y<0||P>g.length||j<0||Q>this.length)throw new RangeError("out of range index");if(j>=Q&&y>=P)return 0;if(j>=Q)return-1;if(y>=P)return 1;if(y>>>=0,P>>>=0,j>>>=0,Q>>>=0,this===g)return 0;let se=Q-j,we=P-y;const Ne=Math.min(se,we),Be=this.slice(j,Q),Ue=g.slice(y,P);for(let Le=0;Le<Ne;++Le)if(Be[Le]!==Ue[Le]){se=Be[Le],we=Ue[Le];break}return se<we?-1:we<se?1:0};function C(S,g,y,P,j){if(S.length===0)return-1;if(typeof y=="string"?(P=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,ri(y)&&(y=j?0:S.length-1),y<0&&(y=S.length+y),y>=S.length){if(j)return-1;y=S.length-1}else if(y<0)if(j)y=0;else return-1;if(typeof g=="string"&&(g=p.from(g,P)),p.isBuffer(g))return g.length===0?-1:I(S,g,y,P,j);if(typeof g=="number")return g=g&255,typeof n.prototype.indexOf=="function"?j?n.prototype.indexOf.call(S,g,y):n.prototype.lastIndexOf.call(S,g,y):I(S,[g],y,P,j);throw new TypeError("val must be string, number or Buffer")}function I(S,g,y,P,j){let Q=1,se=S.length,we=g.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(S.length<2||g.length<2)return-1;Q=2,se/=2,we/=2,y/=2}function Ne(Ue,Le){return Q===1?Ue[Le]:Ue.readUInt16BE(Le*Q)}let Be;if(j){let Ue=-1;for(Be=y;Be<se;Be++)if(Ne(S,Be)===Ne(g,Ue===-1?0:Be-Ue)){if(Ue===-1&&(Ue=Be),Be-Ue+1===we)return Ue*Q}else Ue!==-1&&(Be-=Be-Ue),Ue=-1}else for(y+we>se&&(y=se-we),Be=y;Be>=0;Be--){let Ue=!0;for(let Le=0;Le<we;Le++)if(Ne(S,Be+Le)!==Ne(g,Le)){Ue=!1;break}if(Ue)return Be}return-1}p.prototype.includes=function(g,y,P){return this.indexOf(g,y,P)!==-1},p.prototype.indexOf=function(g,y,P){return C(this,g,y,P,!0)},p.prototype.lastIndexOf=function(g,y,P){return C(this,g,y,P,!1)};function W(S,g,y,P){y=Number(y)||0;const j=S.length-y;P?(P=Number(P),P>j&&(P=j)):P=j;const Q=g.length;P>Q/2&&(P=Q/2);let se;for(se=0;se<P;++se){const we=parseInt(g.substr(se*2,2),16);if(ri(we))return se;S[y+se]=we}return se}function Y(S,g,y,P){return Lt(Ie(g,S.length-y),S,y,P)}function X(S,g,y,P){return Lt(je(g),S,y,P)}function ne(S,g,y,P){return Lt(ii(g),S,y,P)}function de(S,g,y,P){return Lt(ze(g,S.length-y),S,y,P)}p.prototype.write=function(g,y,P,j){if(y===void 0)j="utf8",P=this.length,y=0;else if(P===void 0&&typeof y=="string")j=y,P=this.length,y=0;else if(isFinite(y))y=y>>>0,isFinite(P)?(P=P>>>0,j===void 0&&(j="utf8")):(j=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Q=this.length-y;if((P===void 0||P>Q)&&(P=Q),g.length>0&&(P<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let se=!1;for(;;)switch(j){case"hex":return W(this,g,y,P);case"utf8":case"utf-8":return Y(this,g,y,P);case"ascii":case"latin1":case"binary":return X(this,g,y,P);case"base64":return ne(this,g,y,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,g,y,P);default:if(se)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),se=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fe(S,g,y){return g===0&&y===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(g,y))}function te(S,g,y){y=Math.min(S.length,y);const P=[];let j=g;for(;j<y;){const Q=S[j];let se=null,we=Q>239?4:Q>223?3:Q>191?2:1;if(j+we<=y){let Ne,Be,Ue,Le;switch(we){case 1:Q<128&&(se=Q);break;case 2:Ne=S[j+1],(Ne&192)===128&&(Le=(Q&31)<<6|Ne&63,Le>127&&(se=Le));break;case 3:Ne=S[j+1],Be=S[j+2],(Ne&192)===128&&(Be&192)===128&&(Le=(Q&15)<<12|(Ne&63)<<6|Be&63,Le>2047&&(Le<55296||Le>57343)&&(se=Le));break;case 4:Ne=S[j+1],Be=S[j+2],Ue=S[j+3],(Ne&192)===128&&(Be&192)===128&&(Ue&192)===128&&(Le=(Q&15)<<18|(Ne&63)<<12|(Be&63)<<6|Ue&63,Le>65535&&Le<1114112&&(se=Le))}}se===null?(se=65533,we=1):se>65535&&(se-=65536,P.push(se>>>10&1023|55296),se=56320|se&1023),P.push(se),j+=we}return oe(P)}const le=4096;function oe(S){const g=S.length;if(g<=le)return String.fromCharCode.apply(String,S);let y="",P=0;for(;P<g;)y+=String.fromCharCode.apply(String,S.slice(P,P+=le));return y}function ce(S,g,y){let P="";y=Math.min(S.length,y);for(let j=g;j<y;++j)P+=String.fromCharCode(S[j]&127);return P}function ue(S,g,y){let P="";y=Math.min(S.length,y);for(let j=g;j<y;++j)P+=String.fromCharCode(S[j]);return P}function Ee(S,g,y){const P=S.length;(!g||g<0)&&(g=0),(!y||y<0||y>P)&&(y=P);let j="";for(let Q=g;Q<y;++Q)j+=hi[S[Q]];return j}function Ae(S,g,y){const P=S.slice(g,y);let j="";for(let Q=0;Q<P.length-1;Q+=2)j+=String.fromCharCode(P[Q]+P[Q+1]*256);return j}p.prototype.slice=function(g,y){const P=this.length;g=~~g,y=y===void 0?P:~~y,g<0?(g+=P,g<0&&(g=0)):g>P&&(g=P),y<0?(y+=P,y<0&&(y=0)):y>P&&(y=P),y<g&&(y=g);const j=this.subarray(g,y);return Object.setPrototypeOf(j,p.prototype),j};function Te(S,g,y){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+g>y)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g],Q=1,se=0;for(;++se<y&&(Q*=256);)j+=this[g+se]*Q;return j},p.prototype.readUintBE=p.prototype.readUIntBE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g+--y],Q=1;for(;y>0&&(Q*=256);)j+=this[g+--y]*Q;return j},p.prototype.readUint8=p.prototype.readUInt8=function(g,y){return g=g>>>0,y||Te(g,1,this.length),this[g]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(g,y){return g=g>>>0,y||Te(g,2,this.length),this[g]|this[g+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(g,y){return g=g>>>0,y||Te(g,2,this.length),this[g]<<8|this[g+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},p.prototype.readBigUInt64LE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,Q=this[++g]+this[++g]*2**8+this[++g]*2**16+P*2**24;return BigInt(j)+(BigInt(Q)<<BigInt(32))}),p.prototype.readBigUInt64BE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=y*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],Q=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+P;return(BigInt(j)<<BigInt(32))+BigInt(Q)}),p.prototype.readIntLE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g],Q=1,se=0;for(;++se<y&&(Q*=256);)j+=this[g+se]*Q;return Q*=128,j>=Q&&(j-=Math.pow(2,8*y)),j},p.prototype.readIntBE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=y,Q=1,se=this[g+--j];for(;j>0&&(Q*=256);)se+=this[g+--j]*Q;return Q*=128,se>=Q&&(se-=Math.pow(2,8*y)),se},p.prototype.readInt8=function(g,y){return g=g>>>0,y||Te(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},p.prototype.readInt16LE=function(g,y){g=g>>>0,y||Te(g,2,this.length);const P=this[g]|this[g+1]<<8;return P&32768?P|4294901760:P},p.prototype.readInt16BE=function(g,y){g=g>>>0,y||Te(g,2,this.length);const P=this[g+1]|this[g]<<8;return P&32768?P|4294901760:P},p.prototype.readInt32LE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},p.prototype.readInt32BE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},p.prototype.readBigInt64LE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(P<<24);return(BigInt(j)<<BigInt(32))+BigInt(y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),p.prototype.readBigInt64BE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=(y<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(j)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+P)}),p.prototype.readFloatLE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),t.read(this,g,!0,23,4)},p.prototype.readFloatBE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),t.read(this,g,!1,23,4)},p.prototype.readDoubleLE=function(g,y){return g=g>>>0,y||Te(g,8,this.length),t.read(this,g,!0,52,8)},p.prototype.readDoubleBE=function(g,y){return g=g>>>0,y||Te(g,8,this.length),t.read(this,g,!1,52,8)};function _e(S,g,y,P,j,Q){if(!p.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>j||g<Q)throw new RangeError('"value" argument is out of bounds');if(y+P>S.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(g,y,P,j){if(g=+g,y=y>>>0,P=P>>>0,!j){const we=Math.pow(2,8*P)-1;_e(this,g,y,P,we,0)}let Q=1,se=0;for(this[y]=g&255;++se<P&&(Q*=256);)this[y+se]=g/Q&255;return y+P},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(g,y,P,j){if(g=+g,y=y>>>0,P=P>>>0,!j){const we=Math.pow(2,8*P)-1;_e(this,g,y,P,we,0)}let Q=P-1,se=1;for(this[y+Q]=g&255;--Q>=0&&(se*=256);)this[y+Q]=g/se&255;return y+P},p.prototype.writeUint8=p.prototype.writeUInt8=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,1,255,0),this[y]=g&255,y+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,65535,0),this[y]=g&255,this[y+1]=g>>>8,y+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,65535,0),this[y]=g>>>8,this[y+1]=g&255,y+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,4,4294967295,0),this[y+3]=g>>>24,this[y+2]=g>>>16,this[y+1]=g>>>8,this[y]=g&255,y+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,4,4294967295,0),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4};function lt(S,g,y,P,j){ti(g,P,j,S,y,7);let Q=Number(g&BigInt(4294967295));S[y++]=Q,Q=Q>>8,S[y++]=Q,Q=Q>>8,S[y++]=Q,Q=Q>>8,S[y++]=Q;let se=Number(g>>BigInt(32)&BigInt(4294967295));return S[y++]=se,se=se>>8,S[y++]=se,se=se>>8,S[y++]=se,se=se>>8,S[y++]=se,y}function dt(S,g,y,P,j){ti(g,P,j,S,y,7);let Q=Number(g&BigInt(4294967295));S[y+7]=Q,Q=Q>>8,S[y+6]=Q,Q=Q>>8,S[y+5]=Q,Q=Q>>8,S[y+4]=Q;let se=Number(g>>BigInt(32)&BigInt(4294967295));return S[y+3]=se,se=se>>8,S[y+2]=se,se=se>>8,S[y+1]=se,se=se>>8,S[y]=se,y+8}p.prototype.writeBigUInt64LE=Tt(function(g,y=0){return lt(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=Tt(function(g,y=0){return dt(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(g,y,P,j){if(g=+g,y=y>>>0,!j){const Ne=Math.pow(2,8*P-1);_e(this,g,y,P,Ne-1,-Ne)}let Q=0,se=1,we=0;for(this[y]=g&255;++Q<P&&(se*=256);)g<0&&we===0&&this[y+Q-1]!==0&&(we=1),this[y+Q]=(g/se>>0)-we&255;return y+P},p.prototype.writeIntBE=function(g,y,P,j){if(g=+g,y=y>>>0,!j){const Ne=Math.pow(2,8*P-1);_e(this,g,y,P,Ne-1,-Ne)}let Q=P-1,se=1,we=0;for(this[y+Q]=g&255;--Q>=0&&(se*=256);)g<0&&we===0&&this[y+Q+1]!==0&&(we=1),this[y+Q]=(g/se>>0)-we&255;return y+P},p.prototype.writeInt8=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,1,127,-128),g<0&&(g=255+g+1),this[y]=g&255,y+1},p.prototype.writeInt16LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,32767,-32768),this[y]=g&255,this[y+1]=g>>>8,y+2},p.prototype.writeInt16BE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,32767,-32768),this[y]=g>>>8,this[y+1]=g&255,y+2},p.prototype.writeInt32LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,4,2147483647,-2147483648),this[y]=g&255,this[y+1]=g>>>8,this[y+2]=g>>>16,this[y+3]=g>>>24,y+4},p.prototype.writeInt32BE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4},p.prototype.writeBigInt64LE=Tt(function(g,y=0){return lt(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=Tt(function(g,y=0){return dt(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function tt(S,g,y,P,j,Q){if(y+P>S.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function ht(S,g,y,P,j){return g=+g,y=y>>>0,j||tt(S,g,y,4),t.write(S,g,y,P,23,4),y+4}p.prototype.writeFloatLE=function(g,y,P){return ht(this,g,y,!0,P)},p.prototype.writeFloatBE=function(g,y,P){return ht(this,g,y,!1,P)};function Ct(S,g,y,P,j){return g=+g,y=y>>>0,j||tt(S,g,y,8),t.write(S,g,y,P,52,8),y+8}p.prototype.writeDoubleLE=function(g,y,P){return Ct(this,g,y,!0,P)},p.prototype.writeDoubleBE=function(g,y,P){return Ct(this,g,y,!1,P)},p.prototype.copy=function(g,y,P,j){if(!p.isBuffer(g))throw new TypeError("argument should be a Buffer");if(P||(P=0),!j&&j!==0&&(j=this.length),y>=g.length&&(y=g.length),y||(y=0),j>0&&j<P&&(j=P),j===P||g.length===0||this.length===0)return 0;if(y<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),g.length-y<j-P&&(j=g.length-y+P);const Q=j-P;return this===g&&typeof n.prototype.copyWithin=="function"?this.copyWithin(y,P,j):n.prototype.set.call(g,this.subarray(P,j),y),Q},p.prototype.fill=function(g,y,P,j){if(typeof g=="string"){if(typeof y=="string"?(j=y,y=0,P=this.length):typeof P=="string"&&(j=P,P=this.length),j!==void 0&&typeof j!="string")throw new TypeError("encoding must be a string");if(typeof j=="string"&&!p.isEncoding(j))throw new TypeError("Unknown encoding: "+j);if(g.length===1){const se=g.charCodeAt(0);(j==="utf8"&&se<128||j==="latin1")&&(g=se)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(y<0||this.length<y||this.length<P)throw new RangeError("Out of range index");if(P<=y)return this;y=y>>>0,P=P===void 0?this.length:P>>>0,g||(g=0);let Q;if(typeof g=="number")for(Q=y;Q<P;++Q)this[Q]=g;else{const se=p.isBuffer(g)?g:p.from(g,j),we=se.length;if(we===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for(Q=0;Q<P-y;++Q)this[Q+y]=se[Q%we]}return this};const Qe={};function ft(S,g,y){Qe[S]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(j){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:j,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}ft("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ft("ERR_INVALID_ARG_TYPE",function(S,g){return`The "${S}" argument must be of type number. Received type ${typeof g}`},TypeError),ft("ERR_OUT_OF_RANGE",function(S,g,y){let P=`The value of "${S}" is out of range.`,j=y;return Number.isInteger(y)&&Math.abs(y)>2**32?j=ei(String(y)):typeof y=="bigint"&&(j=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(j=ei(j)),j+="n"),P+=` It must be ${g}. Received ${j}`,P},RangeError);function ei(S){let g="",y=S.length;const P=S[0]==="-"?1:0;for(;y>=P+4;y-=3)g=`_${S.slice(y-3,y)}${g}`;return`${S.slice(0,y)}${g}`}function ut(S,g,y){He(g,"offset"),(S[g]===void 0||S[g+y]===void 0)&&Ht(g,S.length-(y+1))}function ti(S,g,y,P,j,Q){if(S>y||S<g){const se=typeof g=="bigint"?"n":"";let we;throw g===0||g===BigInt(0)?we=`>= 0${se} and < 2${se} ** ${(Q+1)*8}${se}`:we=`>= -(2${se} ** ${(Q+1)*8-1}${se}) and < 2 ** ${(Q+1)*8-1}${se}`,new Qe.ERR_OUT_OF_RANGE("value",we,S)}ut(P,j,Q)}function He(S,g){if(typeof S!="number")throw new Qe.ERR_INVALID_ARG_TYPE(g,"number",S)}function Ht(S,g,y){throw Math.floor(S)!==S?(He(S,y),new Qe.ERR_OUT_OF_RANGE("offset","an integer",S)):g<0?new Qe.ERR_BUFFER_OUT_OF_BOUNDS:new Qe.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,S)}const At=/[^+/0-9A-Za-z-_]/g;function Rt(S){if(S=S.split("=")[0],S=S.trim().replace(At,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function Ie(S,g){g=g||1/0;let y;const P=S.length;let j=null;const Q=[];for(let se=0;se<P;++se){if(y=S.charCodeAt(se),y>55295&&y<57344){if(!j){if(y>56319){(g-=3)>-1&&Q.push(239,191,189);continue}else if(se+1===P){(g-=3)>-1&&Q.push(239,191,189);continue}j=y;continue}if(y<56320){(g-=3)>-1&&Q.push(239,191,189),j=y;continue}y=(j-55296<<10|y-56320)+65536}else j&&(g-=3)>-1&&Q.push(239,191,189);if(j=null,y<128){if((g-=1)<0)break;Q.push(y)}else if(y<2048){if((g-=2)<0)break;Q.push(y>>6|192,y&63|128)}else if(y<65536){if((g-=3)<0)break;Q.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((g-=4)<0)break;Q.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return Q}function je(S){const g=[];for(let y=0;y<S.length;++y)g.push(S.charCodeAt(y)&255);return g}function ze(S,g){let y,P,j;const Q=[];for(let se=0;se<S.length&&!((g-=2)<0);++se)y=S.charCodeAt(se),P=y>>8,j=y%256,Q.push(j),Q.push(P);return Q}function ii(S){return e.toByteArray(Rt(S))}function Lt(S,g,y,P){let j;for(j=0;j<P&&!(j+y>=g.length||j>=S.length);++j)g[j+y]=S[j];return j}function pt(S,g){return S instanceof g||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===g.name}function ri(S){return S!==S}const hi=(function(){const S="0123456789abcdef",g=new Array(256);for(let y=0;y<16;++y){const P=y*16;for(let j=0;j<16;++j)g[P+j]=S[y]+S[j]}return g})();function Tt(S){return typeof BigInt>"u"?Xi:S}function Xi(){throw new Error("BigInt not supported")}})(Vd);const My=Vd.Buffer;var Fy=function(e){return N.atob?N.atob(e):My.from(e,"base64").toString("binary")};function zd(r){for(var e=Fy(r),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Uy extends qo{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
11
+ `);t>-1;t=this.buffer.indexOf(`
12
+ `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const $y=" ",ja=function(r){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(r||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},jy=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Dt=function(r){const e={};if(!r)return e;const t=r.split(jy());let i=t.length,s;for(;i--;)t[i]!==""&&(s=/([^=]*)=(.*)/.exec(t[i]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]);return e},Qu=r=>{const e=r.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class qy extends qo{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,a)=>{const o=a(e);return o===e?n:n.concat([o])},[e]).forEach(n=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){i=ot(ja(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(i={type:"tag",tagType:"map"},t[1]){const a=Dt(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=ja(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=Dt(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=Qu(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Dt(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Dt(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Dt(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=Dt(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split($y)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=Dt(t[1]),["DURATION"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=ja(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=Dt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=Dt(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=Dt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const o=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[o]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=Dt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=Dt(t[1]),["ID","CLASS"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=String(i.attributes[o]))}),["START-DATE","END-DATE"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=new Date(i.attributes[o]))}),["DURATION","PLANNED-DURATION"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=parseFloat(i.attributes[o]))}),["END-ON-NEXT"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=/YES/i.test(i.attributes[o]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=i.attributes[o].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const o in i.attributes){if(!a.test(o))continue;const u=/[0-9A-Fa-f]{6}/g.test(i.attributes[o]),d=/^\d+(\.\d+)?$/.test(i.attributes[o]);i.attributes[o]=u?i.attributes[o].toString(16):d?parseFloat(i.attributes[o]):String(i.attributes[o])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){i={type:"tag",tagType:"content-steering"},i.attributes=Dt(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=Dt(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=Qu(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){i={type:"tag",tagType:"define"},i.attributes=Dt(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:s}){typeof i!="function"&&(i=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){const i=s=>e.test(s)?t(s):s;this.tagMappers.push(i)}}const Vy=r=>r.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),$i=function(r){const e={};return Object.keys(r).forEach(function(t){e[Vy(t)]=r[t]}),e},qa=function(r){const{serverControl:e,targetDuration:t,partTargetDuration:i}=r;if(!e)return;const s="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=t&&t*3,u=i&&i*2;t&&!e.hasOwnProperty(n)&&(e[n]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[n]<o&&(this.trigger("warn",{message:`${s} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${o})`}),e[n]=o),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${s} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<u&&(this.trigger("warn",{message:`${s} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${u}).`}),e[a]=u)};class Hy extends qo{constructor(e={}){super(),this.lineStream=new Uy,this.parseStream=new qy,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let s={},n,a,o=!1;const u=function(){},d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},p="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let T=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let A=0,b=0;const k={};this.on("end",()=>{s.uri||!s.parts&&!s.preloadHints||(!s.map&&n&&(s.map=n),!s.key&&a&&(s.key=a),!s.timeline&&typeof T=="number"&&(s.timeline=T),this.manifest.preloadSegment=s)}),this.parseStream.on("data",function(v){let L,U;if(t.manifest.definitions){for(const $ in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${$}}`,t.manifest.definitions[$])),v.attributes)for(const F in v.attributes)typeof v.attributes[F]=="string"&&(v.attributes[F]=v.attributes[F].replace(`{$${$}}`,t.manifest.definitions[$]))}({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const $={};"length"in v&&(s.byterange=$,$.length=v.length,"offset"in v||(v.offset=A)),"offset"in v&&(s.byterange=$,$.offset=v.offset),A=$.offset+$.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.title&&(s.title=v.title),v.duration>0&&(s.duration=v.duration),v.duration===0&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){a=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===p){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:zd(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(a.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,T=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){n={},v.uri&&(n.uri=v.uri),v.byterange&&(n.byterange=v.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}s.attributes||(s.attributes={}),ot(s.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const $=this.manifest.mediaGroups[v.attributes.TYPE];$[v.attributes["GROUP-ID"]]=$[v.attributes["GROUP-ID"]]||{},L=$[v.attributes["GROUP-ID"]],U={default:/yes/i.test(v.attributes.DEFAULT)},U.default?U.autoselect=!0:U.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(U.language=v.attributes.LANGUAGE),v.attributes.URI&&(U.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(U.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(U.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(U.forced=/yes/i.test(v.attributes.FORCED)),L[v.attributes.NAME]=U},discontinuity(){T+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),s.dateTimeString=v.dateTimeString,s.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:$}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),$===null&&this.manifest.segments.reduceRight((F,H)=>(H.programDateTime=F-H.duration*1e3,H.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,qa.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){s.cueOut=v.data},"cue-out-cont"(){s.cueOutCont=v.data},"cue-in"(){s.cueIn=v.data},skip(){this.manifest.skip=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const $=this.manifest.segments.length,F=$i(v.attributes);s.parts=s.parts||[],s.parts.push(F),F.byterange&&(F.byterange.hasOwnProperty("offset")||(F.byterange.offset=b),b=F.byterange.offset+F.byterange.length);const H=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${H} for segment #${$}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((B,V)=>{B.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${V} lacks required attribute(s): LAST-PART`})})},"server-control"(){const $=this.manifest.serverControl=$i(v.attributes);$.hasOwnProperty("canBlockReload")||($.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),qa.call(this,this.manifest),$.canSkipDateranges&&!$.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const $=this.manifest.segments.length,F=$i(v.attributes),H=F.type&&F.type==="PART";s.preloadHints=s.preloadHints||[],s.preloadHints.push(F),F.byterange&&(F.byterange.hasOwnProperty("offset")||(F.byterange.offset=H?b:0,H&&(b=F.byterange.offset+F.byterange.length)));const B=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${B} for segment #${$}`,v.attributes,["TYPE","URI"]),!!F.type)for(let V=0;V<s.preloadHints.length-1;V++){const G=s.preloadHints[V];G.type&&G.type===F.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${B} for segment #${$} has the same TYPE ${F.type} as preload hint #${V}`})}},"rendition-report"(){const $=$i(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push($);const F=this.manifest.renditionReports.length-1,H=["LAST-MSN","URI"];o&&H.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${F}`,v.attributes,H)},"part-inf"(){this.manifest.partInf=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),qa.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push($i(v.attributes));const $=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${$}`,v.attributes,["ID","START-DATE"]);const F=this.manifest.dateRanges[$];F.endDate&&F.startDate&&new Date(F.endDate)<new Date(F.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),F.duration&&F.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),F.plannedDuration&&F.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const H=!!F.endOnNext;if(H&&!F.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),H&&(F.duration||F.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),F.duration&&F.endDate){const V=F.startDate.getTime()+F.duration*1e3;this.manifest.dateRanges[$].endDate=new Date(V)}if(!k[F.id])k[F.id]=F;else{for(const V in k[F.id])if(F[V]&&JSON.stringify(k[F.id][V])!==JSON.stringify(F[V])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const B=this.manifest.dateRanges.findIndex(V=>V.id===F.id);this.manifest.dateRanges[B]=ot(this.manifest.dateRanges[B],F),k[F.id]=ot(k[F.id],F),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const $=(F,H)=>{if(F in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${F}`});return}this.manifest.definitions[F]=H};if("QUERYPARAM"in v.attributes){if("NAME"in v.attributes||"IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const F=this.params.get(v.attributes.QUERYPARAM);if(!F){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}$(v.attributes.QUERYPARAM,decodeURIComponent(F));return}if("NAME"in v.attributes){if("IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in v.attributes)||typeof v.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${v.attributes.NAME}`});return}$(v.attributes.NAME,v.attributes.VALUE);return}if("IMPORT"in v.attributes){if(!this.mainDefinitions[v.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${v.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}$(v.attributes.IMPORT,this.mainDefinitions[v.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:v.attributes,uri:v.uri,timeline:T}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",v.attributes,["BANDWIDTH","URI"])}}[v.tagType]||u).call(t)},uri(){s.uri=v.uri,i.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),a&&(s.key=a),s.timeline=T,n&&(s.map=n),b=0,this.lastProgramDateTime!==null&&(s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=s.duration*1e3),s={}},comment(){},custom(){v.segment?(s.custom=s.custom||{},s.custom[v.customType]=v.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[v.customType]=v.data)}})[v.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach(function(n){t.hasOwnProperty(n)||s.push(n)}),s.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
13
+ `),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var ar={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},zy=["video","audio","text"],Ju=["Video","Audio","Text"],Wd=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,s){var n=("00"+Number(i).toString(16)).slice(-2),a=("00"+Number(s).toString(16)).slice(-2);return"avc1."+n+"00"+a})},Ti=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(s){s=s.trim();var n;zy.forEach(function(a){var o=ar[a].exec(s.toLowerCase());if(!(!o||o.length<=1)){n=a;var u=s.substring(0,o[1].length),d=s.replace(u,"");i.push({type:u,details:d,mediaType:a})}}),n||i.push({type:s,details:"",mediaType:"unknown"})}),i},Wy=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var s in i){var n=i[s];if(n.default&&n.playlists)return Ti(n.playlists[0].attributes.CODECS)}return null},Gd=function(e){return e===void 0&&(e=""),ar.audio.test(e.trim().toLowerCase())},Gy=function(e){return e===void 0&&(e=""),ar.text.test(e.trim().toLowerCase())},Pr=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Wd(n.trim())}),i="video";t.length===1&&Gd(t[0])?i="audio":t.length===1&&Gy(t[0])&&(i="application");var s="mp4";return t.every(function(n){return ar.mp4.test(n)})?s="mp4":t.every(function(n){return ar.webm.test(n)})?s="webm":t.every(function(n){return ar.ogg.test(n)})&&(s="ogg"),i+"/"+s+';codecs="'+e+'"'}},vs=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),N.MediaSource&&N.MediaSource.isTypeSupported&&N.MediaSource.isTypeSupported(Pr(e))||t&&N.ManagedMediaSource&&N.ManagedMediaSource.isTypeSupported&&N.ManagedMediaSource.isTypeSupported(Pr(e))||!1},Va=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<Ju.length;i++){var s=Ju[i];if(ar["muxer"+s].test(t))return!0}return!1})},Zu="mp4a.40.2",Ky="avc1.4d400d",Xy=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Yy=/^application\/dash\+xml/i,Kd=function(e){return Xy.test(e)?"hls":Yy.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},Qy=function(e){return e.toString(2).length},Jy=function(e){return Math.ceil(Qy(e)/8)},Xd=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Zy=function(e){return Xd(e)},be=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Zy(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},vt=N.BigInt||Number,fo=[vt("0x1"),vt("0x100"),vt("0x10000"),vt("0x1000000"),vt("0x100000000"),vt("0x10000000000"),vt("0x1000000000000"),vt("0x100000000000000"),vt("0x10000000000000000")];(function(){var r=new Uint16Array([65484]),e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var e_=function(e,t){var i=t===void 0?{}:t,s=i.signed,n=s===void 0?!1:s,a=i.le,o=a===void 0?!1:a;e=be(e);var u=o?"reduce":"reduceRight",d=e[u]?e[u]:Array.prototype[u],p=d.call(e,function(A,b,k){var v=o?k:Math.abs(k+1-e.length);return A+vt(b)*fo[v]},vt(0));if(n){var T=fo[e.length]/vt(2)-vt(1);p=vt(p),p>T&&(p-=T,p-=T,p-=vt(2))}return Number(p)},t_=function(e,t){var i={},s=i.le,n=s===void 0?!1:s;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=vt(e);for(var a=Jy(e),o=new Uint8Array(new ArrayBuffer(a)),u=0;u<a;u++){var d=n?u:Math.abs(u+1-o.length);o[d]=Number(e/fo[u]&vt(255)),e<0&&(o[d]=Math.abs(~o[d]),o[d]-=u===0?1:2)}return o},Yd=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i},i_=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(o){return o&&(o.byteLength||o.length)&&typeof o!="string"}),t.length<=1)return be(t[0]);var s=t.reduce(function(o,u,d){return o+(u.byteLength||u.length)},0),n=new Uint8Array(s),a=0;return t.forEach(function(o){o=be(o),n.set(o,a),a+=o.byteLength}),n},Ze=function(e,t,i){var s=i===void 0?{}:i,n=s.offset,a=n===void 0?0:n,o=s.mask,u=o===void 0?[]:o;e=be(e),t=be(t);var d=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&d.call(t,function(p,T){var A=u[T]?u[T]&e[a+T]:e[a+T];return p===A})},r_=function(e,t,i){t.forEach(function(s){for(var n in e.mediaGroups[s])for(var a in e.mediaGroups[s][n]){var o=e.mediaGroups[s][n][a];i(o,s,n,a)}})},ds={},Ri={},er={},ec;function Kn(){if(ec)return er;ec=1;function r(n,a,o){if(o===void 0&&(o=Array.prototype),n&&typeof o.find=="function")return o.find.call(n,a);for(var u=0;u<n.length;u++)if(Object.prototype.hasOwnProperty.call(n,u)){var d=n[u];if(a.call(void 0,d,u,n))return d}}function e(n,a){return a===void 0&&(a=Object),a&&typeof a.freeze=="function"?a.freeze(n):n}function t(n,a){if(n===null||typeof n!="object")throw new TypeError("target is not an object");for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o]);return n}var i=e({HTML:"text/html",isHTML:function(n){return n===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),s=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===s.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return er.assign=t,er.find=r,er.freeze=e,er.MIME_TYPE=i,er.NAMESPACE=s,er}var tc;function Qd(){if(tc)return Ri;tc=1;var r=Kn(),e=r.find,t=r.NAMESPACE;function i(x){return x!==""}function s(x){return x?x.split(/[\t\n\f\r ]+/).filter(i):[]}function n(x,E){return x.hasOwnProperty(E)||(x[E]=!0),x}function a(x){if(!x)return[];var E=s(x);return Object.keys(E.reduce(n,{}))}function o(x){return function(E){return x&&x.indexOf(E)!==-1}}function u(x,E){for(var M in x)Object.prototype.hasOwnProperty.call(x,M)&&(E[M]=x[M])}function d(x,E){var M=x.prototype;if(!(M instanceof E)){let K=function(){};K.prototype=E.prototype,K=new K,u(M,K),x.prototype=M=K}M.constructor!=x&&(typeof x!="function"&&console.error("unknown Class:"+x),M.constructor=x)}var p={},T=p.ELEMENT_NODE=1,A=p.ATTRIBUTE_NODE=2,b=p.TEXT_NODE=3,k=p.CDATA_SECTION_NODE=4,v=p.ENTITY_REFERENCE_NODE=5,L=p.ENTITY_NODE=6,U=p.PROCESSING_INSTRUCTION_NODE=7,$=p.COMMENT_NODE=8,F=p.DOCUMENT_NODE=9,H=p.DOCUMENT_TYPE_NODE=10,B=p.DOCUMENT_FRAGMENT_NODE=11,V=p.NOTATION_NODE=12,G={},ie={};G.INDEX_SIZE_ERR=(ie[1]="Index size error",1),G.DOMSTRING_SIZE_ERR=(ie[2]="DOMString size error",2);var C=G.HIERARCHY_REQUEST_ERR=(ie[3]="Hierarchy request error",3);G.WRONG_DOCUMENT_ERR=(ie[4]="Wrong document",4),G.INVALID_CHARACTER_ERR=(ie[5]="Invalid character",5),G.NO_DATA_ALLOWED_ERR=(ie[6]="No data allowed",6),G.NO_MODIFICATION_ALLOWED_ERR=(ie[7]="No modification allowed",7);var I=G.NOT_FOUND_ERR=(ie[8]="Not found",8);G.NOT_SUPPORTED_ERR=(ie[9]="Not supported",9);var W=G.INUSE_ATTRIBUTE_ERR=(ie[10]="Attribute in use",10);G.INVALID_STATE_ERR=(ie[11]="Invalid state",11),G.SYNTAX_ERR=(ie[12]="Syntax error",12),G.INVALID_MODIFICATION_ERR=(ie[13]="Invalid modification",13),G.NAMESPACE_ERR=(ie[14]="Invalid namespace",14),G.INVALID_ACCESS_ERR=(ie[15]="Invalid access",15);function Y(x,E){if(E instanceof Error)var M=E;else M=this,Error.call(this,ie[x]),this.message=ie[x],Error.captureStackTrace&&Error.captureStackTrace(this,Y);return M.code=x,E&&(this.message=this.message+": "+E),M}Y.prototype=Error.prototype,u(G,Y);function X(){}X.prototype={length:0,item:function(x){return x>=0&&x<this.length?this[x]:null},toString:function(x,E){for(var M=[],K=0;K<this.length;K++)Ne(this[K],M,x,E);return M.join("")},filter:function(x){return Array.prototype.filter.call(this,x)},indexOf:function(x){return Array.prototype.indexOf.call(this,x)}};function ne(x,E){this._node=x,this._refresh=E,de(this)}function de(x){var E=x._node._inc||x._node.ownerDocument._inc;if(x._inc!==E){var M=x._refresh(x._node);if(Le(x,"length",M.length),!x.$$length||M.length<x.$$length)for(var K=M.length;K in x;K++)Object.prototype.hasOwnProperty.call(x,K)&&delete x[K];u(M,x),x._inc=E}}ne.prototype.item=function(x){return de(this),this[x]||null},d(ne,X);function fe(){}function te(x,E){for(var M=x.length;M--;)if(x[M]===E)return M}function le(x,E,M,K){if(K?E[te(E,K)]=M:E[E.length++]=M,x){M.ownerElement=x;var pe=x.ownerDocument;pe&&(K&&lt(pe,x,K),_e(pe,x,M))}}function oe(x,E,M){var K=te(E,M);if(K>=0){for(var pe=E.length-1;K<pe;)E[K]=E[++K];if(E.length=pe,x){var Se=x.ownerDocument;Se&&(lt(Se,x,M),M.ownerElement=null)}}else throw new Y(I,new Error(x.tagName+"@"+M))}fe.prototype={length:0,item:X.prototype.item,getNamedItem:function(x){for(var E=this.length;E--;){var M=this[E];if(M.nodeName==x)return M}},setNamedItem:function(x){var E=x.ownerElement;if(E&&E!=this._ownerElement)throw new Y(W);var M=this.getNamedItem(x.nodeName);return le(this._ownerElement,this,x,M),M},setNamedItemNS:function(x){var E=x.ownerElement,M;if(E&&E!=this._ownerElement)throw new Y(W);return M=this.getNamedItemNS(x.namespaceURI,x.localName),le(this._ownerElement,this,x,M),M},removeNamedItem:function(x){var E=this.getNamedItem(x);return oe(this._ownerElement,this,E),E},removeNamedItemNS:function(x,E){var M=this.getNamedItemNS(x,E);return oe(this._ownerElement,this,M),M},getNamedItemNS:function(x,E){for(var M=this.length;M--;){var K=this[M];if(K.localName==E&&K.namespaceURI==x)return K}return null}};function ce(){}ce.prototype={hasFeature:function(x,E){return!0},createDocument:function(x,E,M){var K=new Te;if(K.implementation=this,K.childNodes=new X,K.doctype=M||null,M&&K.appendChild(M),E){var pe=K.createElementNS(x,E);K.appendChild(pe)}return K},createDocumentType:function(x,E,M){var K=new Tt;return K.name=x,K.nodeName=x,K.publicId=E||"",K.systemId=M||"",K}};function ue(){}ue.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(x,E){return Rt(this,x,E)},replaceChild:function(x,E){Rt(this,x,E,At),E&&this.removeChild(E)},removeChild:function(x){return tt(this,x)},appendChild:function(x){return this.insertBefore(x,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(x){return Ue(this.ownerDocument||this,this,x)},normalize:function(){for(var x=this.firstChild;x;){var E=x.nextSibling;E&&E.nodeType==b&&x.nodeType==b?(this.removeChild(E),x.appendData(E.data)):(x.normalize(),x=E)}},isSupported:function(x,E){return this.ownerDocument.implementation.hasFeature(x,E)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(x){for(var E=this;E;){var M=E._nsMap;if(M){for(var K in M)if(Object.prototype.hasOwnProperty.call(M,K)&&M[K]===x)return K}E=E.nodeType==A?E.ownerDocument:E.parentNode}return null},lookupNamespaceURI:function(x){for(var E=this;E;){var M=E._nsMap;if(M&&Object.prototype.hasOwnProperty.call(M,x))return M[x];E=E.nodeType==A?E.ownerDocument:E.parentNode}return null},isDefaultNamespace:function(x){var E=this.lookupPrefix(x);return E==null}};function Ee(x){return x=="<"&&"&lt;"||x==">"&&"&gt;"||x=="&"&&"&amp;"||x=='"'&&"&quot;"||"&#"+x.charCodeAt()+";"}u(p,ue),u(p,ue.prototype);function Ae(x,E){if(E(x))return!0;if(x=x.firstChild)do if(Ae(x,E))return!0;while(x=x.nextSibling)}function Te(){this.ownerDocument=this}function _e(x,E,M){x&&x._inc++;var K=M.namespaceURI;K===t.XMLNS&&(E._nsMap[M.prefix?M.localName:""]=M.value)}function lt(x,E,M,K){x&&x._inc++;var pe=M.namespaceURI;pe===t.XMLNS&&delete E._nsMap[M.prefix?M.localName:""]}function dt(x,E,M){if(x&&x._inc){x._inc++;var K=E.childNodes;if(M)K[K.length++]=M;else{for(var pe=E.firstChild,Se=0;pe;)K[Se++]=pe,pe=pe.nextSibling;K.length=Se,delete K[K.length]}}}function tt(x,E){var M=E.previousSibling,K=E.nextSibling;return M?M.nextSibling=K:x.firstChild=K,K?K.previousSibling=M:x.lastChild=M,E.parentNode=null,E.previousSibling=null,E.nextSibling=null,dt(x.ownerDocument,x),E}function ht(x){return x&&(x.nodeType===ue.DOCUMENT_NODE||x.nodeType===ue.DOCUMENT_FRAGMENT_NODE||x.nodeType===ue.ELEMENT_NODE)}function Ct(x){return x&&(ft(x)||ei(x)||Qe(x)||x.nodeType===ue.DOCUMENT_FRAGMENT_NODE||x.nodeType===ue.COMMENT_NODE||x.nodeType===ue.PROCESSING_INSTRUCTION_NODE)}function Qe(x){return x&&x.nodeType===ue.DOCUMENT_TYPE_NODE}function ft(x){return x&&x.nodeType===ue.ELEMENT_NODE}function ei(x){return x&&x.nodeType===ue.TEXT_NODE}function ut(x,E){var M=x.childNodes||[];if(e(M,ft)||Qe(E))return!1;var K=e(M,Qe);return!(E&&K&&M.indexOf(K)>M.indexOf(E))}function ti(x,E){var M=x.childNodes||[];function K(Se){return ft(Se)&&Se!==E}if(e(M,K))return!1;var pe=e(M,Qe);return!(E&&pe&&M.indexOf(pe)>M.indexOf(E))}function He(x,E,M){if(!ht(x))throw new Y(C,"Unexpected parent node type "+x.nodeType);if(M&&M.parentNode!==x)throw new Y(I,"child not in parent");if(!Ct(E)||Qe(E)&&x.nodeType!==ue.DOCUMENT_NODE)throw new Y(C,"Unexpected node type "+E.nodeType+" for parent node type "+x.nodeType)}function Ht(x,E,M){var K=x.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var Se=pe.filter(ft);if(Se.length>1||e(pe,ei))throw new Y(C,"More than one element or text in fragment");if(Se.length===1&&!ut(x,M))throw new Y(C,"Element in fragment can not be inserted before doctype")}if(ft(E)&&!ut(x,M))throw new Y(C,"Only one element can be added and only after doctype");if(Qe(E)){if(e(K,Qe))throw new Y(C,"Only one doctype is allowed");var qe=e(K,ft);if(M&&K.indexOf(qe)<K.indexOf(M))throw new Y(C,"Doctype can only be inserted before an element");if(!M&&qe)throw new Y(C,"Doctype can not be appended since element is present")}}function At(x,E,M){var K=x.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var Se=pe.filter(ft);if(Se.length>1||e(pe,ei))throw new Y(C,"More than one element or text in fragment");if(Se.length===1&&!ti(x,M))throw new Y(C,"Element in fragment can not be inserted before doctype")}if(ft(E)&&!ti(x,M))throw new Y(C,"Only one element can be added and only after doctype");if(Qe(E)){if(e(K,function(Ft){return Qe(Ft)&&Ft!==M}))throw new Y(C,"Only one doctype is allowed");var qe=e(K,ft);if(M&&K.indexOf(qe)<K.indexOf(M))throw new Y(C,"Doctype can only be inserted before an element")}}function Rt(x,E,M,K){He(x,E,M),x.nodeType===ue.DOCUMENT_NODE&&(K||Ht)(x,E,M);var pe=E.parentNode;if(pe&&pe.removeChild(E),E.nodeType===B){var Se=E.firstChild;if(Se==null)return E;var qe=E.lastChild}else Se=qe=E;var bt=M?M.previousSibling:x.lastChild;Se.previousSibling=bt,qe.nextSibling=M,bt?bt.nextSibling=Se:x.firstChild=Se,M==null?x.lastChild=qe:M.previousSibling=qe;do{Se.parentNode=x;var Ft=x.ownerDocument||x;Ie(Se,Ft)}while(Se!==qe&&(Se=Se.nextSibling));return dt(x.ownerDocument||x,x),E.nodeType==B&&(E.firstChild=E.lastChild=null),E}function Ie(x,E){if(x.ownerDocument!==E){if(x.ownerDocument=E,x.nodeType===T&&x.attributes)for(var M=0;M<x.attributes.length;M++){var K=x.attributes.item(M);K&&(K.ownerDocument=E)}for(var pe=x.firstChild;pe;)Ie(pe,E),pe=pe.nextSibling}}function je(x,E){E.parentNode&&E.parentNode.removeChild(E),E.parentNode=x,E.previousSibling=x.lastChild,E.nextSibling=null,E.previousSibling?E.previousSibling.nextSibling=E:x.firstChild=E,x.lastChild=E,dt(x.ownerDocument,x,E);var M=x.ownerDocument||x;return Ie(E,M),E}Te.prototype={nodeName:"#document",nodeType:F,doctype:null,documentElement:null,_inc:1,insertBefore:function(x,E){if(x.nodeType==B){for(var M=x.firstChild;M;){var K=M.nextSibling;this.insertBefore(M,E),M=K}return x}return Rt(this,x,E),Ie(x,this),this.documentElement===null&&x.nodeType===T&&(this.documentElement=x),x},removeChild:function(x){return this.documentElement==x&&(this.documentElement=null),tt(this,x)},replaceChild:function(x,E){Rt(this,x,E,At),Ie(x,this),E&&this.removeChild(E),ft(x)&&(this.documentElement=x)},importNode:function(x,E){return Be(this,x,E)},getElementById:function(x){var E=null;return Ae(this.documentElement,function(M){if(M.nodeType==T&&M.getAttribute("id")==x)return E=M,!0}),E},getElementsByClassName:function(x){var E=a(x);return new ne(this,function(M){var K=[];return E.length>0&&Ae(M.documentElement,function(pe){if(pe!==M&&pe.nodeType===T){var Se=pe.getAttribute("class");if(Se){var qe=x===Se;if(!qe){var bt=a(Se);qe=E.every(o(bt))}qe&&K.push(pe)}}}),K})},createElement:function(x){var E=new ze;E.ownerDocument=this,E.nodeName=x,E.tagName=x,E.localName=x,E.childNodes=new X;var M=E.attributes=new fe;return M._ownerElement=E,E},createDocumentFragment:function(){var x=new y;return x.ownerDocument=this,x.childNodes=new X,x},createTextNode:function(x){var E=new pt;return E.ownerDocument=this,E.appendData(x),E},createComment:function(x){var E=new ri;return E.ownerDocument=this,E.appendData(x),E},createCDATASection:function(x){var E=new hi;return E.ownerDocument=this,E.appendData(x),E},createProcessingInstruction:function(x,E){var M=new P;return M.ownerDocument=this,M.tagName=M.nodeName=M.target=x,M.nodeValue=M.data=E,M},createAttribute:function(x){var E=new ii;return E.ownerDocument=this,E.name=x,E.nodeName=x,E.localName=x,E.specified=!0,E},createEntityReference:function(x){var E=new g;return E.ownerDocument=this,E.nodeName=x,E},createElementNS:function(x,E){var M=new ze,K=E.split(":"),pe=M.attributes=new fe;return M.childNodes=new X,M.ownerDocument=this,M.nodeName=E,M.tagName=E,M.namespaceURI=x,K.length==2?(M.prefix=K[0],M.localName=K[1]):M.localName=E,pe._ownerElement=M,M},createAttributeNS:function(x,E){var M=new ii,K=E.split(":");return M.ownerDocument=this,M.nodeName=E,M.name=E,M.namespaceURI=x,M.specified=!0,K.length==2?(M.prefix=K[0],M.localName=K[1]):M.localName=E,M}},d(Te,ue);function ze(){this._nsMap={}}ze.prototype={nodeType:T,hasAttribute:function(x){return this.getAttributeNode(x)!=null},getAttribute:function(x){var E=this.getAttributeNode(x);return E&&E.value||""},getAttributeNode:function(x){return this.attributes.getNamedItem(x)},setAttribute:function(x,E){var M=this.ownerDocument.createAttribute(x);M.value=M.nodeValue=""+E,this.setAttributeNode(M)},removeAttribute:function(x){var E=this.getAttributeNode(x);E&&this.removeAttributeNode(E)},appendChild:function(x){return x.nodeType===B?this.insertBefore(x,null):je(this,x)},setAttributeNode:function(x){return this.attributes.setNamedItem(x)},setAttributeNodeNS:function(x){return this.attributes.setNamedItemNS(x)},removeAttributeNode:function(x){return this.attributes.removeNamedItem(x.nodeName)},removeAttributeNS:function(x,E){var M=this.getAttributeNodeNS(x,E);M&&this.removeAttributeNode(M)},hasAttributeNS:function(x,E){return this.getAttributeNodeNS(x,E)!=null},getAttributeNS:function(x,E){var M=this.getAttributeNodeNS(x,E);return M&&M.value||""},setAttributeNS:function(x,E,M){var K=this.ownerDocument.createAttributeNS(x,E);K.value=K.nodeValue=""+M,this.setAttributeNode(K)},getAttributeNodeNS:function(x,E){return this.attributes.getNamedItemNS(x,E)},getElementsByTagName:function(x){return new ne(this,function(E){var M=[];return Ae(E,function(K){K!==E&&K.nodeType==T&&(x==="*"||K.tagName==x)&&M.push(K)}),M})},getElementsByTagNameNS:function(x,E){return new ne(this,function(M){var K=[];return Ae(M,function(pe){pe!==M&&pe.nodeType===T&&(x==="*"||pe.namespaceURI===x)&&(E==="*"||pe.localName==E)&&K.push(pe)}),K})}},Te.prototype.getElementsByTagName=ze.prototype.getElementsByTagName,Te.prototype.getElementsByTagNameNS=ze.prototype.getElementsByTagNameNS,d(ze,ue);function ii(){}ii.prototype.nodeType=A,d(ii,ue);function Lt(){}Lt.prototype={data:"",substringData:function(x,E){return this.data.substring(x,x+E)},appendData:function(x){x=this.data+x,this.nodeValue=this.data=x,this.length=x.length},insertData:function(x,E){this.replaceData(x,0,E)},appendChild:function(x){throw new Error(ie[C])},deleteData:function(x,E){this.replaceData(x,E,"")},replaceData:function(x,E,M){var K=this.data.substring(0,x),pe=this.data.substring(x+E);M=K+M+pe,this.nodeValue=this.data=M,this.length=M.length}},d(Lt,ue);function pt(){}pt.prototype={nodeName:"#text",nodeType:b,splitText:function(x){var E=this.data,M=E.substring(x);E=E.substring(0,x),this.data=this.nodeValue=E,this.length=E.length;var K=this.ownerDocument.createTextNode(M);return this.parentNode&&this.parentNode.insertBefore(K,this.nextSibling),K}},d(pt,Lt);function ri(){}ri.prototype={nodeName:"#comment",nodeType:$},d(ri,Lt);function hi(){}hi.prototype={nodeName:"#cdata-section",nodeType:k},d(hi,Lt);function Tt(){}Tt.prototype.nodeType=H,d(Tt,ue);function Xi(){}Xi.prototype.nodeType=V,d(Xi,ue);function S(){}S.prototype.nodeType=L,d(S,ue);function g(){}g.prototype.nodeType=v,d(g,ue);function y(){}y.prototype.nodeName="#document-fragment",y.prototype.nodeType=B,d(y,ue);function P(){}P.prototype.nodeType=U,d(P,ue);function j(){}j.prototype.serializeToString=function(x,E,M){return Q.call(x,E,M)},ue.prototype.toString=Q;function Q(x,E){var M=[],K=this.nodeType==9&&this.documentElement||this,pe=K.prefix,Se=K.namespaceURI;if(Se&&pe==null){var pe=K.lookupPrefix(Se);if(pe==null)var qe=[{namespace:Se,prefix:null}]}return Ne(this,M,x,E,qe),M.join("")}function se(x,E,M){var K=x.prefix||"",pe=x.namespaceURI;if(!pe||K==="xml"&&pe===t.XML||pe===t.XMLNS)return!1;for(var Se=M.length;Se--;){var qe=M[Se];if(qe.prefix===K)return qe.namespace!==pe}return!0}function we(x,E,M){x.push(" ",E,'="',M.replace(/[<>&"\t\n\r]/g,Ee),'"')}function Ne(x,E,M,K,pe){if(pe||(pe=[]),K)if(x=K(x),x){if(typeof x=="string"){E.push(x);return}}else return;switch(x.nodeType){case T:var Se=x.attributes,qe=Se.length,We=x.firstChild,bt=x.tagName;M=t.isHTML(x.namespaceURI)||M;var Ft=bt;if(!M&&!x.prefix&&x.namespaceURI){for(var fi,zt=0;zt<Se.length;zt++)if(Se.item(zt).name==="xmlns"){fi=Se.item(zt).value;break}if(!fi)for(var si=pe.length-1;si>=0;si--){var Wt=pe[si];if(Wt.prefix===""&&Wt.namespace===x.namespaceURI){fi=Wt.namespace;break}}if(fi!==x.namespaceURI)for(var si=pe.length-1;si>=0;si--){var Wt=pe[si];if(Wt.namespace===x.namespaceURI){Wt.prefix&&(Ft=Wt.prefix+":"+bt);break}}}E.push("<",Ft);for(var st=0;st<qe;st++){var Gt=Se.item(st);Gt.prefix=="xmlns"?pe.push({prefix:Gt.localName,namespace:Gt.value}):Gt.nodeName=="xmlns"&&pe.push({prefix:"",namespace:Gt.value})}for(var st=0;st<qe;st++){var Gt=Se.item(st);if(se(Gt,M,pe)){var Ii=Gt.prefix||"",pi=Gt.namespaceURI;we(E,Ii?"xmlns:"+Ii:"xmlns",pi),pe.push({prefix:Ii,namespace:pi})}Ne(Gt,E,M,K,pe)}if(bt===Ft&&se(x,M,pe)){var Ii=x.prefix||"",pi=x.namespaceURI;we(E,Ii?"xmlns:"+Ii:"xmlns",pi),pe.push({prefix:Ii,namespace:pi})}if(We||M&&!/^(?:meta|link|img|br|hr|input)$/i.test(bt)){if(E.push(">"),M&&/^script$/i.test(bt))for(;We;)We.data?E.push(We.data):Ne(We,E,M,K,pe.slice()),We=We.nextSibling;else for(;We;)Ne(We,E,M,K,pe.slice()),We=We.nextSibling;E.push("</",Ft,">")}else E.push("/>");return;case F:case B:for(var We=x.firstChild;We;)Ne(We,E,M,K,pe.slice()),We=We.nextSibling;return;case A:return we(E,x.name,x.value);case b:return E.push(x.data.replace(/[<&>]/g,Ee));case k:return E.push("<![CDATA[",x.data,"]]>");case $:return E.push("<!--",x.data,"-->");case H:var Yi=x.publicId,Re=x.systemId;if(E.push("<!DOCTYPE ",x.name),Yi)E.push(" PUBLIC ",Yi),Re&&Re!="."&&E.push(" ",Re),E.push(">");else if(Re&&Re!=".")E.push(" SYSTEM ",Re,">");else{var Ms=x.internalSubset;Ms&&E.push(" [",Ms,"]"),E.push(">")}return;case U:return E.push("<?",x.target," ",x.data,"?>");case v:return E.push("&",x.nodeName,";");default:E.push("??",x.nodeName)}}function Be(x,E,M){var K;switch(E.nodeType){case T:K=E.cloneNode(!1),K.ownerDocument=x;case B:break;case A:M=!0;break}if(K||(K=E.cloneNode(!1)),K.ownerDocument=x,K.parentNode=null,M)for(var pe=E.firstChild;pe;)K.appendChild(Be(x,pe,M)),pe=pe.nextSibling;return K}function Ue(x,E,M){var K=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var Se=E[pe];typeof Se!="object"&&Se!=K[pe]&&(K[pe]=Se)}switch(E.childNodes&&(K.childNodes=new X),K.ownerDocument=x,K.nodeType){case T:var qe=E.attributes,bt=K.attributes=new fe,Ft=qe.length;bt._ownerElement=K;for(var fi=0;fi<Ft;fi++)K.setAttributeNode(Ue(x,qe.item(fi),!0));break;case A:M=!0}if(M)for(var zt=E.firstChild;zt;)K.appendChild(Ue(x,zt,M)),zt=zt.nextSibling;return K}function Le(x,E,M){x[E]=M}try{if(Object.defineProperty){let x=function(E){switch(E.nodeType){case T:case B:var M=[];for(E=E.firstChild;E;)E.nodeType!==7&&E.nodeType!==8&&M.push(x(E)),E=E.nextSibling;return M.join("");default:return E.nodeValue}};Object.defineProperty(ne.prototype,"length",{get:function(){return de(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){return x(this)},set:function(E){switch(this.nodeType){case T:case B:for(;this.firstChild;)this.removeChild(this.firstChild);(E||String(E))&&this.appendChild(this.ownerDocument.createTextNode(E));break;default:this.data=E,this.value=E,this.nodeValue=E}}}),Le=function(E,M,K){E["$$"+M]=K}}}catch{}return Ri.DocumentType=Tt,Ri.DOMException=Y,Ri.DOMImplementation=ce,Ri.Element=ze,Ri.Node=ue,Ri.NodeList=X,Ri.XMLSerializer=j,Ri}var hs={},Ha={},ic;function s_(){return ic||(ic=1,(function(r){var e=Kn().freeze;r.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
14
+ `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),r.entityMap=r.HTML_ENTITIES})(Ha)),Ha}var un={},rc;function n_(){if(rc)return un;rc=1;var r=Kn().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),s=0,n=1,a=2,o=3,u=4,d=5,p=6,T=7;function A(C,I){this.message=C,this.locator=I,Error.captureStackTrace&&Error.captureStackTrace(this,A)}A.prototype=new Error,A.prototype.name=A.name;function b(){}b.prototype={parse:function(C,I,W){var Y=this.domBuilder;Y.startDocument(),H(I,I={}),k(C,I,W,Y,this.errorHandler),Y.endDocument()}};function k(C,I,W,Y,X){function ne(je){if(je>65535){je-=65536;var ze=55296+(je>>10),ii=56320+(je&1023);return String.fromCharCode(ze,ii)}else return String.fromCharCode(je)}function de(je){var ze=je.slice(1,-1);return Object.hasOwnProperty.call(W,ze)?W[ze]:ze.charAt(0)==="#"?ne(parseInt(ze.substr(1).replace("x","0x"))):(X.error("entity not found:"+je),je)}function fe(je){if(je>Te){var ze=C.substring(Te,je).replace(/&#?\w+;/g,de);ue&&te(Te),Y.characters(ze,0,je-Te),Te=je}}function te(je,ze){for(;je>=oe&&(ze=ce.exec(C));)le=ze.index,oe=le+ze[0].length,ue.lineNumber++;ue.columnNumber=je-le+1}for(var le=0,oe=0,ce=/.*(?:\r\n?|\n)|.*$/g,ue=Y.locator,Ee=[{currentNSMap:I}],Ae={},Te=0;;){try{var _e=C.indexOf("<",Te);if(_e<0){if(!C.substr(Te).match(/^\s*$/)){var lt=Y.doc,dt=lt.createTextNode(C.substr(Te));lt.appendChild(dt),Y.currentElement=dt}return}switch(_e>Te&&fe(_e),C.charAt(_e+1)){case"/":var He=C.indexOf(">",_e+3),tt=C.substring(_e+2,He).replace(/[ \t\n\r]+$/g,""),ht=Ee.pop();He<0?(tt=C.substring(_e+2).replace(/[\s<].*/,""),X.error("end tag name: "+tt+" is not complete:"+ht.tagName),He=_e+1+tt.length):tt.match(/\s</)&&(tt=tt.replace(/[\s<].*/,""),X.error("end tag name: "+tt+" maybe not complete"),He=_e+1+tt.length);var Ct=ht.localNSMap,Qe=ht.tagName==tt,ft=Qe||ht.tagName&&ht.tagName.toLowerCase()==tt.toLowerCase();if(ft){if(Y.endElement(ht.uri,ht.localName,tt),Ct)for(var ei in Ct)Object.prototype.hasOwnProperty.call(Ct,ei)&&Y.endPrefixMapping(ei);Qe||X.fatalError("end tag name: "+tt+" is not match the current start tagName:"+ht.tagName)}else Ee.push(ht);He++;break;case"?":ue&&te(_e),He=V(C,_e,Y);break;case"!":ue&&te(_e),He=B(C,_e,Y,X);break;default:ue&&te(_e);var ut=new G,ti=Ee[Ee.length-1].currentNSMap,He=L(C,_e,ut,ti,de,X),Ht=ut.length;if(!ut.closed&&F(C,He,ut.tagName,Ae)&&(ut.closed=!0,W.nbsp||X.warning("unclosed xml attribute")),ue&&Ht){for(var At=v(ue,{}),Rt=0;Rt<Ht;Rt++){var Ie=ut[Rt];te(Ie.offset),Ie.locator=v(ue,{})}Y.locator=At,U(ut,Y,ti)&&Ee.push(ut),Y.locator=ue}else U(ut,Y,ti)&&Ee.push(ut);r.isHTML(ut.uri)&&!ut.closed?He=$(C,He,ut.tagName,de,Y):He++}}catch(je){if(je instanceof A)throw je;X.error("element parse error: "+je),He=-1}He>Te?Te=He:fe(Math.max(_e,Te)+1)}}function v(C,I){return I.lineNumber=C.lineNumber,I.columnNumber=C.columnNumber,I}function L(C,I,W,Y,X,ne){function de(ue,Ee,Ae){W.attributeNames.hasOwnProperty(ue)&&ne.fatalError("Attribute "+ue+" redefined"),W.addValue(ue,Ee.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,X),Ae)}for(var fe,te,le=++I,oe=s;;){var ce=C.charAt(le);switch(ce){case"=":if(oe===n)fe=C.slice(I,le),oe=o;else if(oe===a)oe=o;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(oe===o||oe===n)if(oe===n&&(ne.warning('attribute value must after "="'),fe=C.slice(I,le)),I=le+1,le=C.indexOf(ce,I),le>0)te=C.slice(I,le),de(fe,te,I-1),oe=d;else throw new Error("attribute value no end '"+ce+"' match");else if(oe==u)te=C.slice(I,le),de(fe,te,I),ne.warning('attribute "'+fe+'" missed start quot('+ce+")!!"),I=le+1,oe=d;else throw new Error('attribute value must after "="');break;case"/":switch(oe){case s:W.setTagName(C.slice(I,le));case d:case p:case T:oe=T,W.closed=!0;case u:case n:break;case a:W.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ne.error("unexpected end of input"),oe==s&&W.setTagName(C.slice(I,le)),le;case">":switch(oe){case s:W.setTagName(C.slice(I,le));case d:case p:case T:break;case u:case n:te=C.slice(I,le),te.slice(-1)==="/"&&(W.closed=!0,te=te.slice(0,-1));case a:oe===a&&(te=fe),oe==u?(ne.warning('attribute "'+te+'" missed quot(")!'),de(fe,te,I)):((!r.isHTML(Y[""])||!te.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+te+'" missed value!! "'+te+'" instead!!'),de(te,te,I));break;case o:throw new Error("attribute value missed!!")}return le;case"€":ce=" ";default:if(ce<=" ")switch(oe){case s:W.setTagName(C.slice(I,le)),oe=p;break;case n:fe=C.slice(I,le),oe=a;break;case u:var te=C.slice(I,le);ne.warning('attribute "'+te+'" missed quot(")!!'),de(fe,te,I);case d:oe=p;break}else switch(oe){case a:W.tagName,(!r.isHTML(Y[""])||!fe.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+fe+'" missed value!! "'+fe+'" instead2!!'),de(fe,fe,I),I=le,oe=n;break;case d:ne.warning('attribute space is required"'+fe+'"!!');case p:oe=n,I=le;break;case o:oe=u,I=le;break;case T:throw new Error("elements closed character '/' and '>' must be connected to")}}le++}}function U(C,I,W){for(var Y=C.tagName,X=null,ce=C.length;ce--;){var ne=C[ce],de=ne.qName,fe=ne.value,ue=de.indexOf(":");if(ue>0)var te=ne.prefix=de.slice(0,ue),le=de.slice(ue+1),oe=te==="xmlns"&&le;else le=de,te=null,oe=de==="xmlns"&&"";ne.localName=le,oe!==!1&&(X==null&&(X={},H(W,W={})),W[oe]=X[oe]=fe,ne.uri=r.XMLNS,I.startPrefixMapping(oe,fe))}for(var ce=C.length;ce--;){ne=C[ce];var te=ne.prefix;te&&(te==="xml"&&(ne.uri=r.XML),te!=="xmlns"&&(ne.uri=W[te||""]))}var ue=Y.indexOf(":");ue>0?(te=C.prefix=Y.slice(0,ue),le=C.localName=Y.slice(ue+1)):(te=null,le=C.localName=Y);var Ee=C.uri=W[te||""];if(I.startElement(Ee,le,Y,C),C.closed){if(I.endElement(Ee,le,Y),X)for(te in X)Object.prototype.hasOwnProperty.call(X,te)&&I.endPrefixMapping(te)}else return C.currentNSMap=W,C.localNSMap=X,!0}function $(C,I,W,Y,X){if(/^(?:script|textarea)$/i.test(W)){var ne=C.indexOf("</"+W+">",I),de=C.substring(I+1,ne);if(/[&<]/.test(de))return/^script$/i.test(W)?(X.characters(de,0,de.length),ne):(de=de.replace(/&#?\w+;/g,Y),X.characters(de,0,de.length),ne)}return I+1}function F(C,I,W,Y){var X=Y[W];return X==null&&(X=C.lastIndexOf("</"+W+">"),X<I&&(X=C.lastIndexOf("</"+W)),Y[W]=X),X<I}function H(C,I){for(var W in C)Object.prototype.hasOwnProperty.call(C,W)&&(I[W]=C[W])}function B(C,I,W,Y){var X=C.charAt(I+2);switch(X){case"-":if(C.charAt(I+3)==="-"){var ne=C.indexOf("-->",I+4);return ne>I?(W.comment(C,I+4,ne-I-4),ne+3):(Y.error("Unclosed comment"),-1)}else return-1;default:if(C.substr(I+3,6)=="CDATA["){var ne=C.indexOf("]]>",I+9);return W.startCDATA(),W.characters(C,I+9,ne-I-9),W.endCDATA(),ne+3}var de=ie(C,I),fe=de.length;if(fe>1&&/!doctype/i.test(de[0][0])){var te=de[1][0],le=!1,oe=!1;fe>3&&(/^public$/i.test(de[2][0])?(le=de[3][0],oe=fe>4&&de[4][0]):/^system$/i.test(de[2][0])&&(oe=de[3][0]));var ce=de[fe-1];return W.startDTD(te,le,oe),W.endDTD(),ce.index+ce[0].length}}return-1}function V(C,I,W){var Y=C.indexOf("?>",I);if(Y){var X=C.substring(I,Y).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return X?(X[0].length,W.processingInstruction(X[1],X[2]),Y+2):-1}return-1}function G(){this.attributeNames={}}G.prototype={setTagName:function(C){if(!i.test(C))throw new Error("invalid tagName:"+C);this.tagName=C},addValue:function(C,I,W){if(!i.test(C))throw new Error("invalid attribute:"+C);this.attributeNames[C]=this.length,this[this.length++]={qName:C,value:I,offset:W}},length:0,getLocalName:function(C){return this[C].localName},getLocator:function(C){return this[C].locator},getQName:function(C){return this[C].qName},getURI:function(C){return this[C].uri},getValue:function(C){return this[C].value}};function ie(C,I){var W,Y=[],X=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(X.lastIndex=I,X.exec(C);W=X.exec(C);)if(Y.push(W),W[1])return Y}return un.XMLReader=b,un.ParseError=A,un}var sc;function a_(){if(sc)return hs;sc=1;var r=Kn(),e=Qd(),t=s_(),i=n_(),s=e.DOMImplementation,n=r.NAMESPACE,a=i.ParseError,o=i.XMLReader;function u(L){return L.replace(/\r[\n\u0085]/g,`
15
+ `).replace(/[\r\u0085\u2028]/g,`
16
+ `)}function d(L){this.options=L||{locator:{}}}d.prototype.parseFromString=function(L,U){var $=this.options,F=new o,H=$.domBuilder||new T,B=$.errorHandler,V=$.locator,G=$.xmlns||{},ie=/\/x?html?$/.test(U),C=ie?t.HTML_ENTITIES:t.XML_ENTITIES;V&&H.setDocumentLocator(V),F.errorHandler=p(B,H,V),F.domBuilder=$.domBuilder||H,ie&&(G[""]=n.HTML),G.xml=G.xml||n.XML;var I=$.normalizeLineEndings||u;return L&&typeof L=="string"?F.parse(I(L),G,C):F.errorHandler.error("invalid doc source"),H.doc};function p(L,U,$){if(!L){if(U instanceof T)return U;L=U}var F={},H=L instanceof Function;$=$||{};function B(V){var G=L[V];!G&&H&&(G=L.length==2?function(ie){L(V,ie)}:L),F[V]=G&&function(ie){G("[xmldom "+V+"] "+ie+b($))}||function(){}}return B("warning"),B("error"),B("fatalError"),F}function T(){this.cdata=!1}function A(L,U){U.lineNumber=L.lineNumber,U.columnNumber=L.columnNumber}T.prototype={startDocument:function(){this.doc=new s().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(L,U,$,F){var H=this.doc,B=H.createElementNS(L,$||U),V=F.length;v(this,B),this.currentElement=B,this.locator&&A(this.locator,B);for(var G=0;G<V;G++){var L=F.getURI(G),ie=F.getValue(G),$=F.getQName(G),C=H.createAttributeNS(L,$);this.locator&&A(F.getLocator(G),C),C.value=C.nodeValue=ie,B.setAttributeNode(C)}},endElement:function(L,U,$){var F=this.currentElement;F.tagName,this.currentElement=F.parentNode},startPrefixMapping:function(L,U){},endPrefixMapping:function(L){},processingInstruction:function(L,U){var $=this.doc.createProcessingInstruction(L,U);this.locator&&A(this.locator,$),v(this,$)},ignorableWhitespace:function(L,U,$){},characters:function(L,U,$){if(L=k.apply(this,arguments),L){if(this.cdata)var F=this.doc.createCDATASection(L);else var F=this.doc.createTextNode(L);this.currentElement?this.currentElement.appendChild(F):/^\s*$/.test(L)&&this.doc.appendChild(F),this.locator&&A(this.locator,F)}},skippedEntity:function(L){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(L){(this.locator=L)&&(L.lineNumber=0)},comment:function(L,U,$){L=k.apply(this,arguments);var F=this.doc.createComment(L);this.locator&&A(this.locator,F),v(this,F)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(L,U,$){var F=this.doc.implementation;if(F&&F.createDocumentType){var H=F.createDocumentType(L,U,$);this.locator&&A(this.locator,H),v(this,H),this.doc.doctype=H}},warning:function(L){console.warn("[xmldom warning] "+L,b(this.locator))},error:function(L){console.error("[xmldom error] "+L,b(this.locator))},fatalError:function(L){throw new a(L,this.locator)}};function b(L){if(L)return`
17
+ @`+(L.systemId||"")+"#[line:"+L.lineNumber+",col:"+L.columnNumber+"]"}function k(L,U,$){return typeof L=="string"?L.substr(U,$):L.length>=U+$||U?new java.lang.String(L,U,$)+"":L}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(L){T.prototype[L]=function(){return null}});function v(L,U){L.currentElement?L.currentElement.appendChild(U):L.doc.appendChild(U)}return hs.__DOMHandler=T,hs.normalizeLineEndings=u,hs.DOMParser=d,hs}var nc;function o_(){if(nc)return ds;nc=1;var r=Qd();return ds.DOMImplementation=r.DOMImplementation,ds.XMLSerializer=r.XMLSerializer,ds.DOMParser=a_().DOMParser,ds}var Ho=o_();const l_=ui.getDefaultExportFromCjs(Ho),u_=bg({__proto__:null,default:l_},[Ho]);const ac=r=>!!r&&typeof r=="object",yt=(...r)=>r.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ac(e[i])&&ac(t[i])?e[i]=yt(e[i],t[i]):e[i]=t[i]}),e),{}),Jd=r=>Object.keys(r).map(e=>r[e]),c_=(r,e)=>{const t=[];for(let i=r;i<e;i++)t.push(i);return t},Rr=r=>r.reduce((e,t)=>e.concat(t),[]),Zd=r=>{if(!r.length)return[];const e=[];for(let t=0;t<r.length;t++)e.push(r[t]);return e},d_=(r,e)=>r.reduce((t,i,s)=>(i[e]&&t.push(s),t),[]),h_=(r,e)=>Jd(r.reduce((t,i)=>(i.forEach(s=>{t[e(s)]=s}),t),{}));var Lr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const ws=({baseUrl:r="",source:e="",range:t="",indexRange:i=""})=>{const s={uri:e,resolvedUri:Wn(r||"",e)};if(t||i){const a=(t||i).split("-");let o=N.BigInt?N.BigInt(a[0]):parseInt(a[0],10),u=N.BigInt?N.BigInt(a[1]):parseInt(a[1],10);o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o)),u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u));let d;typeof u=="bigint"||typeof o=="bigint"?d=N.BigInt(u)-N.BigInt(o)+N.BigInt(1):d=u-o+1,typeof d=="bigint"&&d<Number.MAX_SAFE_INTEGER&&(d=Number(d)),s.byterange={length:d,offset:o}}return s},f_=r=>{let e;return typeof r.offset=="bigint"||typeof r.length=="bigint"?e=N.BigInt(r.offset)+N.BigInt(r.length)-N.BigInt(1):e=r.offset+r.length-1,`${r.offset}-${e}`},oc=r=>(r&&typeof r!="number"&&(r=parseInt(r,10)),isNaN(r)?null:r),p_={static(r){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:s}=r,n=oc(r.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:i/a}},dynamic(r){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:u=1/0}=r,d=oc(r.endNumber),p=(e+t)/1e3,T=i+a,b=p+o-T,k=Math.ceil(b*s/n),v=Math.floor((p-T-u)*s/n),L=Math.floor((p-T)*s/n);return{start:Math.max(0,v),end:typeof d=="number"?d:Math.min(k,L)}}},m_=r=>e=>{const{duration:t,timescale:i=1,periodStart:s,startNumber:n=1}=r;return{number:n+e,duration:t/i,timeline:s,time:e*t}},zo=r=>{const{type:e,duration:t,timescale:i=1,periodDuration:s,sourceDuration:n}=r,{start:a,end:o}=p_[e](r),u=c_(a,o).map(m_(r));if(e==="static"){const d=u.length-1,p=typeof s=="number"?s:n;u[d].duration=p-t/i*d}return u},eh=r=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:s="",periodStart:n,presentationTime:a,number:o=0,duration:u}=r;if(!e)throw new Error(Lr.NO_BASE_URL);const d=ws({baseUrl:e,source:t.sourceURL,range:t.range}),p=ws({baseUrl:e,source:e,indexRange:s});if(p.map=d,u){const T=zo(r);T.length&&(p.duration=T[0].duration,p.timeline=T[0].timeline)}else i&&(p.duration=i,p.timeline=n);return p.presentationTime=a||n,p.number=o,[p]},Wo=(r,e,t)=>{const i=r.sidx.map?r.sidx.map:null,s=r.sidx.duration,n=r.timeline||0,a=r.sidx.byterange,o=a.offset+a.length,u=e.timescale,d=e.references.filter(L=>L.referenceType!==1),p=[],T=r.endList?"static":"dynamic",A=r.sidx.timeline;let b=A,k=r.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=N.BigInt(o)+e.firstOffset:v=o+e.firstOffset;for(let L=0;L<d.length;L++){const U=e.references[L],$=U.referencedSize,F=U.subsegmentDuration;let H;typeof v=="bigint"?H=v+N.BigInt($)-N.BigInt(1):H=v+$-1;const B=`${v}-${H}`,G=eh({baseUrl:t,timescale:u,timeline:n,periodStart:A,presentationTime:b,number:k,duration:F,sourceDuration:s,indexRange:B,type:T})[0];i&&(G.map=i),p.push(G),typeof v=="bigint"?v+=N.BigInt($):v+=$,b+=F/u,k++}return r.segments=p,r},g_=["AUDIO","SUBTITLES"],y_=1/60,th=r=>h_(r,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),__=(r,e)=>{for(let t=0;t<r.length;t++)if(r[t].attributes.NAME===e)return r[t];return null},lc=r=>{let e=[];return r_(r,g_,(t,i,s,n)=>{e=e.concat(t.playlists||[])}),e},uc=({playlist:r,mediaSequence:e})=>{r.mediaSequence=e,r.segments.forEach((t,i)=>{t.number=r.mediaSequence+i})},T_=({oldPlaylists:r,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:u}){return u===i.timeline});const s=__(r,i.attributes.NAME);if(!s||i.sidx)return;const n=i.segments[0],a=s.segments.findIndex(function(u){return Math.abs(u.presentationTime-n.presentationTime)<y_});if(a===-1){uc({playlist:i,mediaSequence:s.mediaSequence+s.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!s.segments.length&&i.timeline>s.timeline||s.segments.length&&i.timeline>s.segments[s.segments.length-1].timeline)&&i.discontinuitySequence--;return}s.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),uc({playlist:i,mediaSequence:s.segments[a].number})})},v_=({oldManifest:r,newManifest:e})=>{const t=r.playlists.concat(lc(r)),i=e.playlists.concat(lc(e));return e.timelineStarts=th([r.timelineStarts,e.timelineStarts]),T_({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Xn=r=>r&&r.uri+"-"+f_(r.byterange),za=r=>{const e=r.reduce(function(i,s){return i[s.attributes.baseUrl]||(i[s.attributes.baseUrl]=[]),i[s.attributes.baseUrl].push(s),i},{});let t=[];return Object.values(e).forEach(i=>{const s=Jd(i.reduce((n,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return n[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[o].segments.push(...a.segments)),a.attributes.contentProtection&&(n[o].attributes.contentProtection=a.attributes.contentProtection)):(n[o]=a,n[o].attributes.timelineStarts=[]),n[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(s)}),t.map(i=>(i.discontinuityStarts=d_(i.segments||[],"discontinuity"),i))},Go=(r,e)=>{const t=Xn(r.sidx),i=t&&e[t]&&e[t].sidx;return i&&Wo(r,i,r.sidx.resolvedUri),r},b_=(r,e={})=>{if(!Object.keys(e).length)return r;for(const t in r)r[t]=Go(r[t],e);return r},x_=({attributes:r,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:s,discontinuityStarts:n},a)=>{const o={attributes:{NAME:r.id,BANDWIDTH:r.bandwidth,CODECS:r.codecs,"PROGRAM-ID":1},uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:r.timelineStarts,mediaSequence:i,segments:e};return r.contentProtection&&(o.contentProtection=r.contentProtection),r.serviceLocation&&(o.attributes.serviceLocation=r.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},S_=({attributes:r,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:s})=>{typeof e>"u"&&(e=[{uri:r.baseUrl,timeline:r.periodStart,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration);const n={NAME:r.id,BANDWIDTH:r.bandwidth,"PROGRAM-ID":1};r.codecs&&(n.CODECS=r.codecs);const a={attributes:n,uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,timelineStarts:r.timelineStarts,discontinuityStarts:i,discontinuitySequence:s,mediaSequence:t,segments:e};return r.serviceLocation&&(a.attributes.serviceLocation=r.serviceLocation),a},E_=(r,e={},t=!1)=>{let i;const s=r.reduce((n,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let d=a.attributes.label||"main";if(u&&!a.attributes.label){const T=o?` (${o})`:"";d=`${a.attributes.lang}${T}`}n[d]||(n[d]={language:u,autoselect:!0,default:o==="main",playlists:[],uri:""});const p=Go(x_(a,t),e);return n[d].playlists.push(p),typeof i>"u"&&o==="main"&&(i=a,i.default=!0),n},{});if(!i){const n=Object.keys(s)[0];s[n].default=!0}return s},C_=(r,e={})=>r.reduce((t,i)=>{const s=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";return t[s]||(t[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(Go(S_(i),e)),t},{}),A_=r=>r.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:s,language:n}=i;e[n]={autoselect:!1,default:!1,instreamId:s,language:n},i.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[n].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[n]["3D"]=i["3D"])}),e),{}),w_=({attributes:r,segments:e,sidx:t,discontinuityStarts:i})=>{const s={attributes:{NAME:r.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:r.width,height:r.height},CODECS:r.codecs,BANDWIDTH:r.bandwidth,"PROGRAM-ID":1},uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,discontinuityStarts:i,timelineStarts:r.timelineStarts,segments:e};return r.frameRate&&(s.attributes["FRAME-RATE"]=r.frameRate),r.contentProtection&&(s.contentProtection=r.contentProtection),r.serviceLocation&&(s.attributes.serviceLocation=r.serviceLocation),t&&(s.sidx=t),s},D_=({attributes:r})=>r.mimeType==="video/mp4"||r.mimeType==="video/webm"||r.contentType==="video",I_=({attributes:r})=>r.mimeType==="audio/mp4"||r.mimeType==="audio/webm"||r.contentType==="audio",k_=({attributes:r})=>r.mimeType==="text/vtt"||r.contentType==="text",P_=(r,e)=>{r.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,s)=>{i.number=s})})},cc=r=>r?Object.keys(r).reduce((e,t)=>{const i=r[t];return e.concat(i.playlists)},[]):[],R_=({dashPlaylists:r,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:s,eventStream:n})=>{if(!r.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:u,minimumUpdatePeriod:d}=r[0].attributes,p=za(r.filter(D_)).map(w_),T=za(r.filter(I_)),A=za(r.filter(k_)),b=r.map(H=>H.attributes.captionServices).filter(Boolean),k={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:b_(p,i)};d>=0&&(k.minimumUpdatePeriod=d*1e3),e&&(k.locations=e),t&&(k.contentSteering=t),o==="dynamic"&&(k.suggestedPresentationDelay=u),n&&n.length>0&&(k.eventStream=n);const v=k.playlists.length===0,L=T.length?E_(T,i,v):null,U=A.length?C_(A,i):null,$=p.concat(cc(L),cc(U)),F=$.map(({timelineStarts:H})=>H);return k.timelineStarts=th(F),P_($,k.timelineStarts),L&&(k.mediaGroups.AUDIO.audio=L),U&&(k.mediaGroups.SUBTITLES.subs=U),b.length&&(k.mediaGroups["CLOSED-CAPTIONS"].cc=A_(b)),s?v_({oldManifest:s,newManifest:k}):k},L_=(r,e,t)=>{const{NOW:i,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:u=0}=r,d=(i+s)/1e3,p=n+o,A=d+u-p;return Math.ceil((A*a-e)/t)},ih=(r,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:u}=r,d=[];let p=-1;for(let T=0;T<e.length;T++){const A=e[T],b=A.d,k=A.r||0,v=A.t||0;p<0&&(p=v),v&&v>p&&(p=v);let L;if(k<0){const F=T+1;F===e.length?t==="dynamic"&&i>0&&s.indexOf("$Number$")>0?L=L_(r,p,b):L=(n*a-p)/b:L=(e[F].t-p)/b}else L=k+1;const U=o+d.length+L;let $=o+d.length;for(;$<U;)d.push({number:$,duration:b/a,time:p,timeline:u}),p+=b,$++}return d},N_=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,O_=r=>(e,t,i,s)=>{if(e==="$$")return"$";if(typeof r[t]>"u")return e;const n=""+r[t];return t==="RepresentationID"||(i?s=parseInt(s,10):s=1,n.length>=s)?n:`${new Array(s-n.length+1).join("0")}${n}`},dc=(r,e)=>r.replace(N_,O_(e)),B_=(r,e)=>!r.duration&&!e?[{number:r.startNumber||1,duration:r.sourceDuration,time:0,timeline:r.periodStart}]:r.duration?zo(r):ih(r,e),M_=(r,e)=>{const t={RepresentationID:r.id,Bandwidth:r.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=r,s=ws({baseUrl:r.baseUrl,source:dc(i.sourceURL,t),range:i.range});return B_(r,e).map(a=>{t.Number=a.number,t.Time=a.time;const o=dc(r.media||"",t),u=r.timescale||1,d=r.presentationTimeOffset||0,p=r.periodStart+(a.time-d)/u;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:Wn(r.baseUrl||"",o),map:s,number:a.number,presentationTime:p}})},F_=(r,e)=>{const{baseUrl:t,initialization:i={}}=r,s=ws({baseUrl:t,source:i.sourceURL,range:i.range}),n=ws({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=s,n},U_=(r,e)=>{const{duration:t,segmentUrls:i=[],periodStart:s}=r;if(!t&&!e||t&&e)throw new Error(Lr.SEGMENT_TIME_UNSPECIFIED);const n=i.map(u=>F_(r,u));let a;return t&&(a=zo(r)),e&&(a=ih(r,e)),a.map((u,d)=>{if(n[d]){const p=n[d],T=r.timescale||1,A=r.presentationTimeOffset||0;return p.timeline=u.timeline,p.duration=u.duration,p.number=u.number,p.presentationTime=s+(u.time-A)/T,p}}).filter(u=>u)},$_=({attributes:r,segmentInfo:e})=>{let t,i;e.template?(i=M_,t=yt(r,e.template)):e.base?(i=eh,t=yt(r,e.base)):e.list&&(i=U_,t=yt(r,e.list));const s={attributes:r};if(!i)return s;const n=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else n.length?t.duration=n.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return s.attributes=t,s.segments=n,e.base&&t.indexRange&&(s.sidx=n[0],s.segments=[]),s},j_=r=>r.map($_),et=(r,e)=>Zd(r.childNodes).filter(({tagName:t})=>t===e),Ps=r=>r.textContent.trim(),q_=r=>parseFloat(r.split("/").reduce((e,t)=>e/t)),gr=r=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(r);if(!o)return 0;const[u,d,p,T,A,b]=o.slice(1);return parseFloat(u||0)*31536e3+parseFloat(d||0)*2592e3+parseFloat(p||0)*86400+parseFloat(T||0)*3600+parseFloat(A||0)*60+parseFloat(b||0)},V_=r=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(r)&&(r+="Z"),Date.parse(r)),hc={mediaPresentationDuration(r){return gr(r)},availabilityStartTime(r){return V_(r)/1e3},minimumUpdatePeriod(r){return gr(r)},suggestedPresentationDelay(r){return gr(r)},type(r){return r},timeShiftBufferDepth(r){return gr(r)},start(r){return gr(r)},width(r){return parseInt(r,10)},height(r){return parseInt(r,10)},bandwidth(r){return parseInt(r,10)},frameRate(r){return q_(r)},startNumber(r){return parseInt(r,10)},timescale(r){return parseInt(r,10)},presentationTimeOffset(r){return parseInt(r,10)},duration(r){const e=parseInt(r,10);return isNaN(e)?gr(r):e},d(r){return parseInt(r,10)},t(r){return parseInt(r,10)},r(r){return parseInt(r,10)},presentationTime(r){return parseInt(r,10)},DEFAULT(r){return r}},ct=r=>r&&r.attributes?Zd(r.attributes).reduce((e,t)=>{const i=hc[t.name]||hc.DEFAULT;return e[t.name]=i(t.value),e},{}):{},H_={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Yn=(r,e)=>e.length?Rr(r.map(function(t){return e.map(function(i){const s=Ps(i),n=Wn(t.baseUrl,s),a=yt(ct(i),{baseUrl:n});return n!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):r,Ko=r=>{const e=et(r,"SegmentTemplate")[0],t=et(r,"SegmentList")[0],i=t&&et(t,"SegmentURL").map(T=>yt({tag:"SegmentURL"},ct(T))),s=et(r,"SegmentBase")[0],n=t||e,a=n&&et(n,"SegmentTimeline")[0],o=t||s||e,u=o&&et(o,"Initialization")[0],d=e&&ct(e);d&&u?d.initialization=u&&ct(u):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});const p={template:d,segmentTimeline:a&&et(a,"S").map(T=>ct(T)),list:t&&yt(ct(t),{segmentUrls:i,initialization:ct(u)}),base:s&&yt(ct(s),{initialization:ct(u)})};return Object.keys(p).forEach(T=>{p[T]||delete p[T]}),p},z_=(r,e,t)=>i=>{const s=et(i,"BaseURL"),n=Yn(e,s),a=yt(r,ct(i)),o=Ko(i);return n.map(u=>({segmentInfo:yt(t,o),attributes:yt(a,u)}))},W_=r=>r.reduce((e,t)=>{const i=ct(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const s=H_[i.schemeIdUri];if(s){e[s]={attributes:i};const n=et(t,"cenc:pssh")[0];if(n){const a=Ps(n);e[s].pssh=a&&zd(a)}}return e},{}),G_=r=>{if(r.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof r.value!="string"?[]:r.value.split(";")).map(t=>{let i,s;return s=t,/^CC\d=/.test(t)?[i,s]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:s}});if(r.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof r.value!="string"?[]:r.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,n=""]=t.split("=");i.channel=s,i.language=t,n.split(",").forEach(a=>{const[o,u]=a.split(":");o==="lang"?i.language=u:o==="er"?i.easyReader=Number(u):o==="war"?i.aspectRatio=Number(u):o==="3D"&&(i["3D"]=Number(u))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},K_=r=>Rr(et(r.node,"EventStream").map(e=>{const t=ct(e),i=t.schemeIdUri;return et(e,"Event").map(s=>{const n=ct(s),a=n.presentationTime||0,o=t.timescale||1,u=n.duration||0,d=a/o+r.attributes.start;return{schemeIdUri:i,value:t.value,id:n.id,start:d,end:d+u/o,messageData:Ps(s)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),X_=(r,e,t)=>i=>{const s=ct(i),n=Yn(e,et(i,"BaseURL")),a=et(i,"Role")[0],o={role:ct(a)};let u=yt(r,s,o);const d=et(i,"Accessibility")[0],p=G_(ct(d));p&&(u=yt(u,{captionServices:p}));const T=et(i,"Label")[0];if(T&&T.childNodes.length){const L=T.childNodes[0].nodeValue.trim();u=yt(u,{label:L})}const A=W_(et(i,"ContentProtection"));Object.keys(A).length&&(u=yt(u,{contentProtection:A}));const b=Ko(i),k=et(i,"Representation"),v=yt(t,b);return Rr(k.map(z_(u,n,v)))},Y_=(r,e)=>(t,i)=>{const s=Yn(e,et(t.node,"BaseURL")),n=yt(r,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=et(t.node,"AdaptationSet"),o=Ko(t.node);return Rr(a.map(X_(n,s,o)))},Q_=(r,e)=>{if(r.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!r.length)return null;const t=yt({serverURL:Ps(r[0])},ct(r[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},J_=({attributes:r,priorPeriodAttributes:e,mpdType:t})=>typeof r.start=="number"?r.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,Z_=(r,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,a=et(r,"Period");if(!a.length)throw new Error(Lr.INVALID_NUMBER_OF_PERIOD);const o=et(r,"Location"),u=ct(r),d=Yn([{baseUrl:t}],et(r,"BaseURL")),p=et(r,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=i,u.clientOffset=s,o.length&&(u.locations=o.map(Ps));const T=[];return a.forEach((A,b)=>{const k=ct(A),v=T[b-1];k.start=J_({attributes:k,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),T.push({node:A,attributes:k})}),{locations:u.locations,contentSteeringInfo:Q_(p,n),representationInfo:Rr(T.map(Y_(u,d))),eventStream:Rr(T.map(K_))}},rh=r=>{if(r==="")throw new Error(Lr.DASH_EMPTY_MANIFEST);const e=new Ho.DOMParser;let t,i;try{t=e.parseFromString(r,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Lr.DASH_INVALID_XML);return i},eT=r=>{const e=et(r,"UTCTiming")[0];if(!e)return null;const t=ct(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Lr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},tT=(r,e={})=>{const t=Z_(rh(r),e),i=j_(t.representationInfo);return R_({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},iT=r=>eT(rh(r));var Wa,fc;function rT(){if(fc)return Wa;fc=1;var r=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),s;return i.getBigUint64?(s=i.getBigUint64(0),s<Number.MAX_SAFE_INTEGER?Number(s):s):i.getUint32(0)*r+i.getUint32(4)};return Wa={getUint64:e,MAX_UINT32:r},Wa}var Ga,pc;function sT(){if(pc)return Ga;pc=1;var r=rT().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),s={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},n=12;s.version===0?(s.earliestPresentationTime=i.getUint32(n),s.firstOffset=i.getUint32(n+4),n+=8):(s.earliestPresentationTime=r(t.subarray(n)),s.firstOffset=r(t.subarray(n+8)),n+=16),n+=2;var a=i.getUint16(n);for(n+=2;a>0;n+=12,a--)s.references.push({referenceType:(t[n]&128)>>>7,referencedSize:i.getUint32(n)&2147483647,subsegmentDuration:i.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:i.getUint32(n+8)&268435455});return s};return Ga=e,Ga}var nT=sT();const aT=ui.getDefaultExportFromCjs(nT);var oT=be([73,68,51]),lT=function(e,t){t===void 0&&(t=0),e=be(e);var i=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(i&16)>>4;return n?s+20:s+10},ys=function r(e,t){return t===void 0&&(t=0),e=be(e),e.length-t<10||!Ze(e,oT,{offset:t})?t:(t+=lT(e,t),r(e,t))},mc=function(e){return typeof e=="string"?Yd(e):e},uT=function(e){return Array.isArray(e)?e.map(function(t){return mc(t)}):[mc(e)]},cT=function r(e,t,i){i===void 0&&(i=!1),t=uT(t),e=be(e);var s=[];if(!t.length)return s;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,o=e.subarray(n+4,n+8);if(a===0)break;var u=n+a;if(u>e.length){if(i)break;u=e.length}var d=e.subarray(n+8,u);Ze(o,t[0])&&(t.length===1?s.push(d):s.push.apply(s,r(d,t.slice(1),i))),n=u}return s},cn={EBML:be([26,69,223,163]),DocType:be([66,130]),Segment:be([24,83,128,103]),SegmentInfo:be([21,73,169,102]),Tracks:be([22,84,174,107]),Track:be([174]),TrackNumber:be([215]),DefaultDuration:be([35,227,131]),TrackEntry:be([174]),TrackType:be([131]),FlagDefault:be([136]),CodecID:be([134]),CodecPrivate:be([99,162]),VideoTrack:be([224]),AudioTrack:be([225]),Cluster:be([31,67,182,117]),Timestamp:be([231]),TimestampScale:be([42,215,177]),BlockGroup:be([160]),BlockDuration:be([155]),Block:be([161]),SimpleBlock:be([163])},po=[128,64,32,16,8,4,2,1],dT=function(e){for(var t=1,i=0;i<po.length&&!(e&po[i]);i++)t++;return t},bn=function(e,t,i,s){i===void 0&&(i=!0),s===void 0&&(s=!1);var n=dT(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=po[n-1]),{length:n,value:e_(a,{signed:s}),bytes:a}},gc=function r(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return r(t)}):typeof e=="number"?t_(e):e},hT=function(e){return Array.isArray(e)?e.map(function(t){return gc(t)}):[gc(e)]},fT=function r(e,t,i){if(i>=t.length)return t.length;var s=bn(t,i,!1);if(Ze(e.bytes,s.bytes))return i;var n=bn(t,i+s.length);return r(e,t,i+n.length+n.value+s.length)},yc=function r(e,t){t=hT(t),e=be(e);var i=[];if(!t.length)return i;for(var s=0;s<e.length;){var n=bn(e,s,!1),a=bn(e,s+n.length),o=s+n.length+a.length;a.value===127&&(a.value=fT(n,e,o),a.value!==e.length&&(a.value-=o));var u=o+a.value>e.length?e.length:o+a.value,d=e.subarray(o,u);Ze(t[0],n.bytes)&&(t.length===1?i.push(d):i=i.concat(r(d,t.slice(1))));var p=n.length+a.length+d.length;s+=p}return i},pT=be([0,0,0,1]),mT=be([0,0,1]),gT=be([0,0,3]),yT=function(e){for(var t=[],i=1;i<e.length-2;)Ze(e.subarray(i,i+3),gT)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var s=e.length-t.length,n=new Uint8Array(s),a=0;for(i=0;i<s;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=e[a];return n},sh=function(e,t,i,s){e=be(e),i=[].concat(i);for(var n=0,a,o=0;n<e.length&&(o<s||a);){var u=void 0;if(Ze(e.subarray(n),pT)?u=4:Ze(e.subarray(n),mT)&&(u=3),!u){n++;continue}if(o++,a)return yT(e.subarray(a,n));var d=void 0;t==="h264"?d=e[n+u]&31:t==="h265"&&(d=e[n+u]>>1&63),i.indexOf(d)!==-1&&(a=n+u),n+=u+(t==="h264"?1:2)}return e.subarray(0,0)},_T=function(e,t,i){return sh(e,"h264",t,i)},TT=function(e,t,i){return sh(e,"h265",t,i)},It={webm:be([119,101,98,109]),matroska:be([109,97,116,114,111,115,107,97]),flac:be([102,76,97,67]),ogg:be([79,103,103,83]),ac3:be([11,119]),riff:be([82,73,70,70]),avi:be([65,86,73]),wav:be([87,65,86,69]),"3gp":be([102,116,121,112,51,103]),mp4:be([102,116,121,112]),fmp4:be([115,116,121,112]),mov:be([102,116,121,112,113,116]),moov:be([109,111,111,118]),moof:be([109,111,111,102])},Nr={aac:function(e){var t=ys(e);return Ze(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=ys(e);return Ze(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=yc(e,[cn.EBML,cn.DocType])[0];return Ze(t,It.webm)},mkv:function(e){var t=yc(e,[cn.EBML,cn.DocType])[0];return Ze(t,It.matroska)},mp4:function(e){if(Nr["3gp"](e)||Nr.mov(e))return!1;if(Ze(e,It.mp4,{offset:4})||Ze(e,It.fmp4,{offset:4})||Ze(e,It.moof,{offset:4})||Ze(e,It.moov,{offset:4}))return!0},mov:function(e){return Ze(e,It.mov,{offset:4})},"3gp":function(e){return Ze(e,It["3gp"],{offset:4})},ac3:function(e){var t=ys(e);return Ze(e,It.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=ys(e);return Ze(e,It.flac,{offset:t})},ogg:function(e){return Ze(e,It.ogg)},avi:function(e){return Ze(e,It.riff)&&Ze(e,It.avi,{offset:8})},wav:function(e){return Ze(e,It.riff)&&Ze(e,It.wav,{offset:8})},h264:function(e){return _T(e,7,3).length},h265:function(e){return TT(e,[32,33],3).length}},mo=Object.keys(Nr).filter(function(r){return r!=="ts"&&r!=="h264"&&r!=="h265"}).concat(["ts","h264","h265"]);mo.forEach(function(r){var e=Nr[r];Nr[r]=function(t){return e(be(t))}});var vT=Nr,Xo=function(e){e=be(e);for(var t=0;t<mo.length;t++){var i=mo[t];if(vT[i](e))return i}return""},bT=function(e){return cT(e,["moof"]).length>0},Ka,_c;function xT(){if(_c)return Ka;_c=1;var r=9e4,e,t,i,s,n,a,o;return e=function(u){return u*r},t=function(u,d){return u*d},i=function(u){return u/r},s=function(u,d){return u/d},n=function(u,d){return e(s(u,d))},a=function(u,d){return t(i(u),d)},o=function(u,d,p){return i(p?u:u-d)},Ka={ONE_SECOND_IN_TS:r,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:s,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:o},Ka}var sr=xT(),go="8.21.0";const Li={},Wi=function(r,e){return Li[r]=Li[r]||[],e&&(Li[r]=Li[r].concat(e)),Li[r]},ST=function(r,e){Wi(r,e)},nh=function(r,e){const t=Wi(r).indexOf(e);return t<=-1?!1:(Li[r]=Li[r].slice(),Li[r].splice(t,1),!0)},ET=function(r,e){Wi(r,[].concat(e).map(t=>{const i=(...s)=>(nh(r,i),t(...s));return i}))},xn={prefixed:!0},yn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Tc=yn[0];let _s;for(let r=0;r<yn.length;r++)if(yn[r][1]in he){_s=yn[r];break}if(_s){for(let r=0;r<_s.length;r++)xn[Tc[r]]=_s[r];xn.prefixed=_s[0]!==Tc[0]}let Nt=[];const CT=(r,e,t)=>(i,s,n)=>{const a=e.levels[s],o=new RegExp(`^(${a})$`);let u=r;if(i!=="log"&&n.unshift(i.toUpperCase()+":"),t&&(u=`%c${r}`,n.unshift(t)),n.unshift(u+":"),Nt){Nt.push([].concat(n));const p=Nt.length-1e3;Nt.splice(0,p>0?p:0)}if(!N.console)return;let d=N.console[i];!d&&i==="debug"&&(d=N.console.info||N.console.log),!(!d||!a||!o.test(i))&&d[Array.isArray(n)?"apply":"call"](N.console,n)};function yo(r,e=":",t=""){let i="info",s;function n(...a){s("log",i,a)}return s=CT(r,n,t),n.createLogger=(a,o,u)=>{const d=o!==void 0?o:e,p=u!==void 0?u:t,T=`${r} ${d} ${a}`;return yo(T,d,p)},n.createNewLogger=(a,o,u)=>yo(a,o,u),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},n.history=()=>Nt?[].concat(Nt):[],n.history.filter=a=>(Nt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),n.history.clear=()=>{Nt&&(Nt.length=0)},n.history.disable=()=>{Nt!==null&&(Nt.length=0,Nt=null)},n.history.enable=()=>{Nt===null&&(Nt=[])},n.error=(...a)=>s("error",i,a),n.warn=(...a)=>s("warn",i,a),n.debug=(...a)=>s("debug",i,a),n}const Pe=yo("VIDEOJS"),ah=Pe.createLogger,AT=Object.prototype.toString,oh=function(r){return Ai(r)?Object.keys(r):[]};function Sr(r,e){oh(r).forEach(t=>e(r[t],t))}function lh(r,e,t=0){return oh(r).reduce((i,s)=>e(i,r[s],s),t)}function Ai(r){return!!r&&typeof r=="object"}function Or(r){return Ai(r)&&AT.call(r)==="[object Object]"&&r.constructor===Object}function $e(...r){const e={};return r.forEach(t=>{t&&Sr(t,(i,s)=>{if(!Or(i)){e[s]=i;return}Or(e[s])||(e[s]={}),e[s]=$e(e[s],i)})}),e}function uh(r={}){const e=[];for(const t in r)if(r.hasOwnProperty(t)){const i=r[t];e.push(i)}return e}function Qn(r,e,t,i=!0){const s=a=>Object.defineProperty(r,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return i&&(n.set=s),Object.defineProperty(r,e,n)}var wT=Object.freeze({__proto__:null,each:Sr,reduce:lh,isObject:Ai,isPlain:Or,merge:$e,values:uh,defineLazyProperty:Qn});let Yo=!1,ch=null,ci=!1,dh,hh=!1,Er=!1,Cr=!1,wi=!1,Qo=null,Jn=null;const DT=!!(N.cast&&N.cast.framework&&N.cast.framework.CastReceiverContext);let fh=null,Sn=!1,Zn=!1,En=!1,ea=!1,Cn=!1,An=!1,wn=!1;const Ds=!!(jr()&&("ontouchstart"in N||N.navigator.maxTouchPoints||N.DocumentTouch&&N.document instanceof N.DocumentTouch)),ji=N.navigator&&N.navigator.userAgentData;ji&&ji.platform&&ji.brands&&(ci=ji.platform==="Android",Er=!!ji.brands.find(r=>r.brand==="Microsoft Edge"),Cr=!!ji.brands.find(r=>r.brand==="Chromium"),wi=!Er&&Cr,Qo=Jn=(ji.brands.find(r=>r.brand==="Chromium")||{}).version||null,Zn=ji.platform==="Windows");if(!Cr){const r=N.navigator&&N.navigator.userAgent||"";Yo=/iPod/i.test(r),ch=(function(){const e=r.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),ci=/Android/i.test(r),dh=(function(){const e=r.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),hh=/Firefox/i.test(r),Er=/Edg/i.test(r),Cr=/Chrome/i.test(r)||/CriOS/i.test(r),wi=!Er&&Cr,Qo=Jn=(function(){const e=r.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),fh=(function(){const e=/MSIE\s(\d+)\.\d/.exec(r);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(r)&&/rv:11.0/.test(r)&&(t=11),t})(),Cn=/Tizen/i.test(r),An=/Web0S/i.test(r),wn=Cn||An,Sn=/Safari/i.test(r)&&!wi&&!ci&&!Er&&!wn,Zn=/Windows/i.test(r),En=/iPad/i.test(r)||Sn&&Ds&&!/iPhone/i.test(r),ea=/iPhone/i.test(r)&&!En}const xt=ea||En||Yo,ta=(Sn||xt)&&!wi;var ph=Object.freeze({__proto__:null,get IS_IPOD(){return Yo},get IOS_VERSION(){return ch},get IS_ANDROID(){return ci},get ANDROID_VERSION(){return dh},get IS_FIREFOX(){return hh},get IS_EDGE(){return Er},get IS_CHROMIUM(){return Cr},get IS_CHROME(){return wi},get CHROMIUM_VERSION(){return Qo},get CHROME_VERSION(){return Jn},IS_CHROMECAST_RECEIVER:DT,get IE_VERSION(){return fh},get IS_SAFARI(){return Sn},get IS_WINDOWS(){return Zn},get IS_IPAD(){return En},get IS_IPHONE(){return ea},get IS_TIZEN(){return Cn},get IS_WEBOS(){return An},get IS_SMART_TV(){return wn},TOUCH_ENABLED:Ds,IS_IOS:xt,IS_ANY_SAFARI:ta});function vc(r){return typeof r=="string"&&!!r.trim()}function IT(r){if(r.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function jr(){return he===N.document}function qr(r){return Ai(r)&&r.nodeType===1}function mh(){try{return N.parent!==N.self}catch{return!0}}function gh(r){return function(e,t){if(!vc(e))return he[r](null);vc(t)&&(t=he.querySelector(t));const i=qr(t)?t:he;return i[r]&&i[r](e)}}function xe(r="div",e={},t={},i){const s=he.createElement(r);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Ki(s,a):(s[n]!==a||n==="tabIndex")&&(s[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){s.setAttribute(n,t[n])}),i&&Jo(s,i),s}function Ki(r,e){return typeof r.textContent>"u"?r.innerText=e:r.textContent=e,r}function _o(r,e){e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}function bs(r,e){return IT(e),r.classList.contains(e)}function or(r,...e){return r.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),r}function ia(r,...e){return r?(r.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),r):(Pe.warn("removeClass was called with an element that doesn't exist"),null)}function yh(r,e,t){return typeof t=="function"&&(t=t(r,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>r.classList.toggle(i,t)),r}function _h(r,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?r.removeAttribute(t):r.setAttribute(t,i===!0?"":i)})}function Hi(r){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(r&&r.attributes&&r.attributes.length>0){const i=r.attributes;for(let s=i.length-1;s>=0;s--){const n=i[s].name;let a=i[s].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function Th(r,e){return r.getAttribute(e)}function Br(r,e,t){r.setAttribute(e,t)}function ra(r,e){r.removeAttribute(e)}function vh(){he.body.focus(),he.onselectstart=function(){return!1}}function bh(){he.onselectstart=function(){return!0}}function Mr(r){if(r&&r.getBoundingClientRect&&r.parentNode){const e=r.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Fr(r,"height"))),t.width||(t.width=parseFloat(Fr(r,"width"))),t}}function Is(r){if(!r||r&&!r.offsetParent)return{left:0,top:0,width:0,height:0};const e=r.offsetWidth,t=r.offsetHeight;let i=0,s=0;for(;r.offsetParent&&r!==he[xn.fullscreenElement];)i+=r.offsetLeft,s+=r.offsetTop,r=r.offsetParent;return{left:i,top:s,width:e,height:t}}function sa(r,e){const t={x:0,y:0};if(xt){let p=r;for(;p&&p.nodeName.toLowerCase()!=="html";){const T=Fr(p,"transform");if(/^matrix/.test(T)){const A=T.slice(7,-1).split(/,\s/).map(Number);t.x+=A[4],t.y+=A[5]}else if(/^matrix3d/.test(T)){const A=T.slice(9,-1).split(/,\s/).map(Number);t.x+=A[12],t.y+=A[13]}if(p.assignedSlot&&p.assignedSlot.parentElement&&N.WebKitCSSMatrix){const A=N.getComputedStyle(p.assignedSlot.parentElement).transform,b=new N.WebKitCSSMatrix(A);t.x+=b.m41,t.y+=b.m42}p=p.parentNode||p.host}}const i={},s=Is(e.target),n=Is(r),a=n.width,o=n.height;let u=e.offsetY-(n.top-s.top),d=e.offsetX-(n.left-s.left);return e.changedTouches&&(d=e.changedTouches[0].pageX-n.left,u=e.changedTouches[0].pageY+n.top,xt&&(d-=t.x,u-=t.y)),i.y=1-Math.max(0,Math.min(1,u/o)),i.x=Math.max(0,Math.min(1,d/a)),i}function xh(r){return Ai(r)&&r.nodeType===3}function na(r){for(;r.firstChild;)r.removeChild(r.firstChild);return r}function Sh(r){return typeof r=="function"&&(r=r()),(Array.isArray(r)?r:[r]).map(e=>{if(typeof e=="function"&&(e=e()),qr(e)||xh(e))return e;if(typeof e=="string"&&/\S/.test(e))return he.createTextNode(e)}).filter(e=>e)}function Jo(r,e){return Sh(e).forEach(t=>r.appendChild(t)),r}function Eh(r,e){return Jo(na(r),e)}function ks(r){return r.button===void 0&&r.buttons===void 0||r.button===0&&r.buttons===void 0||r.type==="mouseup"&&r.button===0&&r.buttons===0||r.type==="mousedown"&&r.button===0&&r.buttons===0?!0:!(r.button!==0||r.buttons!==1)}const Gi=gh("querySelector"),Ch=gh("querySelectorAll");function Fr(r,e){if(!r||!e)return"";if(typeof N.getComputedStyle=="function"){let t;try{t=N.getComputedStyle(r)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Ah(r){[...he.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),i=he.createElement("style");i.textContent=t,r.document.head.appendChild(i)}catch{const i=he.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,r.document.head.appendChild(i)}})}var wh=Object.freeze({__proto__:null,isReal:jr,isEl:qr,isInFrame:mh,createEl:xe,textContent:Ki,prependTo:_o,hasClass:bs,addClass:or,removeClass:ia,toggleClass:yh,setAttributes:_h,getAttributes:Hi,getAttribute:Th,setAttribute:Br,removeAttribute:ra,blockTextSelection:vh,unblockTextSelection:bh,getBoundingClientRect:Mr,findPosition:Is,getPointerPosition:sa,isTextNode:xh,emptyEl:na,normalizeContent:Sh,appendContent:Jo,insertContent:Eh,isSingleLeftClick:ks,$:Gi,$$:Ch,computedStyle:Fr,copyStyleSheetsToWindow:Ah});let Dh=!1,To;const kT=function(){if(To.options.autoSetup===!1)return;const r=Array.prototype.slice.call(he.getElementsByTagName("video")),e=Array.prototype.slice.call(he.getElementsByTagName("audio")),t=Array.prototype.slice.call(he.getElementsByTagName("video-js")),i=r.concat(e,t);if(i&&i.length>0)for(let s=0,n=i.length;s<n;s++){const a=i[s];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&To(a);else{vo(1);break}}else Dh||vo(1)};function vo(r,e){jr()&&(e&&(To=e),N.setTimeout(kT,r))}function bo(){Dh=!0,N.removeEventListener("load",bo)}jr()&&(he.readyState==="complete"?bo():N.addEventListener("load",bo));const Ih=function(r){const e=he.createElement("style");return e.className=r,e},kh=function(r,e){r.styleSheet?r.styleSheet.cssText=e:r.textContent=e};var Pt=new WeakMap;const PT=3;let RT=PT;function Qt(){return RT++}function bc(r,e){if(!Pt.has(r))return;const t=Pt.get(r);t.handlers[e].length===0&&(delete t.handlers[e],r.removeEventListener?r.removeEventListener(e,t.dispatcher,!1):r.detachEvent&&r.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&Pt.delete(r)}function Zo(r,e,t,i){t.forEach(function(s){r(e,s,i)})}function aa(r){if(r.fixed_)return r;function e(){return!0}function t(){return!1}if(!r||!r.isPropagationStopped||!r.isImmediatePropagationStopped){const i=r||N.event;r={};const s=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in i)s.includes(n)||n==="returnValue"&&i.preventDefault||(r[n]=i[n]);if(r.target||(r.target=r.srcElement||he),r.relatedTarget||(r.relatedTarget=r.fromElement===r.target?r.toElement:r.fromElement),r.preventDefault=function(){i.preventDefault&&i.preventDefault(),r.returnValue=!1,i.returnValue=!1,r.defaultPrevented=!0},r.defaultPrevented=!1,r.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),r.cancelBubble=!0,i.cancelBubble=!0,r.isPropagationStopped=e},r.isPropagationStopped=t,r.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),r.isImmediatePropagationStopped=e,r.stopPropagation()},r.isImmediatePropagationStopped=t,r.clientX!==null&&r.clientX!==void 0){const n=he.documentElement,a=he.body;r.pageX=r.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),r.pageY=r.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}r.which=r.charCode||r.keyCode,r.button!==null&&r.button!==void 0&&(r.button=r.button&1?0:r.button&4?1:r.button&2?2:0)}return r.fixed_=!0,r}let dn;const LT=function(){if(typeof dn!="boolean"){dn=!1;try{const r=Object.defineProperty({},"passive",{get(){dn=!0}});N.addEventListener("test",null,r),N.removeEventListener("test",null,r)}catch{}}return dn},NT=["touchstart","touchmove"];function qt(r,e,t){if(Array.isArray(e))return Zo(qt,r,e,t);Pt.has(r)||Pt.set(r,{});const i=Pt.get(r);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=Qt()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(s,n){if(i.disabled)return;s=aa(s);const a=i.handlers[s.type];if(a){const o=a.slice(0);for(let u=0,d=o.length;u<d&&!s.isImmediatePropagationStopped();u++)try{o[u].call(r,s,n)}catch(p){Pe.error(p)}}}),i.handlers[e].length===1)if(r.addEventListener){let s=!1;LT()&&NT.indexOf(e)>-1&&(s={passive:!0}),r.addEventListener(e,i.dispatcher,s)}else r.attachEvent&&r.attachEvent("on"+e,i.dispatcher)}function St(r,e,t){if(!Pt.has(r))return;const i=Pt.get(r);if(!i.handlers)return;if(Array.isArray(e))return Zo(St,r,e,t);const s=function(a,o){i.handlers[o]=[],bc(a,o)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&s(r,a);return}const n=i.handlers[e];if(n){if(!t){s(r,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);bc(r,e)}}function Vr(r,e,t){const i=Pt.has(r)?Pt.get(r):{},s=r.parentNode||r.ownerDocument;if(typeof e=="string"?e={type:e,target:r}:e.target||(e.target=r),e=aa(e),i.dispatcher&&i.dispatcher.call(r,e,t),s&&!e.isPropagationStopped()&&e.bubbles===!0)Vr.call(null,s,e,t);else if(!s&&!e.defaultPrevented&&e.target&&e.target[e.type]){Pt.has(e.target)||Pt.set(e.target,{});const n=Pt.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function oa(r,e,t){if(Array.isArray(e))return Zo(oa,r,e,t);const i=function(){St(r,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Qt(),qt(r,e,i)}function el(r,e,t){const i=function(){St(r,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Qt(),qt(r,e,i)}var OT=Object.freeze({__proto__:null,fixEvent:aa,on:qt,off:St,trigger:Vr,one:oa,any:el});const Jt=30,Ge=function(r,e,t){e.guid||(e.guid=Qt());const i=e.bind(r);return i.guid=t?t+"_"+e.guid:e.guid,i},Di=function(r,e){let t=N.performance.now();return function(...s){const n=N.performance.now();n-t>=e&&(r(...s),t=n)}},Ph=function(r,e,t,i=N){let s;const n=()=>{i.clearTimeout(s),s=null},a=function(){const o=this,u=arguments;let d=function(){s=null,d=null,t||r.apply(o,u)};!s&&t&&r.apply(o,u),i.clearTimeout(s),s=i.setTimeout(d,e)};return a.cancel=n,a};var BT=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Jt,bind_:Ge,throttle:Di,debounce:Ph});let fs;class Vt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},qt(this,e,t),this.addEventListener=i}off(e,t){St(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},oa(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},el(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=aa(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Vr(this,e)}queueTrigger(e){fs||(fs=new Map);const t=e.type||e;let i=fs.get(this);i||(i=new Map,fs.set(this,i));const s=i.get(t);i.delete(t),N.clearTimeout(s);const n=N.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,fs.delete(this)),this.trigger(e)},0);i.set(t,n)}}Vt.prototype.allowedEvents_={};Vt.prototype.addEventListener=Vt.prototype.on;Vt.prototype.removeEventListener=Vt.prototype.off;Vt.prototype.dispatchEvent=Vt.prototype.trigger;const la=r=>typeof r.name=="function"?r.name():typeof r.name=="string"?r.name:r.name_?r.name_:r.constructor&&r.constructor.name?r.constructor.name:typeof r,Oi=r=>r instanceof Vt||!!r.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof r[e]=="function"),MT=(r,e)=>{Oi(r)?e():(r.eventedCallbacks||(r.eventedCallbacks=[]),r.eventedCallbacks.push(e))},xo=r=>typeof r=="string"&&/\S/.test(r)||Array.isArray(r)&&!!r.length,Dn=(r,e,t)=>{if(!r||!r.nodeName&&!Oi(r))throw new Error(`Invalid target for ${la(e)}#${t}; must be a DOM node or evented object.`)},Rh=(r,e,t)=>{if(!xo(r))throw new Error(`Invalid event type for ${la(e)}#${t}; must be a non-empty string or array.`)},Lh=(r,e,t)=>{if(typeof r!="function")throw new Error(`Invalid listener for ${la(e)}#${t}; must be a function.`)},Xa=(r,e,t)=>{const i=e.length<3||e[0]===r||e[0]===r.eventBusEl_;let s,n,a;return i?(s=r.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(s=e[0],n=e[1],a=e[2]),Dn(s,r,t),Rh(n,r,t),Lh(a,r,t),a=Ge(r,a),{isTargetingSelf:i,target:s,type:n,listener:a}},tr=(r,e,t,i)=>{Dn(r,r,e),r.nodeName?OT[e](r,t,i):r[e](t,i)},FT={on(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"on");if(tr(t,"on",i,s),!e){const n=()=>this.off(t,i,s);n.guid=s.guid;const a=()=>this.off("dispose",n);a.guid=s.guid,tr(this,"on","dispose",n),tr(t,"on","dispose",a)}},one(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"one");if(e)tr(t,"one",i,s);else{const n=(...a)=>{this.off(t,i,n),s.apply(null,a)};n.guid=s.guid,tr(t,"one",i,n)}},any(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"any");if(e)tr(t,"any",i,s);else{const n=(...a)=>{this.off(t,i,n),s.apply(null,a)};n.guid=s.guid,tr(t,"any",i,n)}},off(r,e,t){if(!r||xo(r))St(this.eventBusEl_,r,e);else{const i=r,s=e;Dn(i,this,"off"),Rh(s,this,"off"),Lh(t,this,"off"),t=Ge(this,t),this.off("dispose",t),i.nodeName?(St(i,s,t),St(i,"dispose",t)):Oi(i)&&(i.off(s,t),i.off("dispose",t))}},trigger(r,e){Dn(this.eventBusEl_,this,"trigger");const t=r&&typeof r!="string"?r.type:r;if(!xo(t))throw new Error(`Invalid event type for ${la(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Vr(this.eventBusEl_,r,e)}};function tl(r,e={}){const{eventBusKey:t}=e;if(t){if(!r[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);r.eventBusEl_=r[t]}else r.eventBusEl_=xe("span",{className:"vjs-event-bus"});return Object.assign(r,FT),r.eventedCallbacks&&r.eventedCallbacks.forEach(i=>{i()}),r.on("dispose",()=>{r.off(),[r,r.el_,r.eventBusEl_].forEach(function(i){i&&Pt.has(i)&&Pt.delete(i)}),N.setTimeout(()=>{r.eventBusEl_=null},0)}),r}const UT={state:{},setState(r){typeof r=="function"&&(r=r());let e;return Sr(r,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Oi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Nh(r,e){return Object.assign(r,UT),r.state=Object.assign({},r.state,e),typeof r.handleStateChanged=="function"&&Oi(r)&&r.on("statechanged",r.handleStateChanged),r}const xs=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toLowerCase())},nt=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toUpperCase())},Oh=function(r,e){return nt(r)===nt(e)};var $T=Object.freeze({__proto__:null,toLowerCase:xs,toTitleCase:nt,titleCaseEquals:Oh});class ee{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=$e({},this.options_),t=this.options_=$e(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Qt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(s=>this.addClass(s)),["on","off","one","any","trigger"].forEach(s=>{this[s]=void 0}),t.evented!==!1&&(tl(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Nh(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=$e(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return xe(e,t,i)}localize(e,t,i=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[s],o=s&&s.split("-")[0],u=n&&n[o];let d=i;return a&&a[e]?d=a[e]:u&&u[e]&&(d=u[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(p,T){const A=t[T-1];let b=A;return typeof A>"u"&&(b=p),b})),d}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,s)=>i.concat(s),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",s=xe("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=he.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=he.createElementNS(i,"use");return n.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),s.appendChild(n),this.iconIsSet_?t.replaceChild(s,t.querySelector(".vjs-icon-placeholder")):t.appendChild(s),this.iconIsSet_=!0,s}addChild(e,t={},i=this.children_.length){let s,n;if(typeof e=="string"){n=nt(e);const a=t.componentClass||n;t.name=n;const o=ee.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;s=new o(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(i,0,s),s.parentComponent_=this,typeof s.id=="function"&&(this.childIndex_[s.id()]=s),n=n||s.name&&nt(s.name()),n&&(this.childNameIndex_[n]=s,this.childNameIndex_[xs(n)]=s),typeof s.el=="function"&&s.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:qr(this.children_[i+1])&&(a=this.children_[i+1])),this.contentEl().insertBefore(s.el(),a)}return s}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[nt(e.name())]=null,this.childNameIndex_[xs(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const o=a.name;let u=a.opts;if(t[o]!==void 0&&(u=t[o]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const d=this.addChild(o,u);d&&(this[o]=d)};let s;const n=ee.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,u;return typeof a=="string"?(o=a,u=e[o]||this.options_[o]||{}):(o=a.name,u=a),{name:o,opts:u}}).filter(a=>{const o=ee.getComponent(a.opts.componentClass||nt(a.name));return o&&!n.isTech(o)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Gi(e,t||this.contentEl())}$$(e,t){return Ch(e,t||this.contentEl())}hasClass(e){return bs(this.el_,e)}addClass(...e){or(this.el_,...e)}removeClass(...e){ia(this.el_,...e)}toggleClass(e,t){yh(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Th(this.el_,e)}setAttribute(e,t){Br(this.el_,e,t)}removeAttribute(e){ra(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const s=this.el_.style[e],n=s.indexOf("px");return parseInt(n!==-1?s.slice(0,n):this.el_["offset"+nt(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Fr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${nt(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,s=200;let n;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=N.performance.now(),n=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)n=!1;else if(t){const u=o.touches[0].pageX-t.pageX,d=o.touches[0].pageY-t.pageY;Math.sqrt(u*u+d*d)>i&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,n===!0&&N.performance.now()-e<s&&(o.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ge(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(s){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Ge(this,e),this.clearTimersOnDispose_(),i=N.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),N.clearTimeout(e)),e}setInterval(e,t){e=Ge(this,e),this.clearTimersOnDispose_();const i=N.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),N.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ge(this,e),t=N.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Ge(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),N.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,s)=>this[t](s))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=N.getComputedStyle(n,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function i(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||N.getComputedStyle(n).height==="0px"||N.getComputedStyle(n).width==="0px")}function s(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(he.documentElement.clientWidth||N.innerWidth)||a.y<0||a.y>(he.documentElement.clientHeight||N.innerHeight))return!1;let o=he.elementFromPoint(a.x,a.y);for(;o;){if(o===n)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(s(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=ee.getComponent("Tech"),s=i&&i.isTech(t),n=ee===t||ee.prototype.isPrototypeOf(t.prototype);if(s||!n){let o;throw s?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=nt(e),ee.components_||(ee.components_={});const a=ee.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,u=Object.keys(o);if(o&&u.length>0&&u.map(d=>o[d]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return ee.components_[e]=t,ee.components_[xs(e)]=t,t}static getComponent(e){if(!(!e||!ee.components_))return ee.components_[e]}}ee.registerComponent("Component",ee);function jT(r,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${r}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function xc(r,e,t,i){return jT(r,i,t.length-1),t[i][e]}function Ya(r){let e;return r===void 0||r.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:r.length,start:xc.bind(null,"start",0,r),end:xc.bind(null,"end",1,r)},N.Symbol&&N.Symbol.iterator&&(e[N.Symbol.iterator]=()=>(r||[]).values()),e}function li(r,e){return Array.isArray(r)?Ya(r):r===void 0||e===void 0?Ya():Ya([[r,e]])}const Bh=function(r,e){r=r<0?0:r;let t=Math.floor(r%60),i=Math.floor(r/60%60),s=Math.floor(r/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(r)||r===1/0)&&(s=i=t="-"),s=s>0||a>0?s+":":"",i=((s||n>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,s+i+t};let il=Bh;function Mh(r){il=r}function Fh(){il=Bh}function dr(r,e=r){return il(r,e)}var qT=Object.freeze({__proto__:null,createTimeRanges:li,createTimeRange:li,setFormatTime:Mh,resetFormatTime:Fh,formatTime:dr});function Uh(r,e){let t=0,i,s;if(!e)return 0;(!r||!r.length)&&(r=li(0,0));for(let n=0;n<r.length;n++)i=r.start(n),s=r.end(n),s>e&&(s=e),t+=s-i;return t/e}function rt(r){if(r instanceof rt)return r;typeof r=="number"?this.code=r:typeof r=="string"?this.message=r:Ai(r)&&(typeof r.code=="number"&&(this.code=r.code),Object.assign(this,r)),this.message||(this.message=rt.defaultMessages[this.code]||"")}rt.prototype.code=0;rt.prototype.message="";rt.prototype.status=null;rt.prototype.metadata=null;rt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];rt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};rt.MEDIA_ERR_CUSTOM=0;rt.prototype.MEDIA_ERR_CUSTOM=0;rt.MEDIA_ERR_ABORTED=1;rt.prototype.MEDIA_ERR_ABORTED=1;rt.MEDIA_ERR_NETWORK=2;rt.prototype.MEDIA_ERR_NETWORK=2;rt.MEDIA_ERR_DECODE=3;rt.prototype.MEDIA_ERR_DECODE=3;rt.MEDIA_ERR_SRC_NOT_SUPPORTED=4;rt.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;rt.MEDIA_ERR_ENCRYPTED=5;rt.prototype.MEDIA_ERR_ENCRYPTED=5;function Ss(r){return r!=null&&typeof r.then=="function"}function xi(r){Ss(r)&&r.then(null,e=>{})}const So=function(r){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,s)=>(r[i]&&(t[i]=r[i]),t),{cues:r.cues&&Array.prototype.map.call(r.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},VT=function(r){const e=r.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const n=So(s.track);return s.src&&(n.src=s.src),n}).concat(Array.prototype.filter.call(r.textTracks(),function(s){return t.indexOf(s)===-1}).map(So))},HT=function(r,e){return r.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>i.addCue(s))}),e.textTracks()};var Sc={textTracksToJson:VT,jsonToTextTracks:HT,trackToJson_:So};const Qa="vjs-modal-dialog";class Hr extends ee{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=xe("div",{className:`${Qa}-content`},{role:"document"}),this.descEl_=xe("p",{className:`${Qa}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ki(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Qa} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const s=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Eh(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);const n=this.getChild("closeButton");n&&i.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),na(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=he.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let s;for(let n=0;n<t.length;n++)if(i===t[n]){s=n;break}he.activeElement===this.el_&&(s=0),e.shiftKey&&s===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&s===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof N.HTMLAnchorElement||t instanceof N.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof N.HTMLInputElement||t instanceof N.HTMLSelectElement||t instanceof N.HTMLTextAreaElement||t instanceof N.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof N.HTMLIFrameElement||t instanceof N.HTMLObjectElement||t instanceof N.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Hr.prototype.options_={pauseOnOpen:!0,temporary:!0};ee.registerComponent("ModalDialog",Hr);class Ur extends Vt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Oi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}Ur.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const r in Ur.prototype.allowedEvents_)Ur.prototype["on"+r]=null;const Ja=function(r,e){for(let t=0;t<r.length;t++)!Object.keys(r[t]).length||e.id===r[t].id||(r[t].enabled=!1)};class zT extends Ur{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Ja(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Ja(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Ja(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Za=function(r,e){for(let t=0;t<r.length;t++)!Object.keys(r[t]).length||e.id===r[t].id||(r[t].selected=!1)};class WT extends Ur{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Za(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&Za(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Za(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class $h extends Ur{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class GT{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,s=this.trackElements_.length;i<s;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class In{constructor(e){In.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const s=e.length;this.cues_=e,this.length_=e.length;const n=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<s)for(i=t;i<s;i++)n.call(this,i)}getCueById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}const KT={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},XT={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},YT={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ec={disabled:"disabled",hidden:"hidden",showing:"showing"};class rl extends Vt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Qt(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const s in t)Object.defineProperty(this,s,{get(){return t[s]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(s){s!==i&&(i=s,this.trigger("labelchange"))}})}}const sl=function(r){return new URL(r,he.baseURI)},jh=function(r){return new URL(r,he.baseURI).href},nl=function(r){if(typeof r=="string"){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(r);if(t)return t.pop().toLowerCase()}return""},ua=function(r,e=N.location){return sl(r).origin!==e.origin};var QT=Object.freeze({__proto__:null,parseUrl:sl,getAbsoluteURL:jh,getFileExtension:nl,isCrossOrigin:ua});const Cc=function(r,e){const t=new N.WebVTT.Parser(N,N.vttjs,N.WebVTT.StringDecoder()),i=[];t.oncue=function(s){e.addCue(s)},t.onparsingerror=function(s){i.push(s)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(r),i.length>0&&(N.console&&N.console.groupCollapsed&&N.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(s=>Pe.error(s)),N.console&&N.console.groupEnd&&N.console.groupEnd()),t.flush()},Ac=function(r,e){const t={uri:r},i=ua(r);i&&(t.cors=i);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),qd(t,Ge(this,function(n,a,o){if(n)return Pe.error(n,a);e.loaded_=!0,typeof N.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){Pe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Cc(o,e)}):Cc(o,e)}))};class Rs extends rl{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=$e(e,{kind:YT[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Ec[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new In(this.cues_),a=new In(this.activeCues_);let o=!1;this.timeupdateHandler=Ge(this,function(d={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return i},set(d){Ec[d]&&i!==d&&(i=d,!this.preload_&&i!=="disabled"&&this.cues.length===0&&Ac(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const d=this.tech_.currentTime(),p=[];for(let T=0,A=this.cues.length;T<A;T++){const b=this.cues[T];b.startTime<=d&&b.endTime>=d&&p.push(b)}if(o=!1,p.length!==this.activeCues_.length)o=!0;else for(let T=0;T<p.length;T++)this.activeCues_.indexOf(p[T])===-1&&(o=!0);return this.activeCues_=p,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&Ac(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new N.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const s in e)s in t||(t[s]=e[s]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let s=0;s<i.length;s++)i[s]!==this&&i[s].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Rs.prototype.allowedEvents_={cuechange:"cuechange"};class qh extends rl{constructor(e={}){const t=$e(e,{kind:XT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(s){typeof s!="boolean"||s===i||(i=s,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Vh extends rl{constructor(e={}){const t=$e(e,{kind:KT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(s){typeof s!="boolean"||s===i||(i=s,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Bi extends Vt{constructor(e={}){super();let t;const i=new Rs(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=Bi.NONE,i.addEventListener("loadeddata",()=>{t=Bi.LOADED,this.trigger({type:"load",target:this})})}}Bi.prototype.allowedEvents_={load:"load"};Bi.NONE=0;Bi.LOADING=1;Bi.LOADED=2;Bi.ERROR=3;const Yt={audio:{ListClass:zT,TrackClass:qh,capitalName:"Audio"},video:{ListClass:WT,TrackClass:Vh,capitalName:"Video"},text:{ListClass:$h,TrackClass:Rs,capitalName:"Text"}};Object.keys(Yt).forEach(function(r){Yt[r].getterName=`${r}Tracks`,Yt[r].privateName=`${r}Tracks_`});const $r={remoteText:{ListClass:$h,TrackClass:Rs,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:GT,TrackClass:Bi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},kt=Object.assign({},Yt,$r);$r.names=Object.keys($r);Yt.names=Object.keys(Yt);kt.names=[].concat($r.names).concat(Yt.names);function JT(r,e,t,i,s={}){const n=r.textTracks();s.kind=e,t&&(s.label=t),i&&(s.language=i),s.tech=r;const a=new kt.text.TrackClass(s);return n.addTrack(a),a}class De extends ee{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),kt.names.forEach(i=>{const s=kt[i];e&&e[s.getterName]&&(this[s.privateName]=e[s.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new kt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ge(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return li(0,0)}bufferedPercent(){return Uh(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Yt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let s=i.length;for(;s--;){const n=i[s];t==="text"&&this.removeRemoteTextTrack(n),i.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new rt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?li(0,0):li()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Yt.names.forEach(e=>{const t=Yt[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!N.WebVTT)if(he.body.contains(this.el())){if(!this.options_["vtt.js"]&&Or(Xu)&&Object.keys(Xu).length>0){this.trigger("vttjsloaded");return}const e=he.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),N.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=o=>e.addTrack(o.track),s=o=>e.removeTrack(o.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let o=0;o<e.length;o++){const u=e[o];u.removeEventListener("cuechange",n),u.mode==="showing"&&u.addEventListener("cuechange",n)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",s),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",n)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return JT(this,e,t,i)}createRemoteTextTrack(e){const t=$e(e,{tech:this});return new $r.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Qt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return De.canPlayType(e.type)}static isTech(e){return e.prototype instanceof De||e instanceof De||e===De}static registerTech(e,t){if(De.techs_||(De.techs_={}),!De.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!De.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!De.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=nt(e),De.techs_[e]=t,De.techs_[xs(e)]=t,e!=="Tech"&&De.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(De.techs_&&De.techs_[e])return De.techs_[e];if(e=nt(e),N&&N.videojs&&N.videojs[e])return Pe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),N.videojs[e]}}}kt.names.forEach(function(r){const e=kt[r];De.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});De.prototype.featuresVolumeControl=!0;De.prototype.featuresMuteControl=!0;De.prototype.featuresFullscreenResize=!1;De.prototype.featuresPlaybackRate=!1;De.prototype.featuresProgressEvents=!1;De.prototype.featuresSourceset=!1;De.prototype.featuresTimeupdateEvents=!1;De.prototype.featuresNativeTextTracks=!1;De.prototype.featuresVideoFrameCallback=!1;De.withSourceHandlers=function(r){r.registerSourceHandler=function(t,i){let s=r.sourceHandlers;s||(s=r.sourceHandlers=[]),i===void 0&&(i=s.length),s.splice(i,0,t)},r.canPlayType=function(t){const i=r.sourceHandlers||[];let s;for(let n=0;n<i.length;n++)if(s=i[n].canPlayType(t),s)return s;return""},r.selectSourceHandler=function(t,i){const s=r.sourceHandlers||[];let n;for(let a=0;a<s.length;a++)if(n=s[a].canHandleSource(t,i),n)return s[a];return null},r.canPlaySource=function(t,i){const s=r.selectSourceHandler(t,i);return s?s.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},r.prototype),r.prototype.setSource=function(t){let i=r.selectSourceHandler(t,this.options_);i||(r.nativeSourceHandler?i=r.nativeSourceHandler:Pe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==r.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},r.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};ee.registerComponent("Tech",De);De.registerTech("Tech",De);De.defaultTechOrder_=[];const lr={},kn={},Pn={};function ZT(r,e){lr[r]=lr[r]||[],lr[r].push(e)}function ev(r,e,t){r.setTimeout(()=>ir(e,lr[e.type],t,r),1)}function tv(r,e){r.forEach(t=>t.setTech&&t.setTech(e))}function iv(r,e,t){return r.reduceRight(al(t),e[t]())}function rv(r,e,t,i){return e[t](r.reduce(al(t),i))}function wc(r,e,t,i=null){const s="call"+nt(t),n=r.reduce(al(s),i),a=n===Pn,o=a?null:e[t](n);return av(r,t,o,a),o}const sv={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},nv={setCurrentTime:1,setMuted:1,setVolume:1},Dc={play:1,pause:1};function al(r){return(e,t)=>e===Pn?Pn:t[r]?t[r](e):e}function av(r,e,t,i){for(let s=r.length-1;s>=0;s--){const n=r[s];n[e]&&n[e](i,t)}}function ov(r){kn.hasOwnProperty(r.id())&&delete kn[r.id()]}function lv(r,e){const t=kn[r.id()];let i=null;if(t==null)return i=e(r),kn[r.id()]=[[e,i]],i;for(let s=0;s<t.length;s++){const[n,a]=t[s];n===e&&(i=a)}return i===null&&(i=e(r),t.push([e,i])),i}function ir(r={},e=[],t,i,s=[],n=!1){const[a,...o]=e;if(typeof a=="string")ir(r,lr[a],t,i,s,n);else if(a){const u=lv(i,a);if(!u.setSource)return s.push(u),ir(r,o,t,i,s,n);u.setSource(Object.assign({},r),function(d,p){if(d)return ir(r,o,t,i,s,n);s.push(u),ir(p,r.type===p.type?o:lr[p.type],t,i,s,n)})}else o.length?ir(r,o,t,i,s,n):n?t(r,s):ir(r,lr["*"],t,i,s,!0)}const uv={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Rn=function(r=""){const e=nl(r);return uv[e.toLowerCase()]||""},cv=(r,e)=>{if(!e)return"";if(r.cache_.source.src===e&&r.cache_.source.type)return r.cache_.source.type;const t=r.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const i=r.$$("source");for(let s=0;s<i.length;s++){const n=i[s];if(n.type&&n.src&&n.src===e)return n.type}return Rn(e)},Hh=function(r){if(Array.isArray(r)){let e=[];r.forEach(function(t){t=Hh(t),Array.isArray(t)?e=e.concat(t):Ai(t)&&e.push(t)}),r=e}else typeof r=="string"&&r.trim()?r=[Ic({src:r})]:Ai(r)&&typeof r.src=="string"&&r.src&&r.src.trim()?r=[Ic(r)]:r=[];return r};function Ic(r){if(!r.type){const e=Rn(r.src);e&&(r.type=e)}return r}var dv=`<svg xmlns="http://www.w3.org/2000/svg">
18
+ <defs>
19
+ <symbol viewBox="0 0 48 48" id="vjs-icon-play">
20
+ <path d="M16 10v28l22-14z"></path>
21
+ </symbol>
22
+ <symbol viewBox="0 0 48 48" id="vjs-icon-pause">
23
+ <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
24
+ </symbol>
25
+ <symbol viewBox="0 0 48 48" id="vjs-icon-audio">
26
+ <path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
27
+ </symbol>
28
+ <symbol viewBox="0 0 48 48" id="vjs-icon-captions">
29
+ <path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
30
+ </symbol>
31
+ <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
32
+ <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
33
+ </symbol>
34
+ <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
35
+ <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
36
+ </symbol>
37
+ <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
38
+ <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
39
+ </symbol>
40
+ <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
41
+ <path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
42
+ </symbol>
43
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
44
+ <path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
45
+ </symbol>
46
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
47
+ <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
48
+ </symbol>
49
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
50
+ <path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
51
+ </symbol>
52
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
53
+ <path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
54
+ </symbol>
55
+ <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
56
+ <path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
57
+ </symbol>
58
+ <symbol viewBox="0 0 24 24" id="vjs-icon-hd">
59
+ <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
60
+ </symbol>
61
+ <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
62
+ <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
63
+ </symbol>
64
+ <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
65
+ <path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
66
+ </symbol>
67
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
68
+ <path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
69
+ </symbol>
70
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
71
+ <path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
72
+ </symbol>
73
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
74
+ <path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
75
+ </symbol>
76
+ <symbol viewBox="0 0 48 48" id="vjs-icon-share">
77
+ <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
78
+ </symbol>
79
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cog">
80
+ <path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
81
+ </symbol>
82
+ <symbol viewBox="0 0 48 48" id="vjs-icon-square">
83
+ <path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
84
+ </symbol>
85
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle">
86
+ <circle cx="24" cy="24" r="20"></circle>
87
+ </symbol>
88
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
89
+ <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
90
+ </symbol>
91
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
92
+ <path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
93
+ </symbol>
94
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
95
+ <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
96
+ </symbol>
97
+ <symbol viewBox="0 0 48 48" id="vjs-icon-replay">
98
+ <path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
99
+ </symbol>
100
+ <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
101
+ <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
102
+ </symbol>
103
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
104
+ <path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
105
+ </symbol>
106
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
107
+ <path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
108
+ </symbol>
109
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
110
+ <path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
111
+ </symbol>
112
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
113
+ <path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
114
+ </symbol>
115
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
116
+ <path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
117
+ </symbol>
118
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
119
+ <path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
120
+ </symbol>
121
+ <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
122
+ <g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
123
+ </symbol>
124
+ <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
125
+ <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
126
+ </symbol>
127
+ <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
128
+ <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
129
+ </symbol>
130
+ <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
131
+ <path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
132
+ </symbol>
133
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cast">
134
+ <path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
135
+ </symbol>
136
+ <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
137
+ <path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
138
+ </symbol>
139
+ <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
140
+ <path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
141
+ <path fill="none" d="M-1-3h24v24H-1z"></path>
142
+ </symbol>
143
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
144
+ <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
145
+ </symbol>
146
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
147
+ <path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
148
+ </symbol>
149
+ <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
150
+ <path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
151
+ </symbol>
152
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
153
+ <path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
154
+ </symbol>
155
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
156
+ <path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
157
+ </symbol>
158
+ </defs>
159
+ </svg>`;const kc=Cn?10009:An?461:8,yr={codes:{play:415,pause:19,ff:417,rw:412,back:kc},names:{415:"play",19:"pause",417:"ff",412:"rw",[kc]:"back"},isEventKey(r,e){return e=e.toLowerCase(),!!(this.names[r.keyCode]&&this.names[r.keyCode]===e)},getEventName(r){if(this.names[r.keyCode])return this.names[r.keyCode];if(this.codes[r.code]){const e=this.codes[r.code];return this.names[e]}return null}},Pc=5;class hv extends Vt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(yr.isEventKey(t,"play")||yr.isEventKey(t,"pause")||yr.isEventKey(t,"ff")||yr.isEventKey(t,"rw")){t.preventDefault();const i=yr.getEventName(t);this.performMediaAction_(i)}else yr.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Pc);break;case"rw":this.userSeek_(this.player_.currentTime()-Pc);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const s=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(s&&s.name()==="CloseButton"?this.refocusComponent():(this.pause(),s&&s.el()&&(this.lastFocusedComponent_=s)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(s){for(const n of s)n.hasOwnProperty("el_")&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())&&t.push(n),n.hasOwnProperty("children_")&&n.children_.length>0&&i(n.children_)}return e.children_.forEach(s=>{if(s.hasOwnProperty("el_"))if(s.getIsFocusable&&s.getIsAvailableToBeFocused&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())){t.push(s);return}else s.hasOwnProperty("children_")&&s.children_.length>0?i(s.children_):s.hasOwnProperty("items")&&s.items.length>0?i(s.items):this.findSuitableDOMChild(s)&&t.push(s);if(s.name_==="ErrorDisplay"&&s.opened_){const n=s.el_.querySelector(".vjs-errors-ok-button-container");n&&n.querySelectorAll("button").forEach((o,u)=>{t.push({name:()=>"ModalButton"+(u+1),el:()=>o,getPositions:()=>{const d=o.getBoundingClientRect(),p={x:d.x,y:d.y,width:d.width,height:d.height,top:d.top,right:d.right,bottom:d.bottom,left:d.left},T={x:d.left+d.width/2,y:d.top+d.height/2,width:0,height:0,top:d.top+d.height/2,right:d.left+d.width/2,bottom:d.top+d.height/2,left:d.left+d.width/2};return{boundingClientRect:p,center:T}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:d=>!0,focus:()=>o.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let s=0;s<i.children.length;s++){const n=i.children[s],a=t(n);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),s=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(i.center,s,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let s=1/0,n=null;for(const a of t){const o=a.getPositions().center,u=this.calculateDistance_(e,o,i);u<s&&(s=u,n=a)}return n}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const s=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);let a;switch(i){case"right":case"left":a=s+n*100;break;case"up":a=n*2+s*.5;break;case"down":a=n*5+s;break;default:a=s+n}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class fv extends ee{constructor(e,t,i){const s=$e({createEl:!1},t);if(super(e,s,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const o=nt(a[n]);let u=De.getTech(o);if(o||(u=ee.getComponent(o)),u&&u.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}ee.registerComponent("MediaLoader",fv);class ca extends ee{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Pe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const s=xe(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=xe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ki(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}ee.registerComponent("ClickableComponent",ca);class Eo extends ca{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return xe("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(xe("picture",{className:"vjs-poster",tabIndex:-1},{},xe("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?xi(this.player_.play()):this.player_.pause())}}Eo.prototype.crossorigin=Eo.prototype.crossOrigin;ee.registerComponent("PosterImage",Eo);const Kt="#222",Rc="#ccc",pv={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function eo(r,e){let t;if(r.length===4)t=r[1]+r[1]+r[2]+r[2]+r[3]+r[3];else if(r.length===7)t=r.slice(1);else throw new Error("Invalid color code provided, "+r+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function yi(r,e,t){try{r.style[e]=t}catch{return}}function Lc(r){return r?`${r}px`:""}class mv extends ee{constructor(e,t,i){super(e,t,i);const s=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",s),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Ge(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=N.screen.orientation||N,o=N.screen.orientation?"change":"orientationchange";a.addEventListener(o,n),e.on("dispose",()=>a.removeEventListener(o,n));const u=this.options_.playerOptions.tracks||[];for(let d=0;d<u.length;d++)this.player_.addRemoteTextTrack(u[d],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let s,n,a;for(let o=0;o<t.length;o++){const u=t[o];i&&i.enabled&&i.language&&i.language===u.language&&u.kind in e?u.kind===i.kind?a=u:a||(a=u):i&&!i.enabled?(a=null,s=null,n=null):u.default&&(u.kind==="descriptions"&&!s?s=u:u.kind in e&&!n&&(n=u))}a?a.mode="showing":n?n.mode="showing":s&&(s.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof N.WebVTT=="function"&&N.WebVTT.processCues(N,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const u=e[o];u.mode==="showing"&&a.push(u)}this.updateForTrack(a);return}let i=null,s=null,n=e.length;for(;n--;){const a=e[n];a.mode==="showing"&&(a.kind==="descriptions"?i=a:s=a)}if(s?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!N.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),u=this.player_.controlBar.el_.getBoundingClientRect().height,d=this.player_.el_.getBoundingClientRect().height;a.style="",yi(a,"position","relative"),yi(a,"height",d-u+"px"),yi(a,"top","unset"),wn?yi(a,"bottom",d+"px"):yi(a,"bottom","0px"),o.length>0&&o.forEach(p=>{if(p.style.inset){const T=p.style.inset.split(" ");T.length===3&&Object.assign(p.style,{top:T[0],right:T[1],bottom:T[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!N.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(i-s)>.1&&(i>s?n=Math.round((e-t*s)/2):a=Math.round((t-e/s)/2)),yi(this.el_,"insetInline",Lc(n)),yi(this.el_,"insetBlock",Lc(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){const n=i[s];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&yi(a.firstChild,"color",eo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&yi(a.firstChild,"backgroundColor",eo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?yi(a,"backgroundColor",eo(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Kt}, 2px 2px 4px ${Kt}, 2px 2px 5px ${Kt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Kt}, 2px 2px ${Kt}, 3px 3px ${Kt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Rc}, 0 1px ${Rc}, -1px -1px ${Kt}, 0 -1px ${Kt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}`)),t.fontPercent&&t.fontPercent!==1){const o=N.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=pv[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof N.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const s=e[i];for(let n=0;n<s.activeCues.length;++n)t.push(s.activeCues[n])}N.WebVTT.processCues(N,t,this.el_);for(let i=0;i<e.length;++i){const s=e[i];for(let n=0;n<s.activeCues.length;++n){const a=s.activeCues[n].displayState;or(a,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:i)),s.language&&Br(a,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}}ee.registerComponent("TextTrackDisplay",mv);class gv extends ee{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=xe("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}ee.registerComponent("LoadingSpinner",gv);class Et extends ca{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const s=xe(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}addChild(e,t={}){const i=this.constructor.name;return Pe.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),ee.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}ee.registerComponent("Button",Et);class zh extends Et{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){xi(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}const n=()=>s.focus();Ss(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}zh.prototype.controlText_="Play Video";ee.registerComponent("BigPlayButton",zh);class yv extends Et{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}ee.registerComponent("CloseButton",yv);class Wh extends Et{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?xi(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}Wh.prototype.controlText_="Play";ee.registerComponent("PlayToggle",Wh);class zr extends ee{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=xe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=xe("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=dr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Pe.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=he.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}zr.prototype.labelText_="Time";zr.prototype.controlText_="Time";ee.registerComponent("TimeDisplay",zr);class ol extends zr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ol.prototype.labelText_="Current Time";ol.prototype.controlText_="Current Time";ee.registerComponent("CurrentTimeDisplay",ol);class ll extends zr{constructor(e,t){super(e,t);const i=s=>this.updateContent(s);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}ll.prototype.labelText_="Duration";ll.prototype.controlText_="Duration";ee.registerComponent("DurationDisplay",ll);class _v extends ee{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}ee.registerComponent("TimeDivider",_v);class ul extends zr{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(xe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}ul.prototype.labelText_="Remaining Time";ul.prototype.controlText_="Remaining Time";ee.registerComponent("RemainingTimeDisplay",ul);class Tv extends ee{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=xe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(xe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(he.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}ee.registerComponent("LiveDisplay",Tv);class Gh extends Et{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=xe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}Gh.prototype.controlText_="Seek to live, currently playing live";ee.registerComponent("SeekToLive",Gh);function Ls(r,e,t){return r=Number(r),Math.min(t,Math.max(e,isNaN(r)?e:r))}var vv=Object.freeze({__proto__:null,clamp:Ls});class cl extends ee{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!wi&&e.preventDefault(),vh(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;bh(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Ls(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=sa(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,s=t&&t.horizontalSeek;i?s&&e.key==="ArrowLeft"||!s&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):s&&e.key==="ArrowRight"||!s&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}ee.registerComponent("Slider",cl);const to=(r,e)=>Ls(r/e*100,0,100).toFixed(2)+"%";class bv extends ee{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=xe("span",{className:"vjs-control-text"}),i=xe("span",{textContent:this.localize("Loaded")}),s=he.createTextNode(": ");return this.percentageEl_=xe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),s=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,o=to(n,s);this.percent_!==o&&(this.el_.style.width=o,Ki(this.percentageEl_,o),this.percent_=o);for(let u=0;u<i.length;u++){const d=i.start(u),p=i.end(u);let T=a[u];T||(T=this.el_.appendChild(xe()),a[u]=T),!(T.dataset.start===d&&T.dataset.end===p)&&(T.dataset.start=d,T.dataset.end=p,T.style.left=to(d,n),T.style.width=to(p-d,n))}for(let u=a.length;u>i.length;u--)this.el_.removeChild(a[u-1]);a.length=i.length})}}ee.registerComponent("LoadProgressBar",bv);class xv extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const s=Is(this.el_),n=Mr(this.player_.el()),a=e.width*t;if(!n||!s)return;let o=e.left-n.left+a,u=e.width-a+(n.right-e.right);u||(u=e.width-a,o=a);let d=s.width/2;o<d?d+=d-o:u<d&&(d=u),d<0?d=0:d>s.width&&(d=s.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(i)}write(e){Ki(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),u=o-t*o;n=(u<1?"":"-")+dr(u,o)}else n=dr(i,a);this.update(e,t,n),s&&s()})}}ee.registerComponent("TimeTooltip",xv);class dl extends ee{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const i=this.getChild("timeTooltip");if(!i)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}dl.prototype.options_={children:[]};!xt&&!ci&&dl.prototype.options_.children.push("timeTooltip");ee.registerComponent("PlayProgressBar",dl);class Kh extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}Kh.prototype.options_={children:["timeTooltip"]};ee.registerComponent("MouseTimeDisplay",Kh);const hn=5,Nc=12;class da extends cl{constructor(e,t){t=$e(da.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(xt||ci);(!xt&&!ci||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ge(this,this.update),this.update=Di(this.update_,Jt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in he&&"visibilityState"in he&&this.on(he,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){he.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Jt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(he.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker;let n=this.player_.duration();s&&s.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[dr(i,n),dr(n,n)],"{1} of {2}")),this.currentTime_=i,this.duration_=n),this.bar&&this.bar.update(Mr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ks(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!ks(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const s=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())i=s*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(s>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),o=n.liveCurrentTime();if(i=a+s*n.liveWindow(),i>=o&&(i=o),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=i:this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?xi(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+hn)}stepBack(){this.userSeek_(this.player_.currentTime()-hn)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-hn*Nc)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+hn*Nc)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in he&&"visibilityState"in he&&this.off(he,"visibilitychange",this.toggleVisibility_),super.dispose()}}da.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};ee.registerComponent("SeekBar",da);class Xh extends ee{constructor(e,t){super(e,t),this.handleMouseMove=Di(Ge(this,this.handleMouseMove),Jt),this.throttledHandleMouseSeek=Di(Ge(this,this.handleMouseSeek),Jt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;const n=t.el(),a=Is(n);let o=sa(n,e).x;o=Ls(o,0,1),s&&s.update(a,o),i&&i.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&xi(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Xh.prototype.options_={children:["seekBar"]};ee.registerComponent("ProgressControl",Xh);class Yh extends Et{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){he.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in N?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof he.exitPictureInPicture=="function"&&super.show()}}Yh.prototype.controlText_="Picture-in-Picture";ee.registerComponent("PictureInPictureToggle",Yh);class Qh extends Et{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),he[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Qh.prototype.controlText_="Fullscreen";ee.registerComponent("FullscreenToggle",Qh);const Sv=function(r,e){e.tech_&&!e.tech_.featuresVolumeControl&&r.addClass("vjs-hidden"),r.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?r.removeClass("vjs-hidden"):r.addClass("vjs-hidden")})};class Ev extends ee{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}ee.registerComponent("VolumeLevel",Ev);class Cv extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){const n=Mr(this.el_),a=Mr(this.player_.el()),o=e.width*t;if(!a||!n)return;const u=e.left-a.left+o,d=e.width-o+(a.right-e.right);let p=n.width/2;u<p?p+=p-u:d<p&&(p=d),p<0?p=0:p>n.width&&(p=n.width),this.el_.style.right=`-${p}px`}this.write(`${s}%`)}write(e){Ki(this.el_,e)}updateVolume(e,t,i,s,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),n&&n()})}}ee.registerComponent("VolumeLevelTooltip",Cv);class Jh extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Jh.prototype.options_={children:["volumeLevelTooltip"]};ee.registerComponent("MouseVolumeLevelDisplay",Jh);class ha extends cl{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ks(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),s=Mr(i),n=this.vertical();let a=sa(i,e);a=n?a.y:a.x,a=Ls(a,0,1),t.update(s,a,n)}ks(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}ha.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!xt&&!ci&&ha.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ha.prototype.playerEvent="volumechange";ee.registerComponent("VolumeBar",ha);class Zh extends ee{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Or(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Sv(this,e),this.throttledHandleMouseMove=Di(Ge(this,this.handleMouseMove),Jt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Zh.prototype.options_={children:["volumeBar"]};ee.registerComponent("VolumeControl",Zh);const Av=function(r,e){e.tech_&&!e.tech_.featuresMuteControl&&r.addClass("vjs-hidden"),r.on(e,"loadstart",function(){e.tech_.featuresMuteControl?r.removeClass("vjs-hidden"):r.addClass("vjs-hidden")})};class ef extends Et{constructor(e,t){super(e,t),Av(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const s=i<.1?.1:i;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),xt&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),ia(this.el_,[0,1,2,3].reduce((i,s)=>i+`${s?" ":""}vjs-vol-${s}`,"")),or(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}ef.prototype.controlText_="Mute";ee.registerComponent("MuteToggle",ef);class tf extends ee{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Or(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),qt(he,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),St(he,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}tf.prototype.options_={children:["muteToggle","volumeControl"]};ee.registerComponent("VolumePanel",tf);class rf extends Et{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration();let n;t+this.skipTime<=s?n=t+this.skipTime:n=s,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}rf.prototype.controlText_="Skip Forward";ee.registerComponent("SkipForward",rf);class sf extends Et{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart();let n;s&&t-this.skipTime<=s?n=s:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}sf.prototype.controlText_="Skip Backward";ee.registerComponent("SkipBackward",sf);class nf extends ee{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof ee&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof ee&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=xe(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),qt(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||he.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(s=>s.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}ee.registerComponent("Menu",nf);class hl extends ee{constructor(e,t={}){super(e,t),this.menuButton_=new Et(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Et.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),qt(he,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",n=>this.handleMouseLeave(n)),this.on("keydown",n=>this.handleSubmenuKeyDown(n))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new nf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=xe("li",{className:"vjs-menu-title",textContent:nt(this.options_.title),tabIndex:-1}),i=new ee(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=Et.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),St(he,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),xt&&mh())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}ee.registerComponent("MenuButton",hl);class fl extends hl{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const s=Ge(this,this.update);i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),i.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s),i.removeEventListener("labelchange",s)})}}ee.registerComponent("TrackButton",fl);class Ns extends ca{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),n=xe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?s.appendChild(n):s.replaceChild(n,s.querySelector(".vjs-icon-placeholder")),s}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}ee.registerComponent("MenuItem",Ns);class Os extends Ns{constructor(e,t){const i=t.track,s=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],n),s.addEventListener("change",n),s.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),s.removeEventListener("change",n),s.removeEventListener("selectedlanguagechange",a)}),s.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof N.Event!="object")try{o=new N.Event("change")}catch{}o||(o=he.createEvent("Event"),o.initEvent("change",!0,!0)),s.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let s=0;s<i.length;s++){const n=i[s];this.kinds.indexOf(n.kind)!==-1&&(n===t?n.mode!=="showing"&&(n.mode="showing"):n.mode!=="disabled"&&(n.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}ee.registerComponent("TextTrackMenuItem",Os);class af extends Os{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}ee.registerComponent("OffTextTrackMenuItem",af);class Wr extends fl{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Os){let i;this.label_&&(i=`${this.label_} off`),e.push(new af(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n<s.length;n++){const a=s[n];if(this.kinds_.indexOf(a.kind)>-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}ee.registerComponent("TextTrackButton",Wr);class of extends Ns{constructor(e,t){const i=t.track,s=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=n&&n<s.endTime,super(e,t),this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}ee.registerComponent("ChaptersTrackMenuItem",of);class pl extends Wr{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(s=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(nt(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,s=t.length;i<s;i++){const n=t[i],a=new of(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}pl.prototype.kind_="chapters";pl.prototype.controlText_="Chapters";ee.registerComponent("ChaptersButton",pl);class ml extends Wr{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const s=e.textTracks(),n=Ge(this,this.handleTracksChange);s.addEventListener("change",n),this.on("dispose",function(){s.removeEventListener("change",n)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(a.kind!==this.kind_&&a.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}ml.prototype.kind_="descriptions";ml.prototype.controlText_="Descriptions";ee.registerComponent("DescriptionsButton",ml);class gl extends Wr{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}gl.prototype.kind_="subtitles";gl.prototype.controlText_="Subtitles";ee.registerComponent("SubtitlesButton",gl);class yl extends Os{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}ee.registerComponent("CaptionSettingsMenuItem",yl);class _l extends Wr{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new yl(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}_l.prototype.kind_="captions";_l.prototype.controlText_="Captions";ee.registerComponent("CaptionsButton",_l);class lf extends Os{createEl(e,t,i){const s=super.createEl(e,t,i),n=s.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",s):n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(xe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),s}}ee.registerComponent("SubsCapsMenuItem",lf);class Tl extends Wr{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(nt(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new yl(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,lf),e}}Tl.prototype.kinds_=["captions","subtitles"];Tl.prototype.controlText_="Subtitles";ee.registerComponent("SubsCapsButton",Tl);class uf extends Ns{constructor(e,t){const i=t.track,s=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};s.addEventListener("change",n),this.on("dispose",()=>{s.removeEventListener("change",n)})}createEl(e,t,i){const s=super.createEl(e,t,i),n=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(xe("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const s=t[i];s!==this.track&&(s.enabled=s===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}ee.registerComponent("AudioTrackMenuItem",uf);class cf extends fl{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const s=t[i];e.push(new uf(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}cf.prototype.controlText_="Audio Track";ee.registerComponent("AudioTrackButton",cf);class vl extends Ns{constructor(e,t){const i=t.rate,s=parseFloat(i,10);t.label=i,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=s,this.on(e,"ratechange",n=>this.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}vl.prototype.contentElType="button";ee.registerComponent("PlaybackRateMenuItem",vl);class df extends hl{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=xe("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new vl(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}df.prototype.controlText_="Playback Rate";ee.registerComponent("PlaybackRateMenuButton",df);class hf extends ee{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}ee.registerComponent("Spacer",hf);class wv extends hf{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}ee.registerComponent("CustomControlSpacer",wv);class ff extends ee{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}ff.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};ee.registerComponent("ControlBar",ff);class pf extends Hr{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}pf.prototype.options_=Object.assign({},Hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});ee.registerComponent("ErrorDisplay",pf);class mf extends ee{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),xe("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Qt()}`)+"-"+t[1].replace(/\W+/g,""),s=xe("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),s}))}}ee.registerComponent("TextTrackSelect",mf);class ur extends ee{constructor(e,t={}){super(e,t);const i=xe("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const s=this.options_.selects;for(const n of s){const a=this.options_.selectConfigs[n],o=a.className,u=a.id.replace("%s",this.options_.id_);let d=null;const p=`vjs_select_${Qt()}`;if(this.options_.type==="colors"){d=xe("span",{className:o});const A=xe("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});A.setAttribute("for",p),d.appendChild(A)}const T=new mf(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:p,labelId:u});this.addChild(T),this.options_.type==="colors"&&(d.appendChild(T.el()),this.el().appendChild(d))}}createEl(){return xe("fieldset",{className:this.options_.className})}}ee.registerComponent("TextTrackFieldset",ur);class gf extends ee{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new ur(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const n=new ur(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new ur(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return xe("div",{className:"vjs-track-settings-colors"})}}ee.registerComponent("TextTrackSettingsColors",gf);class yf extends ee{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new ur(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const n=new ur(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new ur(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return xe("div",{className:"vjs-track-settings-font"})}}ee.registerComponent("TextTrackSettingsFont",yf);class _f extends ee{constructor(e,t={}){super(e,t);const i=this.localize("restore all settings to the default values"),s=new Et(e,{controlText:i,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const n=new Et(e,{controlText:i,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Done"),this.addChild(n)}createEl(){return xe("div",{className:"vjs-track-settings-controls"})}}ee.registerComponent("TrackSettingsControls",_f);const io="vjs-text-track-settings",Oc=["#000","Black"],Bc=["#00F","Blue"],Mc=["#0FF","Cyan"],Fc=["#0F0","Green"],Uc=["#F0F","Magenta"],$c=["#F00","Red"],jc=["#FFF","White"],qc=["#FF0","Yellow"],ro=["1","Opaque"],so=["0.5","Semi-Transparent"],Vc=["0","Transparent"],zi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Oc,jc,$c,Fc,Bc,qc,Uc,Mc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ro,so,Vc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[jc,Oc,$c,Fc,Bc,qc,Uc,Mc],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:r=>r==="1.00"?null:Number(r)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ro,so],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Vc,so,ro],className:"vjs-window-opacity vjs-opacity"}};zi.windowColor.options=zi.backgroundColor.options;function Tf(r,e){if(e&&(r=e(r)),r&&r!=="none")return r}function Dv(r,e){const t=r.options[r.options.selectedIndex].value;return Tf(t,e)}function Iv(r,e,t){if(e){for(let i=0;i<r.options.length;i++)if(Tf(r.options[i].value,t)===e){r.selectedIndex=i;break}}}class kv extends Hr{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=xe("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new gf(e,{textTrackComponentid:this.id_,selectConfigs:zi,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new yf(e,{textTrackComponentid:this.id_,selectConfigs:zi,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const s=new _f(e);this.addChild(s)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Sr(zi,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return lh(zi,(e,t,i)=>{const s=Dv(this.$(t.selector),t.parser);return s!==void 0&&(e[i]=s),e},{})}setValues(e){Sr(zi,(t,i)=>{Iv(this.$(t.selector),e[i],t.parser)})}setDefaults(){Sr(zi,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(N.localStorage.getItem(io))}catch(t){Pe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?N.localStorage.setItem(io,JSON.stringify(e)):N.localStorage.removeItem(io)}catch(t){Pe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}ee.registerComponent("TextTrackSettings",kv);class Pv extends ee{constructor(e,t){let i=t.ResizeObserver||N.ResizeObserver;t.ResizeObserver===null&&(i=!1);const s=$e({createEl:!i,reportTouchActivity:!1},t);super(e,s),this.ResizeObserver=t.ResizeObserver||N.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Ph(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){St(this,"resize",n),St(this,"unload",a),a=null};qt(this.el_.contentWindow,"unload",a),qt(this.el_.contentWindow,"resize",n)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}ee.registerComponent("ResizeManager",Pv);const Rv={trackingThreshold:20,liveTolerance:15};class Lv extends ee{constructor(e,t){const i=$e(Rv,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=s=>this.handlePlay(s),this.handleFirstTimeupdate_=s=>this.handleFirstTimeupdate(s),this.handleSeeked_=s=>this.handleSeeked(s),this.seekToLiveEdge_=s=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",s=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(N.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const s=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||s===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Jt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}ee.registerComponent("LiveTracker",Lv);class Nv extends ee{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:xe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Qt()}`}),description:xe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Qt()}`})},xe("div",{className:"vjs-title-bar"},{},uh(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(s=>{const n=this.state[s],a=this.els[s],o=i[s];na(a),n&&Ki(a,n),t&&(t.removeAttribute(o),n&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}ee.registerComponent("TitleBar",Nv);const Ov={initialDisplay:4e3,position:[],takeFocus:!1};class Bv extends Et{constructor(e,t){t=$e(Ov,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=xe("button",{},{type:"button",class:this.buildCSSClass()},xe("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}ee.registerComponent("TransientButton",Bv);const Co=r=>{const e=r.el();if(e.hasAttribute("src"))return r.triggerSourceset(e.src),!0;const t=r.$$("source"),i=[];let s="";if(!t.length)return!1;for(let n=0;n<t.length;n++){const a=t[n].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(s=i[0]),r.triggerSourceset(s),!0):!1},Mv=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(r){const e=he.createElement(this.nodeName.toLowerCase());e.innerHTML=r;const t=he.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",N.Element.prototype.appendChild.call(this,t),this.innerHTML}}),vf=(r,e)=>{let t={};for(let i=0;i<r.length&&(t=Object.getOwnPropertyDescriptor(r[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},Fv=r=>vf([r.el(),N.HTMLMediaElement.prototype,N.Element.prototype,Mv],"innerHTML"),Hc=function(r){const e=r.el();if(e.resetSourceWatch_)return;const t={},i=Fv(r),s=n=>(...a)=>{const o=n.apply(e,a);return Co(r),o};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=s(t[n]))}),Object.defineProperty(e,"innerHTML",$e(i,{set:s(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",i)},r.one("sourceset",e.resetSourceWatch_)},Uv=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?jh(N.Element.prototype.getAttribute.call(this,"src")):""},set(r){return N.Element.prototype.setAttribute.call(this,"src",r),r}}),$v=r=>vf([r.el(),N.HTMLMediaElement.prototype,Uv],"src"),jv=function(r){if(!r.featuresSourceset)return;const e=r.el();if(e.resetSourceset_)return;const t=$v(r),i=e.setAttribute,s=e.load;Object.defineProperty(e,"src",$e(t,{set:n=>{const a=t.set.call(e,n);return r.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const o=i.call(e,n,a);return/src/i.test(n)&&r.triggerSourceset(e.src),o},e.load=()=>{const n=s.call(e);return Co(r)||(r.triggerSourceset(""),Hc(r)),n},e.currentSrc?r.triggerSourceset(e.currentSrc):Co(r)||Hc(r),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=s,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class ye extends De{constructor(e,t){super(e,t);const i=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const o=[];for(;a--;){const u=n[a];u.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(u),this.remoteTextTracks().addTrack(u.track),this.textTracks().addTrack(u.track),!s&&!this.el_.hasAttribute("crossorigin")&&ua(u.src)&&(s=!0)):o.push(u))}for(let u=0;u<o.length;u++)this.el_.removeChild(o[u])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s&&Pe.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
160
+ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(Ds||ea)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),ye.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){jv(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const s=()=>{for(let n=0;n<t.length;n++){const a=t[n];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(s=>{this.el()[`${i}Tracks`].removeEventListener(s,this[`${i}TracksListeners_`][s])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Yt[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:o=>{const u={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(u),e==="text"&&this[$r.remoteText.getterName]().trigger(u)},addtrack(o){s.addTrack(o.track)},removetrack(o){s.removeTrack(o.track)}},a=function(){const o=[];for(let u=0;u<s.length;u++){let d=!1;for(let p=0;p<i.length;p++)if(i[p]===s[u]){d=!0;break}d||o.push(s[u])}for(;o.length;)s.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=n,Object.keys(n).forEach(o=>{const u=n[o];i.addEventListener(o,u),this.on("dispose",d=>i.removeEventListener(o,u))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Yt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),ye.disposeMediaElement(e),e=i}else{e=he.createElement("video");const i=this.options_.tag&&Hi(this.options_.tag),s=$e({},i);(!Ds||this.options_.nativeControlsForTouch!==!0)&&delete s.controls,_h(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Br(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const s=t[i],n=this.options_[s];typeof n<"u"&&(n?Br(e,s,s):ra(e,s),e[s]=n)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const s=function(){i=!0};this.on("loadstart",s);const n=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",n),this.ready(function(){this.off("loadstart",s),this.off("loadedmetadata",n),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ta?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Pe(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ci&&wi&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)xi(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Pe.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const s=xe("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return Pe.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Pe.warn(`No matching source element found with src: ${e}`),!1}reset(){ye.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=he.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),N.performance&&(e.creationTime=N.performance.now()),e}}Qn(ye,"TEST_VID",function(){if(!jr())return;const r=he.createElement("video"),e=he.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",r.appendChild(e),r});ye.isSupported=function(){try{ye.TEST_VID.volume=.5}catch{return!1}return!!(ye.TEST_VID&&ye.TEST_VID.canPlayType)};ye.canPlayType=function(r){return ye.TEST_VID.canPlayType(r)};ye.canPlaySource=function(r,e){return ye.canPlayType(r.type)};ye.canControlVolume=function(){try{const r=ye.TEST_VID.volume;ye.TEST_VID.volume=r/2+.1;const e=r!==ye.TEST_VID.volume;return e&&xt?(N.setTimeout(()=>{ye&&ye.prototype&&(ye.prototype.featuresVolumeControl=r!==ye.TEST_VID.volume)}),!1):e}catch{return!1}};ye.canMuteVolume=function(){try{const r=ye.TEST_VID.muted;return ye.TEST_VID.muted=!r,ye.TEST_VID.muted?Br(ye.TEST_VID,"muted","muted"):ra(ye.TEST_VID,"muted","muted"),r!==ye.TEST_VID.muted}catch{return!1}};ye.canControlPlaybackRate=function(){if(ci&&wi&&Jn<58)return!1;try{const r=ye.TEST_VID.playbackRate;return ye.TEST_VID.playbackRate=r/2+.1,r!==ye.TEST_VID.playbackRate}catch{return!1}};ye.canOverrideAttributes=function(){try{const r=()=>{};Object.defineProperty(he.createElement("video"),"src",{get:r,set:r}),Object.defineProperty(he.createElement("audio"),"src",{get:r,set:r}),Object.defineProperty(he.createElement("video"),"innerHTML",{get:r,set:r}),Object.defineProperty(he.createElement("audio"),"innerHTML",{get:r,set:r})}catch{return!1}return!0};ye.supportsNativeTextTracks=function(){return ta||xt&&wi};ye.supportsNativeVideoTracks=function(){return!!(ye.TEST_VID&&ye.TEST_VID.videoTracks)};ye.supportsNativeAudioTracks=function(){return!!(ye.TEST_VID&&ye.TEST_VID.audioTracks)};ye.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([r,e]){Qn(ye.prototype,r,()=>ye[e](),!0)});ye.prototype.featuresVolumeControl=ye.canControlVolume();ye.prototype.movingMediaElementInDOM=!xt;ye.prototype.featuresFullscreenResize=!0;ye.prototype.featuresProgressEvents=!0;ye.prototype.featuresTimeupdateEvents=!0;ye.prototype.featuresVideoFrameCallback=!!(ye.TEST_VID&&ye.TEST_VID.requestVideoFrameCallback);ye.disposeMediaElement=function(r){if(r){for(r.parentNode&&r.parentNode.removeChild(r);r.hasChildNodes();)r.removeChild(r.firstChild);r.removeAttribute("src"),typeof r.load=="function"&&(function(){try{r.load()}catch{}})()}};ye.resetMediaElement=function(r){if(!r)return;const e=r.querySelectorAll("source");let t=e.length;for(;t--;)r.removeChild(e[t]);r.removeAttribute("src"),typeof r.load=="function"&&(function(){try{r.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]||this.el_.hasAttribute(r)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(r){ye.prototype["set"+nt(r)]=function(e){this.el_[r]=e,e?this.el_.setAttribute(r,r):this.el_.removeAttribute(r)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(r){ye.prototype["set"+nt(r)]=function(e){this.el_[r]=e}});["pause","load","play"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]()}});De.withSourceHandlers(ye);ye.nativeSourceHandler={};ye.nativeSourceHandler.canPlayType=function(r){try{return ye.TEST_VID.canPlayType(r)}catch{return""}};ye.nativeSourceHandler.canHandleSource=function(r,e){if(r.type)return ye.nativeSourceHandler.canPlayType(r.type);if(r.src){const t=nl(r.src);return ye.nativeSourceHandler.canPlayType(`video/${t}`)}return""};ye.nativeSourceHandler.handleSource=function(r,e,t){e.setSrc(r.src)};ye.nativeSourceHandler.dispose=function(){};ye.registerSourceHandler(ye.nativeSourceHandler);De.registerTech("Html5",ye);const bf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],no={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ao=["tiny","xsmall","small","medium","large","xlarge","huge"],_n={};Ao.forEach(r=>{const e=r.charAt(0)==="x"?`x-${r.substring(1)}`:r;_n[r]=`vjs-layout-${e}`});const qv={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ye extends ee{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Qt()}`,t=Object.assign(Ye.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=ah(this.id_),this.fsApi_=xn,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Hi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ye.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),tl(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(qt(he,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=$e(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const o=new N.DOMParser().parseFromString(dv,"image/svg+xml");if(o.querySelector("parsererror"))Pe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const d=o.documentElement;d.style.display="none",this.el_.appendChild(d),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new hv(this),this.addClass("vjs-spatial-navigation-enabled")),Ds&&this.addClass("vjs-touch-enabled"),xt||this.addClass("vjs-workinghover"),Ye.players[this.id_]=this;const n=go.split(".")[0];this.addClass(`vjs-v${n}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),St(he,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),St(he,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ye.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),ov(this),kt.names.forEach(e=>{const t=kt[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const s=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:s||(t=this.el_=super.createEl("div"));const n=Hi(e);if(s){for(t=this.el_=e,e=this.tag=he.createElement("video");t.children.length;)e.appendChild(t.firstChild);bs(t,"video-js")||or(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",wi&&Zn&&(e.setAttribute("role","application"),n.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in n&&delete n.width,"height"in n&&delete n.height,Object.getOwnPropertyNames(n).forEach(function(u){s&&u==="class"||t.setAttribute(u,n[u]),s&&e.setAttribute(u,n[u])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(u=>ph[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),N.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Ih("vjs-styles-dimensions");const u=Gi(".vjs-styles-defaults"),d=Gi("head");d.insertBefore(this.styleEl_,u?u.nextSibling:d.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const o=e.getElementsByTagName("a");for(let u=0;u<o.length;u++){const d=o.item(u);or(d,"vjs-hidden"),d.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),_o(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Pe.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const s=parseFloat(t);if(isNaN(s)){Pe.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Oi(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),MT(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(N.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(o>=0&&(d.width=o),u>=0&&(d.height=u));return}let e,t,i,s;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const n=i.split(":"),a=n[1]/n[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?s="dimensions-"+this.id():s=this.id()+"-dimensions",this.addClass(s),kh(this.styleEl_,`
161
+ .${s} {
162
+ width: ${e}px;
163
+ height: ${t}px;
164
+ }
165
+
166
+ .${s}.vjs-fluid:not(.vjs-audio-only-mode) {
167
+ padding-top: ${a*100}%;
168
+ }
169
+ `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=nt(e),s=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(De.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};kt.names.forEach(u=>{const d=kt[u];a[d.getterName]=this[d.privateName]}),Object.assign(a,this.options_[i]),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=De.getTech(e);if(!o)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Ge(this,this.handleTechReady_),!0),Sc.jsonToTextTracks(this.textTracksJson_||[],this.tech_),bf.forEach(u=>{this.on(this.tech_,u,d=>this[`handleTech${nt(u)}_`](d))}),Object.keys(no).forEach(u=>{this.on(this.tech_,u,d=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${no[u]}_`].bind(this),event:d});return}this[`handleTech${no[u]}_`](d)})}),this.on(this.tech_,"loadstart",u=>this.handleTechLoadStart_(u)),this.on(this.tech_,"sourceset",u=>this.handleTechSourceset_(u)),this.on(this.tech_,"waiting",u=>this.handleTechWaiting_(u)),this.on(this.tech_,"ended",u=>this.handleTechEnded_(u)),this.on(this.tech_,"seeking",u=>this.handleTechSeeking_(u)),this.on(this.tech_,"play",u=>this.handleTechPlay_(u)),this.on(this.tech_,"pause",u=>this.handleTechPause_(u)),this.on(this.tech_,"durationchange",u=>this.handleTechDurationChange_(u)),this.on(this.tech_,"fullscreenchange",(u,d)=>this.handleTechFullscreenChange_(u,d)),this.on(this.tech_,"fullscreenerror",(u,d)=>this.handleTechFullscreenError_(u,d)),this.on(this.tech_,"enterpictureinpicture",u=>this.handleTechEnterPictureInPicture_(u)),this.on(this.tech_,"leavepictureinpicture",u=>this.handleTechLeavePictureInPicture_(u)),this.on(this.tech_,"error",u=>this.handleTechError_(u)),this.on(this.tech_,"posterchange",u=>this.handleTechPosterChange_(u)),this.on(this.tech_,"textdata",u=>this.handleTechTextData_(u)),this.on(this.tech_,"ratechange",u=>this.handleTechRateChange_(u)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&_o(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){kt.names.forEach(e=>{const t=kt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Sc.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Pe.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
170
+ See https://github.com/videojs/video.js/issues/2617 for more info.
171
+ `),this.tech_}version(){return{"video.js":go}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const s=this.muted();this.muted(!0);const n=()=>{this.muted(s)};this.playTerminatedQueue_.push(n);const a=this.play();if(Ss(a))return a.catch(o=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),Ss(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!Ss(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=cv(this,t)),this.cache_.source=$e({},e,{src:t,type:i});const s=this.cache_.sources.filter(u=>u.src&&u.src===t),n=[],a=this.$$("source"),o=[];for(let u=0;u<a.length;u++){const d=Hi(a[u]);n.push(d),d.src&&d.src===t&&o.push(d.src)}o.length&&!s.length?this.cache_.sources=n:s.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=n=>this.updateSourceCaches_(n);const i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],n=>{if(n.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?xi(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!he.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let s=he[this.fsApi_.fullscreenElement]===i;!s&&i.matches&&(s=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in nv)return rv(this.middleware_,this.tech_,e,t);if(e in Dc)return wc(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Pe(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in sv)return iv(this.middleware_,this.tech_,e);if(e in Dc)return wc(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Pe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Pe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Pe(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=xi){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(ta||xt);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),s===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||li(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=li(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=li(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Uh(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,s)=>{function n(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){n(),i()}function o(d,p){n(),s(p)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const u=t.requestFullscreenHelper_(e);u&&(u.then(n,n),u.then(i,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function s(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){s(),t()}function a(u,d){s(),i(d)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(s,s),o.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=he[this.fsApi_.exitFullscreen]();return e&&xi(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=he.documentElement.style.overflow,qt(he,"keydown",this.boundFullWindowOnEscKey_),he.documentElement.style.overflow="hidden",or(he.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,St(he,"keydown",this.boundFullWindowOnEscKey_),he.documentElement.style.overflow=this.docOrigOverflow,ia(he.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&N.documentPictureInPicture){const e=he.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(xe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),N.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Ah(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const s=i.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in he&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(N.documentPictureInPicture&&N.documentPictureInPicture.window)return N.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in he)return he.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(s=>{const n=s.tagName.toLowerCase();if(s.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(s.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=a=>e.key.toLowerCase()==="f",muteKey:s=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=ee.getComponent("FullscreenToggle");he[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),ee.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ee.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i<s.length;i++){const n=s[i];let a=De.getTech(n);if(a||(a=ee.getComponent(n)),!a){Pe.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(o=>[o,De.getTech(o)]).filter(([o,u])=>u?u.isSupported():(Pe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(o,u,d){let p;return o.some(T=>u.some(A=>{if(p=d(T,A),p)return!0})),p};let s;const n=o=>(u,d)=>o(d,u),a=([o,u],d)=>{if(u.canPlaySource(d,this.options_[o.toLowerCase()]))return{source:d,tech:o}};return this.options_.sourceOrder?s=i(e,t,n(a)):s=i(t,e,a),s||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Hh(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),ev(this,i[0],(s,n)=>{if(this.middleware_=n,t||(this.cache_.sources=i),this.updateSourceCaches_(s),this.src_(s)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}tv(n,this.tech_)}),i.length>1){const s=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},n=()=>{this.off("error",s)};this.one("error",s),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Oh(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();xi(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Oi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:n}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),n&&(n.update(),n.loadProgressBar&&n.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Wi("beforeerror").forEach(t=>{const i=t(this,e);if(!(Ai(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new rt(e),this.addClass("vjs-error"),Pe.error(`(CODE:${this.error_.code} ${rt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Wi("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const s=Ge(this,this.reportUserActivity),n=function(T){(T.screenX!==t||T.screenY!==i)&&(t=T.screenX,i=T.screenY,s())},a=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},o=function(T){s(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",o),this.on("mouseleave",o);const u=this.getChild("controlBar");u&&!xt&&!ci&&(u.on("mouseenter",function(T){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),u.on("mouseleave",function(T){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",s),this.on("keyup",s);let d;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(d);const T=this.options_.inactivityTimeout;T<=0||(d=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},T))};this.setInterval(p,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(s=>{s!==t&&s.el_&&!s.hasClass("vjs-hidden")&&(s.hide(),this.audioOnlyCache_.hiddenChildren.push(s))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Oi(this)&&this.trigger("languagechange"))}languages(){return $e(Ye.prototype.options_.languages,this.languages_)}toJSON(){const e=$e(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let s=t[i];s=$e(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Hr(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<Ao.length;i++){const s=Ao[i],n=this.breakpoints_[s];if(t<=n){if(e===s)return;e&&this.removeClass(_n[e]),this.addClass(_n[s]),this.breakpoint_=s;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},qv,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return _n[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=$e(e);const{artist:s,artwork:n,description:a,poster:o,src:u,textTracks:d,title:p}=this.cache_.media;!n&&o&&(this.cache_.media.artwork=[{src:o,type:Rn(o)}]),i&&this.crossOrigin(i),u&&this.src(u),o&&this.poster(o),Array.isArray(d)&&d.forEach(T=>this.addRemoteTextTrack(T,!1)),this.titleBar&&this.titleBar.update({title:p,description:a||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),s={src:t,textTracks:i};return e&&(s.poster=e,s.artwork=[{src:s.poster,type:Rn(s.poster)}]),s}return $e(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Hi(e),s=i["data-setup"];if(bs(e,"vjs-fill")&&(i.fill=!0),bs(e,"vjs-fluid")&&(i.fluid=!0),s!==null)try{Object.assign(i,JSON.parse(s||"{}"))}catch(n){Pe.error("data-setup",n)}if(Object.assign(t,i),e.hasChildNodes()){const n=e.childNodes;for(let a=0,o=n.length;a<o;a++){const u=n[a],d=u.nodeName.toLowerCase();d==="source"?t.sources.push(Hi(u)):d==="track"&&t.tracks.push(Hi(u))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}kt.names.forEach(function(r){const e=kt[r];Ye.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ye.prototype.crossorigin=Ye.prototype.crossOrigin;Ye.players={};const ps=N.navigator;Ye.prototype.options_={techOrder:De.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ps&&(ps.languages&&ps.languages[0]||ps.userLanguage||ps.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1};bf.forEach(function(r){Ye.prototype[`handleTech${nt(r)}_`]=function(){return this.trigger(r)}});ee.registerComponent("Player",Ye);const Ln="plugin",Ar="activePlugins_",vr={},Nn=r=>vr.hasOwnProperty(r),Tn=r=>Nn(r)?vr[r]:void 0,xf=(r,e)=>{r[Ar]=r[Ar]||{},r[Ar][e]=!0},On=(r,e,t)=>{const i=(t?"before":"")+"pluginsetup";r.trigger(i,e),r.trigger(i+":"+e.name,e)},Vv=function(r,e){const t=function(){On(this,{name:r,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return xf(this,r),On(this,{name:r,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},zc=(r,e)=>(e.prototype.name=r,function(...t){On(this,{name:r,plugin:e,instance:null},!0);const i=new e(this,...t);return this[r]=()=>i,On(this,i.getEventHash()),i});class Mt{constructor(e){if(this.constructor===Mt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),tl(this),delete this.trigger,Nh(this,this.constructor.defaultState),xf(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Vr(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Ar][e]=!1,this.player=this.state=null,t[e]=zc(e,vr[e])}static isBasic(e){const t=typeof e=="string"?Tn(e):e;return typeof t=="function"&&!Mt.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Nn(e))Pe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ye.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return vr[e]=t,e!==Ln&&(Mt.isBasic(t)?Ye.prototype[e]=Vv(e,t):Ye.prototype[e]=zc(e,t)),t}static deregisterPlugin(e){if(e===Ln)throw new Error("Cannot de-register base plugin.");Nn(e)&&(delete vr[e],delete Ye.prototype[e])}static getPlugins(e=Object.keys(vr)){let t;return e.forEach(i=>{const s=Tn(i);s&&(t=t||{},t[i]=s)}),t}static getPluginVersion(e){const t=Tn(e);return t&&t.VERSION||""}}Mt.getPlugin=Tn;Mt.BASE_PLUGIN_NAME=Ln;Mt.registerPlugin(Ln,Mt);Ye.prototype.usingPlugin=function(r){return!!this[Ar]&&this[Ar][r]===!0};Ye.prototype.hasPlugin=function(r){return!!Nn(r)};function Hv(r,e){let t=!1;return function(...i){return t||Pe.warn(r),t=!0,e.apply(this,i)}}function di(r,e,t,i){return Hv(`${e} is deprecated and will be removed in ${r}.0; please use ${t} instead.`,i)}var zv={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const Sf=r=>r.indexOf("#")===0?r.slice(1):r;function z(r,e,t){let i=z.getPlayer(r);if(i)return e&&Pe.warn(`Player "${r}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const s=typeof r=="string"?Gi("#"+Sf(r)):r;if(!qr(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in s?s.getRootNode()instanceof N.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;(!s.ownerDocument.defaultView||!a.contains(s))&&Pe.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(s.parentNode&&s.parentNode.hasAttribute&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),Wi("beforesetup").forEach(u=>{const d=u(s,$e(e));if(!Ai(d)||Array.isArray(d)){Pe.error("please return an object in beforesetup hooks");return}e=$e(e,d)});const o=ee.getComponent("Player");return i=new o(s,e,t),Wi("setup").forEach(u=>u(i)),i}z.hooks_=Li;z.hooks=Wi;z.hook=ST;z.hookOnce=ET;z.removeHook=nh;if(N.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&jr()){let r=Gi(".vjs-styles-defaults");if(!r){r=Ih("vjs-styles-defaults");const e=Gi("head");e&&e.insertBefore(r,e.firstChild),kh(r,`
172
+ .video-js {
173
+ width: 300px;
174
+ height: 150px;
175
+ }
176
+
177
+ .vjs-fluid:not(.vjs-audio-only-mode) {
178
+ padding-top: 56.25%
179
+ }
180
+ `)}}vo(1,z);z.VERSION=go;z.options=Ye.prototype.options_;z.getPlayers=()=>Ye.players;z.getPlayer=r=>{const e=Ye.players;let t;if(typeof r=="string"){const i=Sf(r),s=e[i];if(s)return s;t=Gi("#"+i)}else t=r;if(qr(t)){const{player:i,playerId:s}=t;if(i||e[s])return i||e[s]}};z.getAllPlayers=()=>Object.keys(Ye.players).map(r=>Ye.players[r]).filter(Boolean);z.players=Ye.players;z.getComponent=ee.getComponent;z.registerComponent=(r,e)=>(De.isTech(e)&&Pe.warn(`The ${r} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ee.registerComponent.call(ee,r,e));z.getTech=De.getTech;z.registerTech=De.registerTech;z.use=ZT;Object.defineProperty(z,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(z.middleware,"TERMINATOR",{value:Pn,writeable:!1,enumerable:!0});z.browser=ph;z.obj=wT;z.mergeOptions=di(9,"videojs.mergeOptions","videojs.obj.merge",$e);z.defineLazyProperty=di(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Qn);z.bind=di(9,"videojs.bind","native Function.prototype.bind",Ge);z.registerPlugin=Mt.registerPlugin;z.deregisterPlugin=Mt.deregisterPlugin;z.plugin=(r,e)=>(Pe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Mt.registerPlugin(r,e));z.getPlugins=Mt.getPlugins;z.getPlugin=Mt.getPlugin;z.getPluginVersion=Mt.getPluginVersion;z.addLanguage=function(r,e){return r=(""+r).toLowerCase(),z.options.languages=$e(z.options.languages,{[r]:e}),z.options.languages[r]};z.log=Pe;z.createLogger=ah;z.time=qT;z.createTimeRange=di(9,"videojs.createTimeRange","videojs.time.createTimeRanges",li);z.createTimeRanges=di(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",li);z.formatTime=di(9,"videojs.formatTime","videojs.time.formatTime",dr);z.setFormatTime=di(9,"videojs.setFormatTime","videojs.time.setFormatTime",Mh);z.resetFormatTime=di(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Fh);z.parseUrl=di(9,"videojs.parseUrl","videojs.url.parseUrl",sl);z.isCrossOrigin=di(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",ua);z.EventTarget=Vt;z.any=el;z.on=qt;z.one=oa;z.off=St;z.trigger=Vr;z.xhr=qd;z.TextTrack=Rs;z.AudioTrack=qh;z.VideoTrack=Vh;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(r=>{z[r]=function(){return Pe.warn(`videojs.${r}() is deprecated; use videojs.dom.${r}() instead`),wh[r].apply(null,arguments)}});z.computedStyle=di(9,"videojs.computedStyle","videojs.dom.computedStyle",Fr);z.dom=wh;z.fn=BT;z.num=vv;z.str=$T;z.url=QT;z.Error=zv;class Wv{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class Bn extends z.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new Wv(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const s=this[t];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Bn.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const r in Bn.prototype.allowedEvents_)Bn.prototype["on"+r]=null;var Ef="4.1.0";const Gv=function(r,e){const t=r.qualityLevels,i=new Bn,s=function(){i.dispose(),r.qualityLevels=t,r.off("dispose",s)};return r.on("dispose",s),r.qualityLevels=()=>i,r.qualityLevels.VERSION=Ef,i},Cf=function(r){return Gv(this,z.obj.merge({},r))};z.registerPlugin("qualityLevels",Cf);Cf.VERSION=Ef;const Ot=Wn,Mn=(r,e)=>e&&e.responseURL&&r!==e.responseURL?e.responseURL:r,Zt=r=>z.log.debug?z.log.debug.bind(z,"VHS:",`${r} >`):function(){};function Oe(...r){const e=z.obj||z;return(e.merge||e.mergeOptions).apply(e,r)}function _t(...r){const e=z.time||z;return(e.createTimeRanges||e.createTimeRanges).apply(e,r)}function Kv(r){if(r.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
181
+ `;for(let t=0;t<r.length;t++){const i=r.start(t),s=r.end(t);e+=`${i} --> ${s}. Duration (${s-i})
182
+ `}return e}const Si=1/30,Ei=Si*3,Af=function(r,e){const t=[];let i;if(r&&r.length)for(i=0;i<r.length;i++)e(r.start(i),r.end(i))&&t.push([r.start(i),r.end(i)]);return _t(t)},br=function(r,e){return Af(r,function(t,i){return t-Ei<=e&&i+Ei>=e})},fn=function(r,e){return Af(r,function(t){return t-Si>=e})},Xv=function(r){if(r.length<2)return _t();const e=[];for(let t=1;t<r.length;t++){const i=r.end(t-1),s=r.start(t);e.push([i,s])}return _t(e)},Yv=function(r,e){let t=null,i=null,s=0;const n=[],a=[];if(!r||!r.length||!e||!e.length)return _t();let o=r.length;for(;o--;)n.push({time:r.start(o),type:"start"}),n.push({time:r.end(o),type:"end"});for(o=e.length;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(n.sort(function(u,d){return u.time-d.time}),o=0;o<n.length;o++)n[o].type==="start"?(s++,s===2&&(t=n[o].time)):n[o].type==="end"&&(s--,s===1&&(i=n[o].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return _t(a)},wf=r=>{const e=[];if(!r||!r.length)return"";for(let t=0;t<r.length;t++)e.push(r.start(t)+" => "+r.end(t));return e.join(", ")},Qv=function(r,e,t=1){return((r.length?r.end(r.length-1):0)-e)/t},nr=r=>{const e=[];for(let t=0;t<r.length;t++)e.push({start:r.start(t),end:r.end(t)});return e},Jv=function(r,e){if(r===e)return!1;if(!r&&e||!e&&r||r.length!==e.length)return!0;for(let t=0;t<r.length;t++)if(r.start(t)!==e.start(t)||r.end(t)!==e.end(t))return!0;return!1},ao=function(r){if(!(!r||!r.length||!r.end))return r.end(r.length-1)},bl=function(r,e){let t=0;if(!r||!r.length)return t;for(let i=0;i<r.length;i++){const s=r.start(i),n=r.end(i);if(!(e>n)){if(e>s&&e<=n){t+=n-e;continue}t+=n-s}}return t},xl=(r,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=r.partTargetDuration)}),t},wo=r=>(r.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:i,partIndex:n,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),Df=r=>{const e=r.segments&&r.segments.length&&r.segments[r.segments.length-1];return e&&e.parts||[]},If=({preloadSegment:r})=>{if(!r)return;const{parts:e,preloadHints:t}=r;let i=(t||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},kf=(r,e)=>{if(e.endList)return 0;if(r&&r.suggestedPresentationDelay)return r.suggestedPresentationDelay;const t=Df(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},Zv=function(r,e){let t=0,i=e-r.mediaSequence,s=r.segments[i];if(s){if(typeof s.start<"u")return{result:s.start,precise:!0};if(typeof s.end<"u")return{result:s.end-s.duration,precise:!0}}for(;i--;){if(s=r.segments[i],typeof s.end<"u")return{result:t+s.end,precise:!0};if(t+=xl(r,s),typeof s.start<"u")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},eb=function(r,e){let t=0,i,s=e-r.mediaSequence;for(;s<r.segments.length;s++){if(i=r.segments[s],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=xl(r,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Pf=function(r,e,t){if(typeof e>"u"&&(e=r.mediaSequence+r.segments.length),e<r.mediaSequence)return 0;const i=Zv(r,e);if(i.precise)return i.result;const s=eb(r,e);return s.precise?s.result:i.result+t},Rf=function(r,e,t){if(!r)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(r.totalDuration)return r.totalDuration;if(!r.endList)return N.Infinity}return Pf(r,e,t)},Es=function({defaultDuration:r,durationList:e,startIndex:t,endIndex:i}){let s=0;if(t>i&&([t,i]=[i,t]),t<0){for(let n=t;n<Math.min(0,i);n++)s+=r;t=0}for(let n=t;n<i;n++)s+=e[n].duration;return s},Lf=function(r,e,t,i){if(!r||!r.segments)return null;if(r.endList)return Rf(r);if(e===null)return null;e=e||0;let s=Pf(r,r.mediaSequence+r.segments.length,e);return t&&(i=typeof i=="number"?i:kf(null,r),s-=i),Math.max(0,s)},tb=function(r,e,t){const s=e||0;let n=Lf(r,e,!0,t);return n===null?_t():(n<s&&(n=s),_t(s,n))},ib=function({playlist:r,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:s,exactManifestTimings:n}){let a=e-s;const o=wo(r);let u=0;for(let d=0;d<o.length;d++){const p=o[d];if(t===p.segmentIndex&&!(typeof i=="number"&&typeof p.partIndex=="number"&&i!==p.partIndex)){u=d;break}}if(a<0){if(u>0)for(let d=u-1;d>=0;d--){const p=o[d];if(a+=p.duration,n){if(a<0)continue}else if(a+Si<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s-Es({defaultDuration:r.targetDuration,durationList:o,startIndex:u,endIndex:d})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(u<0){for(let d=u;d<0;d++)if(a-=r.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};u=0}for(let d=u;d<o.length;d++){const p=o[d];a-=p.duration;const T=p.duration>Si,A=a===0,b=T&&a+Si>=0;if(!((A||b)&&d!==o.length-1)){if(n){if(a>0)continue}else if(a-Si>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s+Es({defaultDuration:r.targetDuration,durationList:o,startIndex:u,endIndex:d})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Nf=function(r){return r.excludeUntil&&r.excludeUntil>Date.now()},Sl=function(r){return r.excludeUntil&&r.excludeUntil===1/0},fa=function(r){const e=Nf(r);return!r.disabled&&!e},rb=function(r){return r.disabled},sb=function(r){for(let e=0;e<r.segments.length;e++)if(r.segments[e].key)return!0;return!1},Of=function(r,e){return e.attributes&&e.attributes[r]},nb=function(r,e,t,i=0){return Of("BANDWIDTH",t)?(r*t.attributes.BANDWIDTH-i*8)/e:NaN},Do=(r,e)=>{if(r.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return r.playlists.filter(i=>fa(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},El=(r,e)=>!r&&!e||!r&&e||r&&!e?!1:!!(r===e||r.id&&e.id&&r.id===e.id||r.resolvedUri&&e.resolvedUri&&r.resolvedUri===e.resolvedUri||r.uri&&e.uri&&r.uri===e.uri),Wc=function(r,e){const t=r&&r.mediaGroups&&r.mediaGroups.AUDIO||{};let i=!1;for(const s in t){for(const n in t[s])if(i=e(t[s][n]),i)break;if(i)break}return!!i},Bs=r=>{if(!r||!r.playlists||!r.playlists.length)return Wc(r,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<r.playlists.length;e++){const t=r.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(n=>Gd(n))||Wc(r,n=>El(t,n))))return!1}return!0};var Bt={liveEdgeDelay:kf,duration:Rf,seekable:tb,getMediaInfoForTime:ib,isEnabled:fa,isDisabled:rb,isExcluded:Nf,isIncompatible:Sl,playlistEnd:Lf,isAes:sb,hasAttribute:Of,estimateSegmentRequestTime:nb,isLowestEnabledRendition:Do,isAudioOnly:Bs,playlistMatch:El,segmentDurationWithParts:xl};const{log:Bf}=z,wr=(r,e)=>`${r}-${e}`,Mf=(r,e,t)=>`placeholder-uri-${r}-${e}-${t}`,ab=({onwarn:r,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:s=[],llhls:n})=>{const a=new Hy;r&&a.on("warn",r),e&&a.on("info",e),i.forEach(d=>a.addParser(d)),s.forEach(d=>a.addTagMapper(d)),a.push(t),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(d){o.hasOwnProperty(d)&&delete o[d]}),o.segments&&o.segments.forEach(function(d){["parts","preloadHints"].forEach(function(p){d.hasOwnProperty(p)&&delete d[p]})})),!o.targetDuration){let d=10;o.segments&&o.segments.length&&(d=o.segments.reduce((p,T)=>Math.max(p,T.duration),0)),r&&r({message:`manifest has no targetDuration defaulting to ${d}`}),o.targetDuration=d}const u=Df(o);if(u.length&&!o.partTargetDuration){const d=u.reduce((p,T)=>Math.max(p,T.duration),0);r&&(r({message:`manifest has no partTargetDuration defaulting to ${d}`}),Bf.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=d}return o},Gr=(r,e)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(r.mediaGroups[t])for(const i in r.mediaGroups[t])for(const s in r.mediaGroups[t][i]){const n=r.mediaGroups[t][i][s];e(n,t,i,s)}})},Ff=({playlist:r,uri:e,id:t})=>{r.id=t,r.playlistErrors_=0,e&&(r.uri=e),r.attributes=r.attributes||{}},ob=r=>{let e=r.playlists.length;for(;e--;){const t=r.playlists[e];Ff({playlist:t,id:wr(e,t.uri)}),t.resolvedUri=Ot(r.uri,t.uri),r.playlists[t.id]=t,r.playlists[t.uri]=t,t.attributes.BANDWIDTH||Bf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},lb=r=>{Gr(r,e=>{e.uri&&(e.resolvedUri=Ot(r.uri,e.uri))})},ub=(r,e)=>{const t=wr(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:N.location.href,resolvedUri:N.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},Uf=(r,e,t=Mf)=>{r.uri=e;for(let s=0;s<r.playlists.length;s++)if(!r.playlists[s].uri){const n=`placeholder-uri-${s}`;r.playlists[s].uri=n}const i=Bs(r);Gr(r,(s,n,a,o)=>{if(!s.playlists||!s.playlists.length){if(i&&n==="AUDIO"&&!s.uri)for(let u=0;u<r.playlists.length;u++){const d=r.playlists[u];if(d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===a)return}s.playlists=[ot({},s)]}s.playlists.forEach(function(u,d){const p=t(n,a,o,u),T=wr(d,p);u.uri?u.resolvedUri=u.resolvedUri||Ot(r.uri,u.uri):(u.uri=d===0?p:T,u.resolvedUri=u.uri),u.id=u.id||T,u.attributes=u.attributes||{},r.playlists[u.id]=u,r.playlists[u.uri]=u})}),ob(r),lb(r)};class Gc{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((s,n)=>(s.set(n.id,n),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,s)=>{if(!this.processedDateRanges_.has(s)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const n=e[i.class].push(i);i.classListIndex=n-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const s=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&s[i.classListIndex+1]?i.endTime=s[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,s)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(s)})}}const $f=22,cr=({requestType:r,request:e,error:t,parseFailure:i})=>{const s=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:r},o=s&&!n||i;if(t&&n)a.error=ot({},t),a.errorType=z.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=z.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=z.Error.NetworkRequestTimeout;else if(o){const u=i?z.Error.NetworkBodyParserFailed:z.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:cb}=z,db=(r,e)=>{if(e.endList||!e.serverControl)return r;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let s=e.mediaSequence+e.segments.length;if(i){const n=i.parts||[],a=If(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&s--}t._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new N.URL(r);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){t.hasOwnProperty(s)&&i.searchParams.set(s,t[s])}),r=i.toString()}return r},hb=(r,e)=>{if(!r)return e;const t=Oe(r,e);if(r.preloadHints&&!e.preloadHints&&delete t.preloadHints,r.parts&&!e.parts)delete t.parts;else if(r.parts&&e.parts)for(let i=0;i<e.parts.length;i++)r.parts&&r.parts[i]&&(t.parts[i]=Oe(r.parts[i],e.parts[i]));return!r.skipped&&e.skipped&&(t.skipped=!1),r.preload&&!e.preload&&(t.preload=!1),t},fb=(r,e,t)=>{const i=r.slice(),s=e.slice();t=t||0;const n=[];let a;for(let o=0;o<s.length;o++){const u=i[o+t],d=s[o];u?(a=u.map||a,n.push(hb(u,d))):(a&&!d.map&&(d.map=a),n.push(d))}return n},jf=(r,e)=>{!r.resolvedUri&&r.uri&&(r.resolvedUri=Ot(e,r.uri)),r.key&&!r.key.resolvedUri&&(r.key.resolvedUri=Ot(e,r.key.uri)),r.map&&!r.map.resolvedUri&&(r.map.resolvedUri=Ot(e,r.map.uri)),r.map&&r.map.key&&!r.map.key.resolvedUri&&(r.map.key.resolvedUri=Ot(e,r.map.key.uri)),r.parts&&r.parts.length&&r.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))}),r.preloadHints&&r.preloadHints.length&&r.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))})},qf=function(r){const e=r.segments||[],t=r.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=r.targetDuration,t.preload=!0,e.push(t)}return e},Vf=(r,e)=>r===e||r.segments&&e.segments&&r.segments.length===e.segments.length&&r.endList===e.endList&&r.mediaSequence===e.mediaSequence&&r.preloadSegment===e.preloadSegment,Io=(r,e,t=Vf)=>{const i=Oe(r,{}),s=i.playlists[e.id];if(!s||t(s,e))return null;e.segments=qf(e);const n=Oe(s,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,s.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=fb(s.segments,e.segments,e.mediaSequence-s.mediaSequence)}n.segments.forEach(a=>{jf(a,n.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=n);return i.playlists[e.id]=n,i.playlists[e.uri]=n,Gr(r,(a,o,u,d)=>{if(a.playlists)for(let p=0;p<a.playlists.length;p++)e.id===a.playlists[p].id&&(a.playlists[p]=n)}),i},ko=(r,e)=>{const t=r.segments||[],i=t[t.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],n=s&&s.duration||i&&i.duration;return e&&n?n*1e3:(r.partTargetDuration||r.targetDuration||10)*500},Kc=(r,e,t)=>{if(!r)return;const i=[];return r.forEach(s=>{if(!s.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:o}=s.attributes;i.push({id:s.id,bandwidth:n,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:i}};class xr extends cb{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Zt("PlaylistLoader");const{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Gc,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Ot(this.main.uri,e.uri);this.llhls&&(t=db(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,s)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:s,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:cr({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return ab({onwarn:({message:i})=>this.logger_(`m3u8-parser warn for ${e}: ${i}`),oninfo:({message:i})=>this.logger_(`m3u8-parser info for ${e}: ${i}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(i){this.error=i,this.error.metadata={errorType:z.Error.StreamingHlsPlaylistParserError,error:i}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),Ff({playlist:a,uri:i,id:s});const o=Io(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ko(this.media(),!!o)),n.parsedPlaylist=Kc(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),N.clearTimeout(this.mediaUpdateTimeout),N.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Gc,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(N.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=N.setTimeout(this.media.bind(this,e,!1),o);return}const i=this.state,s=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ko(e,!0)),!s)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(o,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Mn(e.resolvedUri,u),o)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=N.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=N.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=N.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:cr({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Mn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=Kc(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Uf(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=qf(i),i.segments.forEach(s=>{jf(s,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||N.location.href;this.main=ub(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,s=e.ID;let n=i.playlists.length;for(;n--;){const a=i.playlists[n];if(a.attributes["PATHWAY-ID"]===s){const o=a.resolvedUri,u=a.id;if(t){const d=this.createCloneURI_(a.resolvedUri,e),p=wr(s,d),T=this.createCloneAttributes_(s,a.attributes),A=this.createClonePlaylist_(a,p,e,T);i.playlists[n]=A,i.playlists[p]=A,i.playlists[d]=A}else i.playlists.splice(n,1);delete i.playlists[u],delete i.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!i.mediaGroups[n]||!i.mediaGroups[n][s])){for(const a in i.mediaGroups[n])if(a===s){for(const o in i.mediaGroups[n][a])i.mediaGroups[n][a][o].playlists.forEach((d,p)=>{const T=i.playlists[d.id],A=T.id,b=T.resolvedUri;delete i.playlists[A],delete i.playlists[b]});delete i.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,s=i.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=wr(e.ID,n),o=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,o);i.playlists[s]=u,i.playlists[a]=u,i.playlists[n]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!s.mediaGroups[n]||s.mediaGroups[n][t]))for(const a in s.mediaGroups[n]){if(a===i)s.mediaGroups[n][t]={};else continue;for(const o in s.mediaGroups[n][a]){const u=s.mediaGroups[n][a][o];s.mediaGroups[n][t][o]=ot({},u);const d=s.mediaGroups[n][t][o],p=this.createCloneURI_(u.resolvedUri,e);d.resolvedUri=p,d.uri=p,d.playlists=[],u.playlists.forEach((T,A)=>{const b=s.playlists[T.id],k=Mf(n,t,o),v=wr(t,k);if(b&&!s.playlists[v]){const L=this.createClonePlaylist_(b,v,e),U=L.resolvedUri;s.playlists[v]=L,s.playlists[U]=L}d.playlists[A]=this.createClonePlaylist_(T,v,e)})}}})}createClonePlaylist_(e,t,i,s){const n=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),s&&(a.attributes=s),Oe(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(s))i.searchParams.set(n,s[n]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(i[s]=e)}),i}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const s=e.contentProtection[i].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const Po=function(r,e,t,i){const s=r.responseType==="arraybuffer"?r.response:r.responseText;!e&&s&&(r.responseTime=Date.now(),r.roundTripTime=r.responseTime-r.requestTime,r.bytesReceived=s.byteLength||s.length,r.bandwidth||(r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3))),t.headers&&(r.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(r.timedout=!0),!e&&!r.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(r&&(s||r.responseText)))),i(e,r)},pb=(r,e)=>{if(!r||!r.size)return;let t=e;return r.forEach(i=>{t=i(t)}),t},mb=(r,e,t,i)=>{!r||!r.size||r.forEach(s=>{s(e,t,i)})},Hf=function(){const r=function e(t,i){t=Oe({timeout:45e3},t);const s=e.beforeRequest||z.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||z.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||z.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(z.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const o=z.Vhs.xhr.original===!0?z.xhr:z.Vhs.xhr,u=pb(n,t);n.delete(s);const d=o(u||t,function(T,A){return mb(a,d,T,A),Po(d,T,A,i)}),p=d.abort;return d.abort=function(){return d.aborted=!0,p.apply(d,arguments)},d.uri=t.uri,d.requestType=t.requestType,d.requestTime=Date.now(),d};return r.original=!0,r},gb=function(r){let e;const t=r.offset;return typeof r.offset=="bigint"||typeof r.length=="bigint"?e=N.BigInt(r.offset)+N.BigInt(r.length)-N.BigInt(1):e=r.offset+r.length-1,"bytes="+t+"-"+e},Ro=function(r){const e={};return r.byterange&&(e.Range=gb(r.byterange)),e},yb=function(r,e){return r.start(e)+"-"+r.end(e)},_b=function(r,e){const t=r.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Tb=function(r){return r>=32&&r<126?String.fromCharCode(r):"."},zf=function(r){const e={};return Object.keys(r).forEach(t=>{const i=r[t];Xd(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Fn=function(r){const e=r.byterange||{length:1/0,offset:0};return[e.length,e.offset,r.resolvedUri].join(",")},Wf=function(r){return r.resolvedUri},Gf=r=>{const e=Array.prototype.slice.call(r),t=16;let i="",s,n;for(let a=0;a<e.length/t;a++)s=e.slice(a*t,a*t+t).map(_b).join(""),n=e.slice(a*t,a*t+t).map(Tb).join(""),i+=s+" "+n+`
183
+ `;return i},vb=({bytes:r})=>Gf(r),bb=r=>{let e="",t;for(t=0;t<r.length;t++)e+=yb(r,t)+" ";return e};var xb=Object.freeze({__proto__:null,createTransferableMessage:zf,initSegmentId:Fn,segmentKeyId:Wf,hexDump:Gf,tagDump:vb,textRanges:bb});const Kf=.25,Sb=(r,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,n=r-s;return new Date(e.dateTimeObject.getTime()+n*1e3)},Eb=r=>r.transmuxedPresentationEnd-r.transmuxedPresentationStart-r.transmuxerPrependedSeconds,Cb=(r,e)=>{let t;try{t=new Date(r)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let u=0;u<e.segments.length-1;u++){i=e.segments[u];const d=new Date(e.segments[u+1].dateTimeObject);if(t<d)break}const s=e.segments[e.segments.length-1],n=s.dateTimeObject,a=s.videoTimingInfo?Eb(s.videoTimingInfo):s.duration+s.duration*Kf,o=new Date(n.getTime()+a*1e3);return t>o?null:(t>new Date(n)&&(i=s),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Bt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Ab=(r,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let n=0;n<e.segments.length&&(i=e.segments[n],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(r<=t));n++);const s=e.segments[e.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<r)return null;if(r>t){if(r>t+s.duration*Kf)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},wb=(r,e)=>{let t,i;try{t=new Date(r),i=new Date(e)}catch{}const s=t.getTime();return(i.getTime()-s)/1e3},Db=r=>{if(!r.segments||r.segments.length===0)return!1;for(let e=0;e<r.segments.length;e++)if(!r.segments[e].dateTimeObject)return!1;return!0},Ib=({playlist:r,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!r||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=Ab(e,r);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const s={mediaSeconds:e},n=Sb(e,i.segment);return n&&(s.programDateTime=n.toISOString()),t(null,s)},Xf=({programTime:r,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof r>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Db(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=Cb(r,e);if(!o)return a({message:`${r} was not found in the stream`});const u=o.segment,d=wb(u.dateTimeObject,r);if(o.type==="estimate"){if(t===0)return a({message:`${r} is not buffered yet. Try again`});i(o.estimatedStart+d),n.one("seeked",()=>{Xf({programTime:r,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:s,tech:n,callback:a})});return}const p=u.start+d,T=()=>a(null,n.currentTime());n.one("seeked",T),s&&n.pause(),i(p)},oo=(r,e)=>{if(r.readyState===4)return e()},kb=(r,e,t,i)=>{let s=[],n,a=!1;const o=function(T,A,b,k){return A.abort(),a=!0,t(T,A,b,k)},u=function(T,A){if(a)return;if(T)return T.metadata=cr({requestType:i,request:A,error:T}),o(T,A,"",s);const b=A.responseText.substring(s&&s.byteLength||0,A.responseText.length);if(s=i_(s,Yd(b,!0)),n=n||ys(s),s.length<10||n&&s.length<n+2)return oo(A,()=>o(T,A,"",s));const k=Xo(s);return k==="ts"&&s.length<188?oo(A,()=>o(T,A,"",s)):!k&&s.length<376?oo(A,()=>o(T,A,"",s)):o(null,A,k,s)},p=e({uri:r,beforeSend(T){T.overrideMimeType("text/plain; charset=x-user-defined"),T.addEventListener("progress",function({total:A,loaded:b}){return Po(T,null,{statusCode:T.status},u)})}},function(T,A){return Po(p,T,A,u)});return p},{EventTarget:Pb}=z,Xc=function(r,e){if(!Vf(r,e)||r.sidx&&e.sidx&&(r.sidx.offset!==e.sidx.offset||r.sidx.length!==e.sidx.length))return!1;if(!r.sidx&&e.sidx||r.sidx&&!e.sidx||r.segments&&!e.segments||!r.segments&&e.segments)return!1;if(!r.segments&&!e.segments)return!0;for(let t=0;t<r.segments.length;t++){const i=r.segments[t],s=e.segments[t];if(i.uri!==s.uri)return!1;if(!i.byterange&&!s.byterange)continue;const n=i.byterange,a=s.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},Rb=(r,e,t,i)=>{const s=i.attributes.NAME||t;return`placeholder-uri-${r}-${e}-${s}`},Lb=({mainXml:r,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:s})=>{const n=tT(r,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:s});return Uf(n,e,Rb),n},Nb=(r,e)=>{Gr(r,(t,i,s,n)=>{(!e.mediaGroups[i][s]||!(n in e.mediaGroups[i][s]))&&delete r.mediaGroups[i][s][n]})},Ob=(r,e,t)=>{let i=!0,s=Oe(r,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const u=Xn(a.sidx);t&&t[u]&&t[u].sidx&&Wo(a,t[u].sidx,a.sidx.resolvedUri)}const o=Io(s,a,Xc);o&&(s=o,i=!1)}return Gr(e,(n,a,o,u)=>{if(n.playlists&&n.playlists.length){const d=n.playlists[0].id,p=Io(s,n.playlists[0],Xc);p&&(s=p,u in s.mediaGroups[a][o]||(s.mediaGroups[a][o][u]=n),s.mediaGroups[a][o][u].playlists[0]=s.playlists[d],i=!1)}}),Nb(s,e),e.minimumUpdatePeriod!==r.minimumUpdatePeriod&&(i=!1),i?null:s},Bb=(r,e)=>(!r.map&&!e.map||!!(r.map&&e.map&&r.map.byterange.offset===e.map.byterange.offset&&r.map.byterange.length===e.map.byterange.length))&&r.uri===e.uri&&r.byterange.offset===e.byterange.offset&&r.byterange.length===e.byterange.length,Yc=(r,e)=>{const t={};for(const i in r){const n=r[i].sidx;if(n){const a=Xn(n);if(!e[a])break;const o=e[a].sidxInfo;Bb(o,n)&&(t[a]=e[a])}}return t},Mb=(r,e)=>{let i=Yc(r.playlists,e);return Gr(r,(s,n,a,o)=>{if(s.playlists&&s.playlists.length){const u=s.playlists;i=Oe(i,Yc(u,e))}}),i};class Lo extends Pb{constructor(e,t,i={},s){super(),this.isPaused_=!0,this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Zt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const s=e.sidx&&Xn(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){N.clearTimeout(this.mediaRequest_),this.mediaRequest_=N.setTimeout(()=>i(!1),0);return}const n=Mn(e.sidx.resolvedUri),a=(u,d)=>{if(this.requestErrored_(u,d,t))return;const p=this.mainPlaylistLoader_.sidxMapping_,{requestType:T}=d;let A;try{A=aT(be(d.response).subarray(8))}catch(b){b.metadata=cr({requestType:T,request:d,parseFailure:!0}),this.requestErrored_(b,d,t);return}return p[s]={sidxInfo:e.sidx,sidx:A},Wo(e,A,e.sidx.resolvedUri),i(!0)},o="dash-sidx";this.request=kb(n,this.vhs_.xhr,(u,d,p,T)=>{if(u)return a(u,d);if(!p||p!=="mp4"){const k=p||"unknown";return a({status:d.status,message:`Unsupported ${k} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},d)}const{offset:A,length:b}=e.sidx.byterange;if(T.length>=b+A)return a(u,{response:T.subarray(A,A+b),status:d.status,uri:d.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ro({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},N.clearTimeout(this.minimumUpdatePeriodTimeout_),N.clearTimeout(this.mediaRequest_),N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,N.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(N.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=N.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){N.clearTimeout(this.mediaRequest_),this.mediaRequest_=N.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,s)=>{if(i){const{requestType:a}=s;i.metadata=cr({requestType:a,request:s,error:i})}if(this.requestErrored_(i,s)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Mn(this.mainPlaylistLoader_.srcUrl,s),n){this.handleMain_(),this.syncClientServerClock_(()=>e(s,n));return}return e(s,n)})}syncClientServerClock_(e){const t=iT(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Ot(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{if(!this.request)return;if(i){const{requestType:a}=s;return this.error.metadata=cr({requestType:a,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!s.responseHeaders||!s.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(s.responseHeaders.date):n=Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){N.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=Lb({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:z.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=Ob(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:n,endList:a}=i,o=[];i.playlists.forEach(d=>{o.push({id:d.id,bandwidth:d.attributes.BANDWIDTH,resolution:d.attributes.RESOLUTION,codecs:d.attributes.CODECS})});const u={duration:n,isLive:!a,renditions:o};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(N.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=N.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=Mb(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=N.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},ko(this.media(),!!i)))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const s=e.contentProtection[i].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var gt={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Fb=r=>{const e=new Uint8Array(new ArrayBuffer(r.length));for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e.buffer},Yf=function(r){return r.on=r.addEventListener,r.off=r.removeEventListener,r},Ub=function(r){try{return URL.createObjectURL(new Blob([r],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(r),URL.createObjectURL(t.getBlob())}},Qf=function(r){return function(){const e=Ub(r),t=Yf(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},Jf=function(r){return`var browserWorkerPolyFill = ${Yf.toString()};
184
+ browserWorkerPolyFill(self);
185
+ `+r},Zf=function(r){return r.toString().replace(/^function.+?{/,"").slice(0,-1)},$b=Jf(Zf(function(){var r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ce.global<"u"?Ce.global:typeof self<"u"?self:{},e=function(){this.init=function(){var l={};this.on=function(c,f){l[c]||(l[c]=[]),l[c]=l[c].concat(f)},this.off=function(c,f){var h;return l[c]?(h=l[c].indexOf(f),l[c]=l[c].slice(),l[c].splice(h,1),h>-1):!1},this.trigger=function(c){var f,h,m,_;if(f=l[c],!!f)if(arguments.length===2)for(m=f.length,h=0;h<m;++h)f[h].call(this,arguments[1]);else{for(_=[],h=arguments.length,h=1;h<arguments.length;++h)_.push(arguments[h]);for(m=f.length,h=0;h<m;++h)f[h].apply(this,_)}},this.dispose=function(){l={}}}};e.prototype.pipe=function(l){return this.on("data",function(c){l.push(c)}),this.on("done",function(c){l.flush(c)}),this.on("partialdone",function(c){l.partialFlush(c)}),this.on("endedtimeline",function(c){l.endTimeline(c)}),this.on("reset",function(c){l.reset(c)}),l},e.prototype.push=function(l){this.trigger("data",l)},e.prototype.flush=function(l){this.trigger("done",l)},e.prototype.partialFlush=function(l){this.trigger("partialdone",l)},e.prototype.endTimeline=function(l){this.trigger("endedtimeline",l)},e.prototype.reset=function(l){this.trigger("reset",l)};var t=e,i=Math.pow(2,32),s=function(l){var c=new DataView(l.buffer,l.byteOffset,l.byteLength),f;return c.getBigUint64?(f=c.getBigUint64(0),f<Number.MAX_SAFE_INTEGER?Number(f):f):c.getUint32(0)*i+c.getUint32(4)},n={getUint64:s,MAX_UINT32:i},a=n.MAX_UINT32,o,u,d,p,T,A,b,k,v,L,U,$,F,H,B,V,G,ie,C,I,W,Y,X,ne,de,fe,te,le,oe,ce,ue,Ee,Ae,Te,_e,lt;(function(){var l;if(X={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(l in X)X.hasOwnProperty(l)&&(X[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);ne=new Uint8Array([105,115,111,109]),fe=new Uint8Array([97,118,99,49]),de=new Uint8Array([0,0,0,1]),te=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]),le=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]),oe={video:te,audio:le},Ee=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ue=new Uint8Array([0,0,0,0,0,0,0,0]),Ae=new Uint8Array([0,0,0,0,0,0,0,0]),Te=Ae,_e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),lt=Ae,ce=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var c=[],f=0,h,m,_;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)f+=c[h].byteLength;for(m=new Uint8Array(f+8),_=new DataView(m.buffer,m.byteOffset,m.byteLength),_.setUint32(0,m.byteLength),m.set(l,4),h=0,f=8;h<c.length;h++)m.set(c[h],f),f+=c[h].byteLength;return m},u=function(){return o(X.dinf,o(X.dref,Ee))},d=function(l){return o(X.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},p=function(){return o(X.ftyp,ne,de,ne,fe)},V=function(l){return o(X.hdlr,oe[l])},T=function(l){return o(X.mdat,l)},B=function(l){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(c[12]=l.samplerate>>>24&255,c[13]=l.samplerate>>>16&255,c[14]=l.samplerate>>>8&255,c[15]=l.samplerate&255),o(X.mdhd,c)},H=function(l){return o(X.mdia,B(l),V(l.type),b(l))},A=function(l){return o(X.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},b=function(l){return o(X.minf,l.type==="video"?o(X.vmhd,ce):o(X.smhd,ue),u(),ie(l))},k=function(l,c){for(var f=[],h=c.length;h--;)f[h]=I(c[h]);return o.apply(null,[X.moof,A(l)].concat(f))},v=function(l){for(var c=l.length,f=[];c--;)f[c]=$(l[c]);return o.apply(null,[X.moov,U(4294967295)].concat(f).concat(L(l)))},L=function(l){for(var c=l.length,f=[];c--;)f[c]=W(l[c]);return o.apply(null,[X.mvex].concat(f))},U=function(l){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&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 o(X.mvhd,c)},G=function(l){var c=l.samples||[],f=new Uint8Array(4+c.length),h,m;for(m=0;m<c.length;m++)h=c[m].flags,f[m+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return o(X.sdtp,f)},ie=function(l){return o(X.stbl,C(l),o(X.stts,lt),o(X.stsc,Te),o(X.stsz,_e),o(X.stco,Ae))},(function(){var l,c;C=function(f){return o(X.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),f.type==="video"?l(f):c(f))},l=function(f){var h=f.sps||[],m=f.pps||[],_=[],w=[],D,R;for(D=0;D<h.length;D++)_.push((h[D].byteLength&65280)>>>8),_.push(h[D].byteLength&255),_=_.concat(Array.prototype.slice.call(h[D]));for(D=0;D<m.length;D++)w.push((m[D].byteLength&65280)>>>8),w.push(m[D].byteLength&255),w=w.concat(Array.prototype.slice.call(m[D]));if(R=[X.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,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(X.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([h.length],_,[m.length],w))),o(X.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var O=f.sarRatio[0],q=f.sarRatio[1];R.push(o(X.pasp,new Uint8Array([(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255,(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255])))}return o.apply(null,R)},c=function(f){return o(X.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),d(f))}})(),F=function(l){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(X.tkhd,c)},I=function(l){var c,f,h,m,_,w,D;return c=o(X.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),w=Math.floor(l.baseMediaDecodeTime/a),D=Math.floor(l.baseMediaDecodeTime%a),f=o(X.tfdt,new Uint8Array([1,0,0,0,w>>>24&255,w>>>16&255,w>>>8&255,w&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255])),_=92,l.type==="audio"?(h=Y(l,_),o(X.traf,c,f,h)):(m=G(l),h=Y(l,m.length+_),o(X.traf,c,f,h,m))},$=function(l){return l.duration=l.duration||4294967295,o(X.trak,F(l),H(l))},W=function(l){var c=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(c[c.length-1]=0),o(X.trex,c)},(function(){var l,c,f;f=function(h,m){var _=0,w=0,D=0,R=0;return h.length&&(h[0].duration!==void 0&&(_=1),h[0].size!==void 0&&(w=2),h[0].flags!==void 0&&(D=4),h[0].compositionTimeOffset!==void 0&&(R=8)),[0,0,_|w|D|R,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(m&4278190080)>>>24,(m&16711680)>>>16,(m&65280)>>>8,m&255]},c=function(h,m){var _,w,D,R,O,q;for(R=h.samples||[],m+=20+16*R.length,D=f(R,m),w=new Uint8Array(D.length+R.length*16),w.set(D),_=D.length,q=0;q<R.length;q++)O=R[q],w[_++]=(O.duration&4278190080)>>>24,w[_++]=(O.duration&16711680)>>>16,w[_++]=(O.duration&65280)>>>8,w[_++]=O.duration&255,w[_++]=(O.size&4278190080)>>>24,w[_++]=(O.size&16711680)>>>16,w[_++]=(O.size&65280)>>>8,w[_++]=O.size&255,w[_++]=O.flags.isLeading<<2|O.flags.dependsOn,w[_++]=O.flags.isDependedOn<<6|O.flags.hasRedundancy<<4|O.flags.paddingValue<<1|O.flags.isNonSyncSample,w[_++]=O.flags.degradationPriority&61440,w[_++]=O.flags.degradationPriority&15,w[_++]=(O.compositionTimeOffset&4278190080)>>>24,w[_++]=(O.compositionTimeOffset&16711680)>>>16,w[_++]=(O.compositionTimeOffset&65280)>>>8,w[_++]=O.compositionTimeOffset&255;return o(X.trun,w)},l=function(h,m){var _,w,D,R,O,q;for(R=h.samples||[],m+=20+8*R.length,D=f(R,m),_=new Uint8Array(D.length+R.length*8),_.set(D),w=D.length,q=0;q<R.length;q++)O=R[q],_[w++]=(O.duration&4278190080)>>>24,_[w++]=(O.duration&16711680)>>>16,_[w++]=(O.duration&65280)>>>8,_[w++]=O.duration&255,_[w++]=(O.size&4278190080)>>>24,_[w++]=(O.size&16711680)>>>16,_[w++]=(O.size&65280)>>>8,_[w++]=O.size&255;return o(X.trun,_)},Y=function(h,m){return h.type==="audio"?l(h,m):c(h,m)}})();var dt={ftyp:p,mdat:T,moof:k,moov:v,initSegment:function(l){var c=p(),f=v(l),h;return h=new Uint8Array(c.byteLength+f.byteLength),h.set(c),h.set(f,c.byteLength),h}},tt=function(l){var c,f,h=[],m=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,h.byteLength=0,c=0;c<l.length;c++)f=l[c],f.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=f.dts-h.dts,m.byteLength+=h.byteLength,m.nalCount+=h.length,m.duration+=h.duration,m.push(h)),h=[f],h.byteLength=f.data.byteLength,h.pts=f.pts,h.dts=f.dts):(f.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=f.dts-h.dts,h.byteLength+=f.data.byteLength,h.push(f));return m.length&&(!h.duration||h.duration<=0)&&(h.duration=m[m.length-1].duration),m.byteLength+=h.byteLength,m.nalCount+=h.length,m.duration+=h.duration,m.push(h),m},ht=function(l){var c,f,h=[],m=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=l[0].pts,h.dts=l[0].dts,m.byteLength=0,m.nalCount=0,m.duration=0,m.pts=l[0].pts,m.dts=l[0].dts,c=0;c<l.length;c++)f=l[c],f.keyFrame?(h.length&&(m.push(h),m.byteLength+=h.byteLength,m.nalCount+=h.nalCount,m.duration+=h.duration),h=[f],h.nalCount=f.length,h.byteLength=f.byteLength,h.pts=f.pts,h.dts=f.dts,h.duration=f.duration):(h.duration+=f.duration,h.nalCount+=f.length,h.byteLength+=f.byteLength,h.push(f));return m.length&&h.duration<=0&&(h.duration=m[m.length-1].duration),m.byteLength+=h.byteLength,m.nalCount+=h.nalCount,m.duration+=h.duration,m.push(h),m},Ct=function(l){var c;return!l[0][0].keyFrame&&l.length>1&&(c=l.shift(),l.byteLength-=c.byteLength,l.nalCount-=c.nalCount,l[0][0].dts=c.dts,l[0][0].pts=c.pts,l[0][0].duration+=c.duration),l},Qe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ft=function(l,c){var f=Qe();return f.dataOffset=c,f.compositionTimeOffset=l.pts-l.dts,f.duration=l.duration,f.size=4*l.length,f.size+=l.byteLength,l.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},ei=function(l,c){var f,h,m,_,w,D=c||0,R=[];for(f=0;f<l.length;f++)for(_=l[f],h=0;h<_.length;h++)w=_[h],m=ft(w,D),D+=m.size,R.push(m);return R},ut=function(l){var c,f,h,m,_,w,D=0,R=l.byteLength,O=l.nalCount,q=R+4*O,Z=new Uint8Array(q),me=new DataView(Z.buffer);for(c=0;c<l.length;c++)for(m=l[c],f=0;f<m.length;f++)for(_=m[f],h=0;h<_.length;h++)w=_[h],me.setUint32(D,w.data.byteLength),D+=4,Z.set(w.data,D),D+=w.data.byteLength;return Z},ti=function(l,c){var f,h=c||0,m=[];return f=ft(l,h),m.push(f),m},He=function(l){var c,f,h=0,m=l.byteLength,_=l.length,w=m+4*_,D=new Uint8Array(w),R=new DataView(D.buffer);for(c=0;c<l.length;c++)f=l[c],R.setUint32(h,f.data.byteLength),h+=4,D.set(f.data,h),h+=f.data.byteLength;return D},Ht={groupNalsIntoFrames:tt,groupFramesIntoGops:ht,extendFirstKeyFrame:Ct,generateSampleTable:ei,concatenateNalData:ut,generateSampleTableForFrame:ti,concatenateNalDataForFrame:He},At=[33,16,5,32,164,27],Rt=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Ie=function(l){for(var c=[];l--;)c.push(0);return c},je=function(l){return Object.keys(l).reduce(function(c,f){return c[f]=new Uint8Array(l[f].reduce(function(h,m){return h.concat(m)},[])),c},{})},ze,ii=function(){if(!ze){var l={96e3:[At,[227,64],Ie(154),[56]],88200:[At,[231],Ie(170),[56]],64e3:[At,[248,192],Ie(240),[56]],48e3:[At,[255,192],Ie(268),[55,148,128],Ie(54),[112]],44100:[At,[255,192],Ie(268),[55,163,128],Ie(84),[112]],32e3:[At,[255,192],Ie(268),[55,234],Ie(226),[112]],24e3:[At,[255,192],Ie(268),[55,255,128],Ie(268),[111,112],Ie(126),[224]],16e3:[At,[255,192],Ie(268),[55,255,128],Ie(268),[111,255],Ie(269),[223,108],Ie(195),[1,192]],12e3:[Rt,Ie(268),[3,127,248],Ie(268),[6,255,240],Ie(268),[13,255,224],Ie(268),[27,253,128],Ie(259),[56]],11025:[Rt,Ie(268),[3,127,248],Ie(268),[6,255,240],Ie(268),[13,255,224],Ie(268),[27,255,192],Ie(268),[55,175,128],Ie(108),[112]],8e3:[Rt,Ie(268),[3,121,16],Ie(47),[7]]};ze=je(l)}return ze},Lt=9e4,pt,ri,hi,Tt,Xi,S,g;pt=function(l){return l*Lt},ri=function(l,c){return l*c},hi=function(l){return l/Lt},Tt=function(l,c){return l/c},Xi=function(l,c){return pt(Tt(l,c))},S=function(l,c){return ri(hi(l),c)},g=function(l,c,f){return hi(f?l:l-c)};var y={ONE_SECOND_IN_TS:Lt,secondsToVideoTs:pt,secondsToAudioTs:ri,videoTsToSeconds:hi,audioTsToSeconds:Tt,audioTsToVideoTs:Xi,videoTsToAudioTs:S,metadataTsToSeconds:g},P=ii,j=y,Q=function(l){var c,f,h=0;for(c=0;c<l.length;c++)f=l[c],h+=f.data.byteLength;return h},se=function(l,c,f,h){var m,_=0,w=0,D=0,R=0,O,q,Z;if(c.length&&(m=j.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),_=Math.ceil(j.ONE_SECOND_IN_TS/(l.samplerate/1024)),f&&h&&(w=m-Math.max(f,h),D=Math.floor(w/_),R=D*_),!(D<1||R>j.ONE_SECOND_IN_TS/2))){for(O=P()[l.samplerate],O||(O=c[0].data),q=0;q<D;q++)Z=c[0],c.splice(0,0,{data:O,dts:Z.dts-_,pts:Z.pts-_});return l.baseMediaDecodeTime-=Math.floor(j.videoTsToAudioTs(R,l.samplerate)),R}},we=function(l,c,f){return c.minSegmentDts>=f?l:(c.minSegmentDts=1/0,l.filter(function(h){return h.dts>=f?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},Ne=function(l){var c,f,h=[];for(c=0;c<l.length;c++)f=l[c],h.push({size:f.data.byteLength,duration:1024});return h},Be=function(l){var c,f,h=0,m=new Uint8Array(Q(l));for(c=0;c<l.length;c++)f=l[c],m.set(f.data,h),h+=f.data.byteLength;return m},Ue={prefixWithSilence:se,trimAdtsFramesByEarliestDts:we,generateSampleTable:Ne,concatenateFrameData:Be},Le=y.ONE_SECOND_IN_TS,x=function(l,c){typeof c.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=c.pts),l.minSegmentPts===void 0?l.minSegmentPts=c.pts:l.minSegmentPts=Math.min(l.minSegmentPts,c.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=c.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=c.dts),l.minSegmentDts===void 0?l.minSegmentDts=c.dts:l.minSegmentDts=Math.min(l.minSegmentDts,c.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=c.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,c.dts))},E=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},M=function(l,c){var f,h,m=l.minSegmentDts;return c||(m-=l.timelineStartInfo.dts),f=l.timelineStartInfo.baseMediaDecodeTime,f+=m,f=Math.max(0,f),l.type==="audio"&&(h=l.samplerate/Le,f*=h,f=Math.floor(f)),f},K={clearDtsInfo:E,calculateTrackBaseMediaDecodeTime:M,collectDtsInfo:x},pe=4,Se=128,qe=function(l){for(var c=0,f={payloadType:-1,payloadSize:0},h=0,m=0;c<l.byteLength&&l[c]!==Se;){for(;l[c]===255;)h+=255,c++;for(h+=l[c++];l[c]===255;)m+=255,c++;if(m+=l[c++],!f.payload&&h===pe){var _=String.fromCharCode(l[c+3],l[c+4],l[c+5],l[c+6]);if(_==="GA94"){f.payloadType=h,f.payloadSize=m,f.payload=l.subarray(c,c+m);break}else f.payload=void 0}c+=m,h=0,m=0}return f},bt=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!==49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},Ft=function(l,c){var f=[],h,m,_,w;if(!(c[0]&64))return f;for(m=c[0]&31,h=0;h<m;h++)_=h*3,w={type:c[_+2]&3,pts:l},c[_+2]&4&&(w.ccData=c[_+3]<<8|c[_+4],f.push(w));return f},fi=function(l){for(var c=l.byteLength,f=[],h=1,m,_;h<c-2;)l[h]===0&&l[h+1]===0&&l[h+2]===3?(f.push(h+2),h+=2):h++;if(f.length===0)return l;m=c-f.length,_=new Uint8Array(m);var w=0;for(h=0;h<m;w++,h++)w===f[0]&&(w++,f.shift()),_[h]=l[w];return _},zt={parseSei:qe,parseUserData:bt,parseCaptionPackets:Ft,discardEmulationPreventionBytes:fi,USER_DATA_REGISTERED_ITU_T_T35:pe},si=t,Wt=zt,st=function(l){l=l||{},st.prototype.init.call(this),this.parse708captions_=typeof l.parse708captions=="boolean"?l.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Je(0,0),new Je(0,1),new Je(1,0),new Je(1,1)],this.parse708captions_&&(this.cc708Stream_=new Re({captionServices:l.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};st.prototype=new si,st.prototype.push=function(l){var c,f,h;if(l.nalUnitType==="sei_rbsp"&&(c=Wt.parseSei(l.escapedRBSP),!!c.payload&&c.payloadType===Wt.USER_DATA_REGISTERED_ITU_T_T35&&(f=Wt.parseUserData(c),!!f))){if(l.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=Wt.parseCaptionPackets(l.pts,f),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},st.prototype.flushCCStreams=function(l){this.ccStreams_.forEach(function(c){return l==="flush"?c.flush():c.partialFlush()},this)},st.prototype.flushStream=function(l){if(!this.captionPackets_.length){this.flushCCStreams(l);return}this.captionPackets_.forEach(function(c,f){c.presortIndex=f}),this.captionPackets_.sort(function(c,f){return c.pts===f.pts?c.presortIndex-f.presortIndex:c.pts-f.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(l)},st.prototype.flush=function(){return this.flushStream("flush")},st.prototype.partialFlush=function(){return this.flushStream("partialFlush")},st.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},st.prototype.dispatchCea608Packet=function(l){this.setsTextOrXDSActive(l)?this.activeCea608Channel_[l.type]=null:this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},st.prototype.setsChannel1Active=function(l){return(l.ccData&30720)===4096},st.prototype.setsChannel2Active=function(l){return(l.ccData&30720)===6144},st.prototype.setsTextOrXDSActive=function(l){return(l.ccData&28928)===256||(l.ccData&30974)===4138||(l.ccData&30974)===6186},st.prototype.dispatchCea708Packet=function(l){this.parse708captions_&&this.cc708Stream_.push(l)};var Gt={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},Ii=function(l){var c=Gt[l]||l;return l&4096&&l===c?"":String.fromCharCode(c)},pi=function(l){return 32<=l&&l<=127||160<=l&&l<=255},We=function(l){this.windowNum=l,this.reset()};We.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},We.prototype.getText=function(){return this.rows.join(`
186
+ `)},We.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},We.prototype.newLine=function(l){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(l),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},We.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},We.prototype.addText=function(l){this.rows[this.rowIdx]+=l},We.prototype.backspace=function(){if(!this.isEmpty()){var l=this.rows[this.rowIdx];this.rows[this.rowIdx]=l.substr(0,l.length-1)}};var Yi=function(l,c,f){this.serviceNum=l,this.text="",this.currentWindow=new We(-1),this.windows=[],this.stream=f,typeof c=="string"&&this.createTextDecoder(c)};Yi.prototype.init=function(l,c){this.startPts=l;for(var f=0;f<8;f++)this.windows[f]=new We(f),typeof c=="function"&&(this.windows[f].beforeRowOverflow=c)},Yi.prototype.setCurrentWindow=function(l){this.currentWindow=this.windows[l]},Yi.prototype.createTextDecoder=function(l){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(l)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+l+" encoding. "+c})}};var Re=function(l){l=l||{},Re.prototype.init.call(this);var c=this,f=l.captionServices||{},h={},m;Object.keys(f).forEach(_=>{m=f[_],/^SERVICE/.test(_)&&(h[_]=m.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(_){_.type===3?(c.new708Packet(),c.add708Bytes(_)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(_))}};Re.prototype=new si,Re.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Re.prototype.add708Bytes=function(l){var c=l.ccData,f=c>>>8,h=c&255;this.current708Packet.ptsVals.push(l.pts),this.current708Packet.data.push(f),this.current708Packet.data.push(h)},Re.prototype.push708Packet=function(){var l=this.current708Packet,c=l.data,f=null,h=null,m=0,_=c[m++];for(l.seq=_>>6,l.sizeCode=_&63;m<c.length;m++)_=c[m++],f=_>>5,h=_&31,f===7&&h>0&&(_=c[m++],f=_),this.pushServiceBlock(f,m,h),h>0&&(m+=h-1)},Re.prototype.pushServiceBlock=function(l,c,f){var h,m=c,_=this.current708Packet.data,w=this.services[l];for(w||(w=this.initService(l,m));m<c+f&&m<_.length;m++)h=_[m],pi(h)?m=this.handleText(m,w):h===24?m=this.multiByteCharacter(m,w):h===16?m=this.extendedCommands(m,w):128<=h&&h<=135?m=this.setCurrentWindow(m,w):152<=h&&h<=159?m=this.defineWindow(m,w):h===136?m=this.clearWindows(m,w):h===140?m=this.deleteWindows(m,w):h===137?m=this.displayWindows(m,w):h===138?m=this.hideWindows(m,w):h===139?m=this.toggleWindows(m,w):h===151?m=this.setWindowAttributes(m,w):h===144?m=this.setPenAttributes(m,w):h===145?m=this.setPenColor(m,w):h===146?m=this.setPenLocation(m,w):h===143?w=this.reset(m,w):h===8?w.currentWindow.backspace():h===12?w.currentWindow.clearText():h===13?w.currentWindow.pendingNewLine=!0:h===14?w.currentWindow.clearText():h===141&&m++},Re.prototype.extendedCommands=function(l,c){var f=this.current708Packet.data,h=f[++l];return pi(h)&&(l=this.handleText(l,c,{isExtended:!0})),l},Re.prototype.getPts=function(l){return this.current708Packet.ptsVals[Math.floor(l/2)]},Re.prototype.initService=function(l,c){var h="SERVICE"+l,f=this,h,m;return h in this.serviceEncodings&&(m=this.serviceEncodings[h]),this.services[l]=new Yi(l,m,f),this.services[l].init(this.getPts(c),function(_){f.flushDisplayed(_,f.services[l])}),this.services[l]},Re.prototype.handleText=function(l,c,f){var h=f&&f.isExtended,m=f&&f.isMultiByte,_=this.current708Packet.data,w=h?4096:0,D=_[l],R=_[l+1],O=c.currentWindow,q,Z;function me(re){return re.map(ve=>("0"+(ve&255).toString(16)).slice(-2)).join("")}if(m?(Z=[D,R],l++):Z=[D],c.textDecoder_&&!h)q=c.textDecoder_.decode(new Uint8Array(Z));else if(m){const re=me(Z);q=String.fromCharCode(parseInt(re,16))}else q=Ii(w|D);return O.pendingNewLine&&!O.isEmpty()&&O.newLine(this.getPts(l)),O.pendingNewLine=!1,O.addText(q),l},Re.prototype.multiByteCharacter=function(l,c){var f=this.current708Packet.data,h=f[l+1],m=f[l+2];return pi(h)&&pi(m)&&(l=this.handleText(++l,c,{isMultiByte:!0})),l},Re.prototype.setCurrentWindow=function(l,c){var f=this.current708Packet.data,h=f[l],m=h&7;return c.setCurrentWindow(m),l},Re.prototype.defineWindow=function(l,c){var f=this.current708Packet.data,h=f[l],m=h&7;c.setCurrentWindow(m);var _=c.currentWindow;return h=f[++l],_.visible=(h&32)>>5,_.rowLock=(h&16)>>4,_.columnLock=(h&8)>>3,_.priority=h&7,h=f[++l],_.relativePositioning=(h&128)>>7,_.anchorVertical=h&127,h=f[++l],_.anchorHorizontal=h,h=f[++l],_.anchorPoint=(h&240)>>4,_.rowCount=h&15,h=f[++l],_.columnCount=h&63,h=f[++l],_.windowStyle=(h&56)>>3,_.penStyle=h&7,_.virtualRowCount=_.rowCount+1,l},Re.prototype.setWindowAttributes=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.winAttr;return h=f[++l],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=f[++l],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=f[++l],m.borderType+=(h&128)>>5,m.wordWrap=(h&64)>>6,m.printDirection=(h&48)>>4,m.scrollDirection=(h&12)>>2,m.justify=h&3,h=f[++l],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,l},Re.prototype.flushDisplayed=function(l,c){for(var f=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&f.push(c.windows[h].getText());c.endPts=l,c.text=f.join(`
187
+
188
+ `),this.pushCaption(c),c.startPts=l},Re.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},Re.prototype.displayWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=1);return l},Re.prototype.hideWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=0);return l},Re.prototype.toggleWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible^=1);return l},Re.prototype.clearWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].clearText();return l},Re.prototype.deleteWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].reset();return l},Re.prototype.setPenAttributes=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penAttr;return h=f[++l],m.textTag=(h&240)>>4,m.offset=(h&12)>>2,m.penSize=h&3,h=f[++l],m.italics=(h&128)>>7,m.underline=(h&64)>>6,m.edgeType=(h&56)>>3,m.fontStyle=h&7,l},Re.prototype.setPenColor=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penColor;return h=f[++l],m.fgOpacity=(h&192)>>6,m.fgRed=(h&48)>>4,m.fgGreen=(h&12)>>2,m.fgBlue=h&3,h=f[++l],m.bgOpacity=(h&192)>>6,m.bgRed=(h&48)>>4,m.bgGreen=(h&12)>>2,m.bgBlue=h&3,h=f[++l],m.edgeRed=(h&48)>>4,m.edgeGreen=(h&12)>>2,m.edgeBlue=h&3,l},Re.prototype.setPenLocation=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=f[++l],m.row=h&15,h=f[++l],m.column=h&63,l},Re.prototype.reset=function(l,c){var f=this.getPts(l);return this.flushDisplayed(f,c),this.initService(c.serviceNum,l)};var Ms={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Fs=function(l){return l===null?"":(l=Ms[l]||l,String.fromCharCode(l))},Us=14,kp=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Qi=function(){for(var l=[],c=Us+1;c--;)l.push({text:"",indent:0,offset:0});return l},Je=function(l,c){Je.prototype.init.call(this),this.field_=l||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var h,m,_,w,D;if(h=f.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),_=h>>>8,w=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(f.pts),this.flushDisplayed(f.pts),m=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=m,this.startPts_=f.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(f.pts),this.displayed_=Qi();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Qi();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=Qi()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(_,w))_=(_&3)<<8,D=Fs(_|w),this[this.mode_](f.pts,D),this.column_++;else if(this.isExtCharacter(_,w))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),_=(_&3)<<8,D=Fs(_|w),this[this.mode_](f.pts,D),this.column_++;else if(this.isMidRowCode(_,w))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(w&14)===14&&this.addFormatting(f.pts,["i"]),(w&1)===1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(_,w)){const O=w&3;this.nonDisplayed_[this.row_].offset=O,this.column_+=O}else if(this.isPAC(_,w)){var R=kp.indexOf(h&7968);if(this.mode_==="rollUp"&&(R-this.rollUpRows_+1<0&&(R=this.rollUpRows_-1),this.setRollUp(f.pts,R)),R!==this.row_&&R>=0&&R<=14&&(this.clearFormatting(f.pts),this.row_=R),w&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(h&16)===16){const O=(h&14)>>1;this.column_=O*4,this.nonDisplayed_[this.row_].indent+=O}this.isColorPAC(w)&&(w&14)===14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(_)&&(w===0&&(w=null),D=Fs(_),D+=Fs(w),this[this.mode_](f.pts,D),this.column_+=D.length)}};Je.prototype=new si,Je.prototype.flushDisplayed=function(l){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},f=[];this.displayed_.forEach((h,m)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(m)}h.text.length&&f.push({text:h.text,line:m+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(m)}),f.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:f,stream:this.name_})},Je.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Qi(),this.nonDisplayed_=Qi(),this.lastControlCode_=null,this.column_=0,this.row_=Us,this.rollUpRows_=2,this.formatting_=[]},Je.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Je.prototype.isSpecialCharacter=function(l,c){return l===this.EXT_&&c>=48&&c<=63},Je.prototype.isExtCharacter=function(l,c){return(l===this.EXT_+1||l===this.EXT_+2)&&c>=32&&c<=63},Je.prototype.isMidRowCode=function(l,c){return l===this.EXT_&&c>=32&&c<=47},Je.prototype.isOffsetControlCode=function(l,c){return l===this.OFFSET_&&c>=33&&c<=35},Je.prototype.isPAC=function(l,c){return l>=this.BASE_&&l<this.BASE_+8&&c>=64&&c<=127},Je.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},Je.prototype.isNormalChar=function(l){return l>=32&&l<=127},Je.prototype.setRollUp=function(l,c){if(this.mode_!=="rollUp"&&(this.row_=Us,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=Qi(),this.displayed_=Qi()),c!==void 0&&c!==this.row_)for(var f=0;f<this.rollUpRows_;f++)this.displayed_[c-f]=this.displayed_[this.row_-f],this.displayed_[this.row_-f]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Je.prototype.addFormatting=function(l,c){this.formatting_=this.formatting_.concat(c);var f=c.reduce(function(h,m){return h+"<"+m+">"},"");this[this.mode_](l,f)},Je.prototype.clearFormatting=function(l){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(f,h){return f+"</"+h+">"},"");this.formatting_=[],this[this.mode_](l,c)}},Je.prototype.popOn=function(l,c){var f=this.nonDisplayed_[this.row_].text;f+=c,this.nonDisplayed_[this.row_].text=f},Je.prototype.rollUp=function(l,c){var f=this.displayed_[this.row_].text;f+=c,this.displayed_[this.row_].text=f},Je.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.row_+1;l<Us+1;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Je.prototype.paintOn=function(l,c){var f=this.displayed_[this.row_].text;f+=c,this.displayed_[this.row_].text=f};var Dl={CaptionStream:st,Cea608Stream:Je,Cea708Stream:Re},$s={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Pp=t,Rp=8589934592,Lp=4294967296,Il="shared",pa=function(l,c){var f=1;for(l>c&&(f=-1);Math.abs(c-l)>Lp;)l+=f*Rp;return l},ma=function(l){var c,f;ma.prototype.init.call(this),this.type_=l||Il,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Il&&h.type!==this.type_||(f===void 0&&(f=h.dts),h.dts=pa(h.dts,f),h.pts=pa(h.pts,f),c=h.dts,this.trigger("data",h))},this.flush=function(){f=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ma.prototype=new Pp;var kl={TimestampRolloverStream:ma,handleRollover:pa},Np=(l,c,f)=>{if(!l)return-1;for(var h=f;h<l.length;h++)if(l[h]===c)return h;return-1},Op={typedArrayIndexOf:Np},js=Op.typedArrayIndexOf,qs={Utf8:3},Pl=function(l,c,f){var h,m="";for(h=c;h<f;h++)m+="%"+("00"+l[h].toString(16)).slice(-2);return m},Kr=function(l,c,f){return decodeURIComponent(Pl(l,c,f))},Xr=function(l,c,f){return unescape(Pl(l,c,f))},Yr=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Qr={APIC:function(l){var c=1,f,h,m="-->";l.data[0]===qs.Utf8&&(f=js(l.data,0,c),!(f<0)&&(l.mimeType=Xr(l.data,c,f),c=f+1,l.pictureType=l.data[c],c++,h=js(l.data,0,c),!(h<0)&&(l.description=Kr(l.data,c,h),c=h+1,l.mimeType===m?l.url=Xr(l.data,c,l.data.length):l.pictureData=l.data.subarray(c,l.data.length))))},"T*":function(l){l.data[0]===qs.Utf8&&(l.value=Kr(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var c;l.data[0]===qs.Utf8&&(c=js(l.data,0,1),c!==-1&&(l.description=Kr(l.data,1,c),l.value=Kr(l.data,c+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Xr(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var c;l.data[0]===qs.Utf8&&(c=js(l.data,0,1),c!==-1&&(l.description=Kr(l.data,1,c),l.url=Xr(l.data,c+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var c;for(c=0;c<l.data.length;c++)if(l.data[c]===0){l.owner=Xr(l.data,0,c);break}l.privateData=l.data.subarray(c+1),l.data=l.privateData}},Bp=function(l){var c,f,h=10,m=0,_=[];if(!(l.length<10||l[0]!==73||l[1]!==68||l[2]!==51)){m=Yr(l.subarray(6,10)),m+=10;var w=l[5]&64;w&&(h+=4,h+=Yr(l.subarray(10,14)),m-=Yr(l.subarray(16,20)));do{if(c=Yr(l.subarray(h+4,h+8)),c<1)break;f=String.fromCharCode(l[h],l[h+1],l[h+2],l[h+3]);var D={id:f,data:l.subarray(h+10,h+c+10)};D.key=D.id,Qr[D.id]?Qr[D.id](D):D.id[0]==="T"?Qr["T*"](D):D.id[0]==="W"&&Qr["W*"](D),_.push(D),h+=10,h+=c}while(h<m);return _}},Rl={parseId3Frames:Bp,parseSyncSafeInteger:Yr,frameParsers:Qr},Mp=t,Fp=$s,Mi=Rl,Vs;Vs=function(l){var c={descriptor:l&&l.descriptor},f=0,h=[],m=0,_;if(Vs.prototype.init.call(this),this.dispatchType=Fp.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(_=0;_<c.descriptor.length;_++)this.dispatchType+=("00"+c.descriptor[_].toString(16)).slice(-2);this.push=function(w){var D,R,O,q,Z,me;if(w.type==="timed-metadata"){if(w.dataAlignmentIndicator&&(m=0,h.length=0),h.length===0&&(w.data.length<10||w.data[0]!==73||w.data[1]!==68||w.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(w),m+=w.data.byteLength,h.length===1&&(f=Mi.parseSyncSafeInteger(w.data.subarray(6,10)),f+=10),!(m<f)){for(D={data:new Uint8Array(f),frames:[],pts:h[0].pts,dts:h[0].dts},Z=0;Z<f;)D.data.set(h[0].data.subarray(0,f-Z),Z),Z+=h[0].data.byteLength,m-=h[0].data.byteLength,h.shift();R=10,D.data[5]&64&&(R+=4,R+=Mi.parseSyncSafeInteger(D.data.subarray(10,14)),f-=Mi.parseSyncSafeInteger(D.data.subarray(16,20)));do{if(O=Mi.parseSyncSafeInteger(D.data.subarray(R+4,R+8)),O<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(me=String.fromCharCode(D.data[R],D.data[R+1],D.data[R+2],D.data[R+3]),q={id:me,data:D.data.subarray(R+10,R+O+10)},q.key=q.id,Mi.frameParsers[q.id]?Mi.frameParsers[q.id](q):q.id[0]==="T"?Mi.frameParsers["T*"](q):q.id[0]==="W"&&Mi.frameParsers["W*"](q),q.owner==="com.apple.streaming.transportStreamTimestamp"){var re=q.data,ve=(re[3]&1)<<30|re[4]<<22|re[5]<<14|re[6]<<6|re[7]>>>2;ve*=4,ve+=re[7]&3,q.timeStamp=ve,D.pts===void 0&&D.dts===void 0&&(D.pts=q.timeStamp,D.dts=q.timeStamp),this.trigger("timestamp",q)}D.frames.push(q),R+=10,R+=O}while(R<f);this.trigger("data",D)}}}},Vs.prototype=new Mp;var Up=Vs,ga=t,ya=Dl,ni=$s,$p=kl.TimestampRolloverStream,Hs,Jr,zs,hr=188,_a=71;Hs=function(){var l=new Uint8Array(hr),c=0;Hs.prototype.init.call(this),this.push=function(f){var h=0,m=hr,_;for(c?(_=new Uint8Array(f.byteLength+c),_.set(l.subarray(0,c)),_.set(f,c),c=0):_=f;m<_.byteLength;){if(_[h]===_a&&_[m]===_a){this.trigger("data",_.subarray(h,m)),h+=hr,m+=hr;continue}h++,m++}h<_.byteLength&&(l.set(_.subarray(h),0),c=_.byteLength-h)},this.flush=function(){c===hr&&l[0]===_a&&(this.trigger("data",l),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},Hs.prototype=new ga,Jr=function(){var l,c,f,h;Jr.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(m,_){var w=0;_.payloadUnitStartIndicator&&(w+=m[w]+1),_.type==="pat"?c(m.subarray(w),_):f(m.subarray(w),_)},c=function(m,_){_.section_number=m[7],_.last_section_number=m[8],h.pmtPid=(m[10]&31)<<8|m[11],_.pmtPid=h.pmtPid},f=function(m,_){var w,D,R,O;if(m[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},w=(m[1]&15)<<8|m[2],D=3+w-4,R=(m[10]&15)<<8|m[11],O=12+R;O<D;){var q=m[O],Z=(m[O+1]&31)<<8|m[O+2];q===ni.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=Z:q===ni.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=Z:q===ni.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][Z]=q),O+=((m[O+3]&15)<<8|m[O+4])+5}_.programMapTable=h.programMapTable}},this.push=function(m){var _={},w=4;if(_.payloadUnitStartIndicator=!!(m[1]&64),_.pid=m[1]&31,_.pid<<=8,_.pid|=m[2],(m[3]&48)>>>4>1&&(w+=m[w]+1),_.pid===0)_.type="pat",l(m.subarray(w),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",l(m.subarray(w),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([m,w,_]):this.processPes_(m,w,_)},this.processPes_=function(m,_,w){w.pid===this.programMapTable.video?w.streamType=ni.H264_STREAM_TYPE:w.pid===this.programMapTable.audio?w.streamType=ni.ADTS_STREAM_TYPE:w.streamType=this.programMapTable["timed-metadata"][w.pid],w.type="pes",w.data=m.subarray(_),this.trigger("data",w)}},Jr.prototype=new ga,Jr.STREAM_TYPES={h264:27,adts:15},zs=function(){var l=this,c=!1,f={data:[],size:0},h={data:[],size:0},m={data:[],size:0},_,w=function(R,O){var q;const Z=R[0]<<16|R[1]<<8|R[2];O.data=new Uint8Array,Z===1&&(O.packetLength=6+(R[4]<<8|R[5]),O.dataAlignmentIndicator=(R[6]&4)!==0,q=R[7],q&192&&(O.pts=(R[9]&14)<<27|(R[10]&255)<<20|(R[11]&254)<<12|(R[12]&255)<<5|(R[13]&254)>>>3,O.pts*=4,O.pts+=(R[13]&6)>>>1,O.dts=O.pts,q&64&&(O.dts=(R[14]&14)<<27|(R[15]&255)<<20|(R[16]&254)<<12|(R[17]&255)<<5|(R[18]&254)>>>3,O.dts*=4,O.dts+=(R[18]&6)>>>1)),O.data=R.subarray(9+R[8]))},D=function(R,O,q){var Z=new Uint8Array(R.size),me={type:O},re=0,ve=0,ke=!1,mt;if(!(!R.data.length||R.size<9)){for(me.trackId=R.data[0].pid,re=0;re<R.data.length;re++)mt=R.data[re],Z.set(mt.data,ve),ve+=mt.data.byteLength;w(Z,me),ke=O==="video"||me.packetLength<=R.size,(q||ke)&&(R.size=0,R.data.length=0),ke&&l.trigger("data",me)}};zs.prototype.init.call(this),this.push=function(R){({pat:function(){},pes:function(){var O,q;switch(R.streamType){case ni.H264_STREAM_TYPE:O=f,q="video";break;case ni.ADTS_STREAM_TYPE:O=h,q="audio";break;case ni.METADATA_STREAM_TYPE:O=m,q="timed-metadata";break;default:return}R.payloadUnitStartIndicator&&D(O,q,!0),O.data.push(R),O.size+=R.data.byteLength},pmt:function(){var O={type:"metadata",tracks:[]};_=R.programMapTable,_.video!==null&&O.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&O.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),c=!0,l.trigger("data",O)}})[R.type]()},this.reset=function(){f.size=0,f.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){D(f,"video"),D(h,"audio"),D(m,"timed-metadata")},this.flush=function(){if(!c&&_){var R={type:"metadata",tracks:[]};_.video!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),l.trigger("data",R)}c=!1,this.flushStreams_(),this.trigger("done")}},zs.prototype=new ga;var Ll={PAT_PID:0,MP2T_PACKET_LENGTH:hr,TransportPacketStream:Hs,TransportParseStream:Jr,ElementaryStream:zs,TimestampRolloverStream:$p,CaptionStream:ya.CaptionStream,Cea608Stream:ya.Cea608Stream,Cea708Stream:ya.Cea708Stream,MetadataStream:Up};for(var Ta in ni)ni.hasOwnProperty(Ta)&&(Ll[Ta]=ni[Ta]);var jp=Ll,qp=t,Vp=y.ONE_SECOND_IN_TS,Ws,Nl=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Ws=function(l){var c,f=0;Ws.prototype.init.call(this),this.skipWarn_=function(h,m){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${m} in frame ${f} outside syncword`})},this.push=function(h){var m=0,_,w,D,R,O;if(l||(f=0),h.type==="audio"){c&&c.length?(D=c,c=new Uint8Array(D.byteLength+h.data.byteLength),c.set(D),c.set(h.data,D.byteLength)):c=h.data;for(var q;m+7<c.length;){if(c[m]!==255||(c[m+1]&246)!==240){typeof q!="number"&&(q=m),m++;continue}if(typeof q=="number"&&(this.skipWarn_(q,m),q=null),w=(~c[m+1]&1)*2,_=(c[m+3]&3)<<11|c[m+4]<<3|(c[m+5]&224)>>5,R=((c[m+6]&3)+1)*1024,O=R*Vp/Nl[(c[m+2]&60)>>>2],c.byteLength-m<_)break;this.trigger("data",{pts:h.pts+f*O,dts:h.dts+f*O,sampleCount:R,audioobjecttype:(c[m+2]>>>6&3)+1,channelcount:(c[m+2]&1)<<2|(c[m+3]&192)>>>6,samplerate:Nl[(c[m+2]&60)>>>2],samplingfrequencyindex:(c[m+2]&60)>>>2,samplesize:16,data:c.subarray(m+7+w,m+_)}),f++,m+=_}typeof q=="number"&&(this.skipWarn_(q,m),q=null),c=c.subarray(m)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},Ws.prototype=new qp;var Hp=Ws,Ol;Ol=function(l){var c=l.byteLength,f=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var m=l.byteLength-c,_=new Uint8Array(4),w=Math.min(4,c);if(w===0)throw new Error("no bytes available");_.set(l.subarray(m,m+w)),f=new DataView(_.buffer).getUint32(0),h=w*8,c-=w},this.skipBits=function(m){var _;h>m?(f<<=m,h-=m):(m-=h,_=Math.floor(m/8),m-=_*8,c-=_,this.loadWord(),f<<=m,h-=m)},this.readBits=function(m){var _=Math.min(h,m),w=f>>>32-_;return h-=_,h>0?f<<=_:c>0&&this.loadWord(),_=m-_,_>0?w<<_|this.readBits(_):w},this.skipLeadingZeros=function(){var m;for(m=0;m<h;++m)if((f&2147483648>>>m)!==0)return f<<=m,h-=m,m;return this.loadWord(),m+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var m=this.skipLeadingZeros();return this.readBits(m+1)-1},this.readExpGolomb=function(){var m=this.readUnsignedExpGolomb();return 1&m?1+m>>>1:-1*(m>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var zp=Ol,Bl=t,Wp=zp,Gs,Ks,Ml;Ks=function(){var l=0,c,f;Ks.prototype.init.call(this),this.push=function(h){var m;f?(m=new Uint8Array(f.byteLength+h.data.byteLength),m.set(f),m.set(h.data,f.byteLength),f=m):f=h.data;for(var _=f.byteLength;l<_-3;l++)if(f[l+2]===1){c=l+5;break}for(;c<_;)switch(f[c]){case 0:if(f[c-1]!==0){c+=2;break}else if(f[c-2]!==0){c++;break}l+3!==c-2&&this.trigger("data",f.subarray(l+3,c-2));do c++;while(f[c]!==1&&c<_);l=c-2,c+=3;break;case 1:if(f[c-1]!==0||f[c-2]!==0){c+=3;break}this.trigger("data",f.subarray(l+3,c-2)),l=c-2,c+=3;break;default:c+=3;break}f=f.subarray(l),c-=l,l=0},this.reset=function(){f=null,l=0,this.trigger("reset")},this.flush=function(){f&&f.byteLength>3&&this.trigger("data",f.subarray(l+3)),f=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Ks.prototype=new Bl,Ml={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Gs=function(){var l=new Ks,c,f,h,m,_,w,D;Gs.prototype.init.call(this),c=this,this.push=function(R){R.type==="video"&&(f=R.trackId,h=R.pts,m=R.dts,l.push(R))},l.on("data",function(R){var O={trackId:f,pts:h,dts:m,data:R,nalUnitTypeCode:R[0]&31};switch(O.nalUnitTypeCode){case 5:O.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:O.nalUnitType="sei_rbsp",O.escapedRBSP=_(R.subarray(1));break;case 7:O.nalUnitType="seq_parameter_set_rbsp",O.escapedRBSP=_(R.subarray(1)),O.config=w(O.escapedRBSP);break;case 8:O.nalUnitType="pic_parameter_set_rbsp";break;case 9:O.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",O)}),l.on("done",function(){c.trigger("done")}),l.on("partialdone",function(){c.trigger("partialdone")}),l.on("reset",function(){c.trigger("reset")}),l.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},D=function(R,O){var q=8,Z=8,me,re;for(me=0;me<R;me++)Z!==0&&(re=O.readExpGolomb(),Z=(q+re+256)%256),q=Z===0?q:Z},_=function(R){for(var O=R.byteLength,q=[],Z=1,me,re;Z<O-2;)R[Z]===0&&R[Z+1]===0&&R[Z+2]===3?(q.push(Z+2),Z+=2):Z++;if(q.length===0)return R;me=O-q.length,re=new Uint8Array(me);var ve=0;for(Z=0;Z<me;ve++,Z++)ve===q[0]&&(ve++,q.shift()),re[Z]=R[ve];return re},w=function(R){var O=0,q=0,Z=0,me=0,re,ve,ke,mt,Ut,Ui,ns,as,os,ls,on,Ke=[1,1],us,oi;if(re=new Wp(R),ve=re.readUnsignedByte(),mt=re.readUnsignedByte(),ke=re.readUnsignedByte(),re.skipUnsignedExpGolomb(),Ml[ve]&&(Ut=re.readUnsignedExpGolomb(),Ut===3&&re.skipBits(1),re.skipUnsignedExpGolomb(),re.skipUnsignedExpGolomb(),re.skipBits(1),re.readBoolean()))for(on=Ut!==3?8:12,oi=0;oi<on;oi++)re.readBoolean()&&(oi<6?D(16,re):D(64,re));if(re.skipUnsignedExpGolomb(),Ui=re.readUnsignedExpGolomb(),Ui===0)re.readUnsignedExpGolomb();else if(Ui===1)for(re.skipBits(1),re.skipExpGolomb(),re.skipExpGolomb(),ns=re.readUnsignedExpGolomb(),oi=0;oi<ns;oi++)re.skipExpGolomb();if(re.skipUnsignedExpGolomb(),re.skipBits(1),as=re.readUnsignedExpGolomb(),os=re.readUnsignedExpGolomb(),ls=re.readBits(1),ls===0&&re.skipBits(1),re.skipBits(1),re.readBoolean()&&(O=re.readUnsignedExpGolomb(),q=re.readUnsignedExpGolomb(),Z=re.readUnsignedExpGolomb(),me=re.readUnsignedExpGolomb()),re.readBoolean()&&re.readBoolean()){switch(us=re.readUnsignedByte(),us){case 1:Ke=[1,1];break;case 2:Ke=[12,11];break;case 3:Ke=[10,11];break;case 4:Ke=[16,11];break;case 5:Ke=[40,33];break;case 6:Ke=[24,11];break;case 7:Ke=[20,11];break;case 8:Ke=[32,11];break;case 9:Ke=[80,33];break;case 10:Ke=[18,11];break;case 11:Ke=[15,11];break;case 12:Ke=[64,33];break;case 13:Ke=[160,99];break;case 14:Ke=[4,3];break;case 15:Ke=[3,2];break;case 16:Ke=[2,1];break;case 255:{Ke=[re.readUnsignedByte()<<8|re.readUnsignedByte(),re.readUnsignedByte()<<8|re.readUnsignedByte()];break}}Ke&&Ke[0]/Ke[1]}return{profileIdc:ve,levelIdc:ke,profileCompatibility:mt,width:(as+1)*16-O*2-q*2,height:(2-ls)*(os+1)*16-Z*2-me*2,sarRatio:Ke}}},Gs.prototype=new Bl;var Gp={H264Stream:Gs},Kp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Fl=function(l,c){var f=l[c+6]<<21|l[c+7]<<14|l[c+8]<<7|l[c+9],h=l[c+5],m=(h&16)>>4;return f=f>=0?f:0,m?f+20:f+10},Ul=function(l,c){return l.length-c<10||l[c]!==73||l[c+1]!==68||l[c+2]!==51?c:(c+=Fl(l,c),Ul(l,c))},Xp=function(l){var c=Ul(l,0);return l.length>=c+2&&(l[c]&255)===255&&(l[c+1]&240)===240&&(l[c+1]&22)===16},$l=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Yp=function(l,c,f){var h,m="";for(h=c;h<f;h++)m+="%"+("00"+l[h].toString(16)).slice(-2);return m},Qp=function(l,c,f){return unescape(Yp(l,c,f))},Jp=function(l,c){var f=(l[c+5]&224)>>5,h=l[c+4]<<3,m=l[c+3]&6144;return m|h|f},Zp=function(l,c){return l[c]===73&&l[c+1]===68&&l[c+2]===51?"timed-metadata":l[c]&!0&&(l[c+1]&240)===240?"audio":null},em=function(l){for(var c=0;c+5<l.length;){if(l[c]!==255||(l[c+1]&246)!==240){c++;continue}return Kp[(l[c+2]&60)>>>2]}return null},tm=function(l){var c,f,h,m;c=10,l[5]&64&&(c+=4,c+=$l(l.subarray(10,14)));do{if(f=$l(l.subarray(c+4,c+8)),f<1)return null;if(m=String.fromCharCode(l[c],l[c+1],l[c+2],l[c+3]),m==="PRIV"){h=l.subarray(c+10,c+f+10);for(var _=0;_<h.byteLength;_++)if(h[_]===0){var w=Qp(h,0,_);if(w==="com.apple.streaming.transportStreamTimestamp"){var D=h.subarray(_+1),R=(D[3]&1)<<30|D[4]<<22|D[5]<<14|D[6]<<6|D[7]>>>2;return R*=4,R+=D[7]&3,R}break}}c+=10,c+=f}while(c<l.byteLength);return null},va={isLikelyAacData:Xp,parseId3TagSize:Fl,parseAdtsSize:Jp,parseType:Zp,parseSampleRate:em,parseAacTimestamp:tm},im=t,jl=va,Xs;Xs=function(){var l=new Uint8Array,c=0;Xs.prototype.init.call(this),this.setTimestamp=function(f){c=f},this.push=function(f){var h=0,m=0,_,w,D,R;for(l.length?(R=l.length,l=new Uint8Array(f.byteLength+R),l.set(l.subarray(0,R)),l.set(f,R)):l=f;l.length-m>=3;){if(l[m]===73&&l[m+1]===68&&l[m+2]===51){if(l.length-m<10||(h=jl.parseId3TagSize(l,m),m+h>l.length))break;w={type:"timed-metadata",data:l.subarray(m,m+h)},this.trigger("data",w),m+=h;continue}else if((l[m]&255)===255&&(l[m+1]&240)===240){if(l.length-m<7||(h=jl.parseAdtsSize(l,m),m+h>l.length))break;D={type:"audio",data:l.subarray(m,m+h),pts:c,dts:c},this.trigger("data",D),m+=h;continue}m++}_=l.length-m,_>0?l=l.subarray(m):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},Xs.prototype=new im;var rm=Xs,sm=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],nm=sm,am=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],om=am,Ys=t,Zr=dt,es=Ht,Qs=Ue,ai=K,ki=jp,Js=y,ql=Hp,lm=Gp.H264Stream,um=rm,cm=va.isLikelyAacData,dm=y.ONE_SECOND_IN_TS,Vl=nm,Hl=om,Zs,ts,en,Ji,hm=function(l,c){c.stream=l,this.trigger("log",c)},zl=function(l,c){for(var f=Object.keys(c),h=0;h<f.length;h++){var m=f[h];m==="headOfPipeline"||!c[m].on||c[m].on("log",hm.bind(l,m))}},Wl=function(l,c){var f;if(l.length!==c.length)return!1;for(f=0;f<l.length;f++)if(l[f]!==c[f])return!1;return!0},Gl=function(l,c,f,h,m,_){var w=f-c,D=h-c,R=m-f;return{start:{dts:l,pts:l+w},end:{dts:l+D,pts:l+R},prependedContentDuration:_,baseMediaDecodeTime:l}};ts=function(l,c){var f=[],h,m=0,_=0,w=1/0;c=c||{},h=c.firstSequenceNumber||0,ts.prototype.init.call(this),this.push=function(D){ai.collectDtsInfo(l,D),l&&Vl.forEach(function(R){l[R]=D[R]}),f.push(D)},this.setEarliestDts=function(D){m=D},this.setVideoBaseMediaDecodeTime=function(D){w=D},this.setAudioAppendStart=function(D){_=D},this.flush=function(){var D,R,O,q,Z,me,re;if(f.length===0){this.trigger("done","AudioSegmentStream");return}D=Qs.trimAdtsFramesByEarliestDts(f,l,m),l.baseMediaDecodeTime=ai.calculateTrackBaseMediaDecodeTime(l,c.keepOriginalTimestamps),re=Qs.prefixWithSilence(l,D,_,w),l.samples=Qs.generateSampleTable(D),O=Zr.mdat(Qs.concatenateFrameData(D)),f=[],R=Zr.moof(h,[l]),q=new Uint8Array(R.byteLength+O.byteLength),h++,q.set(R),q.set(O,R.byteLength),ai.clearDtsInfo(l),Z=Math.ceil(dm*1024/l.samplerate),D.length&&(me=D.length*Z,this.trigger("segmentTimingInfo",Gl(Js.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),D[0].dts,D[0].pts,D[0].dts+me,D[0].pts+me,re||0)),this.trigger("timingInfo",{start:D[0].pts,end:D[0].pts+me})),this.trigger("data",{track:l,boxes:q}),this.trigger("done","AudioSegmentStream")},this.reset=function(){ai.clearDtsInfo(l),f=[],this.trigger("reset")}},ts.prototype=new Ys,Zs=function(l,c){var f,h=[],m=[],_,w;c=c||{},f=c.firstSequenceNumber||0,Zs.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(D){ai.collectDtsInfo(l,D),D.nalUnitType==="seq_parameter_set_rbsp"&&!_&&(_=D.config,l.sps=[D.data],Hl.forEach(function(R){l[R]=_[R]},this)),D.nalUnitType==="pic_parameter_set_rbsp"&&!w&&(w=D.data,l.pps=[D.data]),h.push(D)},this.flush=function(){for(var D,R,O,q,Z,me,re=0,ve,ke;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(D=es.groupNalsIntoFrames(h),O=es.groupFramesIntoGops(D),O[0][0].keyFrame||(R=this.getGopForFusion_(h[0],l),R?(re=R.duration,O.unshift(R),O.byteLength+=R.byteLength,O.nalCount+=R.nalCount,O.pts=R.pts,O.dts=R.dts,O.duration+=R.duration):O=es.extendFirstKeyFrame(O)),m.length){var mt;if(c.alignGopsAtEnd?mt=this.alignGopsAtEnd_(O):mt=this.alignGopsAtStart_(O),!mt){this.gopCache_.unshift({gop:O.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}ai.clearDtsInfo(l),O=mt}ai.collectDtsInfo(l,O),l.samples=es.generateSampleTable(O),Z=Zr.mdat(es.concatenateNalData(O)),l.baseMediaDecodeTime=ai.calculateTrackBaseMediaDecodeTime(l,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",O.map(function(Ut){return{pts:Ut.pts,dts:Ut.dts,byteLength:Ut.byteLength}})),ve=O[0],ke=O[O.length-1],this.trigger("segmentTimingInfo",Gl(l.baseMediaDecodeTime,ve.dts,ve.pts,ke.dts+ke.duration,ke.pts+ke.duration,re)),this.trigger("timingInfo",{start:O[0].pts,end:O[O.length-1].pts+O[O.length-1].duration}),this.gopCache_.unshift({gop:O.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),q=Zr.moof(f,[l]),me=new Uint8Array(q.byteLength+Z.byteLength),f++,me.set(q),me.set(Z,q.byteLength),this.trigger("data",{track:l,boxes:me}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,m.length=0,this.trigger("reset")},this.resetStream_=function(){ai.clearDtsInfo(l),_=void 0,w=void 0},this.getGopForFusion_=function(D){var R=45e3,O=1/0,q,Z,me,re,ve;for(ve=0;ve<this.gopCache_.length;ve++)re=this.gopCache_[ve],me=re.gop,!(!(l.pps&&Wl(l.pps[0],re.pps[0]))||!(l.sps&&Wl(l.sps[0],re.sps[0])))&&(me.dts<l.timelineStartInfo.dts||(q=D.dts-me.dts-me.duration,q>=-1e4&&q<=R&&(!Z||O>q)&&(Z=re,O=q)));return Z?Z.gop:null},this.alignGopsAtStart_=function(D){var R,O,q,Z,me,re,ve,ke;for(me=D.byteLength,re=D.nalCount,ve=D.duration,R=O=0;R<m.length&&O<D.length&&(q=m[R],Z=D[O],q.pts!==Z.pts);){if(Z.pts>q.pts){R++;continue}O++,me-=Z.byteLength,re-=Z.nalCount,ve-=Z.duration}return O===0?D:O===D.length?null:(ke=D.slice(O),ke.byteLength=me,ke.duration=ve,ke.nalCount=re,ke.pts=ke[0].pts,ke.dts=ke[0].dts,ke)},this.alignGopsAtEnd_=function(D){var R,O,q,Z,me,re;for(R=m.length-1,O=D.length-1,me=null,re=!1;R>=0&&O>=0;){if(q=m[R],Z=D[O],q.pts===Z.pts){re=!0;break}if(q.pts>Z.pts){R--;continue}R===m.length-1&&(me=O),O--}if(!re&&me===null)return null;var ve;if(re?ve=O:ve=me,ve===0)return D;var ke=D.slice(ve),mt=ke.reduce(function(Ut,Ui){return Ut.byteLength+=Ui.byteLength,Ut.duration+=Ui.duration,Ut.nalCount+=Ui.nalCount,Ut},{byteLength:0,duration:0,nalCount:0});return ke.byteLength=mt.byteLength,ke.duration=mt.duration,ke.nalCount=mt.nalCount,ke.pts=ke[0].pts,ke.dts=ke[0].dts,ke},this.alignGopsWith=function(D){m=D}},Zs.prototype=new Ys,Ji=function(l,c){this.numberOfTracks=0,this.metadataStream=c,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ji.prototype.init.call(this),this.push=function(f){if(f.content||f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},Ji.prototype=new Ys,Ji.prototype.flush=function(l){var c=0,f={captions:[],captionStreams:{},metadata:[],info:{}},h,m,_,w=0,D;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(w=this.videoTrack.timelineStartInfo.pts,Hl.forEach(function(R){f.info[R]=this.videoTrack[R]},this)):this.audioTrack&&(w=this.audioTrack.timelineStartInfo.pts,Vl.forEach(function(R){f.info[R]=this.audioTrack[R]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?f.type=this.pendingTracks[0].type:f.type="combined",this.emittedTracks+=this.pendingTracks.length,_=Zr.initSegment(this.pendingTracks),f.initSegment=new Uint8Array(_.byteLength),f.initSegment.set(_),f.data=new Uint8Array(this.pendingBytes),D=0;D<this.pendingBoxes.length;D++)f.data.set(this.pendingBoxes[D],c),c+=this.pendingBoxes[D].byteLength;for(D=0;D<this.pendingCaptions.length;D++)h=this.pendingCaptions[D],h.startTime=Js.metadataTsToSeconds(h.startPts,w,this.keepOriginalTimestamps),h.endTime=Js.metadataTsToSeconds(h.endPts,w,this.keepOriginalTimestamps),f.captionStreams[h.stream]=!0,f.captions.push(h);for(D=0;D<this.pendingMetadata.length;D++)m=this.pendingMetadata[D],m.cueTime=Js.metadataTsToSeconds(m.pts,w,this.keepOriginalTimestamps),f.metadata.push(m);for(f.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",f),D=0;D<f.captions.length;D++)h=f.captions[D],this.trigger("caption",h);for(D=0;D<f.metadata.length;D++)m=f.metadata[D],this.trigger("id3Frame",m)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ji.prototype.setRemux=function(l){this.remuxTracks=l},en=function(l){var c=this,f=!0,h,m;en.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="aac",_.metadataStream=new ki.MetadataStream,_.aacStream=new um,_.audioTimestampRolloverStream=new ki.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new ki.TimestampRolloverStream("timed-metadata"),_.adtsStream=new ql,_.coalesceStream=new Ji(l,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(w){_.aacStream.setTimestamp(w.timeStamp)}),_.aacStream.on("data",function(w){w.type!=="timed-metadata"&&w.type!=="audio"||_.audioSegmentStream||(m=m||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new ts(m,l),_.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream),c.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h}))}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),zl(this,_)},this.setupTsPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="ts",_.metadataStream=new ki.MetadataStream,_.packetStream=new ki.TransportPacketStream,_.parseStream=new ki.TransportParseStream,_.elementaryStream=new ki.ElementaryStream,_.timestampRolloverStream=new ki.TimestampRolloverStream,_.adtsStream=new ql,_.h264Stream=new lm,_.captionStream=new ki.CaptionStream(l),_.coalesceStream=new Ji(l,_.metadataStream),_.headOfPipeline=_.packetStream,_.packetStream.pipe(_.parseStream).pipe(_.elementaryStream).pipe(_.timestampRolloverStream),_.timestampRolloverStream.pipe(_.h264Stream),_.timestampRolloverStream.pipe(_.adtsStream),_.timestampRolloverStream.pipe(_.metadataStream).pipe(_.coalesceStream),_.h264Stream.pipe(_.captionStream).pipe(_.coalesceStream),_.elementaryStream.on("data",function(w){var D;if(w.type==="metadata"){for(D=w.tracks.length;D--;)!h&&w.tracks[D].type==="video"?(h=w.tracks[D],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!m&&w.tracks[D].type==="audio"&&(m=w.tracks[D],m.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new Zs(h,l),_.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),_.videoSegmentStream.on("timelineStartInfo",function(R){m&&!l.keepOriginalTimestamps&&(m.timelineStartInfo=R,_.audioSegmentStream.setEarliestDts(R.dts-c.baseMediaDecodeTime))}),_.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),_.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(R){m&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(R)}),_.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),m&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new ts(m,l),_.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),_.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h})}}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("id3Frame",function(w){w.dispatchType=_.metadataStream.dispatchType,c.trigger("id3Frame",w)}),_.coalesceStream.on("caption",this.trigger.bind(this,"caption")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),zl(this,_)},this.setBaseMediaDecodeTime=function(_){var w=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),m&&(m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,ai.clearDtsInfo(m),w.audioTimestampRolloverStream&&w.audioTimestampRolloverStream.discontinuity()),h&&(w.videoSegmentStream&&(w.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,ai.clearDtsInfo(h),w.captionStream.reset()),w.timestampRolloverStream&&w.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){m&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.setRemux=function(_){var w=this.transmuxPipeline_;l.remux=_,w&&w.coalesceStream&&w.coalesceStream.setRemux(_)},this.alignGopsWith=function(_){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.getLogTrigger_=function(_){var w=this;return function(D){D.stream=_,w.trigger("log",D)}},this.push=function(_){if(f){var w=cm(_);w&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!w&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){f=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},en.prototype=new Ys;var fm={Transmuxer:en},pm=function(l){return l>>>0},mm=function(l){return("00"+l.toString(16)).slice(-2)},tn={toUnsigned:pm,toHexString:mm},gm=function(l){var c="";return c+=String.fromCharCode(l[0]),c+=String.fromCharCode(l[1]),c+=String.fromCharCode(l[2]),c+=String.fromCharCode(l[3]),c},Kl=gm,ym=tn.toUnsigned,_m=Kl,Xl=function(l,c){var f=[],h,m,_,w,D;if(!c.length)return null;for(h=0;h<l.byteLength;)m=ym(l[h]<<24|l[h+1]<<16|l[h+2]<<8|l[h+3]),_=_m(l.subarray(h+4,h+8)),w=m>1?h+m:l.byteLength,_===c[0]&&(c.length===1?f.push(l.subarray(h+8,w)):(D=Xl(l.subarray(h+8,w),c.slice(1)),D.length&&(f=f.concat(D)))),h=w;return f},ba=Xl,Tm=tn.toUnsigned,vm=n.getUint64,bm=function(l){var c={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=vm(l.subarray(4)):c.baseMediaDecodeTime=Tm(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),c},xa=bm,xm=function(l){var c=new DataView(l.buffer,l.byteOffset,l.byteLength),f={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:c.getUint32(4)},h=f.flags[2]&1,m=f.flags[2]&2,_=f.flags[2]&8,w=f.flags[2]&16,D=f.flags[2]&32,R=f.flags[0]&65536,O=f.flags[0]&131072,q;return q=8,h&&(q+=4,f.baseDataOffset=c.getUint32(12),q+=4),m&&(f.sampleDescriptionIndex=c.getUint32(q),q+=4),_&&(f.defaultSampleDuration=c.getUint32(q),q+=4),w&&(f.defaultSampleSize=c.getUint32(q),q+=4),D&&(f.defaultSampleFlags=c.getUint32(q)),R&&(f.durationIsEmpty=!0),!h&&O&&(f.baseDataOffsetIsMoof=!0),f},Yl=xm,Sm=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},Em=Sm,Ql=Em,Cm=function(l){var c={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},f=new DataView(l.buffer,l.byteOffset,l.byteLength),h=c.flags[2]&1,m=c.flags[2]&4,_=c.flags[1]&1,w=c.flags[1]&2,D=c.flags[1]&4,R=c.flags[1]&8,O=f.getUint32(4),q=8,Z;for(h&&(c.dataOffset=f.getInt32(q),q+=4),m&&O&&(Z={flags:Ql(l.subarray(q,q+4))},q+=4,_&&(Z.duration=f.getUint32(q),q+=4),w&&(Z.size=f.getUint32(q),q+=4),R&&(c.version===1?Z.compositionTimeOffset=f.getInt32(q):Z.compositionTimeOffset=f.getUint32(q),q+=4),c.samples.push(Z),O--);O--;)Z={},_&&(Z.duration=f.getUint32(q),q+=4),w&&(Z.size=f.getUint32(q),q+=4),D&&(Z.flags=Ql(l.subarray(q,q+4)),q+=4),R&&(c.version===1?Z.compositionTimeOffset=f.getInt32(q):Z.compositionTimeOffset=f.getUint32(q),q+=4),c.samples.push(Z);return c},Jl=Cm,Zl={tfdt:xa,trun:Jl},eu={parseTfdt:Zl.tfdt,parseTrun:Zl.trun},Am=function(l){for(var c=0,f=String.fromCharCode(l[c]),h="";f!=="\0";)h+=f,c++,f=String.fromCharCode(l[c]);return h+=f,h},wm={uint8ToCString:Am},rn=wm.uint8ToCString,Dm=n.getUint64,Im=function(l){var c=4,f=l[0],h,m,_,w,D,R,O,q;if(f===0){h=rn(l.subarray(c)),c+=h.length,m=rn(l.subarray(c)),c+=m.length;var Z=new DataView(l.buffer);_=Z.getUint32(c),c+=4,D=Z.getUint32(c),c+=4,R=Z.getUint32(c),c+=4,O=Z.getUint32(c),c+=4}else if(f===1){var Z=new DataView(l.buffer);_=Z.getUint32(c),c+=4,w=Dm(l.subarray(c)),c+=8,R=Z.getUint32(c),c+=4,O=Z.getUint32(c),c+=4,h=rn(l.subarray(c)),c+=h.length,m=rn(l.subarray(c)),c+=m.length}q=new Uint8Array(l.subarray(c,l.byteLength));var me={scheme_id_uri:h,value:m,timescale:_||1,presentation_time:w,presentation_time_delta:D,event_duration:R,id:O,message_data:q};return Pm(f,me)?me:void 0},km=function(l,c,f,h){return l||l===0?l/c:h+f/c},Pm=function(l,c){var f=c.scheme_id_uri!=="\0",h=l===0&&tu(c.presentation_time_delta)&&f,m=l===1&&tu(c.presentation_time)&&f;return!(l>1)&&h||m},tu=function(l){return l!==void 0||l!==null},Rm={parseEmsgBox:Im,scaleTime:km},is;typeof window<"u"?is=window:typeof r<"u"?is=r:typeof self<"u"?is=self:is={};var iu=is,sn=tn.toUnsigned,rs=tn.toHexString,at=ba,fr=Kl,Sa=Rm,Lm=Yl,Nm=Jl,Om=xa,Bm=n.getUint64,ru,su,nu,au,ou,Ea,lu,Ca=iu,Mm=Rl.parseId3Frames;ru=function(l){var c={},f=at(l,["moov","trak"]);return f.reduce(function(h,m){var _,w,D,R,O;return _=at(m,["tkhd"])[0],!_||(w=_[0],D=w===0?12:20,R=sn(_[D]<<24|_[D+1]<<16|_[D+2]<<8|_[D+3]),O=at(m,["mdia","mdhd"])[0],!O)?null:(w=O[0],D=w===0?12:20,h[R]=sn(O[D]<<24|O[D+1]<<16|O[D+2]<<8|O[D+3]),h)},c)},su=function(l,c){var f;f=at(c,["moof","traf"]);var h=f.reduce(function(m,_){var w=at(_,["tfhd"])[0],D=sn(w[4]<<24|w[5]<<16|w[6]<<8|w[7]),R=l[D]||9e4,O=at(_,["tfdt"])[0],q=new DataView(O.buffer,O.byteOffset,O.byteLength),Z;O[0]===1?Z=Bm(O.subarray(4,12)):Z=q.getUint32(4);let me;return typeof Z=="bigint"?me=Z/Ca.BigInt(R):typeof Z=="number"&&!isNaN(Z)&&(me=Z/R),me<Number.MAX_SAFE_INTEGER&&(me=Number(me)),me<m&&(m=me),m},1/0);return typeof h=="bigint"||isFinite(h)?h:0},nu=function(l,c){var f=at(c,["moof","traf"]),h=0,m=0,_;if(f&&f.length){var w=at(f[0],["tfhd"])[0],D=at(f[0],["trun"])[0],R=at(f[0],["tfdt"])[0];if(w){var O=Lm(w);_=O.trackId}if(R){var q=Om(R);h=q.baseMediaDecodeTime}if(D){var Z=Nm(D);Z.samples&&Z.samples.length&&(m=Z.samples[0].compositionTimeOffset||0)}}var me=l[_]||9e4;typeof h=="bigint"&&(m=Ca.BigInt(m),me=Ca.BigInt(me));var re=(h+m)/me;return typeof re=="bigint"&&re<Number.MAX_SAFE_INTEGER&&(re=Number(re)),re},au=function(l){var c=at(l,["moov","trak"]),f=[];return c.forEach(function(h){var m=at(h,["mdia","hdlr"]),_=at(h,["tkhd"]);m.forEach(function(w,D){var R=fr(w.subarray(8,12)),O=_[D],q,Z,me;R==="vide"&&(q=new DataView(O.buffer,O.byteOffset,O.byteLength),Z=q.getUint8(0),me=Z===0?q.getUint32(12):q.getUint32(20),f.push(me))})}),f},Ea=function(l){var c=l[0],f=c===0?12:20;return sn(l[f]<<24|l[f+1]<<16|l[f+2]<<8|l[f+3])},ou=function(l){var c=at(l,["moov","trak"]),f=[];return c.forEach(function(h){var m={},_=at(h,["tkhd"])[0],w,D;_&&(w=new DataView(_.buffer,_.byteOffset,_.byteLength),D=w.getUint8(0),m.id=D===0?w.getUint32(12):w.getUint32(20));var R=at(h,["mdia","hdlr"])[0];if(R){var O=fr(R.subarray(8,12));O==="vide"?m.type="video":O==="soun"?m.type="audio":m.type=O}var q=at(h,["mdia","minf","stbl","stsd"])[0];if(q){var Z=q.subarray(8);m.codec=fr(Z.subarray(4,8));var me=at(Z,[m.codec])[0],re,ve;me&&(/^[asm]vc[1-9]$/i.test(m.codec)?(re=me.subarray(78),ve=fr(re.subarray(4,8)),ve==="avcC"&&re.length>11?(m.codec+=".",m.codec+=rs(re[9]),m.codec+=rs(re[10]),m.codec+=rs(re[11])):m.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(m.codec)?(re=me.subarray(28),ve=fr(re.subarray(4,8)),ve==="esds"&&re.length>20&&re[19]!==0?(m.codec+="."+rs(re[19]),m.codec+="."+rs(re[20]>>>2&63).replace(/^0/,"")):m.codec="mp4a.40.2"):m.codec=m.codec.toLowerCase())}var ke=at(h,["mdia","mdhd"])[0];ke&&(m.timescale=Ea(ke)),f.push(m)}),f},lu=function(l,c=0){var f=at(l,["emsg"]);return f.map(h=>{var m=Sa.parseEmsgBox(new Uint8Array(h)),_=Mm(m.message_data);return{cueTime:Sa.scaleTime(m.presentation_time,m.timescale,m.presentation_time_delta,c),duration:Sa.scaleTime(m.event_duration,m.timescale),frames:_}})};var ss={findBox:at,parseType:fr,timescale:ru,startTime:su,compositionStartTime:nu,videoTrackIds:au,tracks:ou,getTimescaleFromMediaHeader:Ea,getEmsgID3:lu};const{parseTrun:Fm}=eu,{findBox:uu}=ss;var cu=iu,Um=function(l){var c=uu(l,["moof","traf"]),f=uu(l,["mdat"]),h=[];return f.forEach(function(m,_){var w=c[_];h.push({mdat:m,traf:w})}),h},$m=function(l,c,f){var h=c,m=f.defaultSampleDuration||0,_=f.defaultSampleSize||0,w=f.trackId,D=[];return l.forEach(function(R){var O=Fm(R),q=O.samples;q.forEach(function(Z){Z.duration===void 0&&(Z.duration=m),Z.size===void 0&&(Z.size=_),Z.trackId=w,Z.dts=h,Z.compositionTimeOffset===void 0&&(Z.compositionTimeOffset=0),typeof h=="bigint"?(Z.pts=h+cu.BigInt(Z.compositionTimeOffset),h+=cu.BigInt(Z.duration)):(Z.pts=h+Z.compositionTimeOffset,h+=Z.duration)}),D=D.concat(q)}),D},du={getMdatTrafPairs:Um,parseSamples:$m},jm=zt.discardEmulationPreventionBytes,qm=Dl.CaptionStream,Aa=ba,Vm=xa,Hm=Yl,{getMdatTrafPairs:zm,parseSamples:Wm}=du,Gm=function(l,c){for(var f=l,h=0;h<c.length;h++){var m=c[h];if(f<m.size)return m;f-=m.size}return null},Km=function(l,c,f){var h=new DataView(l.buffer,l.byteOffset,l.byteLength),m={logs:[],seiNals:[]},_,w,D,R;for(w=0;w+4<l.length;w+=D)if(D=h.getUint32(w),w+=4,!(D<=0))switch(l[w]&31){case 6:var O=l.subarray(w+1,w+1+D),q=Gm(w,c);if(_={nalUnitType:"sei_rbsp",size:D,data:O,escapedRBSP:jm(O),trackId:f},q)_.pts=q.pts,_.dts=q.dts,R=q;else if(R)_.pts=R.pts,_.dts=R.dts;else{m.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+w+" for trackId "+f+". See mux.js#223."});break}m.seiNals.push(_);break}return m},Xm=function(l,c){var f={},h=zm(l);return h.forEach(function(m){var _=m.mdat,w=m.traf,D=Aa(w,["tfhd"]),R=Hm(D[0]),O=R.trackId,q=Aa(w,["tfdt"]),Z=q.length>0?Vm(q[0]).baseMediaDecodeTime:0,me=Aa(w,["trun"]),re,ve;c===O&&me.length>0&&(re=Wm(me,Z,R),ve=Km(_,re,O),f[O]||(f[O]={seiNals:[],logs:[]}),f[O].seiNals=f[O].seiNals.concat(ve.seiNals),f[O].logs=f[O].logs.concat(ve.logs))}),f},Ym=function(l,c,f){var h;if(c===null)return null;h=Xm(l,c);var m=h[c]||{};return{seiNals:m.seiNals,logs:m.logs,timescale:f}},Qm=function(){var l=!1,c,f,h,m,_,w;this.isInitialized=function(){return l},this.init=function(D){c=new qm,l=!0,w=D?D.isPartial:!1,c.on("data",function(R){R.startTime=R.startPts/m,R.endTime=R.endPts/m,_.captions.push(R),_.captionStreams[R.stream]=!0}),c.on("log",function(R){_.logs.push(R)})},this.isNewInit=function(D,R){return D&&D.length===0||R&&typeof R=="object"&&Object.keys(R).length===0?!1:h!==D[0]||m!==R[h]},this.parse=function(D,R,O){var q;if(this.isInitialized()){if(!R||!O)return null;if(this.isNewInit(R,O))h=R[0],m=O[h];else if(h===null||!m)return f.push(D),null}else return null;for(;f.length>0;){var Z=f.shift();this.parse(Z,R,O)}return q=Ym(D,h,m),q&&q.logs&&(_.logs=_.logs.concat(q.logs)),q===null||!q.seiNals?_.logs.length?{logs:_.logs,captions:[],captionStreams:[]}:null:(this.pushNals(q.seiNals),this.flushStream(),_)},this.pushNals=function(D){if(!this.isInitialized()||!D||D.length===0)return null;D.forEach(function(R){c.push(R)})},this.flushStream=function(){if(!this.isInitialized())return null;w?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){_.captions=[],_.captionStreams={},_.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){f=[],h=null,m=null,_?this.clearParsedCaptions():_={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Jm=Qm;const{parseTfdt:Zm}=eu,Fi=ba,{getTimescaleFromMediaHeader:eg}=ss,{parseSamples:tg,getMdatTrafPairs:ig}=du;var hu=function(){let l=9e4;this.init=function(c){const f=Fi(c,["moov","trak","mdia","mdhd"])[0];f&&(l=eg(f))},this.parseSegment=function(c){const f=[],h=ig(c);let m=0;return h.forEach(function(_){const w=_.mdat,D=_.traf,R=Fi(D,["tfdt"])[0],O=Fi(D,["tfhd"])[0],q=Fi(D,["trun"]);if(R&&(m=Zm(R).baseMediaDecodeTime),q.length&&O){const Z=tg(q,m,O);let me=0;Z.forEach(function(re){const ve="utf-8",ke=new TextDecoder(ve),mt=w.slice(me,me+re.size);if(Fi(mt,["vtte"])[0]){me+=re.size;return}Fi(mt,["vttc"]).forEach(function(ns){const as=Fi(ns,["payl"])[0],os=Fi(ns,["sttg"])[0],ls=re.pts/l,on=(re.pts+re.duration)/l;let Ke,us;if(as)try{Ke=ke.decode(as)}catch(oi){console.error(oi)}if(os)try{us=ke.decode(os)}catch(oi){console.error(oi)}re.duration&&Ke&&f.push({cueText:Ke,start:ls,end:on,settings:us})}),me+=re.size})}}),f}},wa=$s,fu=function(l){var c=l[1]&31;return c<<=8,c|=l[2],c},nn=function(l){return!!(l[1]&64)},an=function(l){var c=0;return(l[3]&48)>>>4>1&&(c+=l[4]+1),c},rg=function(l,c){var f=fu(l);return f===0?"pat":f===c?"pmt":c?"pes":null},sg=function(l){var c=nn(l),f=4+an(l);return c&&(f+=l[f]+1),(l[f+10]&31)<<8|l[f+11]},ng=function(l){var c={},f=nn(l),h=4+an(l);if(f&&(h+=l[h]+1),!!(l[h+5]&1)){var m,_,w;m=(l[h+1]&15)<<8|l[h+2],_=3+m-4,w=(l[h+10]&15)<<8|l[h+11];for(var D=12+w;D<_;){var R=h+D;c[(l[R+1]&31)<<8|l[R+2]]=l[R],D+=((l[R+3]&15)<<8|l[R+4])+5}return c}},ag=function(l,c){var f=fu(l),h=c[f];switch(h){case wa.H264_STREAM_TYPE:return"video";case wa.ADTS_STREAM_TYPE:return"audio";case wa.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},og=function(l){var c=nn(l);if(!c)return null;var f=4+an(l);if(f>=l.byteLength)return null;var h=null,m;return m=l[f+7],m&192&&(h={},h.pts=(l[f+9]&14)<<27|(l[f+10]&255)<<20|(l[f+11]&254)<<12|(l[f+12]&255)<<5|(l[f+13]&254)>>>3,h.pts*=4,h.pts+=(l[f+13]&6)>>>1,h.dts=h.pts,m&64&&(h.dts=(l[f+14]&14)<<27|(l[f+15]&255)<<20|(l[f+16]&254)<<12|(l[f+17]&255)<<5|(l[f+18]&254)>>>3,h.dts*=4,h.dts+=(l[f+18]&6)>>>1)),h},Da=function(l){switch(l){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},lg=function(l){for(var c=4+an(l),f=l.subarray(c),h=0,m=0,_=!1,w;m<f.byteLength-3;m++)if(f[m+2]===1){h=m+5;break}for(;h<f.byteLength;)switch(f[h]){case 0:if(f[h-1]!==0){h+=2;break}else if(f[h-2]!==0){h++;break}m+3!==h-2&&(w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0));do h++;while(f[h]!==1&&h<f.length);m=h-2,h+=3;break;case 1:if(f[h-1]!==0||f[h-2]!==0){h+=3;break}w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0),m=h-2,h+=3;break;default:h+=3;break}return f=f.subarray(m),h-=m,m=0,f&&f.byteLength>3&&(w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0)),_},ug={parseType:rg,parsePat:sg,parsePmt:ng,parsePayloadUnitStartIndicator:nn,parsePesType:ag,parsePesTime:og,videoPacketContainsKeyFrame:lg},pu=$s,pr=kl.handleRollover,Me={};Me.ts=ug,Me.aac=va;var Zi=y.ONE_SECOND_IN_TS,wt=188,mi=71,cg=function(l,c){for(var f=0,h=wt,m,_;h<l.byteLength;){if(l[f]===mi&&l[h]===mi){switch(m=l.subarray(f,h),_=Me.ts.parseType(m,c.pid),_){case"pat":c.pid=Me.ts.parsePat(m);break;case"pmt":var w=Me.ts.parsePmt(m);c.table=c.table||{},Object.keys(w).forEach(function(D){c.table[D]=w[D]});break}f+=wt,h+=wt;continue}f++,h++}},mu=function(l,c,f){for(var h=0,m=wt,_,w,D,R,O,q=!1;m<=l.byteLength;){if(l[h]===mi&&(l[m]===mi||m===l.byteLength)){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="audio"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="audio",f.audio.push(O),q=!0))),q)break;h+=wt,m+=wt;continue}h++,m++}for(m=l.byteLength,h=m-wt,q=!1;h>=0;){if(l[h]===mi&&(l[m]===mi||m===l.byteLength)){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="audio"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="audio",f.audio.push(O),q=!0))),q)break;h-=wt,m-=wt;continue}h--,m--}},dg=function(l,c,f){for(var h=0,m=wt,_,w,D,R,O,q,Z,me,re=!1,ve={data:[],size:0};m<l.byteLength;){if(l[h]===mi&&l[m]===mi){switch(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w){case"pes":if(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="video"&&(R&&!re&&(O=Me.ts.parsePesTime(_),O&&(O.type="video",f.video.push(O),re=!0)),!f.firstKeyFrame)){if(R&&ve.size!==0){for(q=new Uint8Array(ve.size),Z=0;ve.data.length;)me=ve.data.shift(),q.set(me,Z),Z+=me.byteLength;if(Me.ts.videoPacketContainsKeyFrame(q)){var ke=Me.ts.parsePesTime(q);ke?(f.firstKeyFrame=ke,f.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}ve.size=0}ve.data.push(_),ve.size+=_.byteLength}break}if(re&&f.firstKeyFrame)break;h+=wt,m+=wt;continue}h++,m++}for(m=l.byteLength,h=m-wt,re=!1;h>=0;){if(l[h]===mi&&l[m]===mi){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="video"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="video",f.video.push(O),re=!0))),re)break;h-=wt,m-=wt;continue}h--,m--}},hg=function(l,c){if(l.audio&&l.audio.length){var f=c;(typeof f>"u"||isNaN(f))&&(f=l.audio[0].dts),l.audio.forEach(function(_){_.dts=pr(_.dts,f),_.pts=pr(_.pts,f),_.dtsTime=_.dts/Zi,_.ptsTime=_.pts/Zi})}if(l.video&&l.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=l.video[0].dts),l.video.forEach(function(_){_.dts=pr(_.dts,h),_.pts=pr(_.pts,h),_.dtsTime=_.dts/Zi,_.ptsTime=_.pts/Zi}),l.firstKeyFrame){var m=l.firstKeyFrame;m.dts=pr(m.dts,h),m.pts=pr(m.pts,h),m.dtsTime=m.dts/Zi,m.ptsTime=m.pts/Zi}}},fg=function(l){for(var c=!1,f=0,h=null,m=null,_=0,w=0,D;l.length-w>=3;){var R=Me.aac.parseType(l,w);switch(R){case"timed-metadata":if(l.length-w<10){c=!0;break}if(_=Me.aac.parseId3TagSize(l,w),_>l.length){c=!0;break}m===null&&(D=l.subarray(w,w+_),m=Me.aac.parseAacTimestamp(D)),w+=_;break;case"audio":if(l.length-w<7){c=!0;break}if(_=Me.aac.parseAdtsSize(l,w),_>l.length){c=!0;break}h===null&&(D=l.subarray(w,w+_),h=Me.aac.parseSampleRate(D)),f++,w+=_;break;default:w++;break}if(c)return null}if(h===null||m===null)return null;var O=Zi/h,q={audio:[{type:"audio",dts:m,pts:m},{type:"audio",dts:m+f*1024*O,pts:m+f*1024*O}]};return q},pg=function(l){var c={pid:null,table:null},f={};cg(l,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var m=c.table[h];switch(m){case pu.H264_STREAM_TYPE:f.video=[],dg(l,c,f),f.video.length===0&&delete f.video;break;case pu.ADTS_STREAM_TYPE:f.audio=[],mu(l,c,f),f.audio.length===0&&delete f.audio;break}}return f},mg=function(l,c){var f=Me.aac.isLikelyAacData(l),h;return f?h=fg(l):h=pg(l),!h||!h.audio&&!h.video?null:(hg(h,c),h)},gg={inspect:mg,parseAudioPes_:mu};const yg=function(l,c){c.on("data",function(f){const h=f.initSegment;f.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const m=f.data;f.data=m.buffer,l.postMessage({action:"data",segment:f,byteOffset:m.byteOffset,byteLength:m.byteLength},[f.data])}),c.on("done",function(f){l.postMessage({action:"done"})}),c.on("gopInfo",function(f){l.postMessage({action:"gopInfo",gopInfo:f})}),c.on("videoSegmentTimingInfo",function(f){const h={start:{decode:y.videoTsToSeconds(f.start.dts),presentation:y.videoTsToSeconds(f.start.pts)},end:{decode:y.videoTsToSeconds(f.end.dts),presentation:y.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(f){const h={start:{decode:y.videoTsToSeconds(f.start.dts),presentation:y.videoTsToSeconds(f.start.pts)},end:{decode:y.videoTsToSeconds(f.end.dts),presentation:y.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(f){l.postMessage({action:"id3Frame",id3Frame:f})}),c.on("caption",function(f){l.postMessage({action:"caption",caption:f})}),c.on("trackinfo",function(f){l.postMessage({action:"trackinfo",trackInfo:f})}),c.on("audioTimingInfo",function(f){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:y.videoTsToSeconds(f.start),end:y.videoTsToSeconds(f.end)}})}),c.on("videoTimingInfo",function(f){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:y.videoTsToSeconds(f.start),end:y.videoTsToSeconds(f.end)}})}),c.on("log",function(f){l.postMessage({action:"log",log:f})})};class gu{constructor(c,f){this.options=f||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new fm.Transmuxer(this.options),yg(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new Jm,this.captionParser.init());const f=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(f,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:f.buffer},[f.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new hu);const f=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(f)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new hu);const f=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(f);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:f.buffer},[f.buffer])}probeMp4StartTime({timescales:c,data:f}){const h=ss.startTime(c,f);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:f},[f.buffer])}probeMp4Tracks({data:c}){const f=ss.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:f,data:c},[c.buffer])}probeEmsgID3({data:c,offset:f}){const h=ss.getEmsgID3(c,f);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:f}){const h=typeof f=="number"&&!isNaN(f)?f*y.ONE_SECOND_IN_TS:void 0,m=gg.inspect(c,h);let _=null;m&&(_={hasVideo:m.video&&m.video.length===2||!1,hasAudio:m.audio&&m.audio.length===2||!1},_.hasVideo&&(_.videoStart=m.video[0].ptsTime),_.hasAudio&&(_.audioStart=m.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:_,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const f=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(f)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const f=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(y.secondsToVideoTs(f)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(y.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new gu(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new gu(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var jb=Qf($b);const qb=(r,e,t)=>{const{type:i,initSegment:s,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:u,videoFramePtsTime:d}=r.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:o});const p=r.data.segment.boxes||{data:r.data.segment.data},T={type:i,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};typeof u<"u"&&(T.videoFrameDtsTime=u),typeof d<"u"&&(T.videoFramePtsTime=d),t(T)},Vb=({transmuxedData:r,callback:e})=>{r.buffer=[],e(r)},Hb=(r,e)=>{e.gopInfo=r.data.gopInfo},ep=r=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:s,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:u,onVideoTimingInfo:d,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:T,onId3:A,onCaptions:b,onDone:k,onEndedTimeline:v,onTransmuxerLog:L,isEndOfTimeline:U,segment:$,triggerSegmentEventFn:F}=r,H={buffer:[]};let B=U;const V=ie=>{e.currentTransmux===r&&(ie.data.action==="data"&&qb(ie,H,a),ie.data.action==="trackinfo"&&o(ie.data.trackInfo),ie.data.action==="gopInfo"&&Hb(ie,H),ie.data.action==="audioTimingInfo"&&u(ie.data.audioTimingInfo),ie.data.action==="videoTimingInfo"&&d(ie.data.videoTimingInfo),ie.data.action==="videoSegmentTimingInfo"&&p(ie.data.videoSegmentTimingInfo),ie.data.action==="audioSegmentTimingInfo"&&T(ie.data.audioSegmentTimingInfo),ie.data.action==="id3Frame"&&A([ie.data.id3Frame],ie.data.id3Frame.dispatchType),ie.data.action==="caption"&&b(ie.data.caption),ie.data.action==="endedtimeline"&&(B=!1,v()),ie.data.action==="log"&&L(ie.data.log),ie.data.type==="transmuxed"&&(B||(e.onmessage=null,Vb({transmuxedData:H,callback:k}),tp(e))))},G=()=>{const ie={message:"Received an error message from the transmuxer worker",metadata:{errorType:z.Error.StreamingFailedToTransmuxSegment,segmentInfo:rr({segment:$})}};k(null,ie)};if(e.onmessage=V,e.onerror=G,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(s)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const ie=t instanceof ArrayBuffer?t:t.buffer,C=t instanceof ArrayBuffer?0:t.byteOffset;F({type:"segmenttransmuxingstart",segment:$}),e.postMessage({action:"push",data:ie,byteOffset:C,byteLength:t.byteLength},[ie])}U&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},tp=r=>{r.currentTransmux=null,r.transmuxQueue.length&&(r.currentTransmux=r.transmuxQueue.shift(),typeof r.currentTransmux=="function"?r.currentTransmux():ep(r.currentTransmux))},Qc=(r,e)=>{r.postMessage({action:e}),tp(r)},ip=(r,e)=>{if(!e.currentTransmux){e.currentTransmux=r,Qc(e,r);return}e.transmuxQueue.push(Qc.bind(null,e,r))},zb=r=>{ip("reset",r)},Wb=r=>{ip("endTimeline",r)},rp=r=>{if(!r.transmuxer.currentTransmux){r.transmuxer.currentTransmux=r,ep(r);return}r.transmuxer.transmuxQueue.push(r)},Gb=r=>{const e=new jb;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:r}),e};var lo={reset:zb,endTimeline:Wb,transmux:rp,createTransmuxer:Gb};const Dr=function(r){const e=r.transmuxer,t=r.endAction||r.action,i=r.callback,s=ot({},r,{endAction:null,transmuxer:null,callback:null}),n=a=>{a.data.action===t&&(e.removeEventListener("message",n),a.data.data&&(a.data.data=new Uint8Array(a.data.data,r.byteOffset||0,r.byteLength||a.data.data.byteLength),r.data&&(r.data=a.data.data)),i(a.data))};if(e.addEventListener("message",n),r.data){const a=r.data instanceof ArrayBuffer;s.byteOffset=a?0:r.data.byteOffset,s.byteLength=r.data.byteLength;const o=[a?r.data:r.data.buffer];e.postMessage(s,o)}else e.postMessage(s)},Ci={FAILURE:2,TIMEOUT:-101,ABORTED:-102},sp="wvtt",No=r=>{r.forEach(e=>{e.abort()})},Kb=r=>({bandwidth:r.bandwidth,bytesReceived:r.bytesReceived||0,roundTripTime:r.roundTripTime||0}),Xb=r=>{const e=r.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=r.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},Cl=(r,e)=>{const{requestType:t}=e,i=cr({requestType:t,request:e,error:r});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Ci.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Ci.ABORTED,xhr:e,metadata:i}:r?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Ci.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Ci.FAILURE,xhr:e,metadata:i}:null},Jc=(r,e,t,i)=>(s,n)=>{const a=n.response,o=Cl(s,n);if(o)return t(o,r);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Ci.FAILURE,xhr:n},r);const u=new DataView(a),d=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]);for(let T=0;T<e.length;T++)e[T].bytes=d;const p={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:r,keyInfo:p}),t(null,r)},Yb=(r,e)=>{e===sp&&r.transmuxer.postMessage({action:"initMp4WebVttParser",data:r.map.bytes})},Qb=(r,e,t)=>{e===sp&&Dr({action:"getMp4WebVttText",data:r.bytes,transmuxer:r.transmuxer,callback:({data:i,mp4VttCues:s})=>{r.bytes=i,t(null,r,{mp4VttCues:s})}})},np=(r,e)=>{const t=Xo(r.map.bytes);if(t!=="mp4"){const i=r.map.resolvedUri||r.map.uri,s=t||"unknown";return e({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${i}`,code:Ci.FAILURE,metadata:{mediaType:s}})}Dr({action:"probeMp4Tracks",data:r.map.bytes,transmuxer:r.transmuxer,callback:({tracks:i,data:s})=>(r.map.bytes=s,i.forEach(function(n){r.map.tracks=r.map.tracks||{},!r.map.tracks[n.type]&&(r.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(r.map.timescales=r.map.timescales||{},r.map.timescales[n.id]=n.timescale),n.type==="text"&&Yb(r,n.codec))}),e(null))})},Jb=({segment:r,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,s)=>{const n=Cl(i,s);if(n)return e(n,r);const a=new Uint8Array(s.response);if(t({type:"segmentloaded",segment:r}),r.map.key)return r.map.encryptedBytes=a,e(null,r);r.map.bytes=a,np(r,function(o){if(o)return o.xhr=s,o.status=s.status,e(o,r);e(null,r)})},Zb=({segment:r,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(s,n)=>{const a=Cl(s,n);if(a)return e(a,r);i({type:"segmentloaded",segment:r});const o=t==="arraybuffer"||!n.responseText?n.response:Fb(n.responseText.substring(r.lastReachedChar||0));return r.stats=Kb(n),r.key?r.encryptedBytes=new Uint8Array(o):r.bytes=new Uint8Array(o),e(null,r)},e2=({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{const k=r.map&&r.map.tracks||{},v=!!(k.audio&&k.video);let L=i.bind(null,r,"audio","start");const U=i.bind(null,r,"audio","end");let $=i.bind(null,r,"video","start");const F=i.bind(null,r,"video","end"),H=()=>rp({bytes:e,transmuxer:r.transmuxer,audioAppendStart:r.audioAppendStart,gopsToAlignWith:r.gopsToAlignWith,remux:v,onData:B=>{B.type=B.type==="combined"?"video":B.type,p(r,B)},onTrackInfo:B=>{t&&(v&&(B.isMuxed=!0),t(r,B))},onAudioTimingInfo:B=>{L&&typeof B.start<"u"&&(L(B.start),L=null),U&&typeof B.end<"u"&&U(B.end)},onVideoTimingInfo:B=>{$&&typeof B.start<"u"&&($(B.start),$=null),F&&typeof B.end<"u"&&F(B.end)},onVideoSegmentTimingInfo:B=>{const V={pts:{start:B.start.presentation,end:B.end.presentation},dts:{start:B.start.decode,end:B.end.decode}};b({type:"segmenttransmuxingtiminginfoavailable",segment:r,timingInfo:V}),s(B)},onAudioSegmentTimingInfo:B=>{const V={pts:{start:B.start.pts,end:B.end.pts},dts:{start:B.start.dts,end:B.end.dts}};b({type:"segmenttransmuxingtiminginfoavailable",segment:r,timingInfo:V}),n(B)},onId3:(B,V)=>{a(r,B,V)},onCaptions:B=>{o(r,[B])},isEndOfTimeline:u,onEndedTimeline:()=>{d()},onTransmuxerLog:A,onDone:(B,V)=>{T&&(B.type=B.type==="combined"?"video":B.type,b({type:"segmenttransmuxingcomplete",segment:r}),T(V,r,B))},segment:r,triggerSegmentEventFn:b});Dr({action:"probeTs",transmuxer:r.transmuxer,data:e,baseStartTime:r.baseStartTime,callback:B=>{r.bytes=e=B.data;const V=B.result;V&&(t(r,{hasAudio:V.hasAudio,hasVideo:V.hasVideo,isMuxed:v}),t=null),H()}})},ap=({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{let k=new Uint8Array(e);if(bT(k)){r.isFmp4=!0;const{tracks:v}=r.map;if(v.text&&(!v.audio||!v.video)){p(r,{data:k,type:"text"}),Qb(r,v.text.codec,T);return}const U={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(U.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(U.videoCodec=v.video.codec),v.video&&v.audio&&(U.isMuxed=!0),t(r,U);const $=(F,H)=>{p(r,{data:k,type:U.hasAudio&&!U.isMuxed?"audio":"video"}),H&&H.length&&a(r,H),F&&F.length&&o(r,F),T(null,r,{})};Dr({action:"probeMp4StartTime",timescales:r.map.timescales,data:k,transmuxer:r.transmuxer,callback:({data:F,startTime:H})=>{e=F.buffer,r.bytes=k=F,U.hasAudio&&!U.isMuxed&&i(r,"audio","start",H),U.hasVideo&&i(r,"video","start",H),Dr({action:"probeEmsgID3",data:k,transmuxer:r.transmuxer,offset:H,callback:({emsgData:B,id3Frames:V})=>{if(e=B.buffer,r.bytes=k=B,!v.video||!B.byteLength||!r.transmuxer){$(void 0,V);return}Dr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:r.transmuxer,data:k,timescales:r.map.timescales,trackIds:[v.video.id],callback:G=>{e=G.data.buffer,r.bytes=k=G.data,G.logs.forEach(function(ie){A(Oe(ie,{stream:"mp4CaptionParser"}))}),$(G.captions,V)}})}})}});return}if(!r.transmuxer){T(null,r,{});return}if(typeof r.container>"u"&&(r.container=Xo(k)),r.container!=="ts"&&r.container!=="aac"){t(r,{hasAudio:!1,hasVideo:!1}),T(null,r,{});return}e2({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})},op=function({id:r,key:e,encryptedBytes:t,decryptionWorker:i,segment:s,doneFn:n},a){const o=d=>{if(d.data.source===r){i.removeEventListener("message",o);const p=d.data.decrypted;a(new Uint8Array(p.bytes,p.byteOffset,p.byteLength))}};i.onerror=()=>{const d="An error occurred in the decryption worker",p=rr({segment:s}),T={message:d,metadata:{error:new Error(d),errorType:z.Error.StreamingFailedToDecryptSegment,segmentInfo:p,keyInfo:{uri:s.key.resolvedUri||s.map.key.resolvedUri}}};n(T,s)},i.addEventListener("message",o);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(zf({source:r,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},t2=({decryptionWorker:r,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{b({type:"segmentdecryptionstart"}),op({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:r,segment:e,doneFn:T},k=>{e.bytes=k,b({type:"segmentdecryptioncomplete",segment:e}),ap({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})})},i2=({activeXhrs:r,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{let k=0,v=!1;return(L,U)=>{if(!v){if(L)return v=!0,No(r),T(L,U);if(k+=1,k===r.length){const $=function(){if(U.encryptedBytes)return t2({decryptionWorker:e,segment:U,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b});ap({segment:U,bytes:U.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})};if(U.endOfAllRequests=Date.now(),U.map&&U.map.encryptedBytes&&!U.map.bytes)return b({type:"segmentdecryptionstart",segment:U}),op({decryptionWorker:e,id:U.requestId+"-init",encryptedBytes:U.map.encryptedBytes,key:U.map.key,segment:U,doneFn:T},F=>{U.map.bytes=F,b({type:"segmentdecryptioncomplete",segment:U}),np(U,H=>{if(H)return No(r),T(H,U);$()})});$()}}}},r2=({loadendState:r,abortFn:e})=>t=>{t.target.aborted&&e&&!r.calledAbortFn&&(e(),r.calledAbortFn=!0)},s2=({segment:r,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p})=>T=>{if(!T.target.aborted)return r.stats=Oe(r.stats,Xb(T)),!r.stats.firstBytesReceivedAt&&r.stats.bytesReceived&&(r.stats.firstBytesReceivedAt=Date.now()),e(T,r)},n2=({xhr:r,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:U})=>{const $=[],F=i2({activeXhrs:$,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:U});if(i.key&&!i.key.bytes){const ie=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&ie.push(i.map.key);const C=Oe(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),I=Jc(i,ie,F,U),W={uri:i.key.resolvedUri};U({type:"segmentkeyloadstart",segment:i,keyInfo:W});const Y=r(C,I);$.push(Y)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const Y=Oe(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),X=Jc(i,[i.map.key],F,U),ne={uri:i.map.key.resolvedUri};U({type:"segmentkeyloadstart",segment:i,keyInfo:ne});const de=r(Y,X);$.push(de)}const C=Oe(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Ro(i.map),requestType:"segment-media-initialization"}),I=Jb({segment:i,finishProcessingFn:F,triggerSegmentEventFn:U});U({type:"segmentloadstart",segment:i});const W=r(C,I);$.push(W)}const H=Oe(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Ro(i),requestType:"segment"}),B=Zb({segment:i,finishProcessingFn:F,responseType:H.responseType,triggerSegmentEventFn:U});U({type:"segmentloadstart",segment:i});const V=r(H,B);V.addEventListener("progress",s2({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k})),$.push(V);const G={};return $.forEach(ie=>{ie.addEventListener("loadend",r2({loadendState:G,abortFn:s}))}),()=>No($)},a2=Zt("CodecUtils"),o2=function(r){const e=r.attributes||{};if(e.CODECS)return Ti(e.CODECS)},lp=(r,e)=>{const t=e.attributes||{};return r&&r.mediaGroups&&r.mediaGroups.AUDIO&&t.AUDIO&&r.mediaGroups.AUDIO[t.AUDIO]},l2=(r,e)=>{if(!lp(r,e))return!0;const t=e.attributes||{},i=r.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1},Un=function(r){const e={};return r.forEach(({mediaType:t,type:i,details:s})=>{e[t]=e[t]||[],e[t].push(Wd(`${i}${s}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){a2(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Zc=function(r){let e=0;return r.audio&&e++,r.video&&e++,e},Cs=function(r,e){const t=e.attributes||{},i=Un(o2(e)||[]);if(lp(r,e)&&!i.audio&&!l2(r,e)){const s=Un(Wy(r,t.AUDIO)||[]);s.audio&&(i.audio=s.audio)}return i},pn=Zt("PlaylistSelector"),ed=function(r){if(!r||!r.playlist)return;const e=r.playlist;return JSON.stringify({id:e.id,bandwidth:r.bandwidth,width:r.width,height:r.height,codecs:e.attributes&&e.attributes.CODECS||""})},$n=function(r,e){if(!r)return"";const t=N.getComputedStyle(r);return t?t[e]:""},Ir=function(r,e){const t=r.slice();r.sort(function(i,s){const n=e(i,s);return n===0?t.indexOf(i)-t.indexOf(s):n})},Al=function(r,e){let t,i;return r.attributes.BANDWIDTH&&(t=r.attributes.BANDWIDTH),t=t||N.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||N.Number.MAX_VALUE,t-i},u2=function(r,e){let t,i;return r.attributes.RESOLUTION&&r.attributes.RESOLUTION.width&&(t=r.attributes.RESOLUTION.width),t=t||N.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||N.Number.MAX_VALUE,t===i&&r.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?r.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let up=function(r,e,t,i,s,n){if(!r)return;const a={bandwidth:e,width:t,height:i,limitRenditionByPlayerDimensions:s};let o=r.playlists;Bt.isAudioOnly(r)&&(o=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let u=o.map(B=>{let V;const G=B.attributes&&B.attributes.RESOLUTION&&B.attributes.RESOLUTION.width,ie=B.attributes&&B.attributes.RESOLUTION&&B.attributes.RESOLUTION.height;return V=B.attributes&&B.attributes.BANDWIDTH,V=V||N.Number.MAX_VALUE,{bandwidth:V,width:G,height:ie,playlist:B}});Ir(u,(B,V)=>B.bandwidth-V.bandwidth),u=u.filter(B=>!Bt.isIncompatible(B.playlist));let d=u.filter(B=>Bt.isEnabled(B.playlist));d.length||(d=u.filter(B=>!Bt.isDisabled(B.playlist)));const p=d.filter(B=>B.bandwidth*gt.BANDWIDTH_VARIANCE<e);let T=p[p.length-1];const A=p.filter(B=>B.bandwidth===T.bandwidth)[0];if(s===!1){const B=A||d[0]||u[0];if(B&&B.playlist){let V="sortedPlaylistReps";return A&&(V="bandwidthBestRep"),d[0]&&(V="enabledPlaylistReps"),pn(`choosing ${ed(B)} using ${V} with options`,a),B.playlist}return pn("could not choose a playlist with options",a),null}const b=p.filter(B=>B.width&&B.height);Ir(b,(B,V)=>B.width-V.width);const k=b.filter(B=>B.width===t&&B.height===i);T=k[k.length-1];const v=k.filter(B=>B.bandwidth===T.bandwidth)[0];let L,U,$;v||(L=b.filter(B=>B.width>t||B.height>i),U=L.filter(B=>B.width===L[0].width&&B.height===L[0].height),T=U[U.length-1],$=U.filter(B=>B.bandwidth===T.bandwidth)[0]);let F;if(n.leastPixelDiffSelector){const B=b.map(V=>(V.pixelDiff=Math.abs(V.width-t)+Math.abs(V.height-i),V));Ir(B,(V,G)=>V.pixelDiff===G.pixelDiff?G.bandwidth-V.bandwidth:V.pixelDiff-G.pixelDiff),F=B[0]}const H=F||$||v||A||d[0]||u[0];if(H&&H.playlist){let B="sortedPlaylistReps";return F?B="leastPixelDiffRep":$?B="resolutionPlusOneRep":v?B="resolutionBestRep":A?B="bandwidthBestRep":d[0]&&(B="enabledPlaylistReps"),pn(`choosing ${ed(H)} using ${B} with options`,a),H.playlist}return pn("could not choose a playlist with options",a),null};const td=function(){let r=this.useDevicePixelRatio&&N.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),up(this.playlists.main,this.systemBandwidth,parseInt($n(this.tech_.el(),"width"),10)*r,parseInt($n(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)},c2=function(r){let e=-1,t=-1;if(r<0||r>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&N.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=r*this.systemBandwidth+(1-r)*e,t=this.systemBandwidth),up(this.playlists.main,e,parseInt($n(this.tech_.el(),"width"),10)*i,parseInt($n(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)}},d2=function(r){const{main:e,currentTime:t,bandwidth:i,duration:s,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:u}=r,d=e.playlists.filter(k=>!Bt.isIncompatible(k));let p=d.filter(Bt.isEnabled);p.length||(p=d.filter(k=>!Bt.isDisabled(k)));const A=p.filter(Bt.hasAttribute.bind(null,"BANDWIDTH")).map(k=>{const L=u.getSyncPoint(k,s,o,t)?1:2,$=Bt.estimateSegmentRequestTime(n,i,k)*L-a;return{playlist:k,rebufferingImpact:$}}),b=A.filter(k=>k.rebufferingImpact<=0);return Ir(b,(k,v)=>Al(v.playlist,k.playlist)),b.length?b[0]:(Ir(A,(k,v)=>k.rebufferingImpact-v.rebufferingImpact),A[0]||null)},h2=function(){const r=this.playlists.main.playlists.filter(Bt.isEnabled);return Ir(r,(t,i)=>Al(t,i)),r.filter(t=>!!Cs(this.playlists.main,t).video)[0]||null},f2=r=>{let e=0,t;return r.bytes&&(t=new Uint8Array(r.bytes),r.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function cp(r){try{return new URL(r).pathname.split("/").slice(-2).join("/")}catch{return""}}const p2=function(r,e,t){if(!r[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const s=e.textTracks().getTrackById(i);if(s)r[t]=s;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,u=!1;const d=n[i];d&&(a=d.label,o=d.language,u=d.default),r[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:u,label:a,language:o},!1).track}}},m2=function({inbandTextTracks:r,captionArray:e,timestampOffset:t}){if(!e)return;const i=N.WebKitDataCue||N.VTTCue;e.forEach(s=>{const n=s.stream;s.content?s.content.forEach(a=>{const o=new i(s.startTime+t,s.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",r[n].addCue(o)}):r[n].addCue(new i(s.startTime+t,s.endTime+t,s.text))})},g2=function(r){Object.defineProperties(r.frame,{id:{get(){return z.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),r.value.key}},value:{get(){return z.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),r.value.data}},privateData:{get(){return z.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),r.value.data}}})},y2=({inbandTextTracks:r,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const s=N.WebKitDataCue||N.VTTCue,n=r.metadataTrack_;if(!n||(e.forEach(p=>{const T=p.cueTime+t;typeof T!="number"||N.isNaN(T)||T<0||!(T<1/0)||!p.frames||!p.frames.length||p.frames.forEach(A=>{const b=new s(T,T,A.value||A.url||A.data||"");b.frame=A,b.value=A,g2(b),n.addCue(b)})}),!n.cues||!n.cues.length))return;const a=n.cues,o=[];for(let p=0;p<a.length;p++)a[p]&&o.push(a[p]);const u=o.reduce((p,T)=>{const A=p[T.startTime]||[];return A.push(T),p[T.startTime]=A,p},{}),d=Object.keys(u).sort((p,T)=>Number(p)-Number(T));d.forEach((p,T)=>{const A=u[p],b=isFinite(i)?i:p,k=Number(d[T+1])||b;A.forEach(v=>{v.endTime=k})})},_2={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},T2=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),v2=({inbandTextTracks:r,dateRanges:e})=>{const t=r.metadataTrack_;if(!t)return;const i=N.WebKitDataCue||N.VTTCue;e.forEach(s=>{for(const n of Object.keys(s)){if(T2.has(n))continue;const a=new i(s.startTime,s.endTime,"");a.id=s.id,a.type="com.apple.quicktime.HLS",a.value={key:_2[n],data:s[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}s.processDateRange()})},id=(r,e,t)=>{r.metadataTrack_||(r.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,z.browser.IS_ANY_SAFARI||(r.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ts=function(r,e,t){let i,s;if(t&&t.cues)for(i=t.cues.length;i--;)s=t.cues[i],s.startTime>=r&&s.endTime<=e&&t.removeCue(s)},b2=function(r){const e=r.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const s=e[i],n=`${s.startTime}-${s.endTime}-${s.text}`;t[n]?r.removeCue(s):t[n]=s}},x2=(r,e,t)=>{if(typeof e>"u"||e===null||!r.length)return[];const i=Math.ceil((e-t+3)*sr.ONE_SECOND_IN_TS);let s;for(s=0;s<r.length&&!(r[s].pts>i);s++);return r.slice(s)},S2=(r,e,t)=>{if(!e.length)return r;if(t)return e.slice();const i=e[0].pts;let s=0;for(s;s<r.length&&!(r[s].pts>=i);s++);return r.slice(0,s).concat(e)},E2=(r,e,t,i)=>{const s=Math.ceil((e-i)*sr.ONE_SECOND_IN_TS),n=Math.ceil((t-i)*sr.ONE_SECOND_IN_TS),a=r.slice();let o=r.length;for(;o--&&!(r[o].pts<=n););if(o===-1)return a;let u=o+1;for(;u--&&!(r[u].pts<=s););return u=Math.max(u,0),a.splice(u,o-u+1),a},C2=function(r,e){if(!r&&!e||!r&&e||r&&!e)return!1;if(r===e)return!0;const t=Object.keys(r).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let s=0;s<t.length;s++){const n=t[s];if(n!==i[s]||r[n]!==e[n])return!1}return!0},A2=function(r,e,t){e=e||[];const i=[];let s=0;for(let n=0;n<e.length;n++){const a=e[n];if(r===a.timeline&&(i.push(n),s+=a.duration,s>t))return n}return i.length===0?0:i[i.length-1]},ms=1,w2=500,rd=r=>typeof r=="number"&&isFinite(r),mn=1/60,D2=(r,e,t)=>r!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,I2=(r,e,t)=>{let i=e-gt.BACK_BUFFER_LENGTH;r.length&&(i=Math.max(i,r.start(0)));const s=e-t;return Math.min(s,i)},_r=r=>{const{startOfSegment:e,duration:t,segment:i,part:s,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:u,partIndex:d,timeline:p}=r,T=o.length-1;let A="mediaIndex/partIndex increment";r.getMediaInfoForTime?A=`getMediaInfoForTime (${r.getMediaInfoForTime})`:r.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),r.independent&&(A+=` with independent ${r.independent}`);const b=typeof d=="number",k=r.segment.uri?"segment":"pre-segment",v=b?If({preloadSegment:i})-1:0;return`${k} [${n+u}/${n+T}]`+(b?` part [${d}/${v}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(b?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${p}] selected by [${A}] playlist [${a}]`},sd=r=>`${r}TimingInfo`,k2=({segmentTimeline:r,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:s})=>!s&&r===e?null:r<e?t:i.length?i.end(i.length-1):t,Oo=({timelineChangeController:r,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:s})=>{if(e===t)return!1;if(i==="audio"){const n=r.lastTimelineChange({type:"main"});return!n||n.to!==t}if(i==="main"&&s){const n=r.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},P2=r=>{if(!r)return!1;const e=r.pendingTimelineChange({type:"audio"}),t=r.pendingTimelineChange({type:"main"}),i=e&&t,s=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&s)},R2=r=>{const e=r.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=r.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},qi=r=>{const e=r.pendingSegment_;if(!e)return;if(Oo({timelineChangeController:r.timelineChangeController_,currentTimeline:r.currentTimeline_,segmentTimeline:e.timeline,loaderType:r.loaderType_,audioDisabled:r.audioDisabled_})&&P2(r.timelineChangeController_)){if(R2(r)){r.timelineChangeController_.trigger("audioTimelineBehind");return}r.timelineChangeController_.trigger("fixBadTimelineChange")}},L2=r=>{let e=0;return["video","audio"].forEach(function(t){const i=r[`${t}TimingInfo`];if(!i)return;const{start:s,end:n}=i;let a;typeof s=="bigint"||typeof n=="bigint"?a=N.BigInt(n)-N.BigInt(s):typeof s=="number"&&typeof n=="number"&&(a=n-s),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},nd=({segmentDuration:r,maxDuration:e})=>r?Math.round(r)>e+Si:!1,N2=(r,e)=>{if(e!=="hls")return null;const t=L2({audioTimingInfo:r.audioTimingInfo,videoTimingInfo:r.videoTimingInfo});if(!t)return null;const i=r.playlist.targetDuration,s=nd({segmentDuration:t,maxDuration:i*2}),n=nd({segmentDuration:t,maxDuration:i}),a=`Segment with index ${r.mediaIndex} from playlist ${r.playlist.id} has a duration of ${t} when the reported duration is ${r.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return s||n?{severity:s?"warn":"info",message:a}:null},rr=({type:r,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),s=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:r||e.type,uri:e.resolvedUri||e.uri,start:s,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class Bo extends z.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Zt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(ot({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(ot({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():qi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return lo.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&N.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,N.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&lo.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return _t();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Fn(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const i=Wf(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(s||e).resolvedUri};return s&&(n.bytes=s.bytes),n}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let n=null;if(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
189
+ currentTime: ${this.currentTime_()}
190
+ bufferedEnd: ${ao(this.buffered_())}
191
+ `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}s&&(s.mediaIndex-=a,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(N.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&lo.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},s=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&i()};(s||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=E2(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)Ts(e,t,this.inbandTextTracks_[o]);Ts(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&N.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=N.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&N.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=N.setTimeout(this.monitorBufferTick_.bind(this),w2)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:rr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!s||!s.parts||i+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=ao(e)||0,i=bl(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,n=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||s||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=A2(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const A=a[this.mediaIndex],b=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=A.end?A.end:t,A.parts&&A.parts[b+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=b+1):o.mediaIndex=this.mediaIndex+1}else{let A,b,k;const v=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
192
+ For TargetTime: ${v}.
193
+ CurrentTime: ${this.currentTime_()}
194
+ BufferedEnd: ${t}
195
+ Fetch At Buffer: ${this.fetchAtBuffer_}
196
+ `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const L=this.getSyncInfoFromMediaSequenceSync_(v);if(!L){const U="No sync info found while using media sequence sync";return this.error({message:U,metadata:{errorType:z.Error.StreamingFailedToSelectNextSegment,error:new Error(U)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${L.start} --> ${L.end})`),A=L.segmentIndex,b=L.partIndex,k=L.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const L=Bt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=L.segmentIndex,b=L.partIndex,k=L.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,o.mediaIndex=A,o.startOfSegment=k,o.partIndex=b,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const u=a[o.mediaIndex];let d=u&&typeof o.partIndex=="number"&&u.parts&&u.parts[o.partIndex];if(!u||typeof o.partIndex=="number"&&!d)return null;typeof o.partIndex!="number"&&u.parts&&(o.partIndex=0,d=u.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!p&&!d.independent)if(o.partIndex===0){const A=a[o.mediaIndex-1],b=A.parts&&A.parts.length&&A.parts[A.parts.length-1];b&&b.independent&&(o.mediaIndex-=1,o.partIndex=A.parts.length-1,o.independent="previous segment")}else u.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const T=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const s=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return s?(s.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),s):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:s,startOfSegment:n,isSyncRequest:a,partIndex:o,forceTimestampOffset:u,getMediaInfoForTime:d}=e,p=i.segments[s],T=typeof o=="number"&&p.parts[o],A={requestId:"segment-loader-"+Math.random(),uri:T&&T.resolvedUri||p.resolvedUri,mediaIndex:s,partIndex:T?o:null,isSyncRequest:a,startOfSegment:n,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:p.timeline,duration:T&&T.duration||p.duration,segment:p,part:T,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},b=typeof u<"u"?u:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:b});const k=ao(this.sourceUpdater_.audioBuffered());return typeof k=="number"&&(A.audioAppendStart=k-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=x2(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return k2(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,n=Bt.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),a=Qv(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const o=d2({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const d=n-a-o.rebufferingImpact;let p=.5;a<=Si&&(p=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||d<p)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*gt.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${_r(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:s}=t,n={segmentInfo:rr({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:s}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:n}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},C2(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this))))}handleTimingInfo_(e,t,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=sd(t);n[a]=n[a]||{},n[a][i]=s,this.logger_(`timinginfo: ${t} - ${i} - ${s}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const s=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(a=>{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=n[a.stream];o.startTime=Math.min(o.startTime,a.startTime+s),o.endTime=Math.max(o.endTime,a.endTime+s),o.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:o,endTime:u,captions:d}=n[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${u} for ${a}`),p2(p,this.vhs_.tech_,a),Ts(o,u,p[a]),m2({captionArray:d,inbandTextTracks:p,timestampOffset:s})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Oo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:s,isMuxed:n}=t;return!(s&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||Oo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){qi(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[sd(t.type)].start;else{const s=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&s&&s.hasVideo;let a;n&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){const n=Fn(i);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+nr(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+nr(a).join(", "));const o=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0,d=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(u-o<=ms&&p-d<=ms){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${nr(n).join(", ")}, video buffer: ${nr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const A=this.currentTime_()-ms;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${ms}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=N.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},ms*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){if(s){if(s.code===$f){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:z.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:n}){if(!n){const o=[s];let u=s.byteLength;i&&(o.unshift(i),u+=i.byteLength),n=f2({bytes:u,segments:o})}const a={segmentInfo:rr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,n=`${e}TimingInfo`;s[n]||(s[n]={}),s[n].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[n].transmuxedPresentationStart=i.start.presentation,s[n].transmuxedDecodeStart=i.start.decode,s[n].transmuxedPresentationEnd=i.end.presentation,s[n].transmuxedDecodeEnd=i.end.decode,s[n].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:s}=t;if(!s||!s.byteLength||i==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){qi(this),this.loadQueue_.push(()=>{const t=ot({},e,{forceTimestampOffset:!0});ot(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||s&&n;this.logger_(`Requesting
197
+ ${cp(e.uri)}
198
+ ${_r(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=n2({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:u,stream:d})=>{this.logger_(`${_r(e)} logged from transmuxer stream ${d} as a ${u}: ${o}`)},triggerSegmentEventFn:({type:o,segment:u,keyInfo:d,trackInfo:p,timingInfo:T})=>{const b={segmentInfo:rr({segment:u})};d&&(b.keyInfo=d),p&&(b.trackInfo=p),T&&(b.timingInfo=T),this.trigger({type:o,metadata:b})}})}trimBackBuffer_(e){const t=I2(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:n},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<mn){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${mn}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Ci.ABORTED)return;if(this.pause(),e.code===Ci.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),s.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=S2(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const d=t.segments[i-1];return i===0||!d||typeof d.start>"u"||d.end!==s+n?s:o.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:s,isMuxed:n}=t,a=this.loaderType_==="main"&&s,o=!this.audioDisabled_&&i&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=D2(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),s=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;s&&(e.timingInfo.end=typeof s.end=="number"?s.end:s.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const u={segmentInfo:rr({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:u})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=N2(e,this.sourceType_);if(t&&(t.severity==="warn"?z.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${_r(e)}`);return}this.logger_(`Appended ${_r(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,s=e.part,n=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${_r(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<mn){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${mn}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,s=t.end;if(!rd(i)||!rd(s))return;Ts(i,s,this.segmentMetadataTrack_);const n=N.WebKitDataCue||N.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:s},o=JSON.stringify(a),u=new n(i,s,o);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function Ni(){}const dp=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toUpperCase())},O2=["video","audio"],Mo=(r,e)=>{const t=e[`${r}Buffer`];return t&&t.updating||e.queuePending[r]},B2=(r,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===r)return t}return null},kr=(r,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),kr("audio",e),kr("video",e));return}if(r!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Mo(r,e))){if(i.type!==r){if(t=B2(r,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[r]=i,i.action(r,e),!i.doneFn){e.queuePending[r]=null,kr(r,e);return}}},hp=(r,e)=>{const t=e[`${r}Buffer`],i=dp(r);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[r]=null,e[`${r}Buffer`]=null)},vi=(r,e)=>r&&e&&Array.prototype.indexOf.call(r.sourceBuffers,e)!==-1,$t={appendBuffer:(r,e,t)=>(i,s)=>{const n=s[`${i}Buffer`];if(vi(s.mediaSource,n)){s.logger_(`Appending segment ${e.mediaIndex}'s ${r.length} bytes to ${i}Buffer`);try{n.appendBuffer(r)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===$f?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),s.queuePending[i]=null,t(a)}}},remove:(r,e)=>(t,i)=>{const s=i[`${t}Buffer`];if(vi(i.mediaSource,s)){i.logger_(`Removing ${r} to ${e} from ${t}Buffer`);try{s.remove(r,e)}catch{i.logger_(`Remove ${r} to ${e} from ${t}Buffer failed`)}}},timestampOffset:r=>(e,t)=>{const i=t[`${e}Buffer`];vi(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${r}`),i.timestampOffset=r)},callback:r=>(e,t)=>{r()},endOfStream:r=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${r||""})`);try{e.mediaSource.endOfStream(r)}catch(t){z.log.warn("Failed to call media source endOfStream",t)}}},duration:r=>e=>{e.logger_(`Setting mediaSource duration to ${r}`);try{e.mediaSource.duration=r}catch(t){z.log.warn("Failed to set media source duration",t)}},abort:()=>(r,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${r}Buffer`];if(vi(e.mediaSource,t)){e.logger_(`calling abort on ${r}Buffer`);try{t.abort()}catch(i){z.log.warn(`Failed to abort on ${r}Buffer`,i)}}},addSourceBuffer:(r,e)=>t=>{const i=dp(r),s=Pr(e);t.logger_(`Adding ${r}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",t[`on${i}UpdateEnd_`]),n.addEventListener("error",t[`on${i}Error_`]),t.codecs[r]=e,t[`${r}Buffer`]=n},removeSourceBuffer:r=>e=>{const t=e[`${r}Buffer`];if(hp(r,e),!!vi(e.mediaSource,t)){e.logger_(`Removing ${r}Buffer with codec ${e.codecs[r]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){z.log.warn(`Failed to removeSourceBuffer ${r}Buffer`,i)}}},changeType:r=>(e,t)=>{const i=t[`${e}Buffer`],s=Pr(r);if(!vi(t.mediaSource,i))return;const n=r.substring(0,r.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const u={codecsChangeInfo:{from:a,to:r}};t.trigger({type:"codecschange",metadata:u}),t.logger_(`changing ${e}Buffer codec from ${a} to ${r}`);try{i.changeType(s),t.codecs[e]=r}catch(d){u.errorType=z.Error.StreamingCodecsChangeError,u.error=d,d.metadata=u,t.error_=d,t.trigger("error"),z.log.warn(`Failed to changeType on ${e}Buffer`,d)}}},jt=({type:r,sourceUpdater:e,action:t,doneFn:i,name:s})=>{e.queue.push({type:r,action:t,doneFn:i,name:s}),kr(r,e)},ad=(r,e)=>t=>{const i=e[`${r}Buffered`](),s=Kv(i);if(e.logger_(`received "updateend" event for ${r} Source Buffer: `,s),e.queuePending[r]){const n=e.queuePending[r].doneFn;e.queuePending[r]=null,n&&n(e[`${r}Error_`])}kr(r,e)};class fp extends z.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>kr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Zt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=ad("video",this),this.onAudioUpdateEnd_=ad("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){jt({type:"mediaSource",sourceUpdater:this,action:$t.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){jt({type:e,sourceUpdater:this,action:$t.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){z.log.error("removeSourceBuffer is not supported!");return}jt({type:"mediaSource",sourceUpdater:this,action:$t.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!z.browser.IS_FIREFOX&&N.MediaSource&&N.MediaSource.prototype&&typeof N.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return N.SourceBuffer&&N.SourceBuffer.prototype&&typeof N.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){z.log.error("changeType is not supported!");return}jt({type:e,sourceUpdater:this,action:$t.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:s,bytes:n}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(jt({type:s,sourceUpdater:this,action:$t.appendBuffer(n,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return vi(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:_t()}videoBuffered(){return vi(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:_t()}buffered(){const e=vi(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=vi(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Yv(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ni){jt({type:"mediaSource",sourceUpdater:this,action:$t.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ni){typeof e!="string"&&(e=void 0),jt({type:"mediaSource",sourceUpdater:this,action:$t.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Ni){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}jt({type:"audio",sourceUpdater:this,action:$t.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Ni){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}jt({type:"video",sourceUpdater:this,action:$t.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(Mo("audio",this)||Mo("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(jt({type:"audio",sourceUpdater:this,action:$t.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(jt({type:"video",sourceUpdater:this,action:$t.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&jt({type:"audio",sourceUpdater:this,action:$t.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&jt({type:"video",sourceUpdater:this,action:$t.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),O2.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>hp(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const od=r=>decodeURIComponent(escape(String.fromCharCode.apply(null,r))),M2=r=>{const e=new Uint8Array(r);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},ld=new Uint8Array(`
199
+
200
+ `.split("").map(r=>r.charCodeAt(0)));class F2 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class U2 extends Bo{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return _t();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return _t([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Fn(e);let s=this.initSegments_[i];if(t&&!s&&e.bytes){const n=ld.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(ld,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Ts(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Ci.TIMEOUT&&this.handleTimeout_(),e.code===Ci.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_,n=i.mp4VttCues&&i.mp4VttCues.length;n&&(s.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=s.segment;if(a.map&&(a.map.bytes=t.map.bytes),s.bytes=t.bytes,typeof N.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(s)}catch(o){this.stopForError({message:o.message,metadata:{errorType:z.Error.StreamingVttParserError,error:o}});return}if(n||this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,s.cues.forEach(o=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new N.VTTCue(o.startTime,o.endTime,o.text):o)}),b2(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",s=t&&t.type==="text";i&&s&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const s=i.start+t,n=i.end+t,a=new N.VTTCue(s,n,i.cueText);i.settings&&i.settings.split(" ").forEach(o=>{const u=o.split(":"),d=u[0],p=u[1];a[d]=isNaN(p)?p:Number(p)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof N.WebVTT!="function")throw new F2;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof N.TextDecoder=="function"?t=new N.TextDecoder("utf8"):(t=N.WebVTT.StringDecoder(),i=!0);const s=new N.WebVTT.Parser(N,N.vttjs,t);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{z.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=od(a)),s.parse(a)}let n=e.bytes;i&&(n=od(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,i){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,u=n/sr.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(d=>{const p=d.endTime-d.startTime,T=this.handleRollover_(d.startTime+u,t.time);d.startTime=Math.max(T,0),d.endTime=Math.max(T+p,0)}),!i.syncInfo){const d=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(d,p-s.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*sr.ONE_SECOND_IN_TS;const s=t*sr.ONE_SECOND_IN_TS;let n;for(s<i?n=-8589934592:n=8589934592;Math.abs(i-s)>4294967296;)i+=n;return i/sr.ONE_SECOND_IN_TS}}const $2=function(r,e){const t=r.cues;for(let i=0;i<t.length;i++){const s=t[i];if(e>=s.adStartTime&&e<=s.adEndTime)return s}return null},j2=function(r,e,t=0){if(!r.segments)return;let i=t,s;for(let n=0;n<r.segments.length;n++){const a=r.segments[n];if(s||(s=$2(e,i+a.duration/2)),s){if("cueIn"in a){s.endTime=i,s.adEndTime=i,i+=a.duration,s=null;continue}if(i<s.endTime){i+=a.duration;continue}s.endTime+=a.duration}else if("cueOut"in a&&(s=new N.VTTCue(i,i+a.duration,a.cueOut),s.adStartTime=i,s.adEndTime=i+parseFloat(a.cueOut),e.addCue(s)),"cueOutCont"in a){const[o,u]=a.cueOutCont.split("/").map(parseFloat);s=new N.VTTCue(i,i+a.duration,""),s.adStartTime=i-o,s.adEndTime=s.adStartTime+u,e.addCue(s)}i+=a.duration}};class ud{constructor({start:e,end:t,segmentIndex:i,partIndex:s=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=s,this.appended_=n}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class q2{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class pp{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),!!this.isReliable_)return this.updateStorage_(s,i,this.calculateBaseTime_(i,s,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const s of i)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const s=new Map;let n=`
201
+ `,a=i,o=t;this.start_=a,e.forEach((u,d)=>{const p=this.storage_.get(o),T=a,A=T+u.duration,b=!!(p&&p.segmentSyncInfo&&p.segmentSyncInfo.isAppended),k=new ud({start:T,end:A,appended:b,segmentIndex:d});u.syncInfo=k;let v=a;const L=(u.parts||[]).map((U,$)=>{const F=v,H=v+U.duration,B=!!(p&&p.partsSyncInfo&&p.partsSyncInfo[$]&&p.partsSyncInfo[$].isAppended),V=new ud({start:F,end:H,appended:B,segmentIndex:d,partIndex:$});return v=H,n+=`Media Sequence: ${o}.${$} | Range: ${F} --> ${H} | Appended: ${B}
202
+ `,U.syncInfo=V,V});s.set(o,new q2(k,L)),n+=`${cp(u.resolvedUri)} | Media Sequence: ${o} | Range: ${T} --> ${A} | Appended: ${b}
203
+ `,o++,a=A}),this.end_=a,this.storage_=s,this.diagnostics_=n}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const s=Math.min(...this.storage_.keys());if(e<s){const n=s-e;let a=this.storage_.get(s).segmentSyncInfo.start;for(let o=0;o<n;o++){const u=t[o];a-=u.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class cd extends pp{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const s=this.parent_.getSyncInfoForMediaSequence(e);return s?s.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const V2=86400,uo=[{name:"VOD",run:(r,e,t,i,s)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(r,e,t,i,s,n)=>{const a=r.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(r,e,t,i,s)=>{if(!Object.keys(r.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=wo(e);s=s||0;for(let u=0;u<o.length;u++){const d=e.endList||s===0?u:o.length-(u+1),p=o[d],T=p.segment,A=r.timelineToDatetimeMappings[T.timeline];if(!A||!T.dateTimeObject)continue;let k=T.dateTimeObject.getTime()/1e3+A;if(T.parts&&typeof p.partIndex=="number")for(let L=0;L<p.partIndex;L++)k+=T.parts[L].duration;const v=Math.abs(s-k);if(a!==null&&(v===0||a<v))break;a=v,n={time:k,segmentIndex:p.segmentIndex,partIndex:p.partIndex}}return n}},{name:"Segment",run:(r,e,t,i,s)=>{let n=null,a=null;s=s||0;const o=wo(e);for(let u=0;u<o.length;u++){const d=e.endList||s===0?u:o.length-(u+1),p=o[d],T=p.segment,A=p.part&&p.part.start||T&&T.start;if(T.timeline===i&&typeof A<"u"){const b=Math.abs(s-A);if(a!==null&&a<b)break;(!n||a===null||a>=b)&&(a=b,n={time:A,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return n}},{name:"Discontinuity",run:(r,e,t,i,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const u=e.discontinuityStarts[o],d=e.discontinuitySequence+o+1,p=r.discontinuities[d];if(p){const T=Math.abs(s-p.time);if(a!==null&&a<T)break;(!n||a===null||a>=T)&&(a=T,n={time:p.time,segmentIndex:u,partIndex:null})}}}return n}},{name:"Playlist",run:(r,e,t,i,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class H2 extends z.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new pp,i=new cd(t),s=new cd(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Zt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,n){if(t!==1/0)return uo.find(({name:u})=>u==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,s,n);if(!a.length)return null;for(const o of a){const{syncPoint:u,strategy:d}=o,{segmentIndex:p,time:T}=u;if(p<0)continue;const A=e.segments[p],b=T,k=b+A.duration;if(this.logger_(`Strategy: ${d}. Current time: ${s}. selected segment: ${p}. Time: [${b} -> ${k}]}`),s>=b&&s<k)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:s})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+Es({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s,n){const a=[];for(let o=0;o<uo.length;o++){const u=uo[o],d=u.run(this,e,t,i,s,n);d&&(d.strategy=u.name,a.push({strategy:u.name,syncPoint:d}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,s=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const o=Math.abs(e[a].syncPoint[t.key]-t.value);o<s&&(s=o,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>V2){z.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let s=i-1;s>=0;s--){const n=e.segments[s];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+s,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const n=s.dateTimeObject;s.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[s.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const s=e.segment,n=e.part;let a=this.timelines[e.timeline],o,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,u=t.end+a.mapping;else if(a)o=t.start+a.mapping,u=t.end+a.mapping;else return!1;return n&&(n.start=o,n.end=u),(!s.start||o<s.start)&&(s.start=o),s.end=u,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let s=0;s<t.discontinuityStarts.length;s++){const n=t.discontinuityStarts[s],a=t.discontinuitySequence+s+1,o=n-e.mediaIndex,u=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let d;o<0?d=i.start-Es({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):d=i.end+Es({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:d,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class z2 extends z.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const s={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const W2=Jf(Zf(function(){var r=(function(){function v(){this.listeners={}}var L=v.prototype;return L.on=function($,F){this.listeners[$]||(this.listeners[$]=[]),this.listeners[$].push(F)},L.off=function($,F){if(!this.listeners[$])return!1;var H=this.listeners[$].indexOf(F);return this.listeners[$]=this.listeners[$].slice(0),this.listeners[$].splice(H,1),H>-1},L.trigger=function($){var F=this.listeners[$];if(F)if(arguments.length===2)for(var H=F.length,B=0;B<H;++B)F[B].call(this,arguments[1]);else for(var V=Array.prototype.slice.call(arguments,1),G=F.length,ie=0;ie<G;++ie)F[ie].apply(this,V)},L.dispose=function(){this.listeners={}},L.pipe=function($){this.on("data",function(F){$.push(F)})},v})();function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],L=v[0],U=v[1],$=L[4],F=U[4];let H,B,V;const G=[],ie=[];let C,I,W,Y,X,ne;for(H=0;H<256;H++)ie[(G[H]=H<<1^(H>>7)*283)^H]=H;for(B=V=0;!$[B];B^=C||1,V=ie[V]||1)for(Y=V^V<<1^V<<2^V<<3^V<<4,Y=Y>>8^Y&255^99,$[B]=Y,F[Y]=B,W=G[I=G[C=G[B]]],ne=W*16843009^I*65537^C*257^B*16843008,X=G[Y]*257^Y*16843008,H=0;H<4;H++)L[H][B]=X=X<<24^X>>>8,U[H][Y]=ne=ne<<24^ne>>>8;for(H=0;H<5;H++)L[H]=L[H].slice(0),U[H]=U[H].slice(0);return v};let i=null;class s{constructor(L){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let U,$,F;const H=this._tables[0][4],B=this._tables[1],V=L.length;let G=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const ie=L.slice(0),C=[];for(this._key=[ie,C],U=V;U<4*V+28;U++)F=ie[U-1],(U%V===0||V===8&&U%V===4)&&(F=H[F>>>24]<<24^H[F>>16&255]<<16^H[F>>8&255]<<8^H[F&255],U%V===0&&(F=F<<8^F>>>24^G<<24,G=G<<1^(G>>7)*283)),ie[U]=ie[U-V]^F;for($=0;U;$++,U--)F=ie[$&3?U:U-4],U<=4||$<4?C[$]=F:C[$]=B[0][H[F>>>24]]^B[1][H[F>>16&255]]^B[2][H[F>>8&255]]^B[3][H[F&255]]}decrypt(L,U,$,F,H,B){const V=this._key[1];let G=L^V[0],ie=F^V[1],C=$^V[2],I=U^V[3],W,Y,X;const ne=V.length/4-2;let de,fe=4;const te=this._tables[1],le=te[0],oe=te[1],ce=te[2],ue=te[3],Ee=te[4];for(de=0;de<ne;de++)W=le[G>>>24]^oe[ie>>16&255]^ce[C>>8&255]^ue[I&255]^V[fe],Y=le[ie>>>24]^oe[C>>16&255]^ce[I>>8&255]^ue[G&255]^V[fe+1],X=le[C>>>24]^oe[I>>16&255]^ce[G>>8&255]^ue[ie&255]^V[fe+2],I=le[I>>>24]^oe[G>>16&255]^ce[ie>>8&255]^ue[C&255]^V[fe+3],fe+=4,G=W,ie=Y,C=X;for(de=0;de<4;de++)H[(3&-de)+B]=Ee[G>>>24]<<24^Ee[ie>>16&255]<<16^Ee[C>>8&255]<<8^Ee[I&255]^V[fe++],W=G,G=ie,ie=C,C=I,I=W}}class n extends r{constructor(){super(r),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(L){this.jobs.push(L),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},o=function(v,L,U){const $=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),F=new s(Array.prototype.slice.call(L)),H=new Uint8Array(v.byteLength),B=new Int32Array(H.buffer);let V,G,ie,C,I,W,Y,X,ne;for(V=U[0],G=U[1],ie=U[2],C=U[3],ne=0;ne<$.length;ne+=4)I=a($[ne]),W=a($[ne+1]),Y=a($[ne+2]),X=a($[ne+3]),F.decrypt(I,W,Y,X,B,ne),B[ne]=a(B[ne]^V),B[ne+1]=a(B[ne+1]^G),B[ne+2]=a(B[ne+2]^ie),B[ne+3]=a(B[ne+3]^C),V=I,G=W,ie=Y,C=X;return H};class u{constructor(L,U,$,F){const H=u.STEP,B=new Int32Array(L.buffer),V=new Uint8Array(L.byteLength);let G=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(B.subarray(G,G+H),U,$,V)),G=H;G<B.length;G+=H)$=new Uint32Array([a(B[G-4]),a(B[G-3]),a(B[G-2]),a(B[G-1])]),this.asyncStream_.push(this.decryptChunk_(B.subarray(G,G+H),U,$,V));this.asyncStream_.push(function(){F(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(L,U,$,F){return function(){const H=o(L,U,$);F.set(H,L.byteOffset)}}}var d=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ce.global<"u"?Ce.global:typeof self<"u"?self:{},p;typeof window<"u"?p=window:typeof d<"u"?p=d:typeof self<"u"?p=self:p={};var T=p,A=function(L){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(L):L&&L.buffer instanceof ArrayBuffer},b=T.BigInt||Number;b("0x1"),b("0x100"),b("0x10000"),b("0x1000000"),b("0x100000000"),b("0x10000000000"),b("0x1000000000000"),b("0x100000000000000"),b("0x10000000000000000"),(function(){var v=new Uint16Array([65484]),L=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return L[0]===255?"big":L[0]===204?"little":"unknown"})();const k=function(v){const L={};return Object.keys(v).forEach(U=>{const $=v[U];A($)?L[U]={bytes:$.buffer,byteOffset:$.byteOffset,byteLength:$.byteLength}:L[U]=$}),L};self.onmessage=function(v){const L=v.data,U=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),$=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),F=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new u(U,$,F,function(H,B){self.postMessage(k({source:L.source,decrypted:B}),[B.buffer])})}}));var G2=Qf(W2);const K2=r=>{let e=r.default?"main":"alternative";return r.characteristics&&r.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},mp=(r,e)=>{r.abort(),r.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Fo=(r,e)=>{e.activePlaylistLoader=r,r.load()},X2=(r,e)=>()=>{const{segmentLoaders:{[r]:t,main:i},mediaTypes:{[r]:s}}=e,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,u=s.lastGroup_;if(!(a&&u&&a.id===u.id)&&(s.lastGroup_=a,s.lastTrack_=n,mp(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&i.resetEverything();return}t.resyncLoader(),Fo(a.playlistLoader,s)}},Y2=(r,e)=>()=>{const{segmentLoaders:{[r]:t},mediaTypes:{[r]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Q2=(r,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[r]:i,main:s},mediaTypes:{[r]:n}}=e,a=n.activeTrack(),o=n.getActiveGroup(),u=n.activePlaylistLoader,d=n.lastTrack_;if(!(d&&a&&d.id===a.id)&&(n.lastGroup_=o,n.lastTrack_=a,mp(i,n),!!o)){if(o.isMainPlaylist){if(!a||!d||a.id===d.id)return;const p=e.vhs.playlistController_,T=p.selectPlaylist();if(p.media()===T)return;n.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),t.pause(),s.resetEverything(),p.fastQualityChange_(T);return}if(r==="AUDIO"){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}i.setAudio(!0),s.setAudio(!1)}if(u===o.playlistLoader){Fo(o.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),Fo(o.playlistLoader,n)}},jn={AUDIO:(r,e)=>()=>{const{mediaTypes:{[r]:t},excludePlaylist:i}=e,s=t.activeTrack(),n=t.activeGroup(),a=(n.filter(u=>u.default)[0]||n[0]).id,o=t.tracks[a];if(s===o){i({error:{message:"Problem encountered loading the default audio track."}});return}z.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===o;t.onTrackChanged()},SUBTITLES:(r,e)=>()=>{const{mediaTypes:{[r]:t}}=e;z.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},dd={AUDIO:(r,e,t)=>{if(!e)return;const{tech:i,requestOptions:s,segmentLoaders:{[r]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,s),(!i.paused()||a.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),i.paused()||n.load()}),e.on("error",jn[r](r,t))},SUBTITLES:(r,e,t)=>{const{tech:i,requestOptions:s,segmentLoaders:{[r]:n},mediaTypes:{[r]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();n.playlist(o,s),n.track(a.activeTrack()),(!i.paused()||o.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),i.paused()||n.load()}),e.on("error",jn[r](r,t))}},J2={AUDIO:(r,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[r]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[r]:{groups:o,tracks:u,logger_:d}},mainPlaylistLoader:p}=e,T=Bs(p.main);(!a[r]||Object.keys(a[r]).length===0)&&(a[r]={main:{default:{default:!0}}},T&&(a[r].main.default.playlists=p.main.playlists));for(const A in a[r]){o[A]||(o[A]=[]);for(const b in a[r][A]){let k=a[r][A][b],v;if(T?(d(`AUDIO group '${A}' label '${b}' is a main playlist`),k.isMainPlaylist=!0,v=null):i==="vhs-json"&&k.playlists?v=new xr(k.playlists[0],t,n):k.resolvedUri?v=new xr(k.resolvedUri,t,n):k.playlists&&i==="dash"?v=new Lo(k.playlists[0],t,n,p):v=null,k=Oe({id:b,playlistLoader:v},k),dd[r](r,k.playlistLoader,e),o[A].push(k),typeof u[b]>"u"){const L=new z.AudioTrack({id:b,kind:K2(k),enabled:!1,language:k.language,default:k.default,label:b});u[b]=L}}}s.on("error",jn[r](r,e))},SUBTITLES:(r,e)=>{const{tech:t,vhs:i,sourceType:s,segmentLoaders:{[r]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[r]:{groups:u,tracks:d}},mainPlaylistLoader:p}=e;for(const T in o[r]){u[T]||(u[T]=[]);for(const A in o[r][T]){if(!i.options_.useForcedSubtitles&&o[r][T][A].forced)continue;let b=o[r][T][A],k;if(s==="hls")k=new xr(b.resolvedUri,i,a);else if(s==="dash"){if(!b.playlists.filter(L=>L.excludeUntil!==1/0).length)return;k=new Lo(b.playlists[0],i,a,p)}else s==="vhs-json"&&(k=new xr(b.playlists?b.playlists[0]:b.resolvedUri,i,a));if(b=Oe({id:A,playlistLoader:k},b),dd[r](r,b.playlistLoader,e),u[T].push(b),typeof d[A]>"u"){const v=t.addRemoteTextTrack({id:A,kind:"subtitles",default:b.default&&b.autoselect,language:b.language,label:A},!1).track;d[A]=v}}}n.on("error",jn[r](r,e))},"CLOSED-CAPTIONS":(r,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[r]:{groups:s,tracks:n}}}=e;for(const a in i[r]){s[a]||(s[a]=[]);for(const o in i[r][a]){const u=i[r][a][o];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const d=t.options_.vhs&&t.options_.vhs.captionServices||{};let p={label:o,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(d[p.instreamId]&&(p=Oe(p,d[p.instreamId])),p.default===void 0&&delete p.default,s[a].push(Oe({id:o},u)),typeof n[o]>"u"){const T=t.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;n[o]=T}}}}},gp=(r,e)=>{for(let t=0;t<r.length;t++)if(El(e,r[t])||r[t].playlists&&gp(r[t].playlists,e))return!0;return!1},Z2=(r,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[r]:{groups:s}}}=e,n=i.media();if(!n)return null;let a=null;n.attributes[r]&&(a=s[n.attributes[r]]);const o=Object.keys(s);if(!a)if(r==="AUDIO"&&o.length>1&&Bs(e.main))for(let u=0;u<o.length;u++){const d=s[o[u]];if(gp(d,n)){a=d;break}}else s.main?a=s.main:o.length===1&&(a=s[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},e1={AUDIO:(r,e)=>()=>{const{mediaTypes:{[r]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(r,e)=>()=>{const{mediaTypes:{[r]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},t1=(r,{mediaTypes:e})=>()=>{const t=e[r].activeTrack();return t?e[r].activeGroup(t):null},i1=r=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(d=>{J2[d](d,r)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:s,segmentLoaders:{["AUDIO"]:n,main:a}}=r;["AUDIO","SUBTITLES"].forEach(d=>{e[d].activeGroup=Z2(d,r),e[d].activeTrack=e1[d](d,r),e[d].onGroupChanged=X2(d,r),e[d].onGroupChanging=Y2(d,r),e[d].onTrackChanged=Q2(d,r),e[d].getActiveGroup=t1(d,r)});const o=e.AUDIO.activeGroup();if(o){const d=(o.filter(T=>T.default)[0]||o[0]).id;e.AUDIO.tracks[d].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",u),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{i.audioTracks().removeEventListener("change",u),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const d in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[d])},r1=()=>{const r={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{r[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ni,activeTrack:Ni,getActiveGroup:Ni,onGroupChanged:Ni,onTrackChanged:Ni,lastTrack_:null,logger_:Zt(`MediaGroups[${e}]`)}}),r};class hd{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Ot(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class s1 extends z.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new hd,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Zt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=Ot(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const d=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${d} seconds.`),this.startTTLTimeout_(parseInt(d,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let o;try{o=JSON.parse(this.request_.responseText)}catch(d){const p={errorType:z.Error.StreamingContentSteeringParserError,error:d};this.trigger({type:"error",metadata:p})}this.assignSteeringProperties_(o);const u={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new N.URL(e),i=new N.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(N.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new N.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,i)}if(s){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,s)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(s=>{for(const n of s)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=s=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){const s=this.setProxyServerUrl_(e);if(!t(s))return s}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=N.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){N.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new hd}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Ot(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const n1=(r,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{r.apply(null,i)},e)}},a1=10;let Vi;const o1=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],l1=function(r){return this.audioSegmentLoader_[r]+this.mainSegmentLoader_[r]},u1=function({currentPlaylist:r,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:u}){if(!i)return z.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${r&&r.id||"null"} -> ${i.id}`;if(!r)return u(`${d} as current playlist is not set`),!0;if(i.id===r.id)return!1;const p=!!br(e,t).length;if(!r.endList)return!p&&typeof r.partTargetDuration=="number"?(u(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${d} as current playlist is live`),!0);const T=bl(e,t),A=o?gt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:gt.MAX_BUFFER_LOW_WATER_LINE;if(a<A)return u(`${d} as duration < max low water line (${a} < ${A})`),!0;const b=i.attributes.BANDWIDTH,k=r.attributes.BANDWIDTH;if(b<k&&(!o||T<n)){let v=`${d} as next bandwidth < current bandwidth (${b} < ${k})`;return o&&(v+=` and forwardBuffer < bufferHighWaterLine (${T} < ${n})`),u(v),!0}if((!o||b>k)&&T>=s){let v=`${d} as forwardBuffer >= bufferLowWaterLine (${T} >= ${s})`;return o&&(v+=` and next bandwidth > current bandwidth (${b} > ${k})`),u(v),!0}return u(`not ${d} as no switching criteria met`),!1};class c1 extends z.EventTarget{constructor(e){super(),this.fastQualityChange_=n1(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:s,bandwidth:n,externVhs:a,useCueTags:o,playlistExclusionDuration:u,enableLowInitialPlaylist:d,sourceType:p,cacheEncryptionKeys:T,bufferBasedABR:A,leastPixelDiffSelector:b,captionServices:k,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:L}=e;(L===null||typeof L>"u")&&(L=1/0),Vi=a,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!b,this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=o,this.playlistExclusionDuration=u,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=d,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=r1(),v&&N.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new N.ManagedMediaSource,this.usingManagedMediaSource_=!0,z.log("Using ManagedMediaSource")):N.MediaSource&&(this.mediaSource=new N.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=_t(),this.hasPlayed_=!1,this.syncController_=new H2(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new G2,this.sourceUpdater_=new fp(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new z2,this.keyStatusMap_=new Map;const U={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:k,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:T,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Lo(t,this.vhs_,Oe(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new xr(t,this.vhs_,Oe(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Bo(Oe(U,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Bo(Oe(U,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new U2(Oe(U,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((H,B)=>{function V(){s.off("vttjserror",G),H()}function G(){s.off("vttjsloaded",V),B()}s.one("vttjsloaded",V),s.one("vttjserror",G),s.addWebVttScript_()})}),e);const $=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new s1(this.vhs_.xhr,$),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),o1.forEach(H=>{this[H+"_"]=l1.bind(this,H)}),this.logger_=Zt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const F=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(F,()=>{const H=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-H,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),n=s&&(s.id||s.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){const a=(i.length?i[0].playlists:i.playlists).filter(o=>o.attributes.serviceLocation===s);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=N.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(N.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const o=i.main||s.length&&i[s[0]];for(const u in o)if(o[u].default){n={label:u};break}}if(!n)return t;const a=[];for(const o in i)if(i[o][n.label]){const u=i[o][n.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let d=0;d<e.playlists.length;d++){const p=e.playlists[d];p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===o&&a.push(p)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Do(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),i1({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Do(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(ot({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let s=!0;const n=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const o in i.AUDIO[a])i.AUDIO[a][o].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Vi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(i.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return u1({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const s=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(s)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:a1}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,s=>{this.player_.trigger(ot({},s))}),this.audioSegmentLoader_.on(i,s=>{this.player_.trigger(ot({},s))}),this.subtitleSegmentLoader_.on(i,s=>{this.player_.trigger(ot({},s))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let s=i;if(e.start){const n=e.start.timeOffset;n<0?s=Math.max(i+n,t.start(0)):s=Math.min(i,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const s=Vi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-n<=Ei;const o=a.end(a.length-1);return o-n<=Ei&&s-o<=Ei}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(fa),a=n.length===1&&n[0]===e;if(s.length===1&&i!==1/0)return z.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const k=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(k),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(k)},v);return}let b=!1;s.forEach(k=>{if(k===e)return;const v=k.excludeUntil;typeof v<"u"&&v!==1/0&&(b=!0,delete k.excludeUntil)}),b&&(z.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+i*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const d=t.internal?this.logger_:z.log.warn,p=t.message?" "+t.message:"";d(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const T=u.targetDuration/2*1e3||5*1e3,A=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=T;return this.switchMedia_(u,"exclude",a||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s=e==="all";(s||e==="main")&&i.push(this.mainPlaylistLoader_);const n=[];(s||e==="audio")&&n.push("AUDIO"),(s||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&i.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&i.push(o)}),i.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=br(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Vi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const s=this.syncController_.getMediaSequenceSync(t);if(s&&s.isReliable){const o=s.start,u=s.end;if(!isFinite(o)||!isFinite(u))return null;const d=Vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),p=Math.max(0,u-d);return p<o?null:_t([[o,p]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=Vi.Playlist.seekable(i,n,Vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),s=e.end(0),n=t.start(0),a=t.end(0);return n>s||i>a?e:_t([[Math.max(i,n),Math.min(s,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${wf(this.seekable_)}]`);const s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const s=this.seekable();if(!s.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<s.end(s.length-1))&&this.sourceUpdater_.setDuration(s.end(s.length-1));return}const t=this.tech_.buffered();let i=Vi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(s=>{s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Cs(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||Ky),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||Zu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Zu,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(d,p)=>d?vs(p,this.usingManagedMediaSource_):Va(p),o={};let u;if(["video","audio"].forEach(function(d){if(s.hasOwnProperty(d)&&!a(e[d].isFmp4,s[d])){const p=e[d].isFmp4?"browser":"muxer";o[p]=o[p]||[],o[p].push(s[d]),d==="audio"&&(u=p)}}),n&&u&&t.attributes.AUDIO){const d=t.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===d&&p!==t&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${d} as ${u} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){const d=Object.keys(o).reduce((p,T)=>(p&&(p+=", "),p+=`${T} does not support codec(s): "${o[T].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:d},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const d=[];if(["video","audio"].forEach(p=>{const T=(Ti(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,A=(Ti(s[p]||"")[0]||{}).type;T&&A&&T.toLowerCase()!==A.toLowerCase()&&d.push(`"${this.sourceUpdater_.codecs[p]}" -> "${s[p]}"`)}),d.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${d.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const s=e[i];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const n=Cs(this.main,s),a=[];n.audio&&!Va(n.audio)&&!vs(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Va(n.video)&&!vs(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=Un(Ti(e)),n=Zc(s),a=s.video&&Ti(s.video)[0]||null,o=s.audio&&Ti(s.audio)[0]||null;Object.keys(i).forEach(u=>{const d=i[u];if(t.indexOf(d.id)!==-1||d.excludeUntil===1/0)return;t.push(d.id);const p=[],T=Cs(this.mainPlaylistLoader_.main,d),A=Zc(T);if(!(!T.audio&&!T.video)){if(A!==n&&p.push(`codec count "${A}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const b=T.video&&Ti(T.video)[0]||null,k=T.audio&&Ti(T.audio)[0]||null;b&&a&&b.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${b.type}" !== "${a.type}"`),k&&o&&k.type.toLowerCase()!==o.type.toLowerCase()&&p.push(`audio codec "${k.type}" !== "${o.type}"`)}p.length&&(d.excludeUntil=1/0,this.logger_(`excluding ${d.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),j2(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=gt.GOAL_BUFFER_LENGTH,i=gt.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,gt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=gt.BUFFER_LOW_WATER_LINE,i=gt.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,gt.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,gt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return gt.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){id(this.inbandTextTracks_,"com.apple.streaming",this.tech_),v2({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();id(this.inbandTextTracks_,e,this.tech_),y2({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(ot({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const o of t.playlists){const u=o.attributes.serviceLocation;if(u&&(a.push(u),!n.has(u)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,s=new Set;let n=!1;Object.keys(i).forEach(a=>{const o=i[a],u=this.pathwayAttribute_(o),d=u&&e!==u;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!d&&(delete o.excludeUntil,delete o.lastExcludeReason_,n=!0);const T=!o.excludeUntil&&o.excludeUntil!==1/0;!s.has(o.id)&&d&&T&&(s.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const u=o.activePlaylistLoader.media_;u&&u.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||s&&s.size){for(const[a,o]of i.entries())s.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(o),this.contentSteeringController_.excludePathway(a));for(const[a,o]of s.entries()){const u=i.get(a);if(!u){t.filter(p=>p.attributes["PATHWAY-ID"]===o["BASE-ID"]).forEach(p=>{this.mainPlaylistLoader_.addClonePathway(o,p)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(u,o)||(this.mainPlaylistLoader_.updateOrDeleteClone(o,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const n in i)if(i[n]!==s[n])return!1;for(const n in s)if(i[n]!==s[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const s=this.mainPlaylistLoader_.getKeyIdSet(i);!s||!s.size||s.forEach(n=>{const a="usable",o=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,u=i.lastExcludeReason_===t&&i.excludeUntil===1/0;o?o&&u&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${n} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const s=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,n=i.excludeUntil===1/0&&i.lastExcludeReason_===t;s&&n&&(delete i.excludeUntil,z.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:M2(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const d1=(r,e,t)=>i=>{const s=r.main.playlists[e],n=Sl(s),a=fa(s);if(typeof i>"u")return a;i?delete s.disabled:s.disabled=!0;const o={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};return i!==a&&!n&&(i?(t(s),r.trigger({type:"renditionenabled",metadata:o})):r.trigger({type:"renditiondisabled",metadata:o})),i};class h1{constructor(e,t,i){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Cs(s.main(),t),this.playlist=t,this.id=i,this.enabled=d1(e.playlists,t.id,n)}}const f1=function(r){r.representations=()=>{const e=r.playlistController_.main(),t=Bs(e)?r.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!Sl(i)).map((i,s)=>new h1(r,i,i.id)):[]}},fd=["seeking","seeked","pause","playing","error"];class p1 extends z.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Zt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],u={};o.forEach(p=>{u[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",u[p].reset),this.tech_.on(["seeked","seeking"],u[p].reset)});const d=p=>{["main","audio"].forEach(T=>{a[`${T}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(fd,n),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(fd,n),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",u[p].reset),this.tech_.off(["seeked","seeking"],u[p].reset)}),this.checkCurrentTimeTimeout_&&N.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&N.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=N.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),n=Jv(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,n){const a={bufferedRanges:s};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:nr(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Ei>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(_t([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),s=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(s&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const k=t.start(0);n=k+(k===t.end(0)?0:Ei)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${wf(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),u=a.audioBuffer?a.audioBuffered():null,d=a.videoBuffer?a.videoBuffered():null,p=this.media(),T=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Si)*2,A=[u,d];for(let k=0;k<A.length;k++){if(!A[k])continue;if(bl(A[k],i)<T)return!1}const b=fn(o,i);return b.length===0?!1:(n=b.start(0)+Ei,this.logger_(`Buffered region starts (${b.start(0)}) just beyond seek point (${i}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=br(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=fn(s,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Ei;const a=!i.endList,o=typeof i.partTargetDuration=="number";return a&&(o||s)&&(n=e.end(e.length-1)+i.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const n=br(e,i-3),a=br(e,i),o=br(t,i);o.length&&!a.length&&n.length&&(s={start:n.end(0),end:o.end(0)})}else fn(e,i).length||(s=this.gapFromVideoUnderflow_(e,i));return s?(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=fn(t,i);if(this.resetTimeUpdate_(),s.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+Si);const n={gapInfo:{from:i,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=Xv(e);for(let s=0;s<i.length;s++){const n=i.start(s),a=i.end(s);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const m1={errorInterval:30,getSource(r){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return r(t)}},yp=function(r,e){let t=0,i=0;const s=Oe(m1,e);r.ready(()=>{r.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&r.currentTime(i)},a=function(p){p!=null&&(i=r.duration()!==1/0&&r.currentTime()||0,r.one("loadedmetadata",n),r.src(p),r.trigger({type:"usage",name:"vhs-error-reload"}),r.play())},o=function(){if(Date.now()-t<s.errorInterval*1e3){r.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||typeof s.getSource!="function"){z.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),s.getSource.call(r,a)},u=function(){r.off("loadedmetadata",n),r.off("error",o),r.off("dispose",u)},d=function(p){u(),yp(r,p)};r.on("error",o),r.on("dispose",u),r.reloadSourceOnError=d},g1=function(r){yp(this,r)};var _p="3.16.2",y1="7.1.0",_1="1.3.1",T1="7.2.0",v1="4.0.2";const it={PlaylistLoader:xr,Playlist:Bt,utils:xb,STANDARD_PLAYLIST_SELECTOR:td,INITIAL_PLAYLIST_SELECTOR:h2,lastBandwidthSelector:td,movingAverageBandwidthSelector:c2,comparePlaylistBandwidth:Al,comparePlaylistResolution:u2,xhr:Hf()};Object.keys(gt).forEach(r=>{Object.defineProperty(it,r,{get(){return z.log.warn(`using Vhs.${r} is UNSAFE be sure you know what you are doing`),gt[r]},set(e){if(z.log.warn(`using Vhs.${r} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){z.log.warn(`value of Vhs.${r} must be greater than or equal to 0`);return}gt[r]=e}})});const Tp="videojs-vhs",vp=function(r,e){const t=e.media();let i=-1;for(let s=0;s<r.length;s++)if(r[s].id===t.id){i=s;break}r.selectedIndex_=i,r.trigger({selectedIndex:i,type:"change"})},b1=function(r,e){e.representations().forEach(t=>{r.addQualityLevel(t)}),vp(r,e.playlists)};it.canPlaySource=function(){return z.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const x1=(r,e,t)=>{if(!r)return r;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Un(Ti(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const s=Pr(i.video),n=Pr(i.audio),a={};for(const o in r)a[o]={},n&&(a[o].audioContentType=n),s&&(a[o].videoContentType=s),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof r[o]=="string"&&(a[o].url=r[o]);return Oe(r,a)},S1=(r,e)=>r.reduce((t,i)=>{if(!i.contentProtection)return t;const s=e.reduce((n,a)=>{const o=i.contentProtection[a];return o&&o.pssh&&(n[a]={pssh:o.pssh}),n},{});return Object.keys(s).length&&t.push(s),t},[]),E1=({player:r,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!r.eme.initializeMediaKeys)return Promise.resolve();const s=t?i.concat([t]):i,n=S1(s,Object.keys(e)),a=[],o=[];return n.forEach(u=>{o.push(new Promise((d,p)=>{r.tech_.one("keysessioncreated",d)})),a.push(new Promise((d,p)=>{r.eme.initializeMediaKeys({keySystems:u},T=>{if(T){p(T);return}d()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},C1=({player:r,sourceKeySystems:e,media:t,audioMedia:i})=>{const s=x1(e,t,i);return s?(r.currentSource().keySystems=s,s&&!r.eme?(z.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},bp=()=>{if(!N.localStorage)return null;const r=N.localStorage.getItem(Tp);if(!r)return null;try{return JSON.parse(r)}catch{return null}},A1=r=>{if(!N.localStorage)return!1;let e=bp();e=e?Oe(e,r):r;try{N.localStorage.setItem(Tp,JSON.stringify(e))}catch{return!1}return e},w1=r=>r.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(r.substring(r.indexOf(",")+1)):r,xp=(r,e)=>{r._requestCallbackSet||(r._requestCallbackSet=new Set),r._requestCallbackSet.add(e)},Sp=(r,e)=>{r._responseCallbackSet||(r._responseCallbackSet=new Set),r._responseCallbackSet.add(e)},Ep=(r,e)=>{r._requestCallbackSet&&(r._requestCallbackSet.delete(e),r._requestCallbackSet.size||delete r._requestCallbackSet)},Cp=(r,e)=>{r._responseCallbackSet&&(r._responseCallbackSet.delete(e),r._responseCallbackSet.size||delete r._responseCallbackSet)};it.supportsNativeHls=(function(){if(!he||!he.createElement)return!1;const r=he.createElement("video");return z.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(r.canPlayType(t))}):!1})();it.supportsNativeDash=(function(){return!he||!he.createElement||!z.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(he.createElement("video").canPlayType("application/dash+xml"))})();it.supportsTypeNatively=r=>r==="hls"?it.supportsNativeHls:r==="dash"?it.supportsNativeDash:!1;it.isSupported=function(){return z.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};it.xhr.onRequest=function(r){xp(it.xhr,r)};it.xhr.onResponse=function(r){Sp(it.xhr,r)};it.xhr.offRequest=function(r){Ep(it.xhr,r)};it.xhr.offResponse=function(r){Cp(it.xhr,r)};const D1=z.getComponent("Component");class Ap extends D1{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Zt("VhsHandler"),t.options_&&t.options_.playerId){const s=z.getPlayer(t.options_.playerId);this.player_=s}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(he,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const n=he.fullscreenElement||he.webkitFullscreenElement||he.mozFullScreenElement||he.msFullscreenElement;n&&n.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Oe(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=bp();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=gt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===gt.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=w1(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=it,this.options_.sourceType=Kd(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new c1(this.options_);const i=Oe({liveRangeSafeTimeDelta:Ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new p1(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=z.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),n.error(a)});const s=this.options_.bufferBasedABR?it.movingAverageBandwidthSelector(.55):it.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=it.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(n){this.playlistController_.selectPlaylist=n.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(n){this.playlistController_.mainSegmentLoader_.throughput.rate=n,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let n=this.playlistController_.mainSegmentLoader_.bandwidth;const a=N.navigator.connection||N.navigator.mozConnection||N.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=o&&n>=o?n=Math.max(n,u):n=u}return n},set(n){this.playlistController_.mainSegmentLoader_.bandwidth=n,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const n=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(n+a))},set(){z.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>nr(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>nr(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&A1({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{f1(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=N.URL.createObjectURL(this.playlistController_.mediaSource),(z.browser.IS_ANY_SAFARI||z.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),E1({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=C1({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=z.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{b1(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{vp(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":_p,"mux.js":y1,"mpd-parser":_1,"m3u8-parser":T1,"aes-decrypter":v1}}version(){return this.constructor.version()}canChangeType(){return fp.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&N.URL.revokeObjectURL&&(N.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Ib({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Xf({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{xp(this.xhr,e)},this.xhr.onResponse=e=>{Sp(this.xhr,e)},this.xhr.offRequest=e=>{Ep(this.xhr,e)},this.xhr.offResponse=e=>{Cp(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,s=>{this.player_.trigger(ot({},s))})}),t.forEach(i=>{this.playbackWatcher_.on(i,s=>{this.player_.trigger(ot({},s))})})}}const qn={name:"videojs-http-streaming",VERSION:_p,canHandleSource(r,e={}){const t=Oe(z.options,e);return!t.vhs.experimentalUseMMS&&!vs("avc1.4d400d,mp4a.40.2",!1)?!1:qn.canPlayType(r.type,t)},handleSource(r,e,t={}){const i=Oe(z.options,t);return e.vhs=new Ap(r,e,i),e.vhs.xhr=Hf(),e.vhs.setupXhrHooks_(),e.vhs.src(r.src,r.type),e.vhs},canPlayType(r,e){const t=Kd(r);if(!t)return"";const i=qn.getOverrideNative(e);return!it.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(r={}){const{vhs:e={}}=r,t=!(z.browser.IS_ANY_SAFARI||z.browser.IS_IOS),{overrideNative:i=t}=e;return i}},I1=()=>vs("avc1.4d400d,mp4a.40.2",!0);I1()&&z.getTech("Html5").registerSourceHandler(qn,0);z.VhsHandler=Ap;z.VhsSourceHandler=qn;z.Vhs=it;z.use||z.registerComponent("Vhs",it);z.options.vhs=z.options.vhs||{};(!z.getPlugin||!z.getPlugin("reloadSourceOnError"))&&z.registerPlugin("reloadSourceOnError",g1);class k1{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const i=e.childNodes[t];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i;break}}}}function wp(r,e){const t=[];for(const i in r.childNodes){const s=r.childNodes[i];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function P1(r){if(!r||!r.childNodes)return{};const e=r.childNodes,t=[];for(const s in e){const n=e[s];n.nodeName==="#cdata-section"&&t.push(n)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let i="";for(const s in e){const n=e[s];switch(n.nodeName){case"#text":i+=n.textContent.trim();break;case"#cdata-section":i+=n.data;break}}return i}function wl(r){const e={attributes:{},children:{},value:{}};e.value=P1(r);const t=r.attributes;if(t)for(const s in t){const n=t[s];n.nodeName&&n.nodeValue!==void 0&&n.nodeValue!==null&&(e.attributes[n.nodeName]=n.nodeValue)}const i=r.childNodes;if(i)for(const s in i){const n=i[s];n.nodeName&&n.nodeName.substring(0,1)!=="#"&&(e.children[n.nodeName]=wl(n))}return e}class R1{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const i=e.childNodes[t];switch(i.localName){case"AdSource":this.adSource=new k1(i);break;case"TrackingEvents":for(const s in i.childNodes){const n=i.childNodes[s];n.localName==="Tracking"&&this.trackingEvents.push({event:n.getAttribute("event"),uri:(n.textContent||n.text||"").trim()})}break;case"Extensions":this.extensions=wp(i,"Extension").map(s=>wl(s));break}}}track(e,t){for(const i in this.trackingEvents){const s=this.trackingEvents[i];if(s.event===e){let{uri:n}=s;s.event==="error"&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class L1{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const i=e.documentElement.childNodes[t];switch(i.localName){case"AdBreak":this.adBreaks.push(new R1(i));break;case"Extensions":this.extensions=wp(i,"Extension").map(s=>wl(s));break}}}}const N1=(r,e)=>{const t=goog.pal,i=new t.ConsentSettings;i.allowStorage=!1;const s=new t.NonceLoader(i);return async()=>{try{const n=new URL(e),a=new t.NonceRequest;let o=localStorage.getItem("sl-device-id")||cs.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=cs.v4(),sessionStorage.setItem("sl-ad-session-id",u)),cs.validate(o)||(o=cs.v5(`https://${o}`,cs.v5.URL)),n.searchParams.get("url")||n.searchParams.set("url","https://streamlayer.io"),n.searchParams.get("description_url")||n.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=n.searchParams.get("vpa")==="auto",a.adWillPlayMuted=n.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=n.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=o,a.supportedApiFrameworks="2,7,9",a.videoHeight=r.clientHeight,a.videoWidth=r.clientWidth;const d=await s.loadNonceManager(a);return n.searchParams.get("is_lat")==="[placeholder]"&&n.searchParams.set("is_lat","1"),n.searchParams.get("rdid")==="[placeholder]"&&n.searchParams.set("rdid",o),n.searchParams.get("correlator")==="[placeholder]"&&n.searchParams.set("correlator",u),n.searchParams.set("wta","1"),n.searchParams.set("givn",d.getNonce()),{url:n,manager:d}}catch(n){console.log("AdsManager could not be started",n);return}}},O1=new cy,B1=r=>r.creatives.find(e=>e.mediaFiles),M1=r=>{const e=r?.mediaFiles;return e?.length&&e.find(t=>t.fileURL)?.fileURL||""},gs=Uo.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),F1=(r,e)=>{const[t,i]=Fe.useState(),s=Fe.useRef(Date.now()),n=Fe.useRef(Date.now());return Fe.useEffect(()=>{if(!e||!r?.current)return;const a=N1(r.current,e),o=Date.now();s.current=o,gs.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(u=>{s.current===o&&u&&(i(u.url),gs.set({ads:[],autoplay:!0,muted:!1,nonceManager:u.manager}))}).catch(u=>{console.error(u)})},[r,e]),Fe.useEffect(()=>{const a=async(o,u)=>{let d=[];if(o.searchParams.get("output")==="vmap"){const b=await fetch(o.toString()),k=new DOMParser,v=await b.text(),L=k.parseFromString(v,"text/xml");d=new L1(L).adBreaks.map(U=>U.adSource.adTagURI.uri)}else d=[o.toString()];const p=await Promise.all(d.map((b,k)=>O1.get(b).then(v=>{if(n.current===u){const L=v.ads.find(F=>F.creatives.length>0);if(!L)return;const U=B1(L),$=M1(U);return{creative:U,order:k,mediaFileUrl:$,ad:L,raw:v}}}))),T=o.searchParams.get("vpa")!=="click",A=o.searchParams.get("vpmute")==="1";gs.set({...gs.get(),ads:p.filter(b=>!!b),autoplay:T,muted:A})};if(t){const o=Date.now();n.current=o,a(t,o)}return()=>{n.current=0}},[t]),gs},U1=r=>{const e=Fe.useRef();return Fe.useEffect(()=>{if(!e.current&&r.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),r.current.appendChild(t),e.current=z(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},Dp={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:r=>{},playMuted:!1,muted:!1,autoplay:!0},Xe=Uo.f(Dp),pd=r=>{if(!r)return 0;const e=r.duration(),t=r.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},$1=(r,e)=>{const t=F1(r,e),i=U1(r),s=Fe.useRef(),n=Fe.useRef(!1),a=Fe.useRef(!1),o=Fe.useCallback(()=>{if(a.current)return;const b=t.get().nonceManager;if(b&&n.current)try{b.sendPlaybackEnd()}catch(k){console.warn("[PAL] sendPlaybackEnd failed",k)}a.current=!0},[t]),u=Fe.useCallback(()=>{o(),i.current&&(i.current.pause(),i.current.src(void 0)),s.current=void 0,Xe.set({...Dp,reset:u})},[i,o]);Fe.useEffect(()=>{Xe.setKey("reset",u)},[u]);const d=Fe.useCallback(()=>{const{adPosition:b,adCount:k}=Xe.get();if(i.current){if(b<k){const v=b+1,{ads:L,muted:U,autoplay:$,nonceManager:F}=t.get(),H=L[v-1];if(H){s.current?.complete(),s.current=new dy(null,H.ad,H.creative),s.current.on("clickthrough",B=>{if(F)try{F.sendAdClick()}catch(V){console.warn("[PAL] sendAdClick failed",V)}window.open(B,"_blank")}),Xe.setKey("adPosition",v),Xe.setKey("playMuted",U),Xe.setKey("skipDelay",H.creative.skipDelay||0),Xe.setKey("time",0),Xe.setKey("adAction",B=>{s.current&&s.current.click(null,{CLICKPOS:[B.clientX,B.clientY]})}),Xe.setKey("whyThisAd",H.creative.icons.find(B=>B.program==="GoogleWhyThisAd")||null),Xe.setKey("hasAdUrl",!!H.creative.videoClickThroughURLTemplate?.url),i.current.src(H.mediaFileUrl),Xe.setKey("playing",!0),b===0?(Xe.setKey("muted",U),Xe.setKey("autoplay",$),U&&i.current.muted(!0),$?i.current.play():(i.current.pause(),Xe.setKey("paused",!0))):i.current.play();return}}s.current?.complete(),u()}},[i,u,t]),p=Fe.useCallback(()=>{if(!i.current)return;const b=i.current.muted();i.current.muted(!b),Xe.setKey("muted",!b),s.current&&s.current.setMuted(!b)},[i]),T=Fe.useCallback(()=>{i.current&&(i.current.paused()?(i.current.play(),s.current&&s.current.setPaused(!1)):(i.current.pause(),s.current&&s.current.setPaused(!0)))},[i]),A=Fe.useCallback(()=>{i.current&&(s.current&&s.current.skip(),d())},[d,i]);return Fe.useEffect(()=>{const b=i.current;if(!b)return()=>{};const k=B=>{if(Xe.setKey("playing",!0),Xe.setKey("paused",!1),Xe.setKey("time",pd(B.target.player)),!n.current){const V=t.get().nonceManager;if(V)try{V.sendPlaybackStart(),n.current=!0,a.current=!1}catch(G){console.warn("[PAL] sendPlaybackStart failed",G)}}},v=()=>{s.current?.complete(),d()},L=B=>{Xe.setKey("muted",B.target.player.muted())},U=()=>{Xe.setKey("paused",!0)},$=B=>{B.target.tagName==="VIDEO"&&(Xe.get().autoplay||T())},F=B=>{Xe.setKey("time",pd(B.target.player)),s.current&&s.current.setProgress(B.target.player.currentTime())},H=()=>{u()};return b.on("play",k),b.on("ended",v),b.on("muted",L),b.on("pause",U),b.on("click",$),b.on("timeupdate",F),b.on("error",H),()=>{b.off("play",k),b.off("ended",v),b.off("muted",L),b.off("pause",U),b.off("click",$),b.off("timeupdate",F),b.off("error",H)}},[T,d,i,u,t]),Fe.useEffect(()=>t.subscribe(b=>{b&&(n.current=!1,a.current=!1,Xe.setKey("adCount",b.ads.length),Xe.setKey("adPosition",0),d())}),[t,i,d]),Fe.useEffect(()=>()=>{u()},[u]),[Xe,p,T,A,s]},j1=({promotion:r,onClose:e,promotionId:t,externalAd:i,skipAutoClose:s})=>{const n=Fe.useRef(null),[a,o,u,d]=$1(n,i?.url),{time:p,adCount:T,adPosition:A,skipDelay:b,playing:k,paused:v,reset:L,muted:U,playMuted:$,autoplay:F,whyThisAd:H,hasAdUrl:B,adAction:V}=ge.useStore(a),G=r.sponsor?.logo&&r.logoMode===Ce.PromotionLogoMode.CENTER;return ae.jsxs(Sd,{className:"PromoOverlay",children:[ae.jsxs(Ed,{children:[ae.jsx(Cd,{className:ge.cx_default(!G&&Ad),children:ae.jsx(Dd,{style:{transform:"scale(1.5)"},children:"Ad"})}),ae.jsxs(G0,{children:[ae.jsx(F0,{time:p,adCount:T,adPosition:A}),!!b&&k&&ae.jsx(vn.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{d()},duration:b,isPlaying:!v,skipIcon:!0}),s&&ae.jsx(vn.y,{className:"ClosePromoIcon",close:()=>{L(),e?.()}})]})]}),ae.jsx(wd,{className:ge.cx_default(xu,k&&Su,!k&&Eu),children:ae.jsxs(W0,{ref:n,children:[H&&ae.jsx($0,{whyThisAd:H}),ae.jsxs(j0,{style:H?.xPosition==="right"?{left:"8px"}:{right:"8px"},children:[$&&ae.jsx(V0,{className:ge.cx_default(!U&&"muted"),onClick:()=>o()}),v&&!F&&ae.jsx(z0,{onClick:()=>u()})]})]})}),B&&ae.jsx(Id,{className:ge.cx_default(xu,k&&Su,!k&&Eu),children:ae.jsx(kd,{as:"button",onClick:V,style:{backgroundColor:r.banner?.ctaButton?.color||"#009dc4",color:r.banner?.ctaButton?.textColor||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":r.type,target:"_blank",children:"Show more"})})]})},md=r=>{const{promotion:e,open:t,advertisementPaused:i,togglePause:s,controlVideo:n,skipAutoClose:a,promotionId:o,onClose:u,markAsViewed:d,externalAd:p,isEventFired:T,fireEvent:A,muted:b}=r,k=e.type===Ce.PromotionType.INGAME_IAB11_LBAR||e.type===Ce.PromotionType.INGAME_IAB11||e.type===Ce.PromotionType.INGAME_IAB11_SIDEBAR,v=e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.CENTER,L=!!e.banner?.video?.url,U=e.autoPlayVideo===Ce.AutoPlayVideo.ENABLED,$=e.playVideoMuted===Ce.PlayVideoMuted.ENABLED;if(Fe.useEffect(()=>{s?.(L||U),t?.()},[]),Fe.useEffect(()=>{o&&e.type&&d&&d()},[o,e.type,d]),Fe.useEffect(()=>()=>{n?.({muted:!1})},[n]),p)return ae.jsx(j1,{...r,externalAd:p});let F=e.banner?.url;F&&F.indexOf("http")!==0&&(F=`https://${F}`);let H=!0;return L&&(!i||!U?H=!0:H=!1),ae.jsxs(Sd,{className:"PromoOverlay",children:[ae.jsxs("div",{children:[ae.jsxs(Ed,{children:[ae.jsxs(Cd,{className:ge.cx_default(!v&&Ad),children:[e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT&&ae.jsx(Tu,{className:"PromoSponsorLogo",src:e.sponsor?.logo,alt:"promo"}),ae.jsxs(P0,{style:{paddingLeft:e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT?"0px":"8px"},children:[e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT&&ae.jsx(w0,{children:e.sponsor?.name}),ae.jsxs(R0,{className:"SponsorText",children:[ae.jsx(Dd,{children:"AD"}),ae.jsx(L0,{children:"SPONSORED"})]})]})]}),ae.jsx(vn.y,{className:"ClosePromoIcon",close:u,autoClose:e.closeTimer?.auto,duration:a?0:e.closeTimer?.seconds,isPlaying:H})]}),ae.jsxs(wd,{children:[v&&ae.jsx(Tu,{className:I0,src:e.sponsor?.logo,alt:"promo"}),ae.jsx(vu,{children:e.banner?.video?.url?ae.jsx(vn.Fe,{source:e.banner?.video?.url,poster:e.banner?.video?.thumbnailUrl,aspectRatio:k?"1/1":"2/1",onRender:()=>{T?.("video-rendered")||(_i.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:o,type:e.type}}),A?.("video-rendered"))},onQuartile:B=>{T?.(`video-quartile-${B}`)||(_i.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:o,type:e.type,quartile:B}}),A?.(`video-quartile-${B}`))},onMute:B=>{const V=B?"muted":"unmuted";T?.(V)||(_i.eventBus.emit("advertisement",{action:B?"videoMuted":"videoUnmuted",payload:{id:o,type:e.type}}),A?.(V))},onPause:()=>{U&&s?.(!0)},onReplay:()=>{T?.("replayed")||(_i.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:o,type:e.type}}),A?.("replayed"))},onPlay:()=>{T?.("played")||(_i.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:o,type:e.type}}),A?.("played")),s?.(!1),T?.("played")&&T?.("ended")&&!T?.("replayed")&&(_i.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:o,type:e.type}}),A?.("replayed"))},onEnd:()=>{T?.("ended")||(_i.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:o,type:e.type}}),A?.("ended"))},controlVideo:n,autoPlay:U,playMuted:$,muted:b}):e.banner?.imageUrl?ae.jsx(D0,{style:k?{aspectRatio:"1/1"}:{},src:e.banner?.imageUrl,alt:"promo"}):null}),!k&&ae.jsxs(vu,{children:[e.banner?.title&&ae.jsx(N0,{className:ge.cx_default("AdvTitle",v&&O0),children:e.banner?.title}),e.banner?.body&&ae.jsx(k0,{className:"AdvDescription",children:e.banner?.body})]})]})]}),e.buttonType===Ce.PromotionButtonType.BASIC&&ae.jsx(Id,{children:ae.jsx(kd,{href:F,style:{backgroundColor:e.banner?.ctaButton?.color||"#009dc4",color:e.banner?.ctaButton?.textColor||"#fff"},"data-a":"button","data-promo-id":o,"data-promo-type":e.type,target:"_blank",children:e.banner?.ctaButton?.label})})]})},q1=ge.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),V1=({children:r,direction:e,style:t,className:i,hiding:s})=>ae.jsx($o,{direction:e,style:t,hiding:s,className:i,children:ae.jsx(q1,{children:r})}),gd=r=>r?.type===Ce.PromotionType.INGAME_IAB11_LBAR||r?.type===Ce.PromotionType.INGAME_IAB21_LBAR,H1=r=>r?.type===Ce.PromotionType.INGAME_IAB11_SIDEBAR||r?.type===Ce.PromotionType.INGAME_IAB21_SIDEBAR,z1=r=>r?.type===Ce.PromotionType.INGAME_IAB11||r?.type===Ce.PromotionType.INGAME_IAB21,W1=({advertisement:r,close:e,skipTypeCheck:t,skipAutoClose:i,layoutMode:s="side-by-side",sidebar:n,isNotification:a,banner:o,markAsViewed:u,open:d,externalAd:p,controlVideo:T,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})=>r.promotion?a&&r.notification?ae.jsx(C0,{open:()=>d?.({fromNotification:!0}),notification:r.notification,promotionId:r.question.id,close:e}):!n&&!o&&(t||z1(r.promotion))?ae.jsx(A0,{className:"PromoOverlayContainer",children:ae.jsx(md,{markAsViewed:u,promotionId:r.question.id,promotion:r.promotion,onClose:e,open:d,skipAutoClose:i,externalAd:p,controlVideo:T,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})}):n&&(t||gd(r.promotion)||H1(r.promotion)||p)?ae.jsx(V1,{className:"PromoSidebarContainer",direction:n,hiding:!1,children:ae.jsx(md,{markAsViewed:u,promotionId:r.question.id,promotion:r.promotion,externalAd:p,onClose:e,open:d,controlVideo:T,skipAutoClose:i,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})}):o&&gd(r.promotion)?ae.jsx(_d,{promotionId:r.question.id,hiding:!1,promotion:r.promotion,direction:o,isEventFired:k,fireEvent:v}):null:null,yd=ge.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),G1=r=>{const e=r.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",i=e.getAttribute("data-promo-type")||Ce.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&_i.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:i}}),e.getAttribute("data-a")==="banner"&&_i.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:i}})}},K1=({gamification:r,advertisement:e,layoutMode:t,skipAutoClose:i,skipTypeCheck:s,sidebar:n,banner:a,notification:o,isMobileScreen:u,persistent:d,containerId:p,externalAd:T,controlVideo:A,muted:b})=>{const k=Fe.useRef(null),v=ge.useStore(e.$store),L=ge.useStore(r.openedQuestion.$store);Uo.A(k,{enabled:!!v.data,event:"click",listener:G1});const U=v.data?.question?.backgroundImage?.landscapeUrl||v.data?.promotion?.backgroundImageLandscapeUrl,$=v.data?.question?.backgroundImage?.portraitUrl||v.data?.promotion?.backgroundImagePortraitUrl,F=vg.y({containerId:p,landscapeUrl:U,portraitUrl:$});if(L?.attributes?.adUnit===Ce.AdUnit.STANDART&&L?.attributes?.adPromotion?.banner?.imageUrl)return a?ae.jsx(yd,{ref:k,style:{height:"100%"},className:ge.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view"),children:ae.jsx(Og,{cardId:L.id,promotion:{...L?.attributes?.adPromotion,adUnit:L?.attributes?.adUnit}})}):null;const H=!a&&!n;if(v.data===void 0||!d&&v.isViewed)return null;const B=v?.data?.notification?.promotion?.mode===Ce.NotificationPromotionMode.LOWER_THIRD;return ae.jsxs(yd,{ref:k,style:{height:H?"auto":"100%"},className:ge.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",B&&"SL-AdvertisementUIWrap--lower-third"),children:[!o&&F,ae.jsx(W1,{skipTypeCheck:s,sidebar:n,banner:a,advertisement:v.data,advertisementPaused:!!v.isPaused,togglePause:v.togglePause,isEventFired:v.isEventFired,fireEvent:v.fireEvent,close:v.close,externalAd:T?v.externalAd:void 0,markAsViewed:r.advertisement?.markAsViewed,open:r.advertisement?.open,layoutMode:t,isNotification:o,skipAutoClose:i,controlVideo:A,muted:b})]})},Ip=({sdk:r,sidebar:e,externalAd:t,banner:i,skipAutoClose:s,skipTypeCheck:n,layoutMode:a,isMobileScreen:o,persistent:u,notification:d,muted:p})=>{const T=ge.useStore(r.featuresList.getStore()),[A,b]=Fe.useState(!t),k=ge.useStore(r.options);if(Fe.useEffect(()=>{if(t){const L=document.createElement("script");L.async=!0,L.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(L),L.onload=()=>{b(!0)}}},[t]),e&&i)return ae.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(i&&t)return ae.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!T)return null;const v=r.getFeature(Ce.SdkOverlayType.GAMES);return!v?.advertisement||t&&!A?null:ae.jsx(K1,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:i,layoutMode:a,isMobileScreen:o,persistent:u,notification:d,skipTypeCheck:n,skipAutoClose:s,externalAd:t,controlVideo:r.controlVideoPlayer,containerId:k.containerId,muted:p})},X1=({event:r,sidebar:e,banner:t,isMobileScreen:i,skipAutoClose:s,persistent:n,theme:a,notification:o,skipTypeCheck:u,externalAd:d,muted:p=!1})=>{const T=gi.Y(),A=gi.q(),b=gi._();return T?d&&!A.promotionExternalAd?r!==void 0&&ae.jsx(gi.g,{event:r}):!d&&A.promotionExternalAd?r!==void 0&&ae.jsx(gi.g,{event:r}):e&&!A.promotionSidebar?r!==void 0&&ae.jsx(gi.g,{event:r}):t&&!A.promotionBanner?r!==void 0&&ae.jsx(gi.g,{event:r}):o&&!A.promotionNotification?r!==void 0&&ae.jsx(gi.g,{event:r}):!t&&!e&&!o&&!A.promotionOverlay&&!u?r!==void 0&&ae.jsx(gi.g,{event:r}):ae.jsxs("div",{className:"StreamLayerSDK",children:[ae.jsx(_g.h,{customTheme:a??b.theme,themeMode:b.themeMode,children:ae.jsx(Ip,{sdk:T,sidebar:e,banner:t,isMobileScreen:i,persistent:n,notification:o,skipTypeCheck:u,skipAutoClose:s,layoutMode:"side-by-side",externalAd:d,muted:p})}),r!==void 0&&ae.jsx(gi.g,{event:r})]}):null};exports.StreamLayerSDKAdvertisement=X1;exports.StreamLayerSDKAdvertisementUI=Ip;