mixdashboards 1.0.71 → 1.0.73

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 (470) hide show
  1. package/dist/{BaseComponent-D5tlYehc.js → BaseComponent-CBagahPU.js} +138 -109
  2. package/dist/BaseComponent-Chnv4fBT.cjs +1 -0
  3. package/dist/{EChartComponentBase-CAabYXSj.js → EChartComponentBase-cFfawl6h.js} +2 -2
  4. package/dist/{EChartComponentBase-D4wMej9X.cjs → EChartComponentBase-dLE5F7Tt.cjs} +1 -1
  5. package/dist/{EmergencyPlanPanel-Th4ZNdCb.js → EmergencyPlanPanel--jTGG89o.js} +1 -1
  6. package/dist/{EmergencyPlanPanel-D96XjhRq.cjs → EmergencyPlanPanel-BJb-Bbxh.cjs} +1 -1
  7. package/dist/{HistoryPlanDialog-rn2Bp0Gx.cjs → HistoryPlanDialog-C-QPdV4V.cjs} +1 -1
  8. package/dist/{HistoryPlanDialog-D2mQLhkO.js → HistoryPlanDialog-DerClU2U.js} +1 -1
  9. package/dist/{MonitoringMap-BZ98NYTJ.cjs → MonitoringMap-B6RMbiIS.cjs} +1 -1
  10. package/dist/{MonitoringMap-Coozb35G.js → MonitoringMap-CNaGsq83.js} +2 -2
  11. package/dist/UniverSheet-CM-vvc23.cjs +1 -0
  12. package/dist/{UniverSheet-CJCunVAM.js → UniverSheet-KI09RqKm.js} +16 -15
  13. package/dist/{accelerationChart-DacjcSHD.js → accelerationChart-D7KNk5fI.js} +61 -59
  14. package/dist/accelerationChart-HBCb2bRW.cjs +6 -0
  15. package/dist/{actionItem-d-4p5HZK.js → actionItem-BmNYzAXu.js} +48 -41
  16. package/dist/actionItem-Bx4mW0jP.cjs +1 -0
  17. package/dist/alarmLevelChart-Cvnw4z1w.cjs +2 -0
  18. package/dist/{alarmLevelChart-DddN1NVy.js → alarmLevelChart-DdSw2s7W.js} +91 -46
  19. package/dist/{alertTable-Q-Waa5jf.js → alertTable-CC3c8DFb.js} +40 -39
  20. package/dist/alertTable-hH6HA9pY.cjs +1 -0
  21. package/dist/aliasObjectSelectorDemo-C7E_fnCf.cjs +1 -0
  22. package/dist/{aliasObjectSelectorDemo-BZygQw9k.js → aliasObjectSelectorDemo-yDiavTpG.js} +11 -10
  23. package/dist/{annualRainfallChart-CthANCvn.js → annualRainfallChart-B9ar8vo8.js} +32 -30
  24. package/dist/annualRainfallChart-C6JLSPIf.cjs +1 -0
  25. package/dist/{aqi-C_HnKsjh.js → aqi-BNc5QCM3.js} +21 -19
  26. package/dist/{aqi-BFW_8xYd.cjs → aqi-DEiCVIVa.cjs} +3 -3
  27. package/dist/aqiIndass-Bowic_Pc.cjs +3 -0
  28. package/dist/{aqiIndass-NVRa3lmj.js → aqiIndass-CAGV8_Uf.js} +41 -40
  29. package/dist/{areaDeformCurve-mQiOHdtN.js → areaDeformCurve-CSpR060t.js} +51 -49
  30. package/dist/areaDeformCurve-CVy23kV2.cjs +1 -0
  31. package/dist/arrayCard-NqoQKcE9.cjs +1 -0
  32. package/dist/{arrayCard-DZitcjMs.js → arrayCard-PPDb7U6X.js} +29 -28
  33. package/dist/{audio-CDAMVEgC.js → audio-BJPFIQIr.js} +42 -41
  34. package/dist/audio-Bw-GaYe1.cjs +1 -0
  35. package/dist/{bar--JrlRud9.js → bar-C38h_mUA.js} +72 -70
  36. package/dist/{bar-C7uQADV1.cjs → bar-Cru6WosS.cjs} +2 -2
  37. package/dist/bmp-BXaEkkpa.cjs +1 -0
  38. package/dist/{bmp-DrVcnYxy.js → bmp-BnSOaFEr.js} +15 -14
  39. package/dist/box-CKuGsh2k.cjs +1 -0
  40. package/dist/{box-szcLhted.js → box-DIHVOqrV.js} +58 -57
  41. package/dist/chartConfigPanel-BVdVXbs6.cjs +1 -0
  42. package/dist/{chartConfigPanel-C32o1gyJ.js → chartConfigPanel-D1rO6SGh.js} +86 -79
  43. package/dist/{circleBar-CeL2rqMJ.cjs → circleBar-BzXqA-Cz.cjs} +3 -3
  44. package/dist/{circleBar-BmTjsLHo.js → circleBar-CBLcp4Xi.js} +27 -25
  45. package/dist/{clock-CuQpD76K.js → clock-4AMfFDGC.js} +35 -34
  46. package/dist/clock-DmWyBpo-.cjs +1 -0
  47. package/dist/clt-CmPPtp9c.cjs +1 -0
  48. package/dist/{clt-XCswxZ6i.js → clt-D5i_8-pq.js} +60 -59
  49. package/dist/cmc-8jH3DGv9.cjs +1 -0
  50. package/dist/{cmc-CXmAv6fz.js → cmc-Cjb5w3om.js} +23 -22
  51. package/dist/{cmp-Duz_v-LC.js → cmp-COJzlQPa.js} +19 -18
  52. package/dist/{cmp-DmpxjexT.cjs → cmp-CpmGtNal.cjs} +2 -2
  53. package/dist/{composite-CWgy-w61.js → composite-CsFgfxih.js} +37 -36
  54. package/dist/{composite-DdHASMFQ.cjs → composite-DLmzZNIj.cjs} +3 -3
  55. package/dist/{conclusionCard-BtB0rARK.js → conclusionCard-BQUlLFde.js} +15 -14
  56. package/dist/conclusionCard-C-TT6znN.cjs +1 -0
  57. package/dist/{controlList-C0AQ8Yb8.js → controlList-5D5UIDQL.js} +40 -38
  58. package/dist/controlList-CIwzKylK.cjs +1 -0
  59. package/dist/{controlRecordList-CSPKG1HU.js → controlRecordList-Cp5mmEQ1.js} +55 -53
  60. package/dist/controlRecordList-uEQ3ohmB.cjs +1 -0
  61. package/dist/controlRecordListAPP-B5d4x_xH.cjs +1 -0
  62. package/dist/controlRecordListAPP-p_skbQVD.js +502 -0
  63. package/dist/{crd-DQruf9o3.js → crd-8gRWMf2Y.js} +14 -13
  64. package/dist/crd-Dfl2XKAx.cjs +1 -0
  65. package/dist/{ctrBtn-jEWTt_f2.js → ctrBtn-BzmFxucy.js} +106 -107
  66. package/dist/ctrBtn-OOgL9esv.cjs +1 -0
  67. package/dist/{ctrSet-C4wCODMY.js → ctrSet-Btg2T9w6.js} +24 -23
  68. package/dist/ctrSet-CifyJt05.cjs +1 -0
  69. package/dist/ctrSwitch-6nMHbIE7.js +206 -0
  70. package/dist/ctrSwitch-C8mwxLPe.cjs +1 -0
  71. package/dist/{dataManagement-BQVZS7Hi.js → dataManagement-BZiSmktM.js} +52 -45
  72. package/dist/dataManagement-sQpuBaDz.cjs +1 -0
  73. package/dist/{dataReport-vP1LBJjE.js → dataReport-CbJzXeCE.js} +25 -24
  74. package/dist/{dataReport-DRopth3A.cjs → dataReport-D9Q9c43B.cjs} +2 -2
  75. package/dist/{dataTable-C2AgSR36.cjs → dataTable-BJ4SVFbu.cjs} +1 -1
  76. package/dist/{dataTable-B1FQ3XIq.js → dataTable-BuBB0b-A.js} +1 -1
  77. package/dist/datetime-B66VgJL1.cjs +1 -0
  78. package/dist/{datetime-DU3rzi1v.js → datetime-DO03QrXz.js} +25 -24
  79. package/dist/deepClusterSlipSurface-BqT55vkY.cjs +1 -0
  80. package/dist/{deepClusterSlipSurface-BHwB0eu9.js → deepClusterSlipSurface-DpSAXgFf.js} +45 -43
  81. package/dist/{deepDataMatrix-C3uKZmon.js → deepDataMatrix-CPrIOv5r.js} +46 -45
  82. package/dist/deepDataMatrix-DZZaTMbD.cjs +1 -0
  83. package/dist/{deepDisplacement3D-BBYgB-rK.cjs → deepDisplacement3D-Cd9nwwPt.cjs} +3 -3
  84. package/dist/{deepDisplacement3D-CDNPul6D.js → deepDisplacement3D-JlMej7-5.js} +9 -7
  85. package/dist/{deepDisplacementChart-C_pwwgIC.js → deepDisplacementChart-BiDt60xI.js} +89 -88
  86. package/dist/deepDisplacementChart-CALM3gna.cjs +5 -0
  87. package/dist/deepDisplacementChart-CEaj2bUV.cjs +6 -0
  88. package/dist/{deepDisplacementChart-C6GQHO-J.js → deepDisplacementChart-CjlGpeHj.js} +54 -52
  89. package/dist/{deepDisplacementView-C837RNer.js → deepDisplacementView-BpUw-b-i.js} +37 -36
  90. package/dist/deepDisplacementView-CoSNzN1q.cjs +8 -0
  91. package/dist/deepNodeTemperatureChart-DPN0rYir.cjs +1 -0
  92. package/dist/{deepNodeTemperatureChart-BcH3ZNi4.js → deepNodeTemperatureChart-DfZq7kLx.js} +50 -48
  93. package/dist/{deepTangentAngleChart-DSpCyIdq.js → deepTangentAngleChart-Ca01hah9.js} +92 -90
  94. package/dist/deepTangentAngleChart-Dg9PJspK.cjs +1 -0
  95. package/dist/deepTemperatureField-BqDB97SW.cjs +1 -0
  96. package/dist/{deepTemperatureField-B2qIHL1-.js → deepTemperatureField-CYBTjhEp.js} +95 -93
  97. package/dist/deepTrendChart-B5BAHTeY.cjs +1 -0
  98. package/dist/{deepTrendChart-DFGSV17a.js → deepTrendChart-DBjxV7_A.js} +56 -54
  99. package/dist/{deviceOnlineStatus-CiIFdo9I.js → deviceOnlineStatus-1eoHCl_-.js} +58 -50
  100. package/dist/deviceOnlineStatus-DHzaAzCp.cjs +2 -0
  101. package/dist/deviceStatus-4BMy4qBD.cjs +1 -0
  102. package/dist/{deviceStatus-Dd1pqVnO.js → deviceStatus-90rQa1uj.js} +61 -60
  103. package/dist/{displacementDataTable-CGIHGxye.js → displacementDataTable-BArwj-xp.js} +52 -51
  104. package/dist/displacementDataTable-BLWjiaRQ.cjs +1 -0
  105. package/dist/{displacementTrajectoryChart-RL97CTML.js → displacementTrajectoryChart-CxOPJVlD.js} +34 -32
  106. package/dist/displacementTrajectoryChart-DfJMOCFJ.cjs +22 -0
  107. package/dist/{displacementTrendChart-Bqnv7hiP.js → displacementTrendChart-4E6cDsX8.js} +49 -48
  108. package/dist/displacementTrendChart-Cuxa5iTp.cjs +5 -0
  109. package/dist/{dxf-BQoArgPS.cjs → dxf-BgklkksV.cjs} +1 -1
  110. package/dist/{dxf-DBu1iA-r.js → dxf-BogwbJID.js} +5 -4
  111. package/dist/{dzc-DMVPjosV.cjs → dzc-CApfzriC.cjs} +2 -2
  112. package/dist/{dzc-7tLxe18d.js → dzc-D7tTBLaA.js} +24 -22
  113. package/dist/emergencyPlan-BuFz4XFc.cjs +1 -0
  114. package/dist/{emergencyPlan-C9Edkw51.js → emergencyPlan-CjbuX-N5.js} +19 -18
  115. package/dist/evn-BcSenXF3.cjs +1 -0
  116. package/dist/{evn-CeLoYCUr.js → evn-DTPm72ZM.js} +23 -22
  117. package/dist/evolutionChart-CrwR8i40.cjs +1 -0
  118. package/dist/{evolutionChart-DAlncdLU.js → evolutionChart-D1dVKWOt.js} +25 -23
  119. package/dist/{fileViewer-BFMFEN2f.js → fileViewer-BNHwlZRa.js} +57 -56
  120. package/dist/fileViewer-BUuST3Rp.cjs +1 -0
  121. package/dist/filterBar-BJzjPFFg.cjs +1 -0
  122. package/dist/{filterBar-qJJKdxYE.js → filterBar-CRJinh5K.js} +44 -43
  123. package/dist/fireCombustionCurve-BGdJ1ybj.cjs +1 -0
  124. package/dist/{fireCombustionCurve-DyRikhHw.js → fireCombustionCurve-BZ6qJ1kq.js} +69 -67
  125. package/dist/fireFilterBar-DZejT0oL.cjs +1 -0
  126. package/dist/{fireFilterBar-DkjBGPXa.js → fireFilterBar-KvvbsCsZ.js} +25 -24
  127. package/dist/{fireHistoryTable-ldXil5up.js → fireHistoryTable-80ygqnOG.js} +73 -65
  128. package/dist/fireHistoryTable-CMSGKb3w.cjs +3 -0
  129. package/dist/gag-1bvAZ5m6.cjs +1 -0
  130. package/dist/{gag-KZfFHn72.js → gag-D2obj7AF.js} +30 -28
  131. package/dist/{gasStationList-Btoo_olJ.js → gasStationList-DM-laJsi.js} +527 -526
  132. package/dist/gasStationList-DjJtXnqL.cjs +1 -0
  133. package/dist/{geo3dViewer-Cif9uFqd.cjs → geo3dViewer-CL_89mQf.cjs} +1 -1
  134. package/dist/{geo3dViewer-iZhkCiTP.js → geo3dViewer-FhmMIvMJ.js} +12 -5
  135. package/dist/{glbModel-MJZgDSJf.js → glbModel-B0nWYYJQ.js} +19 -18
  136. package/dist/{glbModel-2xydaxDT.cjs → glbModel-DakMJal6.cjs} +3 -3
  137. package/dist/{globalObjectSelector-CHtYGpi9.js → globalObjectSelector-Gv4srHhp.js} +79 -78
  138. package/dist/globalObjectSelector-jNzZxdnL.cjs +1 -0
  139. package/dist/{gnssFilterBar-CPis6bUI.js → gnssFilterBar-C4rpyNw3.js} +70 -63
  140. package/dist/gnssFilterBar-kEIW7Tjs.cjs +1 -0
  141. package/dist/{gnssHistoryTable-kHZY48EZ.js → gnssHistoryTable-CyMwQJ7_.js} +58 -50
  142. package/dist/gnssHistoryTable-DRKlP8-b.cjs +3 -0
  143. package/dist/{gnssMapView-BNIkieqL.cjs → gnssMapView-DpExCi0x.cjs} +4 -4
  144. package/dist/{gnssMapView-DXP8yz0v.js → gnssMapView-EVufCGrW.js} +174 -167
  145. package/dist/{gnssSectionProfile-DEUDEvJ1.js → gnssSectionProfile-CaJwF9wp.js} +41 -34
  146. package/dist/gnssSectionProfile-DdcOMdNC.cjs +1 -0
  147. package/dist/{gnssTimeSeriesChart-C_xqd0su.js → gnssTimeSeriesChart-iffDvMNx.js} +57 -49
  148. package/dist/gnssTimeSeriesChart-y11Y8k2-.cjs +1 -0
  149. package/dist/{gnssXYTrajectory-GqgFw_qK.js → gnssXYTrajectory-C_1fuLWn.js} +53 -45
  150. package/dist/gnssXYTrajectory-DGBGGDwi.cjs +5 -0
  151. package/dist/grd-C4hCrpvH.cjs +1 -0
  152. package/dist/{grd-QCuVN1jE.js → grd-FfuMQJb7.js} +43 -42
  153. package/dist/{grdIndass-BEcfZTYw.js → grdIndass-BTbZmPLZ.js} +30 -29
  154. package/dist/grdIndass-CyuRKD5H.cjs +1 -0
  155. package/dist/{grg-CMVrF5tB.js → grg-CcnI5kRY.js} +27 -26
  156. package/dist/grg-Cuxa17d6.cjs +1 -0
  157. package/dist/gridview-CKjBuTRq.cjs +1 -0
  158. package/dist/{gridview-Cd3Tqzph.js → gridview-ffVc5Wvg.js} +32 -31
  159. package/dist/groundwaterFilterBar-D3l7GLVY.cjs +1 -0
  160. package/dist/{groundwaterFilterBar-D7lrbzDC.js → groundwaterFilterBar-DaPR-kbl.js} +13 -12
  161. package/dist/groundwaterProfileChart-BxJKIPXF.cjs +11 -0
  162. package/dist/{groundwaterProfileChart-Bjtqz-Zv.js → groundwaterProfileChart-DoSx7WWp.js} +42 -40
  163. package/dist/groundwaterTimeCurve-Bp5MxM9k.cjs +1 -0
  164. package/dist/{groundwaterTimeCurve-Bu6vgAaC.js → groundwaterTimeCurve-D-SdVYeq.js} +57 -55
  165. package/dist/{groupCard-CPvAsuPb.cjs → groupCard-BzUQ8xY0.cjs} +1 -1
  166. package/dist/{groupCard-DQvEe6cc.js → groupCard-COMEkzIb.js} +29 -28
  167. package/dist/headerBar-iFe0YQKE.cjs +1 -0
  168. package/dist/{headerBar-CGOtSvFn.js → headerBar-ouXO8bzC.js} +48 -47
  169. package/dist/{history-D6C3tSut.js → history-BZ869y2d.js} +18 -18
  170. package/dist/{history-9ToM-rJ6.cjs → history-MxYUUwkm.cjs} +1 -1
  171. package/dist/index-DVqMfQVc.cjs +612 -0
  172. package/dist/{index-Bdq33405.js → index-DwPJu6XM.js} +1159 -1128
  173. package/dist/{insarDeformChart-Ls-cdqaP.js → insarDeformChart-5BhCUq8L.js} +24 -17
  174. package/dist/insarDeformChart-Ca3AMsBk.cjs +1 -0
  175. package/dist/{insarImageViewer-Dnke9JDG.js → insarImageViewer-DHNxmLpa.js} +41 -34
  176. package/dist/insarImageViewer-DWPsoHz6.cjs +1 -0
  177. package/dist/{kds-B4BKGG0r.js → kds-BYZC4pIM.js} +57 -50
  178. package/dist/{kds-BjX5tXhF.cjs → kds-Dpf_3WWj.cjs} +2 -2
  179. package/dist/{kpiCard-C77vHJ_E.js → kpiCard-CStPtl-c.js} +5 -4
  180. package/dist/kpiCard-OLJgA48-.cjs +2 -0
  181. package/dist/{landslideMap-BEkbnCqP.js → landslideMap-BUq0x7rd.js} +34 -33
  182. package/dist/landslideMap-JTdoQjW-.cjs +1 -0
  183. package/dist/{landslideWarning-C5upI2cf.js → landslideWarning-VAn9XGUj.js} +55 -54
  184. package/dist/landslideWarning-ZA5LCsIr.cjs +1 -0
  185. package/dist/{layerTabs-DoGw1Jfv.js → layerTabs-CAJ6f-2W.js} +40 -38
  186. package/dist/layerTabs-CdhowHB1.cjs +1 -0
  187. package/dist/{leaflet-src-BUWIqhPn.cjs → leaflet-src-CxFQ_Cn7.cjs} +1 -1
  188. package/dist/{leaflet-src-DFE_g2gF.js → leaflet-src-DNO2-OsP.js} +1 -1
  189. package/dist/{lerc-CXc9KSRL.js → lerc-bF2jqjoV.js} +2 -2
  190. package/dist/{lerc-BBgQP785.cjs → lerc-qU4WKXeS.cjs} +1 -1
  191. package/dist/{lin-ClO2MqZl.cjs → lin-BHI2KgyW.cjs} +2 -2
  192. package/dist/{lin-Difz8N88.js → lin-DbQw7wZw.js} +20 -18
  193. package/dist/linIndass-CIrObeZT.cjs +2 -0
  194. package/dist/{linIndass-DqXVOBh3.js → linIndass-Cd9Hjzs_.js} +31 -30
  195. package/dist/lst-BRsEe-Hq.cjs +1 -0
  196. package/dist/{lst-4RMMZZkY.js → lst-C3C2m1v_.js} +40 -39
  197. package/dist/{manualEntry-B3_4Z-Lj.js → manualEntry-B8TDMcDg.js} +29 -22
  198. package/dist/manualEntry-C3_WtYz8.cjs +1 -0
  199. package/dist/{mapBackground-B3OHQsXZ.js → mapBackground-BrVIQUcT.js} +21 -20
  200. package/dist/{mapBackground-Bmt-oZt6.cjs → mapBackground-Du7R_ICY.cjs} +2 -2
  201. package/dist/{mappingList-DVj7H206.js → mappingList-BpJUawmv.js} +22 -20
  202. package/dist/mappingList-C5OZ8oUx.cjs +1 -0
  203. package/dist/{markdownViewer-fheM5uV4.js → markdownViewer-CoRrvdY7.js} +16 -15
  204. package/dist/{markdownViewer-BAuNEWRt.cjs → markdownViewer-D96bwxEt.cjs} +2 -2
  205. package/dist/materialFileUrl-CubtnHeq.js +108 -0
  206. package/dist/materialFileUrl-DfPNm265.cjs +1 -0
  207. package/dist/{mix-control-modal-BoYynGT2.cjs → mix-control-modal-DwxwW65v.cjs} +1 -1
  208. package/dist/{mix-control-modal-BBiKe4MM.js → mix-control-modal-Qg_mzyT_.js} +1 -1
  209. package/dist/{mixGrid-BUjP1qv2.js → mixGrid-CtJWul6c.js} +44 -43
  210. package/dist/mixGrid-Hj0OJjkg.cjs +1 -0
  211. package/dist/mixMap-CJzmC0IR.cjs +1 -0
  212. package/dist/{mixMap-DPIwyKuP.js → mixMap-E36SDnEa.js} +36 -35
  213. package/dist/mixModel-BMRxhvWn.cjs +3 -0
  214. package/dist/{mixModel-CIdQp4V9.js → mixModel-_McJ6OuH.js} +30 -29
  215. package/dist/{mixPie-C6OhdOCV.js → mixPie-CMOkAe9p.js} +31 -30
  216. package/dist/mixPie-MAKXeYVp.cjs +2 -0
  217. package/dist/mixdashboards.cjs +1 -1
  218. package/dist/mixdashboards.css +1 -1
  219. package/dist/mixdashboards.js +1 -1
  220. package/dist/mixiotObjectListApi-BaeBL318.js +82 -0
  221. package/dist/mixiotObjectListApi-D9OyHNQ3.cjs +1 -0
  222. package/dist/mjpegCamera-BY7pmbDc.cjs +1 -0
  223. package/dist/{mjpegCamera-Cd1vhZ5v.js → mjpegCamera-Dc4IsJA6.js} +12 -11
  224. package/dist/monitorAlert-DVNvJyTy.cjs +1 -0
  225. package/dist/{monitorAlert-DIJtH557.js → monitorAlert-F8QFOchR.js} +45 -44
  226. package/dist/monitorData-AkPbhJ9q.cjs +1 -0
  227. package/dist/{monitorData-B6jhpzVK.js → monitorData-BzqNIdrW.js} +61 -59
  228. package/dist/{monitorSpeedChart-DF5zvxs9.js → monitorSpeedChart-348U37LW.js} +22 -21
  229. package/dist/{monitorSpeedChart-EIcGs3NX.cjs → monitorSpeedChart-DVH1xihw.cjs} +2 -2
  230. package/dist/{mxa-COxjxwpC.js → mxa-CkJjCHA-.js} +29 -27
  231. package/dist/{mxa-BfwIV49n.cjs → mxa-DShU528J.cjs} +2 -2
  232. package/dist/myValue-BCeycpdO.cjs +1 -0
  233. package/dist/{myValue-Crba15Wc.js → myValue-CEfp19i2.js} +17 -16
  234. package/dist/myValueList-CAPOW8TK.cjs +1 -0
  235. package/dist/{myValueList-m2yaIcuf.js → myValueList-y3GR4AX2.js} +41 -40
  236. package/dist/objectList-4rYQk5uq.cjs +1 -0
  237. package/dist/{objectList-BwZJzrXs.js → objectList-D16yLbzD.js} +538 -599
  238. package/dist/objectListAPP-DCwTyqFp.js +1864 -0
  239. package/dist/objectListAPP-Db5beOAM.cjs +1 -0
  240. package/dist/photo-BV6rkbWO.js +811 -0
  241. package/dist/photo-D67wLRkY.cjs +1 -0
  242. package/dist/{pie-CSLVJv0Y.cjs → pie-BeRwVkTk.cjs} +2 -2
  243. package/dist/{pie-C9MU90ON.js → pie-bNKhq6ak.js} +16 -14
  244. package/dist/{placeholder-CRARTMF4.js → placeholder-_iK4rVyU.js} +26 -25
  245. package/dist/placeholder-zByzfWaH.cjs +1 -0
  246. package/dist/{pressBtn-CkYcW1a8.js → pressBtn-B-rZPXK2.js} +124 -124
  247. package/dist/pressBtn-BjqYIPC-.cjs +1 -0
  248. package/dist/processTable-ByPlSKRJ.cjs +3 -0
  249. package/dist/{processTable-BgAhGGAq.js → processTable-s_y8uups.js} +12 -11
  250. package/dist/{progressBar-BbDFps1r.cjs → progressBar-CRdA7oJT.cjs} +1 -1
  251. package/dist/{progressBar-CIPUVeaf.js → progressBar-DskxZk1P.js} +19 -18
  252. package/dist/{progressCircle-DDc5zsd6.js → progressCircle-BE_Am-AP.js} +13 -12
  253. package/dist/{progressCircle-CgkZ1EC1.cjs → progressCircle-CHe-12Hb.cjs} +1 -1
  254. package/dist/{qrcode-CQbWGVgq.cjs → qrcode-D8cFyUpL.cjs} +1 -1
  255. package/dist/{qrcode-CCu677Ad.js → qrcode-Dgth6KwU.js} +39 -38
  256. package/dist/{raceBar-CzNGSYCt.cjs → raceBar-CeybrpCB.cjs} +3 -3
  257. package/dist/{raceBar-Cn8oPhCE.js → raceBar-DV-3KFg2.js} +18 -16
  258. package/dist/rad-BerkC70H.cjs +1 -0
  259. package/dist/{rad-D_cLWeMk.js → rad-BhsfF0XI.js} +22 -20
  260. package/dist/{radarMapViewer-BaAXjsWx.js → radarMapViewer-C2dde8EN.js} +82 -81
  261. package/dist/radarMapViewer-HWzvBTzT.cjs +1 -0
  262. package/dist/{rainfallFilterBar-Bhpadat8.js → rainfallFilterBar-CiT1mvYh.js} +22 -21
  263. package/dist/rainfallFilterBar-kuAQO0M-.cjs +1 -0
  264. package/dist/rainfallTimeCurve-7uHaSkuE.cjs +1 -0
  265. package/dist/{rainfallTimeCurve-sDYapogL.js → rainfallTimeCurve-BlOnCq2M.js} +58 -56
  266. package/dist/rangeLin-BQeWFL_E.cjs +3 -0
  267. package/dist/{rangeLin-CdMOPwMP.js → rangeLin-BvKd8kEv.js} +32 -31
  268. package/dist/realtimeEvolutionMap-BUnD3JjE.cjs +1 -0
  269. package/dist/{realtimeEvolutionMap-CIH_sZ29.js → realtimeEvolutionMap-DZ6yniwl.js} +46 -44
  270. package/dist/regionBar-mMaN5NEc.cjs +3 -0
  271. package/dist/{regionBar-VB-2GpR0.js → regionBar-vp5D52Jd.js} +14 -13
  272. package/dist/{request-BHfDxLXZ.js → request-CMbwWTDF.js} +9 -9
  273. package/dist/{request-DU8pRyvu.cjs → request-DegEaaCG.cjs} +1 -1
  274. package/dist/retainer1-CF2Tr7Zt.cjs +1 -0
  275. package/dist/{retainer1-C_109Weq.js → retainer1-Xvdlh-B_.js} +17 -16
  276. package/dist/retainer2-BQVUhgcH.cjs +1 -0
  277. package/dist/{retainer2-BiHUTumr.js → retainer2-D3a-c_BA.js} +43 -42
  278. package/dist/{retainerRecordList-Cgil_g8a.js → retainerRecordList-BJbPsJ4D.js} +47 -45
  279. package/dist/retainerRecordList-Rqnoz6_6.cjs +1 -0
  280. package/dist/retainerRecordListAPP-B4IDQK3C.cjs +1 -0
  281. package/dist/retainerRecordListAPP-CNntGyA-.js +1068 -0
  282. package/dist/{ringTopN-C9AH-t3T.js → ringTopN-BFKlXqGX.js} +18 -16
  283. package/dist/ringTopN-CsouIsk1.cjs +1 -0
  284. package/dist/{riskRegionTable-Co1uxMzf.js → riskRegionTable-B6k4uM0_.js} +26 -19
  285. package/dist/riskRegionTable-DttMvHe5.cjs +1 -0
  286. package/dist/sankey-CAuBQaYh.cjs +1 -0
  287. package/dist/{sankey-Bag0ladh.js → sankey-DEQK7uU6.js} +17 -15
  288. package/dist/{scd-D9AiOiPg.js → scd-D5TicpCZ.js} +1282 -1062
  289. package/dist/scd-qaap6hGW.cjs +1 -0
  290. package/dist/{sideMenu-869HFB0p.js → sideMenu-ByyrOOYh.js} +28 -27
  291. package/dist/sideMenu-D-73DoYb.cjs +1 -0
  292. package/dist/{slopeStability-bZ0lHLjZ.js → slopeStability-BtgMH3oW.js} +44 -42
  293. package/dist/slopeStability-CTN6Kpva.cjs +1 -0
  294. package/dist/speedCurve-C5NoQCjK.cjs +1 -0
  295. package/dist/{speedCurve-DZ52XKCk.js → speedCurve-CInn7NAC.js} +43 -41
  296. package/dist/staticLine-BC-zj5yZ.cjs +1 -0
  297. package/dist/{staticLine-CyPnmKCh.js → staticLine-CLqN4lpU.js} +51 -50
  298. package/dist/stressFilterBar-Cpfbmllu.cjs +1 -0
  299. package/dist/{stressFilterBar-BAUt2bGy.js → stressFilterBar-D_QqOHna.js} +46 -45
  300. package/dist/{stressTimeCurve-IW4ArsyA.js → stressTimeCurve-1HXHUj-F.js} +64 -62
  301. package/dist/stressTimeCurve-Bp6Cevk1.cjs +1 -0
  302. package/dist/{swiper-BPS9C2GV.cjs → swiper-B8YZ2VQ2.cjs} +1 -1
  303. package/dist/{swiper-RM0GoZkW.js → swiper-D_y4Fj_D.js} +25 -24
  304. package/dist/terminalConfigList-B39cEptG.cjs +1 -0
  305. package/dist/{terminalConfigList-n7NE5NdJ.js → terminalConfigList-CHbA4y-S.js} +38 -36
  306. package/dist/terminalList-Vf-Dbybr.cjs +1 -0
  307. package/dist/{terminalList-Byb4eLcD.js → terminalList-oJFrGVtT.js} +38 -36
  308. package/dist/terminalListAPP-CdBG8krw.cjs +1 -0
  309. package/dist/terminalListAPP-DWArp2D4.js +1366 -0
  310. package/dist/{textbox-DM1AUWw8.js → textbox-D8nmoGjG.js} +13 -12
  311. package/dist/textbox-DPoyxB4u.cjs +1 -0
  312. package/dist/{timeQueryBar-Tbd9M8UT.js → timeQueryBar-DyC0iHq9.js} +21 -20
  313. package/dist/timeQueryBar-uUGotoTx.cjs +1 -0
  314. package/dist/{timeSeries-DCV2YjC2.cjs → timeSeries-BhlqgEOq.cjs} +2 -2
  315. package/dist/{timeSeries-CdpEx6bf.js → timeSeries-U91gMDDQ.js} +66 -64
  316. package/dist/timeSeriesCurve-CiRMnZRD.cjs +1 -0
  317. package/dist/{timeSeriesCurve-C1AmF6TP.js → timeSeriesCurve-DOhIS88N.js} +68 -66
  318. package/dist/{toggleBtn-BGjXjIuK.cjs → toggleBtn-CuWwHFjD.cjs} +1 -1
  319. package/dist/{toggleBtn-XS9MjfKM.js → toggleBtn-DE35dkxx.js} +46 -44
  320. package/dist/trajectoryConfigPanel-DAbF8oE9.cjs +1 -0
  321. package/dist/{trajectoryConfigPanel-BC90nD1T.js → trajectoryConfigPanel-Ye7NY6rd.js} +35 -34
  322. package/dist/{trajectoryScatter-DF_ESBn8.js → trajectoryScatter-DL7HUNJI.js} +47 -45
  323. package/dist/trajectoryScatter-Dg99HzM3.cjs +1 -0
  324. package/dist/universalConfigPanel-1svBCvD9.cjs +1 -0
  325. package/dist/{universalConfigPanel-DjNTwJkz.js → universalConfigPanel-CkyIDl_x.js} +50 -49
  326. package/dist/{universalTable-BY9vRraC.js → universalTable--dpnyNO2.js} +56 -54
  327. package/dist/universalTable-D8w7FQbl.cjs +2 -0
  328. package/dist/useMixiotPanelSurface-CAZgexY5.cjs +1 -0
  329. package/dist/useMixiotPanelSurface-DRl3cZvc.js +22 -0
  330. package/dist/useTableBodyHeight-CwrQvi7M.js +21 -0
  331. package/dist/useTableBodyHeight-pf87uGjw.cjs +1 -0
  332. package/dist/{video-DDvDGDql.js → video-BmMSRRa_.js} +5 -4
  333. package/dist/{video-8_Sf1uz0.cjs → video-RGIZoUn6.cjs} +2 -2
  334. package/dist/videoMonitor-Bo5T0MT_.cjs +1 -0
  335. package/dist/{videoMonitor-sce5N4Q5.js → videoMonitor-uf6tt2E6.js} +34 -33
  336. package/dist/{vlu-BKeYJtOO.js → vlu-D8l5zE_P.js} +24 -23
  337. package/dist/vlu-DEo_h1qN.cjs +1 -0
  338. package/dist/warningOverview-A5AA_vCc.cjs +1 -0
  339. package/dist/{warningOverview-CG5mwtaO.js → warningOverview-CA0PikjV.js} +31 -30
  340. package/dist/{weather-CWvAqxgX.cjs → weather-D20MGzuJ.cjs} +1 -1
  341. package/dist/{weather-BrX2a1an.js → weather-DuseqeNF.js} +19 -18
  342. package/dist/{windLin-BbbsSwuF.cjs → windLin-BU6Q87dE.cjs} +1 -1
  343. package/dist/{windLin-P4Gs2aBB.js → windLin-D8AUL_dV.js} +58 -57
  344. package/package.json +120 -120
  345. package/dist/BaseComponent-CNXUpPY1.cjs +0 -1
  346. package/dist/UniverSheet-CntkzcVZ.cjs +0 -1
  347. package/dist/accelerationChart-DLV-1mpA.cjs +0 -6
  348. package/dist/actionItem-CFxzHf4E.cjs +0 -1
  349. package/dist/alarmLevelChart-DCC6D1fH.cjs +0 -2
  350. package/dist/alertTable-BREZBeS5.cjs +0 -1
  351. package/dist/aliasObjectSelectorDemo-DunKWEkT.cjs +0 -1
  352. package/dist/annualRainfallChart-BJyoUBDn.cjs +0 -1
  353. package/dist/aqiIndass-B441j8CT.cjs +0 -3
  354. package/dist/areaDeformCurve-Dj405Jil.cjs +0 -1
  355. package/dist/arrayCard-B7zb1dFi.cjs +0 -1
  356. package/dist/audio-BfsYRWbm.cjs +0 -1
  357. package/dist/bmp-DIkLqzRN.cjs +0 -1
  358. package/dist/box-kXjrgG2u.cjs +0 -1
  359. package/dist/chartConfigPanel-DN4LMy8-.cjs +0 -1
  360. package/dist/clock-EbmFBRb-.cjs +0 -1
  361. package/dist/clt-C-9xGiKs.cjs +0 -1
  362. package/dist/cmc-CFa8Q3tu.cjs +0 -1
  363. package/dist/conclusionCard-Dlg5GWlE.cjs +0 -1
  364. package/dist/controlList-C1vhlonT.cjs +0 -1
  365. package/dist/controlRecordList-BhK7KtLR.cjs +0 -1
  366. package/dist/crd-CgxqxwKV.cjs +0 -1
  367. package/dist/ctrBtn-BSJ9c7Pt.cjs +0 -1
  368. package/dist/ctrSet-B9M4yI53.cjs +0 -1
  369. package/dist/ctrSwitch-C6dUn_qm.js +0 -206
  370. package/dist/ctrSwitch-ZvMCYKvG.cjs +0 -1
  371. package/dist/dataManagement-CNrEa_zB.cjs +0 -1
  372. package/dist/datetime-CAyDWKE8.cjs +0 -1
  373. package/dist/deepClusterSlipSurface-DzoyF6i1.cjs +0 -1
  374. package/dist/deepDataMatrix--AstWPiL.cjs +0 -1
  375. package/dist/deepDisplacementChart-BnT1ZdfR.cjs +0 -6
  376. package/dist/deepDisplacementChart-DOPij7KP.cjs +0 -5
  377. package/dist/deepDisplacementView-u1IPcbxN.cjs +0 -8
  378. package/dist/deepNodeTemperatureChart-CD3JbqkA.cjs +0 -1
  379. package/dist/deepTangentAngleChart-BCAauuDY.cjs +0 -1
  380. package/dist/deepTemperatureField-BxuKsrtc.cjs +0 -1
  381. package/dist/deepTrendChart-6L4cCHgh.cjs +0 -1
  382. package/dist/deviceOnlineStatus-WkwzGom4.cjs +0 -2
  383. package/dist/deviceStatus-BoIv8fbr.cjs +0 -1
  384. package/dist/displacementDataTable-BwcxrsuU.cjs +0 -1
  385. package/dist/displacementTrajectoryChart-BOPIBgi5.cjs +0 -22
  386. package/dist/displacementTrendChart-CI8i0oQY.cjs +0 -5
  387. package/dist/emergencyPlan-BRFhMubg.cjs +0 -1
  388. package/dist/evn-B05d7LtF.cjs +0 -1
  389. package/dist/evolutionChart-y2mkLVwU.cjs +0 -1
  390. package/dist/fileViewer-Dy2fdABW.cjs +0 -1
  391. package/dist/filterBar-CcrUdD-O.cjs +0 -1
  392. package/dist/fireCombustionCurve-B-6MZLul.cjs +0 -1
  393. package/dist/fireFilterBar-C9b_Ohvr.cjs +0 -1
  394. package/dist/fireHistoryTable-5sG5FDCD.cjs +0 -3
  395. package/dist/gag-CDX99Ta4.cjs +0 -1
  396. package/dist/gasStationList-Dl9qawf_.cjs +0 -1
  397. package/dist/globalObjectSelector-Bz2XhgxT.cjs +0 -1
  398. package/dist/gnssFilterBar-BT19n0j_.cjs +0 -1
  399. package/dist/gnssHistoryTable-CrS2qO6S.cjs +0 -3
  400. package/dist/gnssSectionProfile-_KbP1NXU.cjs +0 -1
  401. package/dist/gnssTimeSeriesChart-BgFoXAZv.cjs +0 -1
  402. package/dist/gnssXYTrajectory-C1N3RWzp.cjs +0 -5
  403. package/dist/grd-DtDoJOOa.cjs +0 -1
  404. package/dist/grdIndass-ci3JkvGZ.cjs +0 -1
  405. package/dist/grg-C2qVuXYE.cjs +0 -1
  406. package/dist/gridview-BLAlr5uj.cjs +0 -1
  407. package/dist/groundwaterFilterBar-1E1j67JT.cjs +0 -1
  408. package/dist/groundwaterProfileChart-CS9xelz8.cjs +0 -11
  409. package/dist/groundwaterTimeCurve-DYiDLgVY.cjs +0 -1
  410. package/dist/headerBar-OwCxpc4o.cjs +0 -1
  411. package/dist/index-D8dh_6Qd.cjs +0 -612
  412. package/dist/insarDeformChart-CSQ7fc2p.cjs +0 -1
  413. package/dist/insarImageViewer-DvaRS1zr.cjs +0 -1
  414. package/dist/kpiCard-oLpk5d4m.cjs +0 -2
  415. package/dist/landslideMap-CO8o7T8J.cjs +0 -1
  416. package/dist/landslideWarning-BZXa5qTB.cjs +0 -1
  417. package/dist/layerTabs-BxRAsklw.cjs +0 -1
  418. package/dist/linIndass-Bb7UA-zk.cjs +0 -2
  419. package/dist/lst-Dri1MTDI.cjs +0 -1
  420. package/dist/manualEntry-D74dgZv8.cjs +0 -1
  421. package/dist/mappingList-CBN7ArkQ.cjs +0 -1
  422. package/dist/mixGrid-DTj2pmFW.cjs +0 -1
  423. package/dist/mixMap-B4T4R6kA.cjs +0 -1
  424. package/dist/mixModel-BzilRtjf.cjs +0 -3
  425. package/dist/mixPie-DtQm-LGp.cjs +0 -2
  426. package/dist/mjpegCamera-Lu3UHJ83.cjs +0 -1
  427. package/dist/monitorAlert-Ctt2kCxQ.cjs +0 -1
  428. package/dist/monitorData-D_tMbx_Y.cjs +0 -1
  429. package/dist/myValue-FZPOucSS.cjs +0 -1
  430. package/dist/myValueList-XIDK3ove.cjs +0 -1
  431. package/dist/objectList-BtbxHtJj.cjs +0 -1
  432. package/dist/photo-BITvEhKG.cjs +0 -1
  433. package/dist/photo-CjulDHTM.js +0 -873
  434. package/dist/placeholder-3kajeeeb.cjs +0 -1
  435. package/dist/pressBtn-pUcQtd5n.cjs +0 -1
  436. package/dist/processTable-CDulvQlu.cjs +0 -3
  437. package/dist/rad-Dk4PrnyI.cjs +0 -1
  438. package/dist/radarMapViewer-TJIPACdT.cjs +0 -1
  439. package/dist/rainfallFilterBar-Myq0MBCf.cjs +0 -1
  440. package/dist/rainfallTimeCurve-BUI-RlnG.cjs +0 -1
  441. package/dist/rangeLin-DYCZ8wVc.cjs +0 -3
  442. package/dist/realtimeEvolutionMap-BwyQdAhL.cjs +0 -1
  443. package/dist/regionBar-DsxqfirI.cjs +0 -3
  444. package/dist/retainer1-CSqjvY4k.cjs +0 -1
  445. package/dist/retainer2-Bqlwvr53.cjs +0 -1
  446. package/dist/retainerRecordList-DWZ3WDiz.cjs +0 -1
  447. package/dist/ringTopN-Bp0er_zV.cjs +0 -1
  448. package/dist/riskRegionTable-B3bzMaR_.cjs +0 -1
  449. package/dist/sankey-B4BJ4xIo.cjs +0 -1
  450. package/dist/scd-Dgd3KDpk.cjs +0 -1
  451. package/dist/sideMenu-BQ5rrGBr.cjs +0 -1
  452. package/dist/slopeStability-D96aiykf.cjs +0 -1
  453. package/dist/speedCurve-5nWqVAzz.cjs +0 -1
  454. package/dist/staticLine-DUCg-0tI.cjs +0 -1
  455. package/dist/stressFilterBar-CorWdmpQ.cjs +0 -1
  456. package/dist/stressTimeCurve-Bci50Cwv.cjs +0 -1
  457. package/dist/terminalConfigList-O881ke5o.cjs +0 -1
  458. package/dist/terminalList-C9TB2cJH.cjs +0 -1
  459. package/dist/textbox-BMWnbPvz.cjs +0 -1
  460. package/dist/timeQueryBar-C6ZheMvD.cjs +0 -1
  461. package/dist/timeSeriesCurve-DRlr5n3U.cjs +0 -1
  462. package/dist/trajectoryConfigPanel-DJ6fOeb1.cjs +0 -1
  463. package/dist/trajectoryScatter-C7kfSkyS.cjs +0 -1
  464. package/dist/universalConfigPanel-PO1hdgjw.cjs +0 -1
  465. package/dist/universalTable-QAb6UKCq.cjs +0 -2
  466. package/dist/useMixiotPanelSurface-BMNrWBMF.cjs +0 -1
  467. package/dist/useMixiotPanelSurface-DlVkLttU.js +0 -40
  468. package/dist/videoMonitor-BKLD_aQs.cjs +0 -1
  469. package/dist/vlu-C0XLDKKk.cjs +0 -1
  470. package/dist/warningOverview--n7crFnZ.cjs +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var oo=Object.defineProperty,lo=Object.defineProperties;var uo=Object.getOwnPropertyDescriptors;var nr=Object.getOwnPropertySymbols;var ho=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable;var or=Math.pow,ar=(a,e,t)=>e in a?oo(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,lr=(a,e)=>{for(var t in e||(e={}))ho.call(e,t)&&ar(a,t,e[t]);if(nr)for(var t of nr(e))co.call(e,t)&&ar(a,t,e[t]);return a},ur=(a,e)=>lo(a,uo(e));var ri=(a,e,t)=>new Promise((i,s)=>{var r=u=>{try{o(t.next(u))}catch(l){s(l)}},n=u=>{try{o(t.throw(u))}catch(l){s(l)}},o=u=>u.done?i(u.value):Promise.resolve(u.value).then(r,n);o((t=t.apply(a,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("vue"),fo=require("./BaseComponent-CNXUpPY1.cjs"),Lt=require("./index-D8dh_6Qd.cjs"),Xe=require("element-plus"),dr=require("./ele-vdo-icon-Bgp9gaT6.cjs");var ji={exports:{}},hr;function go(){return hr||(hr=1,(function(a,e){(function(i,s){a.exports=s()})(self,function(){return(function(){var t={"./node_modules/es6-promise/dist/es6-promise.js":(function(n,o,u){(function(l,d){n.exports=d()})(this,(function(){function l(B){var j=typeof B;return B!==null&&(j==="object"||j==="function")}function d(B){return typeof B=="function"}var h=void 0;Array.isArray?h=Array.isArray:h=function(B){return Object.prototype.toString.call(B)==="[object Array]"};var c=h,g=0,f=void 0,m=void 0,p=function(j,Y){P[g]=j,P[g+1]=Y,g+=2,g===2&&(m?m(C):O())};function v(B){m=B}function _(B){p=B}var E=typeof window!="undefined"?window:void 0,x=E||{},y=x.MutationObserver||x.WebKitMutationObserver,T=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",A=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function L(){return function(){return process.nextTick(C)}}function R(){return typeof f!="undefined"?function(){f(C)}:b()}function I(){var B=0,j=new y(C),Y=document.createTextNode("");return j.observe(Y,{characterData:!0}),function(){Y.data=B=++B%2}}function D(){var B=new MessageChannel;return B.port1.onmessage=C,function(){return B.port2.postMessage(0)}}function b(){var B=setTimeout;return function(){return B(C,1)}}var P=new Array(1e3);function C(){for(var B=0;B<g;B+=2){var j=P[B],Y=P[B+1];j(Y),P[B]=void 0,P[B+1]=void 0}g=0}function k(){try{var B=Function("return this")().require("vertx");return f=B.runOnLoop||B.runOnContext,R()}catch(j){return b()}}var O=void 0;T?O=L():y?O=I():A?O=D():E===void 0?O=k():O=b();function F(B,j){var Y=this,J=new this.constructor(V);J[G]===void 0&&be(J);var ae=Y._state;if(ae){var le=arguments[ae-1];p(function(){return ne(ae,J,le,Y._result)})}else Oe(Y,J,B,j);return J}function U(B){var j=this;if(B&&typeof B=="object"&&B.constructor===j)return B;var Y=new j(V);return Ee(Y,B),Y}var G=Math.random().toString(36).substring(2);function V(){}var $=void 0,K=1,H=2;function X(){return new TypeError("You cannot resolve a promise with itself")}function ee(){return new TypeError("A promises callback cannot return that same promise.")}function Q(B,j,Y,J){try{B.call(j,Y,J)}catch(ae){return ae}}function re(B,j,Y){p(function(J){var ae=!1,le=Q(Y,j,function(De){ae||(ae=!0,j!==De?Ee(J,De):_e(J,De))},function(De){ae||(ae=!0,te(J,De))},"Settle: "+(J._label||" unknown promise"));!ae&&le&&(ae=!0,te(J,le))},B)}function de(B,j){j._state===K?_e(B,j._result):j._state===H?te(B,j._result):Oe(j,void 0,function(Y){return Ee(B,Y)},function(Y){return te(B,Y)})}function he(B,j,Y){j.constructor===B.constructor&&Y===F&&j.constructor.resolve===U?de(B,j):Y===void 0?_e(B,j):d(Y)?re(B,j,Y):_e(B,j)}function Ee(B,j){if(B===j)te(B,X());else if(l(j)){var Y=void 0;try{Y=j.then}catch(J){te(B,J);return}he(B,j,Y)}else _e(B,j)}function Pe(B){B._onerror&&B._onerror(B._result),qe(B)}function _e(B,j){B._state===$&&(B._result=j,B._state=K,B._subscribers.length!==0&&p(qe,B))}function te(B,j){B._state===$&&(B._state=H,B._result=j,p(Pe,B))}function Oe(B,j,Y,J){var ae=B._subscribers,le=ae.length;B._onerror=null,ae[le]=j,ae[le+K]=Y,ae[le+H]=J,le===0&&B._state&&p(qe,B)}function qe(B){var j=B._subscribers,Y=B._state;if(j.length!==0){for(var J=void 0,ae=void 0,le=B._result,De=0;De<j.length;De+=3)J=j[De],ae=j[De+Y],J?ne(Y,J,ae,le):ae(le);B._subscribers.length=0}}function ne(B,j,Y,J){var ae=d(Y),le=void 0,De=void 0,bt=!0;if(ae){try{le=Y(J)}catch(si){bt=!1,De=si}if(j===le){te(j,ee());return}}else le=J;j._state!==$||(ae&&bt?Ee(j,le):bt===!1?te(j,De):B===K?_e(j,le):B===H&&te(j,le))}function ve(B,j){try{j(function(J){Ee(B,J)},function(J){te(B,J)})}catch(Y){te(B,Y)}}var Te=0;function Ue(){return Te++}function be(B){B[G]=Te++,B._state=void 0,B._result=void 0,B._subscribers=[]}function ke(){return new Error("Array Methods must be provided an Array")}var Le=(function(){function B(j,Y){this._instanceConstructor=j,this.promise=new j(V),this.promise[G]||be(this.promise),c(Y)?(this.length=Y.length,this._remaining=Y.length,this._result=new Array(this.length),this.length===0?_e(this.promise,this._result):(this.length=this.length||0,this._enumerate(Y),this._remaining===0&&_e(this.promise,this._result))):te(this.promise,ke())}return B.prototype._enumerate=function(Y){for(var J=0;this._state===$&&J<Y.length;J++)this._eachEntry(Y[J],J)},B.prototype._eachEntry=function(Y,J){var ae=this._instanceConstructor,le=ae.resolve;if(le===U){var De=void 0,bt=void 0,si=!1;try{De=Y.then}catch(Vi){si=!0,bt=Vi}if(De===F&&Y._state!==$)this._settledAt(Y._state,J,Y._result);else if(typeof De!="function")this._remaining--,this._result[J]=Y;else if(ae===Be){var Ki=new ae(V);si?te(Ki,bt):he(Ki,Y,De),this._willSettleAt(Ki,J)}else this._willSettleAt(new ae(function(Vi){return Vi(Y)}),J)}else this._willSettleAt(le(Y),J)},B.prototype._settledAt=function(Y,J,ae){var le=this.promise;le._state===$&&(this._remaining--,Y===H?te(le,ae):this._result[J]=ae),this._remaining===0&&_e(le,this._result)},B.prototype._willSettleAt=function(Y,J){var ae=this;Oe(Y,void 0,function(le){return ae._settledAt(K,J,le)},function(le){return ae._settledAt(H,J,le)})},B})();function ft(B){return new Le(this,B).promise}function lt(B){var j=this;return c(B)?new j(function(Y,J){for(var ae=B.length,le=0;le<ae;le++)j.resolve(B[le]).then(Y,J)}):new j(function(Y,J){return J(new TypeError("You must pass an array to race."))})}function ei(B){var j=this,Y=new j(V);return te(Y,B),Y}function xt(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ti(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var Be=(function(){function B(j){this[G]=Ue(),this._result=this._state=void 0,this._subscribers=[],V!==j&&(typeof j!="function"&&xt(),this instanceof B?ve(this,j):ti())}return B.prototype.catch=function(Y){return this.then(null,Y)},B.prototype.finally=function(Y){var J=this,ae=J.constructor;return d(Y)?J.then(function(le){return ae.resolve(Y()).then(function(){return le})},function(le){return ae.resolve(Y()).then(function(){throw le})}):J.then(Y,Y)},B})();Be.prototype.then=F,Be.all=ft,Be.race=lt,Be.resolve=U,Be.reject=ei,Be._setScheduler=v,Be._setAsap=_,Be._asap=p;function ii(){var B=void 0;if(typeof u.g!="undefined")B=u.g;else if(typeof self!="undefined")B=self;else try{B=Function("return this")()}catch(J){throw new Error("polyfill failed because global object is unavailable in this environment")}var j=B.Promise;if(j){var Y=null;try{Y=Object.prototype.toString.call(j.resolve())}catch(J){}if(Y==="[object Promise]"&&!j.cast)return}B.Promise=Be}return Be.polyfill=ii,Be.Promise=Be,Be}))}),"./node_modules/events/events.js":(function(n){var o=typeof Reflect=="object"?Reflect:null,u=o&&typeof o.apply=="function"?o.apply:function(b,P,C){return Function.prototype.apply.call(b,P,C)},l;o&&typeof o.ownKeys=="function"?l=o.ownKeys:Object.getOwnPropertySymbols?l=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:l=function(b){return Object.getOwnPropertyNames(b)};function d(D){console&&console.warn&&console.warn(D)}var h=Number.isNaN||function(b){return b!==b};function c(){c.init.call(this)}n.exports=c,n.exports.once=L,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var g=10;function f(D){if(typeof D!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof D)}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function(D){if(typeof D!="number"||D<0||h(D))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+D+".");g=D}}),c.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||h(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function m(D){return D._maxListeners===void 0?c.defaultMaxListeners:D._maxListeners}c.prototype.getMaxListeners=function(){return m(this)},c.prototype.emit=function(b){for(var P=[],C=1;C<arguments.length;C++)P.push(arguments[C]);var k=b==="error",O=this._events;if(O!==void 0)k=k&&O.error===void 0;else if(!k)return!1;if(k){var F;if(P.length>0&&(F=P[0]),F instanceof Error)throw F;var U=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw U.context=F,U}var G=O[b];if(G===void 0)return!1;if(typeof G=="function")u(G,this,P);else for(var V=G.length,$=y(G,V),C=0;C<V;++C)u($[C],this,P);return!0};function p(D,b,P,C){var k,O,F;if(f(P),O=D._events,O===void 0?(O=D._events=Object.create(null),D._eventsCount=0):(O.newListener!==void 0&&(D.emit("newListener",b,P.listener?P.listener:P),O=D._events),F=O[b]),F===void 0)F=O[b]=P,++D._eventsCount;else if(typeof F=="function"?F=O[b]=C?[P,F]:[F,P]:C?F.unshift(P):F.push(P),k=m(D),k>0&&F.length>k&&!F.warned){F.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=D,U.type=b,U.count=F.length,d(U)}return D}c.prototype.addListener=function(b,P){return p(this,b,P,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(b,P){return p(this,b,P,!0)};function v(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(D,b,P){var C={fired:!1,wrapFn:void 0,target:D,type:b,listener:P},k=v.bind(C);return k.listener=P,C.wrapFn=k,k}c.prototype.once=function(b,P){return f(P),this.on(b,_(this,b,P)),this},c.prototype.prependOnceListener=function(b,P){return f(P),this.prependListener(b,_(this,b,P)),this},c.prototype.removeListener=function(b,P){var C,k,O,F,U;if(f(P),k=this._events,k===void 0)return this;if(C=k[b],C===void 0)return this;if(C===P||C.listener===P)--this._eventsCount===0?this._events=Object.create(null):(delete k[b],k.removeListener&&this.emit("removeListener",b,C.listener||P));else if(typeof C!="function"){for(O=-1,F=C.length-1;F>=0;F--)if(C[F]===P||C[F].listener===P){U=C[F].listener,O=F;break}if(O<0)return this;O===0?C.shift():T(C,O),C.length===1&&(k[b]=C[0]),k.removeListener!==void 0&&this.emit("removeListener",b,U||P)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(b){var P,C,k;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[b]),this;if(arguments.length===0){var O=Object.keys(C),F;for(k=0;k<O.length;++k)F=O[k],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(P=C[b],typeof P=="function")this.removeListener(b,P);else if(P!==void 0)for(k=P.length-1;k>=0;k--)this.removeListener(b,P[k]);return this};function E(D,b,P){var C=D._events;if(C===void 0)return[];var k=C[b];return k===void 0?[]:typeof k=="function"?P?[k.listener||k]:[k]:P?A(k):y(k,k.length)}c.prototype.listeners=function(b){return E(this,b,!0)},c.prototype.rawListeners=function(b){return E(this,b,!1)},c.listenerCount=function(D,b){return typeof D.listenerCount=="function"?D.listenerCount(b):x.call(D,b)},c.prototype.listenerCount=x;function x(D){var b=this._events;if(b!==void 0){var P=b[D];if(typeof P=="function")return 1;if(P!==void 0)return P.length}return 0}c.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function y(D,b){for(var P=new Array(b),C=0;C<b;++C)P[C]=D[C];return P}function T(D,b){for(;b+1<D.length;b++)D[b]=D[b+1];D.pop()}function A(D){for(var b=new Array(D.length),P=0;P<b.length;++P)b[P]=D[P].listener||D[P];return b}function L(D,b){return new Promise(function(P,C){function k(F){D.removeListener(b,O),C(F)}function O(){typeof D.removeListener=="function"&&D.removeListener("error",k),P([].slice.call(arguments))}I(D,b,O,{once:!0}),b!=="error"&&R(D,k,{once:!0})})}function R(D,b,P){typeof D.on=="function"&&I(D,"error",b,P)}function I(D,b,P,C){if(typeof D.on=="function")C.once?D.once(b,P):D.on(b,P);else if(typeof D.addEventListener=="function")D.addEventListener(b,function k(O){C.once&&D.removeEventListener(b,k),P(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof D)}}),"./node_modules/webworkify-webpack/index.js":(function(n,o,u){function l(v){var _={};function E(y){if(_[y])return _[y].exports;var T=_[y]={i:y,l:!1,exports:{}};return v[y].call(T.exports,T,T.exports,E),T.l=!0,T.exports}E.m=v,E.c=_,E.i=function(y){return y},E.d=function(y,T,A){E.o(y,T)||Object.defineProperty(y,T,{configurable:!1,enumerable:!0,get:A})},E.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},E.n=function(y){var T=y&&y.__esModule?function(){return y.default}:function(){return y};return E.d(T,"a",T),T},E.o=function(y,T){return Object.prototype.hasOwnProperty.call(y,T)},E.p="/",E.oe=function(y){throw console.error(y),y};var x=E(E.s=ENTRY_MODULE);return x.default||x}var d="[\\.|\\-|\\+|\\w|/|@]+",h="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+d+").*?\\)";function c(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function g(v){return!isNaN(1*v)}function f(v,_,E){var x={};x[E]=[];var y=_.toString(),T=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!T)return x;for(var A=T[1],L=new RegExp("(\\\\n|\\W)"+c(A)+h,"g"),R;R=L.exec(y);)R[3]!=="dll-reference"&&x[E].push(R[3]);for(L=new RegExp("\\("+c(A)+'\\("(dll-reference\\s('+d+'))"\\)\\)'+h,"g");R=L.exec(y);)v[R[2]]||(x[E].push(R[1]),v[R[2]]=u(R[1]).m),x[R[2]]=x[R[2]]||[],x[R[2]].push(R[4]);for(var I=Object.keys(x),D=0;D<I.length;D++)for(var b=0;b<x[I[D]].length;b++)g(x[I[D]][b])&&(x[I[D]][b]=1*x[I[D]][b]);return x}function m(v){var _=Object.keys(v);return _.reduce(function(E,x){return E||v[x].length>0},!1)}function p(v,_){for(var E={main:[_]},x={main:[]},y={main:{}};m(E);)for(var T=Object.keys(E),A=0;A<T.length;A++){var L=T[A],R=E[L],I=R.pop();if(y[L]=y[L]||{},!(y[L][I]||!v[L][I])){y[L][I]=!0,x[L]=x[L]||[],x[L].push(I);for(var D=f(v,v[L][I],L),b=Object.keys(D),P=0;P<b.length;P++)E[b[P]]=E[b[P]]||[],E[b[P]]=E[b[P]].concat(D[b[P]])}}return x}n.exports=function(v,_){_=_||{};var E={main:u.m},x=_.all?{main:Object.keys(E.main)}:p(E,v),y="";Object.keys(x).filter(function(I){return I!=="main"}).forEach(function(I){for(var D=0;x[I][D];)D++;x[I].push(D),E[I][D]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+I+" = ("+l.toString().replace("ENTRY_MODULE",JSON.stringify(D))+")({"+x[I].map(function(b){return""+JSON.stringify(b)+": "+E[I][b].toString()}).join(",")+`});
1
+ "use strict";var oo=Object.defineProperty,lo=Object.defineProperties;var uo=Object.getOwnPropertyDescriptors;var nr=Object.getOwnPropertySymbols;var ho=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable;var or=Math.pow,ar=(a,e,t)=>e in a?oo(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,lr=(a,e)=>{for(var t in e||(e={}))ho.call(e,t)&&ar(a,t,e[t]);if(nr)for(var t of nr(e))co.call(e,t)&&ar(a,t,e[t]);return a},ur=(a,e)=>lo(a,uo(e));var ri=(a,e,t)=>new Promise((i,s)=>{var r=u=>{try{o(t.next(u))}catch(l){s(l)}},n=u=>{try{o(t.throw(u))}catch(l){s(l)}},o=u=>u.done?i(u.value):Promise.resolve(u.value).then(r,n);o((t=t.apply(a,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("vue"),fo=require("./BaseComponent-Chnv4fBT.cjs"),Lt=require("./index-DVqMfQVc.cjs"),Xe=require("element-plus"),dr=require("./ele-vdo-icon-Bgp9gaT6.cjs");var ji={exports:{}},hr;function go(){return hr||(hr=1,(function(a,e){(function(i,s){a.exports=s()})(self,function(){return(function(){var t={"./node_modules/es6-promise/dist/es6-promise.js":(function(n,o,u){(function(l,d){n.exports=d()})(this,(function(){function l(B){var j=typeof B;return B!==null&&(j==="object"||j==="function")}function d(B){return typeof B=="function"}var h=void 0;Array.isArray?h=Array.isArray:h=function(B){return Object.prototype.toString.call(B)==="[object Array]"};var c=h,g=0,f=void 0,m=void 0,p=function(j,Y){P[g]=j,P[g+1]=Y,g+=2,g===2&&(m?m(C):O())};function v(B){m=B}function _(B){p=B}var E=typeof window!="undefined"?window:void 0,x=E||{},y=x.MutationObserver||x.WebKitMutationObserver,T=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",A=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function L(){return function(){return process.nextTick(C)}}function R(){return typeof f!="undefined"?function(){f(C)}:b()}function I(){var B=0,j=new y(C),Y=document.createTextNode("");return j.observe(Y,{characterData:!0}),function(){Y.data=B=++B%2}}function D(){var B=new MessageChannel;return B.port1.onmessage=C,function(){return B.port2.postMessage(0)}}function b(){var B=setTimeout;return function(){return B(C,1)}}var P=new Array(1e3);function C(){for(var B=0;B<g;B+=2){var j=P[B],Y=P[B+1];j(Y),P[B]=void 0,P[B+1]=void 0}g=0}function k(){try{var B=Function("return this")().require("vertx");return f=B.runOnLoop||B.runOnContext,R()}catch(j){return b()}}var O=void 0;T?O=L():y?O=I():A?O=D():E===void 0?O=k():O=b();function F(B,j){var Y=this,J=new this.constructor(V);J[G]===void 0&&be(J);var ae=Y._state;if(ae){var le=arguments[ae-1];p(function(){return ne(ae,J,le,Y._result)})}else Oe(Y,J,B,j);return J}function U(B){var j=this;if(B&&typeof B=="object"&&B.constructor===j)return B;var Y=new j(V);return Ee(Y,B),Y}var G=Math.random().toString(36).substring(2);function V(){}var $=void 0,K=1,H=2;function X(){return new TypeError("You cannot resolve a promise with itself")}function ee(){return new TypeError("A promises callback cannot return that same promise.")}function Q(B,j,Y,J){try{B.call(j,Y,J)}catch(ae){return ae}}function re(B,j,Y){p(function(J){var ae=!1,le=Q(Y,j,function(De){ae||(ae=!0,j!==De?Ee(J,De):_e(J,De))},function(De){ae||(ae=!0,te(J,De))},"Settle: "+(J._label||" unknown promise"));!ae&&le&&(ae=!0,te(J,le))},B)}function de(B,j){j._state===K?_e(B,j._result):j._state===H?te(B,j._result):Oe(j,void 0,function(Y){return Ee(B,Y)},function(Y){return te(B,Y)})}function he(B,j,Y){j.constructor===B.constructor&&Y===F&&j.constructor.resolve===U?de(B,j):Y===void 0?_e(B,j):d(Y)?re(B,j,Y):_e(B,j)}function Ee(B,j){if(B===j)te(B,X());else if(l(j)){var Y=void 0;try{Y=j.then}catch(J){te(B,J);return}he(B,j,Y)}else _e(B,j)}function Pe(B){B._onerror&&B._onerror(B._result),qe(B)}function _e(B,j){B._state===$&&(B._result=j,B._state=K,B._subscribers.length!==0&&p(qe,B))}function te(B,j){B._state===$&&(B._state=H,B._result=j,p(Pe,B))}function Oe(B,j,Y,J){var ae=B._subscribers,le=ae.length;B._onerror=null,ae[le]=j,ae[le+K]=Y,ae[le+H]=J,le===0&&B._state&&p(qe,B)}function qe(B){var j=B._subscribers,Y=B._state;if(j.length!==0){for(var J=void 0,ae=void 0,le=B._result,De=0;De<j.length;De+=3)J=j[De],ae=j[De+Y],J?ne(Y,J,ae,le):ae(le);B._subscribers.length=0}}function ne(B,j,Y,J){var ae=d(Y),le=void 0,De=void 0,bt=!0;if(ae){try{le=Y(J)}catch(si){bt=!1,De=si}if(j===le){te(j,ee());return}}else le=J;j._state!==$||(ae&&bt?Ee(j,le):bt===!1?te(j,De):B===K?_e(j,le):B===H&&te(j,le))}function ve(B,j){try{j(function(J){Ee(B,J)},function(J){te(B,J)})}catch(Y){te(B,Y)}}var Te=0;function Ue(){return Te++}function be(B){B[G]=Te++,B._state=void 0,B._result=void 0,B._subscribers=[]}function ke(){return new Error("Array Methods must be provided an Array")}var Le=(function(){function B(j,Y){this._instanceConstructor=j,this.promise=new j(V),this.promise[G]||be(this.promise),c(Y)?(this.length=Y.length,this._remaining=Y.length,this._result=new Array(this.length),this.length===0?_e(this.promise,this._result):(this.length=this.length||0,this._enumerate(Y),this._remaining===0&&_e(this.promise,this._result))):te(this.promise,ke())}return B.prototype._enumerate=function(Y){for(var J=0;this._state===$&&J<Y.length;J++)this._eachEntry(Y[J],J)},B.prototype._eachEntry=function(Y,J){var ae=this._instanceConstructor,le=ae.resolve;if(le===U){var De=void 0,bt=void 0,si=!1;try{De=Y.then}catch(Vi){si=!0,bt=Vi}if(De===F&&Y._state!==$)this._settledAt(Y._state,J,Y._result);else if(typeof De!="function")this._remaining--,this._result[J]=Y;else if(ae===Be){var Ki=new ae(V);si?te(Ki,bt):he(Ki,Y,De),this._willSettleAt(Ki,J)}else this._willSettleAt(new ae(function(Vi){return Vi(Y)}),J)}else this._willSettleAt(le(Y),J)},B.prototype._settledAt=function(Y,J,ae){var le=this.promise;le._state===$&&(this._remaining--,Y===H?te(le,ae):this._result[J]=ae),this._remaining===0&&_e(le,this._result)},B.prototype._willSettleAt=function(Y,J){var ae=this;Oe(Y,void 0,function(le){return ae._settledAt(K,J,le)},function(le){return ae._settledAt(H,J,le)})},B})();function ft(B){return new Le(this,B).promise}function lt(B){var j=this;return c(B)?new j(function(Y,J){for(var ae=B.length,le=0;le<ae;le++)j.resolve(B[le]).then(Y,J)}):new j(function(Y,J){return J(new TypeError("You must pass an array to race."))})}function ei(B){var j=this,Y=new j(V);return te(Y,B),Y}function xt(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ti(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var Be=(function(){function B(j){this[G]=Ue(),this._result=this._state=void 0,this._subscribers=[],V!==j&&(typeof j!="function"&&xt(),this instanceof B?ve(this,j):ti())}return B.prototype.catch=function(Y){return this.then(null,Y)},B.prototype.finally=function(Y){var J=this,ae=J.constructor;return d(Y)?J.then(function(le){return ae.resolve(Y()).then(function(){return le})},function(le){return ae.resolve(Y()).then(function(){throw le})}):J.then(Y,Y)},B})();Be.prototype.then=F,Be.all=ft,Be.race=lt,Be.resolve=U,Be.reject=ei,Be._setScheduler=v,Be._setAsap=_,Be._asap=p;function ii(){var B=void 0;if(typeof u.g!="undefined")B=u.g;else if(typeof self!="undefined")B=self;else try{B=Function("return this")()}catch(J){throw new Error("polyfill failed because global object is unavailable in this environment")}var j=B.Promise;if(j){var Y=null;try{Y=Object.prototype.toString.call(j.resolve())}catch(J){}if(Y==="[object Promise]"&&!j.cast)return}B.Promise=Be}return Be.polyfill=ii,Be.Promise=Be,Be}))}),"./node_modules/events/events.js":(function(n){var o=typeof Reflect=="object"?Reflect:null,u=o&&typeof o.apply=="function"?o.apply:function(b,P,C){return Function.prototype.apply.call(b,P,C)},l;o&&typeof o.ownKeys=="function"?l=o.ownKeys:Object.getOwnPropertySymbols?l=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:l=function(b){return Object.getOwnPropertyNames(b)};function d(D){console&&console.warn&&console.warn(D)}var h=Number.isNaN||function(b){return b!==b};function c(){c.init.call(this)}n.exports=c,n.exports.once=L,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var g=10;function f(D){if(typeof D!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof D)}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function(D){if(typeof D!="number"||D<0||h(D))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+D+".");g=D}}),c.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||h(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function m(D){return D._maxListeners===void 0?c.defaultMaxListeners:D._maxListeners}c.prototype.getMaxListeners=function(){return m(this)},c.prototype.emit=function(b){for(var P=[],C=1;C<arguments.length;C++)P.push(arguments[C]);var k=b==="error",O=this._events;if(O!==void 0)k=k&&O.error===void 0;else if(!k)return!1;if(k){var F;if(P.length>0&&(F=P[0]),F instanceof Error)throw F;var U=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw U.context=F,U}var G=O[b];if(G===void 0)return!1;if(typeof G=="function")u(G,this,P);else for(var V=G.length,$=y(G,V),C=0;C<V;++C)u($[C],this,P);return!0};function p(D,b,P,C){var k,O,F;if(f(P),O=D._events,O===void 0?(O=D._events=Object.create(null),D._eventsCount=0):(O.newListener!==void 0&&(D.emit("newListener",b,P.listener?P.listener:P),O=D._events),F=O[b]),F===void 0)F=O[b]=P,++D._eventsCount;else if(typeof F=="function"?F=O[b]=C?[P,F]:[F,P]:C?F.unshift(P):F.push(P),k=m(D),k>0&&F.length>k&&!F.warned){F.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=D,U.type=b,U.count=F.length,d(U)}return D}c.prototype.addListener=function(b,P){return p(this,b,P,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(b,P){return p(this,b,P,!0)};function v(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(D,b,P){var C={fired:!1,wrapFn:void 0,target:D,type:b,listener:P},k=v.bind(C);return k.listener=P,C.wrapFn=k,k}c.prototype.once=function(b,P){return f(P),this.on(b,_(this,b,P)),this},c.prototype.prependOnceListener=function(b,P){return f(P),this.prependListener(b,_(this,b,P)),this},c.prototype.removeListener=function(b,P){var C,k,O,F,U;if(f(P),k=this._events,k===void 0)return this;if(C=k[b],C===void 0)return this;if(C===P||C.listener===P)--this._eventsCount===0?this._events=Object.create(null):(delete k[b],k.removeListener&&this.emit("removeListener",b,C.listener||P));else if(typeof C!="function"){for(O=-1,F=C.length-1;F>=0;F--)if(C[F]===P||C[F].listener===P){U=C[F].listener,O=F;break}if(O<0)return this;O===0?C.shift():T(C,O),C.length===1&&(k[b]=C[0]),k.removeListener!==void 0&&this.emit("removeListener",b,U||P)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(b){var P,C,k;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[b]),this;if(arguments.length===0){var O=Object.keys(C),F;for(k=0;k<O.length;++k)F=O[k],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(P=C[b],typeof P=="function")this.removeListener(b,P);else if(P!==void 0)for(k=P.length-1;k>=0;k--)this.removeListener(b,P[k]);return this};function E(D,b,P){var C=D._events;if(C===void 0)return[];var k=C[b];return k===void 0?[]:typeof k=="function"?P?[k.listener||k]:[k]:P?A(k):y(k,k.length)}c.prototype.listeners=function(b){return E(this,b,!0)},c.prototype.rawListeners=function(b){return E(this,b,!1)},c.listenerCount=function(D,b){return typeof D.listenerCount=="function"?D.listenerCount(b):x.call(D,b)},c.prototype.listenerCount=x;function x(D){var b=this._events;if(b!==void 0){var P=b[D];if(typeof P=="function")return 1;if(P!==void 0)return P.length}return 0}c.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function y(D,b){for(var P=new Array(b),C=0;C<b;++C)P[C]=D[C];return P}function T(D,b){for(;b+1<D.length;b++)D[b]=D[b+1];D.pop()}function A(D){for(var b=new Array(D.length),P=0;P<b.length;++P)b[P]=D[P].listener||D[P];return b}function L(D,b){return new Promise(function(P,C){function k(F){D.removeListener(b,O),C(F)}function O(){typeof D.removeListener=="function"&&D.removeListener("error",k),P([].slice.call(arguments))}I(D,b,O,{once:!0}),b!=="error"&&R(D,k,{once:!0})})}function R(D,b,P){typeof D.on=="function"&&I(D,"error",b,P)}function I(D,b,P,C){if(typeof D.on=="function")C.once?D.once(b,P):D.on(b,P);else if(typeof D.addEventListener=="function")D.addEventListener(b,function k(O){C.once&&D.removeEventListener(b,k),P(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof D)}}),"./node_modules/webworkify-webpack/index.js":(function(n,o,u){function l(v){var _={};function E(y){if(_[y])return _[y].exports;var T=_[y]={i:y,l:!1,exports:{}};return v[y].call(T.exports,T,T.exports,E),T.l=!0,T.exports}E.m=v,E.c=_,E.i=function(y){return y},E.d=function(y,T,A){E.o(y,T)||Object.defineProperty(y,T,{configurable:!1,enumerable:!0,get:A})},E.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},E.n=function(y){var T=y&&y.__esModule?function(){return y.default}:function(){return y};return E.d(T,"a",T),T},E.o=function(y,T){return Object.prototype.hasOwnProperty.call(y,T)},E.p="/",E.oe=function(y){throw console.error(y),y};var x=E(E.s=ENTRY_MODULE);return x.default||x}var d="[\\.|\\-|\\+|\\w|/|@]+",h="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+d+").*?\\)";function c(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function g(v){return!isNaN(1*v)}function f(v,_,E){var x={};x[E]=[];var y=_.toString(),T=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!T)return x;for(var A=T[1],L=new RegExp("(\\\\n|\\W)"+c(A)+h,"g"),R;R=L.exec(y);)R[3]!=="dll-reference"&&x[E].push(R[3]);for(L=new RegExp("\\("+c(A)+'\\("(dll-reference\\s('+d+'))"\\)\\)'+h,"g");R=L.exec(y);)v[R[2]]||(x[E].push(R[1]),v[R[2]]=u(R[1]).m),x[R[2]]=x[R[2]]||[],x[R[2]].push(R[4]);for(var I=Object.keys(x),D=0;D<I.length;D++)for(var b=0;b<x[I[D]].length;b++)g(x[I[D]][b])&&(x[I[D]][b]=1*x[I[D]][b]);return x}function m(v){var _=Object.keys(v);return _.reduce(function(E,x){return E||v[x].length>0},!1)}function p(v,_){for(var E={main:[_]},x={main:[]},y={main:{}};m(E);)for(var T=Object.keys(E),A=0;A<T.length;A++){var L=T[A],R=E[L],I=R.pop();if(y[L]=y[L]||{},!(y[L][I]||!v[L][I])){y[L][I]=!0,x[L]=x[L]||[],x[L].push(I);for(var D=f(v,v[L][I],L),b=Object.keys(D),P=0;P<b.length;P++)E[b[P]]=E[b[P]]||[],E[b[P]]=E[b[P]].concat(D[b[P]])}}return x}n.exports=function(v,_){_=_||{};var E={main:u.m},x=_.all?{main:Object.keys(E.main)}:p(E,v),y="";Object.keys(x).filter(function(I){return I!=="main"}).forEach(function(I){for(var D=0;x[I][D];)D++;x[I].push(D),E[I][D]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+I+" = ("+l.toString().replace("ENTRY_MODULE",JSON.stringify(D))+")({"+x[I].map(function(b){return""+JSON.stringify(b)+": "+E[I][b].toString()}).join(",")+`});
2
2
  `}),y=y+"new (("+l.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+x.main.map(function(I){return""+JSON.stringify(I)+": "+E.main[I].toString()}).join(",")+"}))(self);";var T=new window.Blob([y],{type:"text/javascript"});if(_.bare)return T;var A=window.URL||window.webkitURL||window.mozURL||window.msURL,L=A.createObjectURL(T),R=new window.Worker(L);return R.objectURL=L,R}}),"./src/config.js":(function(n,o,u){u.r(o),u.d(o,{defaultConfig:function(){return l},createDefaultConfig:function(){return d}});var l={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function d(){return Object.assign({},l)}}),"./src/core/features.js":(function(n,o,u){u.r(o);var l=u("./src/io/io-controller.js"),d=u("./src/config.js"),h=(function(){function c(){}return c.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},c.supportNetworkStreamIO=function(){var g=new l.default({},(0,d.createDefaultConfig)()),f=g.loaderType;return g.destroy(),f=="fetch-stream-loader"||f=="xhr-moz-chunked-loader"},c.getNetworkLoaderTypeName=function(){var g=new l.default({},(0,d.createDefaultConfig)()),f=g.loaderType;return g.destroy(),f},c.supportNativeMediaPlayback=function(g){c.videoElement==null&&(c.videoElement=window.document.createElement("video"));var f=c.videoElement.canPlayType(g);return f==="probably"||f=="maybe"},c.getFeatureList=function(){var g={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return g.mseFlvPlayback=c.supportMSEH264Playback(),g.networkStreamIO=c.supportNetworkStreamIO(),g.networkLoaderName=c.getNetworkLoaderTypeName(),g.mseLiveFlvPlayback=g.mseFlvPlayback&&g.networkStreamIO,g.nativeMP4H264Playback=c.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),g.nativeWebmVP8Playback=c.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),g.nativeWebmVP9Playback=c.supportNativeMediaPlayback('video/webm; codecs="vp9"'),g},c})();o.default=h}),"./src/core/media-info.js":(function(n,o,u){u.r(o);var l=(function(){function d(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return d.prototype.isComplete=function(){var h=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,c=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&h&&c},d.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},d.prototype.getNearestKeyframe=function(h){if(this.keyframesIndex==null)return null;var c=this.keyframesIndex,g=this._search(c.times,h);return{index:g,milliseconds:c.times[g],fileposition:c.filepositions[g]}},d.prototype._search=function(h,c){var g=0,f=h.length-1,m=0,p=0,v=f;for(c<h[0]&&(g=0,p=v+1);p<=v;)if(m=p+Math.floor((v-p)/2),m===f||c>=h[m]&&c<h[m+1]){g=m;break}else h[m]<c?p=m+1:v=m-1;return g},d})();o.default=l}),"./src/core/media-segment-info.js":(function(n,o,u){u.r(o),u.d(o,{SampleInfo:function(){return l},MediaSegmentInfo:function(){return d},IDRSampleList:function(){return h},MediaSegmentInfoList:function(){return c}});var l=(function(){function g(f,m,p,v,_){this.dts=f,this.pts=m,this.duration=p,this.originalDts=v,this.isSyncPoint=_,this.fileposition=null}return g})(),d=(function(){function g(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return g.prototype.appendSyncPoint=function(f){f.isSyncPoint=!0,this.syncPoints.push(f)},g})(),h=(function(){function g(){this._list=[]}return g.prototype.clear=function(){this._list=[]},g.prototype.appendArray=function(f){var m=this._list;f.length!==0&&(m.length>0&&f[0].originalDts<m[m.length-1].originalDts&&this.clear(),Array.prototype.push.apply(m,f))},g.prototype.getLastSyncPointBeforeDts=function(f){if(this._list.length==0)return null;var m=this._list,p=0,v=m.length-1,_=0,E=0,x=v;for(f<m[0].dts&&(p=0,E=x+1);E<=x;)if(_=E+Math.floor((x-E)/2),_===v||f>=m[_].dts&&f<m[_+1].dts){p=_;break}else m[_].dts<f?E=_+1:x=_-1;return this._list[p]},g})(),c=(function(){function g(f){this._type=f,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(g.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),g.prototype.isEmpty=function(){return this._list.length===0},g.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},g.prototype._searchNearestSegmentBefore=function(f){var m=this._list;if(m.length===0)return-2;var p=m.length-1,v=0,_=0,E=p,x=0;if(f<m[0].originalBeginDts)return x=-1,x;for(;_<=E;)if(v=_+Math.floor((E-_)/2),v===p||f>m[v].lastSample.originalDts&&f<m[v+1].originalBeginDts){x=v;break}else m[v].originalBeginDts<f?_=v+1:E=v-1;return x},g.prototype._searchNearestSegmentAfter=function(f){return this._searchNearestSegmentBefore(f)+1},g.prototype.append=function(f){var m=this._list,p=f,v=this._lastAppendLocation,_=0;v!==-1&&v<m.length&&p.originalBeginDts>=m[v].lastSample.originalDts&&(v===m.length-1||v<m.length-1&&p.originalBeginDts<m[v+1].originalBeginDts)?_=v+1:m.length>0&&(_=this._searchNearestSegmentBefore(p.originalBeginDts)+1),this._lastAppendLocation=_,this._list.splice(_,0,p)},g.prototype.getLastSegmentBefore=function(f){var m=this._searchNearestSegmentBefore(f);return m>=0?this._list[m]:null},g.prototype.getLastSampleBefore=function(f){var m=this.getLastSegmentBefore(f);return m!=null?m.lastSample:null},g.prototype.getLastSyncPointBefore=function(f){for(var m=this._searchNearestSegmentBefore(f),p=this._list[m].syncPoints;p.length===0&&m>0;)m--,p=this._list[m].syncPoints;return p.length>0?p[p.length-1]:null},g})()}),"./src/core/mse-controller.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./src/utils/logger.js"),c=u("./src/utils/browser.js"),g=u("./src/core/mse-events.js"),f=u("./src/core/media-segment-info.js"),m=u("./src/utils/exception.js"),p=(function(){function v(_){this.TAG="MSEController",this._config=_,this._emitter=new(d()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new f.IDRSampleList}return v.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},v.prototype.on=function(_,E){this._emitter.addListener(_,E)},v.prototype.off=function(_,E){this._emitter.removeListener(_,E)},v.prototype.attachMediaElement=function(_){if(this._mediaSource)throw new m.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var E=this._mediaSource=new window.MediaSource;E.addEventListener("sourceopen",this.e.onSourceOpen),E.addEventListener("sourceended",this.e.onSourceEnded),E.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=_,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),_.src=this._mediaSourceObjectURL},v.prototype.detachMediaElement=function(){if(this._mediaSource){var _=this._mediaSource;for(var E in this._sourceBuffers){var x=this._pendingSegments[E];x.splice(0,x.length),this._pendingSegments[E]=null,this._pendingRemoveRanges[E]=null,this._lastInitSegments[E]=null;var y=this._sourceBuffers[E];if(y){if(_.readyState!=="closed"){try{_.removeSourceBuffer(y)}catch(T){h.default.e(this.TAG,T.message)}y.removeEventListener("error",this.e.onSourceBufferError),y.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[E]=null,this._sourceBuffers[E]=null}}if(_.readyState==="open")try{_.endOfStream()}catch(T){h.default.e(this.TAG,T.message)}_.removeEventListener("sourceopen",this.e.onSourceOpen),_.removeEventListener("sourceended",this.e.onSourceEnded),_.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},v.prototype.appendInitSegment=function(_,E){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(_),this._pendingSegments[_.type].push(_);return}var x=_,y=""+x.container;x.codec&&x.codec.length>0&&(y+=";codecs="+x.codec);var T=!1;if(h.default.v(this.TAG,"Received Initialization Segment, mimeType: "+y),this._lastInitSegments[x.type]=x,y!==this._mimeTypes[x.type]){if(this._mimeTypes[x.type])h.default.v(this.TAG,"Notice: "+x.type+" mimeType changed, origin: "+this._mimeTypes[x.type]+", target: "+y);else{T=!0;try{var A=this._sourceBuffers[x.type]=this._mediaSource.addSourceBuffer(y);A.addEventListener("error",this.e.onSourceBufferError),A.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(L){h.default.e(this.TAG,L.message),this._emitter.emit(g.default.ERROR,{code:L.code,msg:L.message});return}}this._mimeTypes[x.type]=y}E||this._pendingSegments[x.type].push(x),T||this._sourceBuffers[x.type]&&!this._sourceBuffers[x.type].updating&&this._doAppendSegments(),c.default.safari&&x.container==="audio/mpeg"&&x.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=x.mediaDuration/1e3,this._updateMediaSourceDuration())},v.prototype.appendMediaSegment=function(_){var E=_;this._pendingSegments[E.type].push(E),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var x=this._sourceBuffers[E.type];x&&!x.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()},v.prototype.seek=function(_){for(var E in this._sourceBuffers)if(this._sourceBuffers[E]){var x=this._sourceBuffers[E];if(this._mediaSource.readyState==="open")try{x.abort()}catch(I){h.default.e(this.TAG,I.message)}this._idrList.clear();var y=this._pendingSegments[E];if(y.splice(0,y.length),this._mediaSource.readyState!=="closed"){for(var T=0;T<x.buffered.length;T++){var A=x.buffered.start(T),L=x.buffered.end(T);this._pendingRemoveRanges[E].push({start:A,end:L})}if(x.updating||this._doRemoveRanges(),c.default.safari){var R=this._lastInitSegments[E];R&&(this._pendingSegments[E].push(R),x.updating||this._doAppendSegments())}}}},v.prototype.endOfStream=function(){var _=this._mediaSource,E=this._sourceBuffers;if(!_||_.readyState!=="open"){_&&_.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}E.video&&E.video.updating||E.audio&&E.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,_.endOfStream())},v.prototype.getNearestKeyframe=function(_){return this._idrList.getLastSyncPointBeforeDts(_)},v.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var _=this._mediaElement.currentTime;for(var E in this._sourceBuffers){var x=this._sourceBuffers[E];if(x){var y=x.buffered;if(y.length>=1&&_-y.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},v.prototype._doCleanupSourceBuffer=function(){var _=this._mediaElement.currentTime;for(var E in this._sourceBuffers){var x=this._sourceBuffers[E];if(x){for(var y=x.buffered,T=!1,A=0;A<y.length;A++){var L=y.start(A),R=y.end(A);if(L<=_&&_<R+3){if(_-L>=this._config.autoCleanupMaxBackwardDuration){T=!0;var I=_-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[E].push({start:L,end:I})}}else R<_&&(T=!0,this._pendingRemoveRanges[E].push({start:L,end:R}))}T&&!x.updating&&this._doRemoveRanges()}}},v.prototype._updateMediaSourceDuration=function(){var _=this._sourceBuffers;if(!(this._mediaElement.readyState===0||this._mediaSource.readyState!=="open")&&!(_.video&&_.video.updating||_.audio&&_.audio.updating)){var E=this._mediaSource.duration,x=this._pendingMediaDuration;x>0&&(isNaN(E)||x>E)&&(h.default.v(this.TAG,"Update MediaSource duration from "+E+" to "+x),this._mediaSource.duration=x),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},v.prototype._doRemoveRanges=function(){for(var _ in this._pendingRemoveRanges)if(!(!this._sourceBuffers[_]||this._sourceBuffers[_].updating))for(var E=this._sourceBuffers[_],x=this._pendingRemoveRanges[_];x.length&&!E.updating;){var y=x.shift();E.remove(y.start,y.end)}},v.prototype._doAppendSegments=function(){var _=this._pendingSegments;for(var E in _)if(!(!this._sourceBuffers[E]||this._sourceBuffers[E].updating)&&_[E].length>0){var x=_[E].shift();if(x.timestampOffset){var y=this._sourceBuffers[E].timestampOffset,T=x.timestampOffset/1e3,A=Math.abs(y-T);A>.1&&(h.default.v(this.TAG,"Update MPEG audio timestampOffset from "+y+" to "+T),this._sourceBuffers[E].timestampOffset=T),delete x.timestampOffset}if(!x.data||x.data.byteLength===0)continue;try{this._sourceBuffers[E].appendBuffer(x.data),this._isBufferFull=!1,E==="video"&&x.hasOwnProperty("info")&&this._idrList.appendArray(x.info.syncPoints)}catch(L){this._pendingSegments[E].unshift(x),L.code===22?(this._isBufferFull||this._emitter.emit(g.default.BUFFER_FULL),this._isBufferFull=!0):(h.default.e(this.TAG,L.message),this._emitter.emit(g.default.ERROR,{code:L.code,msg:L.message}))}}},v.prototype._onSourceOpen=function(){if(h.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var _=this._pendingSourceBufferInit;_.length;){var E=_.shift();this.appendInitSegment(E,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(g.default.SOURCE_OPEN)},v.prototype._onSourceEnded=function(){h.default.v(this.TAG,"MediaSource onSourceEnded")},v.prototype._onSourceClose=function(){h.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},v.prototype._hasPendingSegments=function(){var _=this._pendingSegments;return _.video.length>0||_.audio.length>0},v.prototype._hasPendingRemoveRanges=function(){var _=this._pendingRemoveRanges;return _.video.length>0||_.audio.length>0},v.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(g.default.UPDATE_END)},v.prototype._onSourceBufferError=function(_){h.default.e(this.TAG,"SourceBuffer Error: "+_)},v})();o.default=p}),"./src/core/mse-events.js":(function(n,o,u){u.r(o);var l={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};o.default=l}),"./src/core/transmuxer.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./node_modules/webworkify-webpack/index.js"),c=u.n(h),g=u("./src/utils/logger.js"),f=u("./src/utils/logging-control.js"),m=u("./src/core/transmuxing-controller.js"),p=u("./src/core/transmuxing-events.js"),v=u("./src/core/media-info.js"),_=(function(){function E(x,y){if(this.TAG="Transmuxer",this._emitter=new(d()),y.enableWorker&&typeof Worker!="undefined")try{this._worker=c()("./src/core/transmuxing-worker.js"),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[x,y]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},f.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:f.default.getConfig()})}catch(A){g.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new m.default(x,y)}else this._controller=new m.default(x,y);if(this._controller){var T=this._controller;T.on(p.default.IO_ERROR,this._onIOError.bind(this)),T.on(p.default.DEMUX_ERROR,this._onDemuxError.bind(this)),T.on(p.default.INIT_SEGMENT,this._onInitSegment.bind(this)),T.on(p.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),T.on(p.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),T.on(p.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),T.on(p.default.MEDIA_INFO,this._onMediaInfo.bind(this)),T.on(p.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),T.on(p.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),T.on(p.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),T.on(p.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return E.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),f.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},E.prototype.on=function(x,y){this._emitter.addListener(x,y)},E.prototype.off=function(x,y){this._emitter.removeListener(x,y)},E.prototype.hasWorker=function(){return this._worker!=null},E.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},E.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},E.prototype.seek=function(x){this._worker?this._worker.postMessage({cmd:"seek",param:x}):this._controller.seek(x)},E.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},E.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},E.prototype._onInitSegment=function(x,y){var T=this;Promise.resolve().then(function(){T._emitter.emit(p.default.INIT_SEGMENT,x,y)})},E.prototype._onMediaSegment=function(x,y){var T=this;Promise.resolve().then(function(){T._emitter.emit(p.default.MEDIA_SEGMENT,x,y)})},E.prototype._onLoadingComplete=function(){var x=this;Promise.resolve().then(function(){x._emitter.emit(p.default.LOADING_COMPLETE)})},E.prototype._onRecoveredEarlyEof=function(){var x=this;Promise.resolve().then(function(){x._emitter.emit(p.default.RECOVERED_EARLY_EOF)})},E.prototype._onMediaInfo=function(x){var y=this;Promise.resolve().then(function(){y._emitter.emit(p.default.MEDIA_INFO,x)})},E.prototype._onMetaDataArrived=function(x){var y=this;Promise.resolve().then(function(){y._emitter.emit(p.default.METADATA_ARRIVED,x)})},E.prototype._onScriptDataArrived=function(x){var y=this;Promise.resolve().then(function(){y._emitter.emit(p.default.SCRIPTDATA_ARRIVED,x)})},E.prototype._onStatisticsInfo=function(x){var y=this;Promise.resolve().then(function(){y._emitter.emit(p.default.STATISTICS_INFO,x)})},E.prototype._onIOError=function(x,y){var T=this;Promise.resolve().then(function(){T._emitter.emit(p.default.IO_ERROR,x,y)})},E.prototype._onDemuxError=function(x,y){var T=this;Promise.resolve().then(function(){T._emitter.emit(p.default.DEMUX_ERROR,x,y)})},E.prototype._onRecommendSeekpoint=function(x){var y=this;Promise.resolve().then(function(){y._emitter.emit(p.default.RECOMMEND_SEEKPOINT,x)})},E.prototype._onLoggingConfigChanged=function(x){this._worker&&this._worker.postMessage({cmd:"logging_config",param:x})},E.prototype._onWorkerMessage=function(x){var y=x.data,T=y.data;if(y.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(y.msg){case p.default.INIT_SEGMENT:case p.default.MEDIA_SEGMENT:this._emitter.emit(y.msg,T.type,T.data);break;case p.default.LOADING_COMPLETE:case p.default.RECOVERED_EARLY_EOF:this._emitter.emit(y.msg);break;case p.default.MEDIA_INFO:Object.setPrototypeOf(T,v.default.prototype),this._emitter.emit(y.msg,T);break;case p.default.METADATA_ARRIVED:case p.default.SCRIPTDATA_ARRIVED:case p.default.STATISTICS_INFO:this._emitter.emit(y.msg,T);break;case p.default.IO_ERROR:case p.default.DEMUX_ERROR:this._emitter.emit(y.msg,T.type,T.info);break;case p.default.RECOMMEND_SEEKPOINT:this._emitter.emit(y.msg,T);break;case"logcat_callback":g.default.emitter.emit("log",T.type,T.logcat);break}},E})();o.default=_}),"./src/core/transmuxing-controller.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./src/utils/logger.js"),c=u("./src/utils/browser.js"),g=u("./src/core/media-info.js"),f=u("./src/demux/flv-demuxer.js"),m=u("./src/remux/mp4-remuxer.js"),p=u("./src/demux/demux-errors.js"),v=u("./src/io/io-controller.js"),_=u("./src/core/transmuxing-events.js"),E=(function(){function x(y,T){this.TAG="TransmuxingController",this._emitter=new(d()),this._config=T,y.segments||(y.segments=[{duration:y.duration,filesize:y.filesize,url:y.url}]),typeof y.cors!="boolean"&&(y.cors=!0),typeof y.withCredentials!="boolean"&&(y.withCredentials=!1),this._mediaDataSource=y,this._currentSegmentIndex=0;var A=0;this._mediaDataSource.segments.forEach(function(L){L.timestampBase=A,A+=L.duration,L.cors=y.cors,L.withCredentials=y.withCredentials,T.referrerPolicy&&(L.referrerPolicy=T.referrerPolicy)}),!isNaN(A)&&this._mediaDataSource.duration!==A&&(this._mediaDataSource.duration=A),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return x.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},x.prototype.on=function(y,T){this._emitter.addListener(y,T)},x.prototype.off=function(y,T){this._emitter.removeListener(y,T)},x.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},x.prototype._loadSegment=function(y,T){this._currentSegmentIndex=y;var A=this._mediaDataSource.segments[y],L=this._ioctl=new v.default(A,this._config,y);L.onError=this._onIOException.bind(this),L.onSeeked=this._onIOSeeked.bind(this),L.onComplete=this._onIOComplete.bind(this),L.onRedirect=this._onIORedirect.bind(this),L.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),T?this._demuxer.bindDataSource(this._ioctl):L.onDataArrival=this._onInitChunkArrival.bind(this),L.open(T)},x.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},x.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},x.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},x.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},x.prototype.seek=function(y){if(!(this._mediaInfo==null||!this._mediaInfo.isSeekable())){var T=this._searchSegmentIndexContains(y);if(T===this._currentSegmentIndex){var A=this._mediaInfo.segments[T];if(A==null)this._pendingSeekTime=y;else{var L=A.getNearestKeyframe(y);this._remuxer.seek(L.milliseconds),this._ioctl.seek(L.fileposition),this._pendingResolveSeekPoint=L.milliseconds}}else{var R=this._mediaInfo.segments[T];if(R==null)this._pendingSeekTime=y,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(T);else{var L=R.getNearestKeyframe(y);this._internalAbort(),this._remuxer.seek(y),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[T].timestampBase,this._loadSegment(T,L.fileposition),this._pendingResolveSeekPoint=L.milliseconds,this._reportSegmentMediaInfo(T)}}this._enableStatisticsReporter()}},x.prototype._searchSegmentIndexContains=function(y){for(var T=this._mediaDataSource.segments,A=T.length-1,L=0;L<T.length;L++)if(y<T[L].timestampBase){A=L-1;break}return A},x.prototype._onInitChunkArrival=function(y,T){var A=this,L=null,R=0;if(T>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,R=this._demuxer.parseChunks(y,T);else if((L=f.default.probe(y)).match){this._demuxer=new f.default(L,this._config),this._remuxer||(this._remuxer=new m.default(this._config));var I=this._mediaDataSource;I.duration!=null&&!isNaN(I.duration)&&(this._demuxer.overridedDuration=I.duration),typeof I.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=I.hasAudio),typeof I.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=I.hasVideo),this._demuxer.timestampBase=I.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),R=this._demuxer.parseChunks(y,T)}else L=null,h.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){A._internalAbort()}),this._emitter.emit(_.default.DEMUX_ERROR,p.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),R=0;return R},x.prototype._onMediaInfo=function(y){var T=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},y),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,g.default.prototype));var A=Object.assign({},y);Object.setPrototypeOf(A,g.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=A,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var L=T._pendingSeekTime;T._pendingSeekTime=null,T.seek(L)})},x.prototype._onMetaDataArrived=function(y){this._emitter.emit(_.default.METADATA_ARRIVED,y)},x.prototype._onScriptDataArrived=function(y){this._emitter.emit(_.default.SCRIPTDATA_ARRIVED,y)},x.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},x.prototype._onIOComplete=function(y){var T=y,A=T+1;A<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(A)):(this._remuxer.flushStashedSamples(),this._emitter.emit(_.default.LOADING_COMPLETE),this._disableStatisticsReporter())},x.prototype._onIORedirect=function(y){var T=this._ioctl.extraData;this._mediaDataSource.segments[T].redirectedURL=y},x.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(_.default.RECOVERED_EARLY_EOF)},x.prototype._onIOException=function(y,T){h.default.e(this.TAG,"IOException: type = "+y+", code = "+T.code+", msg = "+T.msg),this._emitter.emit(_.default.IO_ERROR,y,T),this._disableStatisticsReporter()},x.prototype._onDemuxException=function(y,T){h.default.e(this.TAG,"DemuxException: type = "+y+", info = "+T),this._emitter.emit(_.default.DEMUX_ERROR,y,T)},x.prototype._onRemuxerInitSegmentArrival=function(y,T){this._emitter.emit(_.default.INIT_SEGMENT,y,T)},x.prototype._onRemuxerMediaSegmentArrival=function(y,T){if(this._pendingSeekTime==null&&(this._emitter.emit(_.default.MEDIA_SEGMENT,y,T),this._pendingResolveSeekPoint!=null&&y==="video")){var A=T.info.syncPoints,L=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,c.default.safari&&A.length>0&&A[0].originalDts===L&&(L=A[0].pts),this._emitter.emit(_.default.RECOMMEND_SEEKPOINT,L)}},x.prototype._enableStatisticsReporter=function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},x.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},x.prototype._reportSegmentMediaInfo=function(y){var T=this._mediaInfo.segments[y],A=Object.assign({},T);A.duration=this._mediaInfo.duration,A.segmentCount=this._mediaInfo.segmentCount,delete A.segments,delete A.keyframesIndex,this._emitter.emit(_.default.MEDIA_INFO,A)},x.prototype._reportStatisticsInfo=function(){var y={};y.url=this._ioctl.currentURL,y.hasRedirect=this._ioctl.hasRedirect,y.hasRedirect&&(y.redirectedURL=this._ioctl.currentRedirectedURL),y.speed=this._ioctl.currentSpeed,y.loaderType=this._ioctl.loaderType,y.currentSegmentIndex=this._currentSegmentIndex,y.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(_.default.STATISTICS_INFO,y)},x})();o.default=E}),"./src/core/transmuxing-events.js":(function(n,o,u){u.r(o);var l={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"};o.default=l}),"./src/core/transmuxing-worker.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logging-control.js"),d=u("./src/utils/polyfill.js"),h=u("./src/core/transmuxing-controller.js"),c=u("./src/core/transmuxing-events.js"),g=function(f){var m=null,p=b.bind(this);d.default.install(),f.addEventListener("message",function(P){switch(P.data.cmd){case"init":m=new h.default(P.data.param[0],P.data.param[1]),m.on(c.default.IO_ERROR,R.bind(this)),m.on(c.default.DEMUX_ERROR,I.bind(this)),m.on(c.default.INIT_SEGMENT,v.bind(this)),m.on(c.default.MEDIA_SEGMENT,_.bind(this)),m.on(c.default.LOADING_COMPLETE,E.bind(this)),m.on(c.default.RECOVERED_EARLY_EOF,x.bind(this)),m.on(c.default.MEDIA_INFO,y.bind(this)),m.on(c.default.METADATA_ARRIVED,T.bind(this)),m.on(c.default.SCRIPTDATA_ARRIVED,A.bind(this)),m.on(c.default.STATISTICS_INFO,L.bind(this)),m.on(c.default.RECOMMEND_SEEKPOINT,D.bind(this));break;case"destroy":m&&(m.destroy(),m=null),f.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(P.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{var C=P.data.param;l.default.applyConfig(C),C.enableCallback===!0?l.default.addLogListener(p):l.default.removeLogListener(p);break}}});function v(P,C){var k={msg:c.default.INIT_SEGMENT,data:{type:P,data:C}};f.postMessage(k,[C.data])}function _(P,C){var k={msg:c.default.MEDIA_SEGMENT,data:{type:P,data:C}};f.postMessage(k,[C.data])}function E(){var P={msg:c.default.LOADING_COMPLETE};f.postMessage(P)}function x(){var P={msg:c.default.RECOVERED_EARLY_EOF};f.postMessage(P)}function y(P){var C={msg:c.default.MEDIA_INFO,data:P};f.postMessage(C)}function T(P){var C={msg:c.default.METADATA_ARRIVED,data:P};f.postMessage(C)}function A(P){var C={msg:c.default.SCRIPTDATA_ARRIVED,data:P};f.postMessage(C)}function L(P){var C={msg:c.default.STATISTICS_INFO,data:P};f.postMessage(C)}function R(P,C){f.postMessage({msg:c.default.IO_ERROR,data:{type:P,info:C}})}function I(P,C){f.postMessage({msg:c.default.DEMUX_ERROR,data:{type:P,info:C}})}function D(P){f.postMessage({msg:c.default.RECOMMEND_SEEKPOINT,data:P})}function b(P,C){f.postMessage({msg:"logcat_callback",data:{type:P,logcat:C}})}};o.default=g}),"./src/demux/amf-parser.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/utils/utf8-conv.js"),h=u("./src/utils/exception.js"),c=(function(){var f=new ArrayBuffer(2);return new DataView(f).setInt16(0,256,!0),new Int16Array(f)[0]===256})(),g=(function(){function f(){}return f.parseScriptData=function(m,p,v){var _={};try{var E=f.parseValue(m,p,v),x=f.parseValue(m,p+E.size,v-E.size);_[E.data]=x.data}catch(y){l.default.e("AMF",y.toString())}return _},f.parseObject=function(m,p,v){if(v<3)throw new h.IllegalStateException("Data not enough when parse ScriptDataObject");var _=f.parseString(m,p,v),E=f.parseValue(m,p+_.size,v-_.size),x=E.objectEnd;return{data:{name:_.data,value:E.data},size:_.size+E.size,objectEnd:x}},f.parseVariable=function(m,p,v){return f.parseObject(m,p,v)},f.parseString=function(m,p,v){if(v<2)throw new h.IllegalStateException("Data not enough when parse String");var _=new DataView(m,p,v),E=_.getUint16(0,!c),x;return E>0?x=(0,d.default)(new Uint8Array(m,p+2,E)):x="",{data:x,size:2+E}},f.parseLongString=function(m,p,v){if(v<4)throw new h.IllegalStateException("Data not enough when parse LongString");var _=new DataView(m,p,v),E=_.getUint32(0,!c),x;return E>0?x=(0,d.default)(new Uint8Array(m,p+4,E)):x="",{data:x,size:4+E}},f.parseDate=function(m,p,v){if(v<10)throw new h.IllegalStateException("Data size invalid when parse Date");var _=new DataView(m,p,v),E=_.getFloat64(0,!c),x=_.getInt16(8,!c);return E+=x*60*1e3,{data:new Date(E),size:10}},f.parseValue=function(m,p,v){if(v<1)throw new h.IllegalStateException("Data not enough when parse Value");var _=new DataView(m,p,v),E=1,x=_.getUint8(0),y,T=!1;try{switch(x){case 0:y=_.getFloat64(1,!c),E+=8;break;case 1:{var A=_.getUint8(1);y=!!A,E+=1;break}case 2:{var L=f.parseString(m,p+1,v-1);y=L.data,E+=L.size;break}case 3:{y={};var R=0;for((_.getUint32(v-4,!c)&16777215)===9&&(R=3);E<v-4;){var I=f.parseObject(m,p+E,v-E-R);if(I.objectEnd)break;y[I.data.name]=I.data.value,E+=I.size}if(E<=v-3){var D=_.getUint32(E-1,!c)&16777215;D===9&&(E+=3)}break}case 8:{y={},E+=4;var R=0;for((_.getUint32(v-4,!c)&16777215)===9&&(R=3);E<v-8;){var b=f.parseVariable(m,p+E,v-E-R);if(b.objectEnd)break;y[b.data.name]=b.data.value,E+=b.size}if(E<=v-3){var D=_.getUint32(E-1,!c)&16777215;D===9&&(E+=3)}break}case 9:y=void 0,E=1,T=!0;break;case 10:{y=[];var P=_.getUint32(1,!c);E+=4;for(var C=0;C<P;C++){var k=f.parseValue(m,p+E,v-E);y.push(k.data),E+=k.size}break}case 11:{var O=f.parseDate(m,p+1,v-1);y=O.data,E+=O.size;break}case 12:{var F=f.parseString(m,p+1,v-1);y=F.data,E+=F.size;break}default:E=v,l.default.w("AMF","Unsupported AMF value type "+x)}}catch(U){l.default.e("AMF",U.toString())}return{data:y,size:E,objectEnd:T}},f})();o.default=g}),"./src/demux/demux-errors.js":(function(n,o,u){u.r(o);var l={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};o.default=l}),"./src/demux/exp-golomb.js":(function(n,o,u){u.r(o);var l=u("./src/utils/exception.js"),d=(function(){function h(c){this.TAG="ExpGolomb",this._buffer=c,this._buffer_index=0,this._total_bytes=c.byteLength,this._total_bits=c.byteLength*8,this._current_word=0,this._current_word_bits_left=0}return h.prototype.destroy=function(){this._buffer=null},h.prototype._fillCurrentWord=function(){var c=this._total_bytes-this._buffer_index;if(c<=0)throw new l.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var g=Math.min(4,c),f=new Uint8Array(4);f.set(this._buffer.subarray(this._buffer_index,this._buffer_index+g)),this._current_word=new DataView(f.buffer).getUint32(0,!1),this._buffer_index+=g,this._current_word_bits_left=g*8},h.prototype.readBits=function(c){if(c>32)throw new l.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(c<=this._current_word_bits_left){var g=this._current_word>>>32-c;return this._current_word<<=c,this._current_word_bits_left-=c,g}var f=this._current_word_bits_left?this._current_word:0;f=f>>>32-this._current_word_bits_left;var m=c-this._current_word_bits_left;this._fillCurrentWord();var p=Math.min(m,this._current_word_bits_left),v=this._current_word>>>32-p;return this._current_word<<=p,this._current_word_bits_left-=p,f=f<<p|v,f},h.prototype.readBool=function(){return this.readBits(1)===1},h.prototype.readByte=function(){return this.readBits(8)},h.prototype._skipLeadingZero=function(){var c;for(c=0;c<this._current_word_bits_left;c++)if((this._current_word&2147483648>>>c)!==0)return this._current_word<<=c,this._current_word_bits_left-=c,c;return this._fillCurrentWord(),c+this._skipLeadingZero()},h.prototype.readUEG=function(){var c=this._skipLeadingZero();return this.readBits(c+1)-1},h.prototype.readSEG=function(){var c=this.readUEG();return c&1?c+1>>>1:-1*(c>>>1)},h})();o.default=d}),"./src/demux/flv-demuxer.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/demux/amf-parser.js"),h=u("./src/demux/sps-parser.js"),c=u("./src/demux/demux-errors.js"),g=u("./src/core/media-info.js"),f=u("./src/utils/exception.js");function m(v,_){return v[_]<<24|v[_+1]<<16|v[_+2]<<8|v[_+3]}var p=(function(){function v(_,E){this.TAG="FLVDemuxer",this._config=E,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=_.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=_.hasAudioTrack,this._hasVideo=_.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new g.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(function(){var x=new ArrayBuffer(2);return new DataView(x).setInt16(0,256,!0),new Int16Array(x)[0]===256})()}return v.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},v.probe=function(_){var E=new Uint8Array(_),x={match:!1};if(E[0]!==70||E[1]!==76||E[2]!==86||E[3]!==1)return x;var y=(E[4]&4)>>>2!==0,T=(E[4]&1)!==0,A=m(E,5);return A<9?x:{match:!0,consumed:A,dataOffset:A,hasAudioTrack:y,hasVideoTrack:T}},v.prototype.bindDataSource=function(_){return _.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(v.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(_){this._onTrackMetadata=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(_){this._onMediaInfo=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(_){this._onMetaDataArrived=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(_){this._onScriptDataArrived=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onError",{get:function(){return this._onError},set:function(_){this._onError=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(_){this._onDataAvailable=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(_){this._timestampBase=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"overridedDuration",{get:function(){return this._duration},set:function(_){this._durationOverrided=!0,this._duration=_,this._mediaInfo.duration=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"overridedHasAudio",{set:function(_){this._hasAudioFlagOverrided=!0,this._hasAudio=_,this._mediaInfo.hasAudio=_},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"overridedHasVideo",{set:function(_){this._hasVideoFlagOverrided=!0,this._hasVideo=_,this._mediaInfo.hasVideo=_},enumerable:!1,configurable:!0}),v.prototype.resetMediaInfo=function(){this._mediaInfo=new g.default},v.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1},v.prototype.parseChunks=function(_,E){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new f.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var x=0,y=this._littleEndian;if(E===0)if(_.byteLength>13){var T=v.probe(_);x=T.dataOffset}else return 0;if(this._firstParse){this._firstParse=!1,E+x!==this._dataOffset&&l.default.w(this.TAG,"First time parsing but chunk byteStart invalid!");var A=new DataView(_,x),L=A.getUint32(0,!y);L!==0&&l.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),x+=4}for(;x<_.byteLength;){this._dispatch=!0;var A=new DataView(_,x);if(x+11+4>_.byteLength)break;var R=A.getUint8(0),I=A.getUint32(0,!y)&16777215;if(x+11+I+4>_.byteLength)break;if(R!==8&&R!==9&&R!==18){l.default.w(this.TAG,"Unsupported tag type "+R+", skipped"),x+=11+I+4;continue}var D=A.getUint8(4),b=A.getUint8(5),P=A.getUint8(6),C=A.getUint8(7),k=P|b<<8|D<<16|C<<24,O=A.getUint32(7,!y)&16777215;O!==0&&l.default.w(this.TAG,"Meet tag which has StreamID != 0!");var F=x+11;switch(R){case 8:this._parseAudioData(_,F,I,k);break;case 9:this._parseVideoData(_,F,I,k,E+x);break;case 18:this._parseScriptData(_,F,I);break}var U=A.getUint32(11+I,!y);U!==11+I&&l.default.w(this.TAG,"Invalid PrevTagSize "+U),x+=11+I+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),x},v.prototype._parseScriptData=function(_,E,x){var y=d.default.parseScriptData(_,E,x);if(y.hasOwnProperty("onMetaData")){if(y.onMetaData==null||typeof y.onMetaData!="object"){l.default.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&l.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=y;var T=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},T)),typeof T.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=T.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof T.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=T.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof T.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=T.audiodatarate),typeof T.videodatarate=="number"&&(this._mediaInfo.videoDataRate=T.videodatarate),typeof T.width=="number"&&(this._mediaInfo.width=T.width),typeof T.height=="number"&&(this._mediaInfo.height=T.height),typeof T.duration=="number"){if(!this._durationOverrided){var A=Math.floor(T.duration*this._timescale);this._duration=A,this._mediaInfo.duration=A}}else this._mediaInfo.duration=0;if(typeof T.framerate=="number"){var L=Math.floor(T.framerate*1e3);if(L>0){var R=L/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=R,this._referenceFrameRate.fps_num=L,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=R}}if(typeof T.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var I=T.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(I),T.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=T,l.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(y).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},y))},v.prototype._parseKeyframesIndex=function(_){for(var E=[],x=[],y=1;y<_.times.length;y++){var T=this._timestampBase+Math.floor(_.times[y]*1e3);E.push(T),x.push(_.filepositions[y])}return{times:E,filepositions:x}},v.prototype._parseAudioData=function(_,E,x,y){if(x<=1){l.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");return}if(!(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)){this._littleEndian;var T=new DataView(_,E,x),A=T.getUint8(0),L=A>>>4;if(L!==2&&L!==10){this._onError(c.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+L);return}var R=0,I=(A&12)>>>2;if(I>=0&&I<=4)R=this._flvSoundRateTable[I];else{this._onError(c.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+I);return}var D=A&1,b=this._audioMetadata,P=this._audioTrack;if(b||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),b=this._audioMetadata={},b.type="audio",b.id=P.id,b.timescale=this._timescale,b.duration=this._duration,b.audioSampleRate=R,b.channelCount=D===0?1:2),L===10){var C=this._parseAACAudioData(_,E+1,x-1);if(C==null)return;if(C.packetType===0){b.config&&l.default.w(this.TAG,"Found another AudioSpecificConfig!");var k=C.data;b.audioSampleRate=k.samplingRate,b.channelCount=k.channelCount,b.codec=k.codec,b.originalCodec=k.originalCodec,b.config=k.config,b.refSampleDuration=1024/b.audioSampleRate*b.timescale,l.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",b);var O=this._mediaInfo;O.audioCodec=b.originalCodec,O.audioSampleRate=b.audioSampleRate,O.audioChannelCount=b.channelCount,O.hasVideo?O.videoCodec!=null&&(O.mimeType='video/x-flv; codecs="'+O.videoCodec+","+O.audioCodec+'"'):O.mimeType='video/x-flv; codecs="'+O.audioCodec+'"',O.isComplete()&&this._onMediaInfo(O)}else if(C.packetType===1){var F=this._timestampBase+y,U={unit:C.data,length:C.data.byteLength,dts:F,pts:F};P.samples.push(U),P.length+=C.data.length}else l.default.e(this.TAG,"Flv: Unsupported AAC data type "+C.packetType)}else if(L===2){if(!b.codec){var k=this._parseMP3AudioData(_,E+1,x-1,!0);if(k==null)return;b.audioSampleRate=k.samplingRate,b.channelCount=k.channelCount,b.codec=k.codec,b.originalCodec=k.originalCodec,b.refSampleDuration=1152/b.audioSampleRate*b.timescale,l.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",b);var O=this._mediaInfo;O.audioCodec=b.codec,O.audioSampleRate=b.audioSampleRate,O.audioChannelCount=b.channelCount,O.audioDataRate=k.bitRate,O.hasVideo?O.videoCodec!=null&&(O.mimeType='video/x-flv; codecs="'+O.videoCodec+","+O.audioCodec+'"'):O.mimeType='video/x-flv; codecs="'+O.audioCodec+'"',O.isComplete()&&this._onMediaInfo(O)}var G=this._parseMP3AudioData(_,E+1,x-1,!1);if(G==null)return;var F=this._timestampBase+y,V={unit:G,length:G.byteLength,dts:F,pts:F};P.samples.push(V),P.length+=G.length}}},v.prototype._parseAACAudioData=function(_,E,x){if(x<=1){l.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}var y={},T=new Uint8Array(_,E,x);return y.packetType=T[0],T[0]===0?y.data=this._parseAACAudioSpecificConfig(_,E+1,x-1):y.data=T.subarray(1),y},v.prototype._parseAACAudioSpecificConfig=function(_,E,x){var y=new Uint8Array(_,E,x),T=null,A=0,L=0,R=0,I=null;if(A=L=y[0]>>>3,R=(y[0]&7)<<1|y[1]>>>7,R<0||R>=this._mpegSamplingRates.length){this._onError(c.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}var D=this._mpegSamplingRates[R],b=(y[1]&120)>>>3;if(b<0||b>=8){this._onError(c.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}A===5&&(I=(y[1]&7)<<1|y[2]>>>7,(y[2]&124)>>>2);var P=self.navigator.userAgent.toLowerCase();return P.indexOf("firefox")!==-1?R>=6?(A=5,T=new Array(4),I=R-3):(A=2,T=new Array(2),I=R):P.indexOf("android")!==-1?(A=2,T=new Array(2),I=R):(A=5,I=R,T=new Array(4),R>=6?I=R-3:b===1&&(A=2,T=new Array(2),I=R)),T[0]=A<<3,T[0]|=(R&15)>>>1,T[1]=(R&15)<<7,T[1]|=(b&15)<<3,A===5&&(T[1]|=(I&15)>>>1,T[2]=(I&1)<<7,T[2]|=8,T[3]=0),{config:T,samplingRate:D,channelCount:b,codec:"mp4a.40."+A,originalCodec:"mp4a.40."+L}},v.prototype._parseMP3AudioData=function(_,E,x,y){if(x<4){l.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}this._littleEndian;var T=new Uint8Array(_,E,x),A=null;if(y){if(T[0]!==255)return;var L=T[1]>>>3&3,R=(T[1]&6)>>1,I=(T[2]&240)>>>4,D=(T[2]&12)>>>2,b=T[3]>>>6&3,P=b!==3?2:1,C=0,k=0,O="mp3";switch(L){case 0:C=this._mpegAudioV25SampleRateTable[D];break;case 2:C=this._mpegAudioV20SampleRateTable[D];break;case 3:C=this._mpegAudioV10SampleRateTable[D];break}switch(R){case 1:I<this._mpegAudioL3BitRateTable.length&&(k=this._mpegAudioL3BitRateTable[I]);break;case 2:I<this._mpegAudioL2BitRateTable.length&&(k=this._mpegAudioL2BitRateTable[I]);break;case 3:I<this._mpegAudioL1BitRateTable.length&&(k=this._mpegAudioL1BitRateTable[I]);break}A={bitRate:k,samplingRate:C,channelCount:P,codec:O,originalCodec:O}}else A=T;return A},v.prototype._parseVideoData=function(_,E,x,y,T){if(x<=1){l.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");return}if(!(this._hasVideoFlagOverrided===!0&&this._hasVideo===!1)){var A=new Uint8Array(_,E,x)[0],L=(A&240)>>>4,R=A&15;if(R!==7){this._onError(c.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+R);return}this._parseAVCVideoPacket(_,E+1,x-1,y,T,L)}},v.prototype._parseAVCVideoPacket=function(_,E,x,y,T,A){if(x<4){l.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}var L=this._littleEndian,R=new DataView(_,E,x),I=R.getUint8(0),D=R.getUint32(0,!L)&16777215,b=D<<8>>8;if(I===0)this._parseAVCDecoderConfigurationRecord(_,E+4,x-4);else if(I===1)this._parseAVCVideoData(_,E+4,x-4,y,T,A,b);else if(I!==2){this._onError(c.default.FORMAT_ERROR,"Flv: Invalid video packet type "+I);return}},v.prototype._parseAVCDecoderConfigurationRecord=function(_,E,x){if(x<7){l.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}var y=this._videoMetadata,T=this._videoTrack,A=this._littleEndian,L=new DataView(_,E,x);y?typeof y.avcc!="undefined"&&l.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),y=this._videoMetadata={},y.type="video",y.id=T.id,y.timescale=this._timescale,y.duration=this._duration);var R=L.getUint8(0),I=L.getUint8(1);if(L.getUint8(2),L.getUint8(3),R!==1||I===0){this._onError(c.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(L.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(c.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));return}var D=L.getUint8(5)&31;if(D===0){this._onError(c.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else D>1&&l.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+D);for(var b=6,P=0;P<D;P++){var C=L.getUint16(b,!A);if(b+=2,C!==0){var k=new Uint8Array(_,E+b,C);b+=C;var O=h.default.parseSPS(k);if(P===0){y.codecWidth=O.codec_size.width,y.codecHeight=O.codec_size.height,y.presentWidth=O.present_size.width,y.presentHeight=O.present_size.height,y.profile=O.profile_string,y.level=O.level_string,y.bitDepth=O.bit_depth,y.chromaFormat=O.chroma_format,y.sarRatio=O.sar_ratio,y.frameRate=O.frame_rate,(O.frame_rate.fixed===!1||O.frame_rate.fps_num===0||O.frame_rate.fps_den===0)&&(y.frameRate=this._referenceFrameRate);var F=y.frameRate.fps_den,U=y.frameRate.fps_num;y.refSampleDuration=y.timescale*(F/U);for(var G=k.subarray(1,4),V="avc1.",$=0;$<3;$++){var K=G[$].toString(16);K.length<2&&(K="0"+K),V+=K}y.codec=V;var H=this._mediaInfo;H.width=y.codecWidth,H.height=y.codecHeight,H.fps=y.frameRate.fps,H.profile=y.profile,H.level=y.level,H.refFrames=O.ref_frames,H.chromaFormat=O.chroma_format_string,H.sarNum=y.sarRatio.width,H.sarDen=y.sarRatio.height,H.videoCodec=V,H.hasAudio?H.audioCodec!=null&&(H.mimeType='video/x-flv; codecs="'+H.videoCodec+","+H.audioCodec+'"'):H.mimeType='video/x-flv; codecs="'+H.videoCodec+'"',H.isComplete()&&this._onMediaInfo(H)}}}var X=L.getUint8(b);if(X===0){this._onError(c.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else X>1&&l.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+X);b++;for(var P=0;P<X;P++){var C=L.getUint16(b,!A);b+=2,C!==0&&(b+=C)}y.avcc=new Uint8Array(x),y.avcc.set(new Uint8Array(_,E,x),0),l.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",y)},v.prototype._parseAVCVideoData=function(_,E,x,y,T,A,L){for(var R=this._littleEndian,I=new DataView(_,E,x),D=[],b=0,P=0,C=this._naluLengthSize,k=this._timestampBase+y,O=A===1;P<x;){if(P+4>=x){l.default.w(this.TAG,"Malformed Nalu near timestamp "+k+", offset = "+P+", dataSize = "+x);break}var F=I.getUint32(P,!R);if(C===3&&(F>>>=8),F>x-C){l.default.w(this.TAG,"Malformed Nalus near timestamp "+k+", NaluSize > DataSize!");return}var U=I.getUint8(P+C)&31;U===5&&(O=!0);var G=new Uint8Array(_,E+P,C+F),V={type:U,data:G};D.push(V),b+=G.byteLength,P+=C+F}if(D.length){var $=this._videoTrack,K={units:D,length:b,isKeyframe:O,dts:k,cts:L,pts:k+L};O&&(K.fileposition=T),$.samples.push(K),$.length+=b}},v})();o.default=p}),"./src/demux/sps-parser.js":(function(n,o,u){u.r(o);var l=u("./src/demux/exp-golomb.js"),d=(function(){function h(){}return h._ebsp2rbsp=function(c){for(var g=c,f=g.byteLength,m=new Uint8Array(f),p=0,v=0;v<f;v++)v>=2&&g[v]===3&&g[v-1]===0&&g[v-2]===0||(m[p]=g[v],p++);return new Uint8Array(m.buffer,0,p)},h.parseSPS=function(c){var g=h._ebsp2rbsp(c),f=new l.default(g);f.readByte();var m=f.readByte();f.readByte();var p=f.readByte();f.readUEG();var v=h.getProfileString(m),_=h.getLevelString(p),E=1,x=420,y=[0,420,422,444],T=8;if((m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128||m===138||m===144)&&(E=f.readUEG(),E===3&&f.readBits(1),E<=3&&(x=y[E]),T=f.readUEG()+8,f.readUEG(),f.readBits(1),f.readBool()))for(var A=E!==3?8:12,L=0;L<A;L++)f.readBool()&&(L<6?h._skipScalingList(f,16):h._skipScalingList(f,64));f.readUEG();var R=f.readUEG();if(R===0)f.readUEG();else if(R===1){f.readBits(1),f.readSEG(),f.readSEG();for(var I=f.readUEG(),L=0;L<I;L++)f.readSEG()}var D=f.readUEG();f.readBits(1);var b=f.readUEG(),P=f.readUEG(),C=f.readBits(1);C===0&&f.readBits(1),f.readBits(1);var k=0,O=0,F=0,U=0,G=f.readBool();G&&(k=f.readUEG(),O=f.readUEG(),F=f.readUEG(),U=f.readUEG());var V=1,$=1,K=0,H=!0,X=0,ee=0,Q=f.readBool();if(Q){if(f.readBool()){var re=f.readByte(),de=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],he=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];re>0&&re<16?(V=de[re-1],$=he[re-1]):re===255&&(V=f.readByte()<<8|f.readByte(),$=f.readByte()<<8|f.readByte())}if(f.readBool()&&f.readBool(),f.readBool()&&(f.readBits(4),f.readBool()&&f.readBits(24)),f.readBool()&&(f.readUEG(),f.readUEG()),f.readBool()){var Ee=f.readBits(32),Pe=f.readBits(32);H=f.readBool(),X=Pe,ee=Ee*2,K=X/ee}}var _e=1;(V!==1||$!==1)&&(_e=V/$);var te=0,Oe=0;if(E===0)te=1,Oe=2-C;else{var qe=E===3?1:2,ne=E===1?2:1;te=qe,Oe=ne*(2-C)}var ve=(b+1)*16,Te=(2-C)*((P+1)*16);ve-=(k+O)*te,Te-=(F+U)*Oe;var Ue=Math.ceil(ve*_e);return f.destroy(),f=null,{profile_string:v,level_string:_,bit_depth:T,ref_frames:D,chroma_format:x,chroma_format_string:h.getChromaFormatString(x),frame_rate:{fixed:H,fps:K,fps_den:ee,fps_num:X},sar_ratio:{width:V,height:$},codec_size:{width:ve,height:Te},present_size:{width:Ue,height:Te}}},h._skipScalingList=function(c,g){for(var f=8,m=8,p=0,v=0;v<g;v++)m!==0&&(p=c.readSEG(),m=(f+p+256)%256),f=m===0?f:m},h.getProfileString=function(c){switch(c){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},h.getLevelString=function(c){return(c/10).toFixed(1)},h.getChromaFormatString=function(c){switch(c){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},h})();o.default=d}),"./src/flv.js":(function(n,o,u){u.r(o);var l=u("./src/utils/polyfill.js"),d=u("./src/core/features.js"),h=u("./src/io/loader.js"),c=u("./src/player/flv-player.js"),g=u("./src/player/native-player.js"),f=u("./src/player/player-events.js"),m=u("./src/player/player-errors.js"),p=u("./src/utils/logging-control.js"),v=u("./src/utils/exception.js");l.default.install();function _(T,A){var L=T;if(L==null||typeof L!="object")throw new v.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!L.hasOwnProperty("type"))throw new v.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");return L.type==="flv"?new c.default(L,A):new g.default(L,A)}function E(){return d.default.supportMSEH264Playback()}function x(){return d.default.getFeatureList()}var y={};y.createPlayer=_,y.isSupported=E,y.getFeatureList=x,y.BaseLoader=h.BaseLoader,y.LoaderStatus=h.LoaderStatus,y.LoaderErrors=h.LoaderErrors,y.Events=f.default,y.ErrorTypes=m.ErrorTypes,y.ErrorDetails=m.ErrorDetails,y.FlvPlayer=c.default,y.NativePlayer=g.default,y.LoggingControl=p.default,Object.defineProperty(y,"version",{enumerable:!0,get:function(){return"1.6.2"}}),o.default=y}),"./src/index.js":(function(n,o,u){n.exports=u("./src/flv.js").default}),"./src/io/fetch-stream-loader.js":(function(n,o,u){u.r(o);var l=u("./src/utils/browser.js"),d=u("./src/io/loader.js"),h=u("./src/utils/exception.js"),c=(function(){var f=function(m,p){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,_){v.__proto__=_}||function(v,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(v[E]=_[E])},f(m,p)};return function(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");f(m,p);function v(){this.constructor=m}m.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})(),g=(function(f){c(m,f);function m(p,v){var _=f.call(this,"fetch-stream-loader")||this;return _.TAG="FetchStreamLoader",_._seekHandler=p,_._config=v,_._needStash=!0,_._requestAbort=!1,_._contentLength=null,_._receivedLength=0,_}return m.isSupported=function(){try{var p=l.default.msedge&&l.default.version.minor>=15048,v=l.default.msedge?p:!0;return self.fetch&&self.ReadableStream&&v}catch(_){return!1}},m.prototype.destroy=function(){this.isWorking()&&this.abort(),f.prototype.destroy.call(this)},m.prototype.open=function(p,v){var _=this;this._dataSource=p,this._range=v;var E=p.url;this._config.reuseRedirectedURL&&p.redirectedURL!=null&&(E=p.redirectedURL);var x=this._seekHandler.getConfig(E,v),y=new self.Headers;if(typeof x.headers=="object"){var T=x.headers;for(var A in T)T.hasOwnProperty(A)&&y.append(A,T[A])}var L={method:"GET",headers:y,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var A in this._config.headers)y.append(A,this._config.headers[A]);p.cors===!1&&(L.mode="same-origin"),p.withCredentials&&(L.credentials="include"),p.referrerPolicy&&(L.referrerPolicy=p.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,L.signal=this._abortController.signal),this._status=d.LoaderStatus.kConnecting,self.fetch(x.url,L).then(function(R){if(_._requestAbort){_._status=d.LoaderStatus.kIdle,R.body.cancel();return}if(R.ok&&R.status>=200&&R.status<=299){if(R.url!==x.url&&_._onURLRedirect){var I=_._seekHandler.removeURLParameters(R.url);_._onURLRedirect(I)}var D=R.headers.get("Content-Length");return D!=null&&(_._contentLength=parseInt(D),_._contentLength!==0&&_._onContentLengthKnown&&_._onContentLengthKnown(_._contentLength)),_._pump.call(_,R.body.getReader())}else if(_._status=d.LoaderStatus.kError,_._onError)_._onError(d.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:R.status,msg:R.statusText});else throw new h.RuntimeException("FetchStreamLoader: Http code invalid, "+R.status+" "+R.statusText)}).catch(function(R){if(!(_._abortController&&_._abortController.signal.aborted))if(_._status=d.LoaderStatus.kError,_._onError)_._onError(d.LoaderErrors.EXCEPTION,{code:-1,msg:R.message});else throw R})},m.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==d.LoaderStatus.kBuffering||!l.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(p){}},m.prototype._pump=function(p){var v=this;return p.read().then(function(_){if(_.done)if(v._contentLength!==null&&v._receivedLength<v._contentLength){v._status=d.LoaderStatus.kError;var E=d.LoaderErrors.EARLY_EOF,x={code:-1,msg:"Fetch stream meet Early-EOF"};if(v._onError)v._onError(E,x);else throw new h.RuntimeException(x.msg)}else v._status=d.LoaderStatus.kComplete,v._onComplete&&v._onComplete(v._range.from,v._range.from+v._receivedLength-1);else{if(v._abortController&&v._abortController.signal.aborted){v._status=d.LoaderStatus.kComplete;return}else if(v._requestAbort===!0)return v._status=d.LoaderStatus.kComplete,p.cancel();v._status=d.LoaderStatus.kBuffering;var y=_.value.buffer,T=v._range.from+v._receivedLength;v._receivedLength+=y.byteLength,v._onDataArrival&&v._onDataArrival(y,T,v._receivedLength),v._pump(p)}}).catch(function(_){if(v._abortController&&v._abortController.signal.aborted){v._status=d.LoaderStatus.kComplete;return}if(!(_.code===11&&l.default.msedge)){v._status=d.LoaderStatus.kError;var E=0,x=null;if((_.code===19||_.message==="network error")&&(v._contentLength===null||v._contentLength!==null&&v._receivedLength<v._contentLength)?(E=d.LoaderErrors.EARLY_EOF,x={code:_.code,msg:"Fetch stream meet Early-EOF"}):(E=d.LoaderErrors.EXCEPTION,x={code:_.code,msg:_.message}),v._onError)v._onError(E,x);else throw new h.RuntimeException(x.msg)}})},m})(d.BaseLoader);o.default=g}),"./src/io/io-controller.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/io/speed-sampler.js"),h=u("./src/io/loader.js"),c=u("./src/io/fetch-stream-loader.js"),g=u("./src/io/xhr-moz-chunked-loader.js"),f=u("./src/io/xhr-range-loader.js"),m=u("./src/io/websocket-loader.js"),p=u("./src/io/range-seek-handler.js"),v=u("./src/io/param-seek-handler.js"),_=u("./src/utils/exception.js"),E=(function(){function x(y,T,A){this.TAG="IOController",this._config=T,this._extraData=A,this._stashInitialSize=1024*384,T.stashInitialSize!=null&&T.stashInitialSize>0&&(this._stashInitialSize=T.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,T.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=y,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(y.url),this._refTotalLength=y.filesize?y.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new d.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return x.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},x.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},x.prototype.isPaused=function(){return this._paused},Object.defineProperty(x.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"extraData",{get:function(){return this._extraData},set:function(y){this._extraData=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(y){this._onDataArrival=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(y){this._onSeeked=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onError",{get:function(){return this._onError},set:function(y){this._onError=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onComplete",{get:function(){return this._onComplete},set:function(y){this._onComplete=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(y){this._onRedirect=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(y){this._onRecoveredEarlyEof=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasRedirect",{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"currentSpeed",{get:function(){return this._loaderClass===f.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),x.prototype._selectSeekHandler=function(){var y=this._config;if(y.seekType==="range")this._seekHandler=new p.default(this._config.rangeLoadZeroStart);else if(y.seekType==="param"){var T=y.seekParamStart||"bstart",A=y.seekParamEnd||"bend";this._seekHandler=new v.default(T,A)}else if(y.seekType==="custom"){if(typeof y.customSeekHandler!="function")throw new _.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new y.customSeekHandler}else throw new _.InvalidArgumentException("Invalid seekType in config: "+y.seekType)},x.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m.default;else if(c.default.isSupported())this._loaderClass=c.default;else if(g.default.isSupported())this._loaderClass=g.default;else if(f.default.isSupported())this._loaderClass=f.default;else throw new _.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!")},x.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},x.prototype.open=function(y){this._currentRange={from:0,to:-1},y&&(this._currentRange.from=y),this._speedSampler.reset(),y||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},x.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},x.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},x.prototype.resume=function(){if(this._paused){this._paused=!1;var y=this._resumeFrom;this._resumeFrom=0,this._internalSeek(y,!0)}},x.prototype.seek=function(y){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(y,!0)},x.prototype._internalSeek=function(y,T){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(T),this._loader.destroy(),this._loader=null;var A={from:y,to:-1};this._currentRange={from:A.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,A),this._onSeeked&&this._onSeeked()},x.prototype.updateUrl=function(y){if(!y||typeof y!="string"||y.length===0)throw new _.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=y},x.prototype._expandBuffer=function(y){for(var T=this._stashSize;T+1024*1024*1<y;)T*=2;if(T+=1024*1024*1,T!==this._bufferSize){var A=new ArrayBuffer(T);if(this._stashUsed>0){var L=new Uint8Array(this._stashBuffer,0,this._stashUsed),R=new Uint8Array(A,0,T);R.set(L,0)}this._stashBuffer=A,this._bufferSize=T}},x.prototype._normalizeSpeed=function(y){var T=this._speedNormalizeList,A=T.length-1,L=0,R=0,I=A;if(y<T[0])return T[0];for(;R<=I;){if(L=R+Math.floor((I-R)/2),L===A||y>=T[L]&&y<T[L+1])return T[L];T[L]<y?R=L+1:I=L-1}},x.prototype._adjustStashSize=function(y){var T=0;this._config.isLive||y<512?T=y:y>=512&&y<=1024?T=Math.floor(y*1.5):T=y*2,T>8192&&(T=8192);var A=T*1024+1024*1024*1;this._bufferSize<A&&this._expandBuffer(A),this._stashSize=T*1024},x.prototype._dispatchChunks=function(y,T){return this._currentRange.to=T+y.byteLength-1,this._onDataArrival(y,T)},x.prototype._onURLRedirect=function(y){this._redirectedURL=y,this._onRedirect&&this._onRedirect(y)},x.prototype._onContentLengthKnown=function(y){y&&this._fullRequestFlag&&(this._totalLength=y,this._fullRequestFlag=!1)},x.prototype._onLoaderChunkArrival=function(y,T,A){if(!this._onDataArrival)throw new _.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(y.byteLength);var L=this._speedSampler.lastSecondKBps;if(L!==0){var R=this._normalizeSpeed(L);this._speedNormalized!==R&&(this._speedNormalized=R,this._adjustStashSize(R))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=T),this._stashUsed+y.byteLength<=this._stashSize){var b=new Uint8Array(this._stashBuffer,0,this._stashSize);b.set(new Uint8Array(y),this._stashUsed),this._stashUsed+=y.byteLength}else{var b=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){var C=this._stashBuffer.slice(0,this._stashUsed),I=this._dispatchChunks(C,this._stashByteStart);if(I<C.byteLength){if(I>0){var P=new Uint8Array(C,I);b.set(P,0),this._stashUsed=P.byteLength,this._stashByteStart+=I}}else this._stashUsed=0,this._stashByteStart+=I;this._stashUsed+y.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+y.byteLength),b=new Uint8Array(this._stashBuffer,0,this._bufferSize)),b.set(new Uint8Array(y),this._stashUsed),this._stashUsed+=y.byteLength}else{var I=this._dispatchChunks(y,T);if(I<y.byteLength){var D=y.byteLength-I;D>this._bufferSize&&(this._expandBuffer(D),b=new Uint8Array(this._stashBuffer,0,this._bufferSize)),b.set(new Uint8Array(y,I),0),this._stashUsed+=D,this._stashByteStart=T+I}}}else if(this._stashUsed===0){var I=this._dispatchChunks(y,T);if(I<y.byteLength){var D=y.byteLength-I;D>this._bufferSize&&this._expandBuffer(D);var b=new Uint8Array(this._stashBuffer,0,this._bufferSize);b.set(new Uint8Array(y,I),0),this._stashUsed+=D,this._stashByteStart=T+I}}else{this._stashUsed+y.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+y.byteLength);var b=new Uint8Array(this._stashBuffer,0,this._bufferSize);b.set(new Uint8Array(y),this._stashUsed),this._stashUsed+=y.byteLength;var I=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(I<this._stashUsed&&I>0){var P=new Uint8Array(this._stashBuffer,I);b.set(P,0)}this._stashUsed-=I,this._stashByteStart+=I}}},x.prototype._flushStashBuffer=function(y){if(this._stashUsed>0){var T=this._stashBuffer.slice(0,this._stashUsed),A=this._dispatchChunks(T,this._stashByteStart),L=T.byteLength-A;if(A<T.byteLength)if(y)l.default.w(this.TAG,L+" bytes unconsumed data remain when flush buffer, dropped");else{if(A>0){var R=new Uint8Array(this._stashBuffer,0,this._bufferSize),I=new Uint8Array(T,A);R.set(I,0),this._stashUsed=I.byteLength,this._stashByteStart+=A}return 0}return this._stashUsed=0,this._stashByteStart=0,L}return 0},x.prototype._onLoaderComplete=function(y,T){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},x.prototype._onLoaderError=function(y,T){switch(l.default.e(this.TAG,"Loader error, code = "+T.code+", msg = "+T.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,y=h.LoaderErrors.UNRECOVERABLE_EARLY_EOF),y){case h.LoaderErrors.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){var A=this._currentRange.to+1;A<this._totalLength&&(l.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(A,!1));return}y=h.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break}case h.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case h.LoaderErrors.CONNECTING_TIMEOUT:case h.LoaderErrors.HTTP_STATUS_CODE_INVALID:case h.LoaderErrors.EXCEPTION:break}if(this._onError)this._onError(y,T);else throw new _.RuntimeException("IOException: "+T.msg)},x})();o.default=E}),"./src/io/loader.js":(function(n,o,u){u.r(o),u.d(o,{LoaderStatus:function(){return d},LoaderErrors:function(){return h},BaseLoader:function(){return c}});var l=u("./src/utils/exception.js"),d={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},h={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},c=(function(){function g(f){this._type=f||"undefined",this._status=d.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return g.prototype.destroy=function(){this._status=d.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},g.prototype.isWorking=function(){return this._status===d.kConnecting||this._status===d.kBuffering},Object.defineProperty(g.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(f){this._onContentLengthKnown=f},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(f){this._onURLRedirect=f},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(f){this._onDataArrival=f},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"onError",{get:function(){return this._onError},set:function(f){this._onError=f},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"onComplete",{get:function(){return this._onComplete},set:function(f){this._onComplete=f},enumerable:!1,configurable:!0}),g.prototype.open=function(f,m){throw new l.NotImplementedException("Unimplemented abstract function!")},g.prototype.abort=function(){throw new l.NotImplementedException("Unimplemented abstract function!")},g})()}),"./src/io/param-seek-handler.js":(function(n,o,u){u.r(o);var l=(function(){function d(h,c){this._startName=h,this._endName=c}return d.prototype.getConfig=function(h,c){var g=h;if(c.from!==0||c.to!==-1){var f=!0;g.indexOf("?")===-1&&(g+="?",f=!1),f&&(g+="&"),g+=this._startName+"="+c.from.toString(),c.to!==-1&&(g+="&"+this._endName+"="+c.to.toString())}return{url:g,headers:{}}},d.prototype.removeURLParameters=function(h){var c=h.split("?")[0],g=void 0,f=h.indexOf("?");f!==-1&&(g=h.substring(f+1));var m="";if(g!=null&&g.length>0)for(var p=g.split("&"),v=0;v<p.length;v++){var _=p[v].split("="),E=v>0;_[0]!==this._startName&&_[0]!==this._endName&&(E&&(m+="&"),m+=p[v])}return m.length===0?c:c+"?"+m},d})();o.default=l}),"./src/io/range-seek-handler.js":(function(n,o,u){u.r(o);var l=(function(){function d(h){this._zeroStart=h||!1}return d.prototype.getConfig=function(h,c){var g={};if(c.from!==0||c.to!==-1){var f=void 0;c.to!==-1?f="bytes="+c.from.toString()+"-"+c.to.toString():f="bytes="+c.from.toString()+"-",g.Range=f}else this._zeroStart&&(g.Range="bytes=0-");return{url:h,headers:g}},d.prototype.removeURLParameters=function(h){return h},d})();o.default=l}),"./src/io/speed-sampler.js":(function(n,o,u){u.r(o);var l=(function(){function d(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return d.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},d.prototype.addBytes=function(h){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=h,this._totalBytes+=h):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=h,this._totalBytes+=h):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=h,this._totalBytes+=h,this._lastCheckpoint=this._now())},Object.defineProperty(d.prototype,"currentKBps",{get:function(){this.addBytes(0);var h=(this._now()-this._lastCheckpoint)/1e3;return h==0&&(h=1),this._intervalBytes/h/1024},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"averageKBps",{get:function(){var h=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/h/1024},enumerable:!1,configurable:!0}),d})();o.default=l}),"./src/io/websocket-loader.js":(function(n,o,u){u.r(o);var l=u("./src/io/loader.js"),d=u("./src/utils/exception.js"),h=(function(){var g=function(f,m){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,v){p.__proto__=v}||function(p,v){for(var _ in v)Object.prototype.hasOwnProperty.call(v,_)&&(p[_]=v[_])},g(f,m)};return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");g(f,m);function p(){this.constructor=f}f.prototype=m===null?Object.create(m):(p.prototype=m.prototype,new p)}})(),c=(function(g){h(f,g);function f(){var m=g.call(this,"websocket-loader")||this;return m.TAG="WebSocketLoader",m._needStash=!0,m._ws=null,m._requestAbort=!1,m._receivedLength=0,m}return f.isSupported=function(){try{return typeof self.WebSocket!="undefined"}catch(m){return!1}},f.prototype.destroy=function(){this._ws&&this.abort(),g.prototype.destroy.call(this)},f.prototype.open=function(m){try{var p=this._ws=new self.WebSocket(m.url);p.binaryType="arraybuffer",p.onopen=this._onWebSocketOpen.bind(this),p.onclose=this._onWebSocketClose.bind(this),p.onmessage=this._onWebSocketMessage.bind(this),p.onerror=this._onWebSocketError.bind(this),this._status=l.LoaderStatus.kConnecting}catch(_){this._status=l.LoaderStatus.kError;var v={code:_.code,msg:_.message};if(this._onError)this._onError(l.LoaderErrors.EXCEPTION,v);else throw new d.RuntimeException(v.msg)}},f.prototype.abort=function(){var m=this._ws;m&&(m.readyState===0||m.readyState===1)&&(this._requestAbort=!0,m.close()),this._ws=null,this._status=l.LoaderStatus.kComplete},f.prototype._onWebSocketOpen=function(m){this._status=l.LoaderStatus.kBuffering},f.prototype._onWebSocketClose=function(m){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=l.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)},f.prototype._onWebSocketMessage=function(m){var p=this;if(m.data instanceof ArrayBuffer)this._dispatchArrayBuffer(m.data);else if(m.data instanceof Blob){var v=new FileReader;v.onload=function(){p._dispatchArrayBuffer(v.result)},v.readAsArrayBuffer(m.data)}else{this._status=l.LoaderStatus.kError;var _={code:-1,msg:"Unsupported WebSocket message type: "+m.data.constructor.name};if(this._onError)this._onError(l.LoaderErrors.EXCEPTION,_);else throw new d.RuntimeException(_.msg)}},f.prototype._dispatchArrayBuffer=function(m){var p=m,v=this._receivedLength;this._receivedLength+=p.byteLength,this._onDataArrival&&this._onDataArrival(p,v,this._receivedLength)},f.prototype._onWebSocketError=function(m){this._status=l.LoaderStatus.kError;var p={code:m.code,msg:m.message};if(this._onError)this._onError(l.LoaderErrors.EXCEPTION,p);else throw new d.RuntimeException(p.msg)},f})(l.BaseLoader);o.default=c}),"./src/io/xhr-moz-chunked-loader.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/io/loader.js"),h=u("./src/utils/exception.js"),c=(function(){var f=function(m,p){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,_){v.__proto__=_}||function(v,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(v[E]=_[E])},f(m,p)};return function(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");f(m,p);function v(){this.constructor=m}m.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})(),g=(function(f){c(m,f);function m(p,v){var _=f.call(this,"xhr-moz-chunked-loader")||this;return _.TAG="MozChunkedLoader",_._seekHandler=p,_._config=v,_._needStash=!0,_._xhr=null,_._requestAbort=!1,_._contentLength=null,_._receivedLength=0,_}return m.isSupported=function(){try{var p=new XMLHttpRequest;return p.open("GET","https://example.com",!0),p.responseType="moz-chunked-arraybuffer",p.responseType==="moz-chunked-arraybuffer"}catch(v){return l.default.w("MozChunkedLoader",v.message),!1}},m.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),f.prototype.destroy.call(this)},m.prototype.open=function(p,v){this._dataSource=p,this._range=v;var _=p.url;this._config.reuseRedirectedURL&&p.redirectedURL!=null&&(_=p.redirectedURL);var E=this._seekHandler.getConfig(_,v);this._requestURL=E.url;var x=this._xhr=new XMLHttpRequest;if(x.open("GET",E.url,!0),x.responseType="moz-chunked-arraybuffer",x.onreadystatechange=this._onReadyStateChange.bind(this),x.onprogress=this._onProgress.bind(this),x.onloadend=this._onLoadEnd.bind(this),x.onerror=this._onXhrError.bind(this),p.withCredentials&&(x.withCredentials=!0),typeof E.headers=="object"){var y=E.headers;for(var T in y)y.hasOwnProperty(T)&&x.setRequestHeader(T,y[T])}if(typeof this._config.headers=="object"){var y=this._config.headers;for(var T in y)y.hasOwnProperty(T)&&x.setRequestHeader(T,y[T])}this._status=d.LoaderStatus.kConnecting,x.send()},m.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=d.LoaderStatus.kComplete},m.prototype._onReadyStateChange=function(p){var v=p.target;if(v.readyState===2){if(v.responseURL!=null&&v.responseURL!==this._requestURL&&this._onURLRedirect){var _=this._seekHandler.removeURLParameters(v.responseURL);this._onURLRedirect(_)}if(v.status!==0&&(v.status<200||v.status>299))if(this._status=d.LoaderStatus.kError,this._onError)this._onError(d.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:v.status,msg:v.statusText});else throw new h.RuntimeException("MozChunkedLoader: Http code invalid, "+v.status+" "+v.statusText);else this._status=d.LoaderStatus.kBuffering}},m.prototype._onProgress=function(p){if(this._status!==d.LoaderStatus.kError){this._contentLength===null&&p.total!==null&&p.total!==0&&(this._contentLength=p.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var v=p.target.response,_=this._range.from+this._receivedLength;this._receivedLength+=v.byteLength,this._onDataArrival&&this._onDataArrival(v,_,this._receivedLength)}},m.prototype._onLoadEnd=function(p){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===d.LoaderStatus.kError)return;this._status=d.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)},m.prototype._onXhrError=function(p){this._status=d.LoaderStatus.kError;var v=0,_=null;if(this._contentLength&&p.loaded<this._contentLength?(v=d.LoaderErrors.EARLY_EOF,_={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(v=d.LoaderErrors.EXCEPTION,_={code:-1,msg:p.constructor.name+" "+p.type}),this._onError)this._onError(v,_);else throw new h.RuntimeException(_.msg)},m})(d.BaseLoader);o.default=g}),"./src/io/xhr-range-loader.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/io/speed-sampler.js"),h=u("./src/io/loader.js"),c=u("./src/utils/exception.js"),g=(function(){var m=function(p,v){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,E){_.__proto__=E}||function(_,E){for(var x in E)Object.prototype.hasOwnProperty.call(E,x)&&(_[x]=E[x])},m(p,v)};return function(p,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");m(p,v);function _(){this.constructor=p}p.prototype=v===null?Object.create(v):(_.prototype=v.prototype,new _)}})(),f=(function(m){g(p,m);function p(v,_){var E=m.call(this,"xhr-range-loader")||this;return E.TAG="RangeLoader",E._seekHandler=v,E._config=_,E._needStash=!1,E._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],E._currentChunkSizeKB=384,E._currentSpeedNormalized=0,E._zeroSpeedChunkCount=0,E._xhr=null,E._speedSampler=new d.default,E._requestAbort=!1,E._waitForTotalLength=!1,E._totalLengthReceived=!1,E._currentRequestURL=null,E._currentRedirectedURL=null,E._currentRequestRange=null,E._totalLength=null,E._contentLength=null,E._receivedLength=0,E._lastTimeLoaded=0,E}return p.isSupported=function(){try{var v=new XMLHttpRequest;return v.open("GET","https://example.com",!0),v.responseType="arraybuffer",v.responseType==="arraybuffer"}catch(_){return l.default.w("RangeLoader",_.message),!1}},p.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),m.prototype.destroy.call(this)},Object.defineProperty(p.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),p.prototype.open=function(v,_){this._dataSource=v,this._range=_,this._status=h.LoaderStatus.kConnecting;var E=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(E=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!E?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()},p.prototype._openSubRange=function(){var v=this._currentChunkSizeKB*1024,_=this._range.from+this._receivedLength,E=_+v;this._contentLength!=null&&E-this._range.from>=this._contentLength&&(E=this._range.from+this._contentLength-1),this._currentRequestRange={from:_,to:E},this._internalOpen(this._dataSource,this._currentRequestRange)},p.prototype._internalOpen=function(v,_){this._lastTimeLoaded=0;var E=v.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?E=this._currentRedirectedURL:v.redirectedURL!=null&&(E=v.redirectedURL));var x=this._seekHandler.getConfig(E,_);this._currentRequestURL=x.url;var y=this._xhr=new XMLHttpRequest;if(y.open("GET",x.url,!0),y.responseType="arraybuffer",y.onreadystatechange=this._onReadyStateChange.bind(this),y.onprogress=this._onProgress.bind(this),y.onload=this._onLoad.bind(this),y.onerror=this._onXhrError.bind(this),v.withCredentials&&(y.withCredentials=!0),typeof x.headers=="object"){var T=x.headers;for(var A in T)T.hasOwnProperty(A)&&y.setRequestHeader(A,T[A])}if(typeof this._config.headers=="object"){var T=this._config.headers;for(var A in T)T.hasOwnProperty(A)&&y.setRequestHeader(A,T[A])}y.send()},p.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=h.LoaderStatus.kComplete},p.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},p.prototype._onReadyStateChange=function(v){var _=v.target;if(_.readyState===2){if(_.responseURL!=null){var E=this._seekHandler.removeURLParameters(_.responseURL);_.responseURL!==this._currentRequestURL&&E!==this._currentRedirectedURL&&(this._currentRedirectedURL=E,this._onURLRedirect&&this._onURLRedirect(E))}if(_.status>=200&&_.status<=299){if(this._waitForTotalLength)return;this._status=h.LoaderStatus.kBuffering}else if(this._status=h.LoaderStatus.kError,this._onError)this._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:_.status,msg:_.statusText});else throw new c.RuntimeException("RangeLoader: Http code invalid, "+_.status+" "+_.statusText)}},p.prototype._onProgress=function(v){if(this._status!==h.LoaderStatus.kError){if(this._contentLength===null){var _=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,_=!0;var E=v.total;this._internalAbort(),E!=null&E!==0&&(this._totalLength=E)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,_){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var x=v.loaded-this._lastTimeLoaded;this._lastTimeLoaded=v.loaded,this._speedSampler.addBytes(x)}},p.prototype._normalizeSpeed=function(v){var _=this._chunkSizeKBList,E=_.length-1,x=0,y=0,T=E;if(v<_[0])return _[0];for(;y<=T;){if(x=y+Math.floor((T-y)/2),x===E||v>=_[x]&&v<_[x+1])return _[x];_[x]<v?y=x+1:T=x-1}},p.prototype._onLoad=function(v){if(this._status!==h.LoaderStatus.kError){if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;var _=this._speedSampler.lastSecondKBps;if(_===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(_=this._speedSampler.currentKBps)),_!==0){var E=this._normalizeSpeed(_);this._currentSpeedNormalized!==E&&(this._currentSpeedNormalized=E,this._currentChunkSizeKB=E)}var x=v.target.response,y=this._range.from+this._receivedLength;this._receivedLength+=x.byteLength;var T=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():T=!0,this._onDataArrival&&this._onDataArrival(x,y,this._receivedLength),T&&(this._status=h.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},p.prototype._onXhrError=function(v){this._status=h.LoaderStatus.kError;var _=0,E=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(_=h.LoaderErrors.EARLY_EOF,E={code:-1,msg:"RangeLoader meet Early-Eof"}):(_=h.LoaderErrors.EXCEPTION,E={code:-1,msg:v.constructor.name+" "+v.type}),this._onError)this._onError(_,E);else throw new c.RuntimeException(E.msg)},p})(h.BaseLoader);o.default=f}),"./src/player/flv-player.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./src/utils/logger.js"),c=u("./src/utils/browser.js"),g=u("./src/player/player-events.js"),f=u("./src/core/transmuxer.js"),m=u("./src/core/transmuxing-events.js"),p=u("./src/core/mse-controller.js"),v=u("./src/core/mse-events.js"),_=u("./src/player/player-errors.js"),E=u("./src/config.js"),x=u("./src/utils/exception.js"),y=(function(){function T(A,L){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(d()),this._config=(0,E.createDefaultConfig)(),typeof L=="object"&&Object.assign(this._config,L),A.type.toLowerCase()!=="flv")throw new x.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");A.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=A,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var R=c.default.chrome&&(c.default.version.major<50||c.default.version.major===50&&c.default.version.build<2661);this._alwaysSeekKeyframe=!!(R||c.default.msedge||c.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return T.prototype.destroy=function(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},T.prototype.on=function(A,L){var R=this;A===g.default.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(function(){R._emitter.emit(g.default.MEDIA_INFO,R.mediaInfo)}):A===g.default.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(function(){R._emitter.emit(g.default.STATISTICS_INFO,R.statisticsInfo)}),this._emitter.addListener(A,L)},T.prototype.off=function(A,L){this._emitter.removeListener(A,L)},T.prototype.attachMediaElement=function(A){var L=this;if(this._mediaElement=A,A.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),A.addEventListener("seeking",this.e.onvSeeking),A.addEventListener("canplay",this.e.onvCanPlay),A.addEventListener("stalled",this.e.onvStalled),A.addEventListener("progress",this.e.onvProgress),this._msectl=new p.default(this._config),this._msectl.on(v.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(v.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(v.default.SOURCE_OPEN,function(){L._mseSourceOpened=!0,L._hasPendingLoad&&(L._hasPendingLoad=!1,L.load())}),this._msectl.on(v.default.ERROR,function(R){L._emitter.emit(g.default.ERROR,_.ErrorTypes.MEDIA_ERROR,_.ErrorDetails.MEDIA_MSE_ERROR,R)}),this._msectl.attachMediaElement(A),this._pendingSeekTime!=null)try{A.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(R){}},T.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},T.prototype.load=function(){var A=this;if(!this._mediaElement)throw new x.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new x.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");if(!this._hasPendingLoad){if(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1){this._hasPendingLoad=!0;return}this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new f.default(this._mediaDataSource,this._config),this._transmuxer.on(m.default.INIT_SEGMENT,function(L,R){A._msectl.appendInitSegment(R)}),this._transmuxer.on(m.default.MEDIA_SEGMENT,function(L,R){if(A._msectl.appendMediaSegment(R),A._config.lazyLoad&&!A._config.isLive){var I=A._mediaElement.currentTime;R.info.endDts>=(I+A._config.lazyLoadMaxDuration)*1e3&&A._progressChecker==null&&(h.default.v(A.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),A._suspendTransmuxer())}}),this._transmuxer.on(m.default.LOADING_COMPLETE,function(){A._msectl.endOfStream(),A._emitter.emit(g.default.LOADING_COMPLETE)}),this._transmuxer.on(m.default.RECOVERED_EARLY_EOF,function(){A._emitter.emit(g.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(m.default.IO_ERROR,function(L,R){A._emitter.emit(g.default.ERROR,_.ErrorTypes.NETWORK_ERROR,L,R)}),this._transmuxer.on(m.default.DEMUX_ERROR,function(L,R){A._emitter.emit(g.default.ERROR,_.ErrorTypes.MEDIA_ERROR,L,{code:-1,msg:R})}),this._transmuxer.on(m.default.MEDIA_INFO,function(L){A._mediaInfo=L,A._emitter.emit(g.default.MEDIA_INFO,Object.assign({},L))}),this._transmuxer.on(m.default.METADATA_ARRIVED,function(L){A._emitter.emit(g.default.METADATA_ARRIVED,L)}),this._transmuxer.on(m.default.SCRIPTDATA_ARRIVED,function(L){A._emitter.emit(g.default.SCRIPTDATA_ARRIVED,L)}),this._transmuxer.on(m.default.STATISTICS_INFO,function(L){A._statisticsInfo=A._fillStatisticsInfo(L),A._emitter.emit(g.default.STATISTICS_INFO,Object.assign({},A._statisticsInfo))}),this._transmuxer.on(m.default.RECOMMEND_SEEKPOINT,function(L){A._mediaElement&&!A._config.accurateSeek&&(A._requestSetTime=!0,A._mediaElement.currentTime=L/1e3)}),this._transmuxer.open()}},T.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},T.prototype.play=function(){return this._mediaElement.play()},T.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(T.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(A){this._mediaElement.volume=A},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(A){this._mediaElement.muted=A},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(A){this._mediaElement?this._internalSeek(A):this._pendingSeekTime=A},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"statisticsInfo",{get:function(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),T.prototype._fillStatisticsInfo=function(A){if(A.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return A;var L=!0,R=0,I=0;if(this._mediaElement.getVideoPlaybackQuality){var D=this._mediaElement.getVideoPlaybackQuality();R=D.totalVideoFrames,I=D.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(R=this._mediaElement.webkitDecodedFrameCount,I=this._mediaElement.webkitDroppedFrameCount):L=!1;return L&&(A.decodedFrames=R,A.droppedFrames=I),A},T.prototype._onmseUpdateEnd=function(){if(!(!this._config.lazyLoad||this._config.isLive)){for(var A=this._mediaElement.buffered,L=this._mediaElement.currentTime,R=0,I=0;I<A.length;I++){var D=A.start(I),b=A.end(I);if(D<=L&&L<b){R=b;break}}R>=L+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(h.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},T.prototype._onmseBufferFull=function(){h.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()},T.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},T.prototype._checkProgressAndResume=function(){for(var A=this._mediaElement.currentTime,L=this._mediaElement.buffered,R=!1,I=0;I<L.length;I++){var D=L.start(I),b=L.end(I);if(A>=D&&A<b){A>=b-this._config.lazyLoadRecoverDuration&&(R=!0);break}}R&&(window.clearInterval(this._progressChecker),this._progressChecker=null,R&&(h.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},T.prototype._isTimepointBuffered=function(A){for(var L=this._mediaElement.buffered,R=0;R<L.length;R++){var I=L.start(R),D=L.end(R);if(A>=I&&A<D)return!0}return!1},T.prototype._internalSeek=function(A){var L=this._isTimepointBuffered(A),R=!1,I=0;if(A<1&&this._mediaElement.buffered.length>0){var D=this._mediaElement.buffered.start(0);(D<1&&A<D||c.default.safari)&&(R=!0,I=c.default.safari?.1:D)}if(R)this._requestSetTime=!0,this._mediaElement.currentTime=I;else if(L){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=A;else{var b=this._msectl.getNearestKeyframe(Math.floor(A*1e3));this._requestSetTime=!0,b!=null?this._mediaElement.currentTime=b.dts/1e3:this._mediaElement.currentTime=A}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(A),this._transmuxer.seek(Math.floor(A*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=A)},T.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var A=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(A)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(A),this._transmuxer.seek(Math.floor(A*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=A))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},T.prototype._checkAndResumeStuckPlayback=function(A){var L=this._mediaElement;if(A||!this._receivedCanPlay||L.readyState<2){var R=L.buffered;R.length>0&&L.currentTime<R.start(0)&&(h.default.w(this.TAG,"Playback seems stuck at "+L.currentTime+", seek to "+R.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=R.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},T.prototype._onvLoadedMetadata=function(A){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},T.prototype._onvSeeking=function(A){var L=this._mediaElement.currentTime,R=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(L<1&&R.length>0){var I=R.start(0);if(I<1&&L<I||c.default.safari){this._requestSetTime=!0,this._mediaElement.currentTime=c.default.safari?.1:I;return}}if(this._isTimepointBuffered(L)){if(this._alwaysSeekKeyframe){var D=this._msectl.getNearestKeyframe(Math.floor(L*1e3));D!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=D.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:L,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},T.prototype._onvCanPlay=function(A){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},T.prototype._onvStalled=function(A){this._checkAndResumeStuckPlayback(!0)},T.prototype._onvProgress=function(A){this._checkAndResumeStuckPlayback()},T})();o.default=y}),"./src/player/native-player.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./src/player/player-events.js"),c=u("./src/config.js"),g=u("./src/utils/exception.js"),f=(function(){function m(p,v){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(d()),this._config=(0,c.createDefaultConfig)(),typeof v=="object"&&Object.assign(this._config,v),p.type.toLowerCase()==="flv")throw new g.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(p.hasOwnProperty("segments"))throw new g.InvalidArgumentException("NativePlayer("+p.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=p,this._mediaElement=null}return m.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},m.prototype.on=function(p,v){var _=this;p===h.default.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){_._emitter.emit(h.default.MEDIA_INFO,_.mediaInfo)}):p===h.default.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){_._emitter.emit(h.default.STATISTICS_INFO,_.statisticsInfo)}),this._emitter.addListener(p,v)},m.prototype.off=function(p,v){this._emitter.removeListener(p,v)},m.prototype.attachMediaElement=function(p){if(this._mediaElement=p,p.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{p.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(v){}},m.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},m.prototype.load=function(){if(!this._mediaElement)throw new g.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},m.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},m.prototype.play=function(){return this._mediaElement.play()},m.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(m.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(p){this._mediaElement.volume=p},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(p){this._mediaElement.muted=p},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(p){this._mediaElement?this._mediaElement.currentTime=p:this._pendingSeekTime=p},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"mediaInfo",{get:function(){var p=this._mediaElement instanceof HTMLAudioElement?"audio/":"video/",v={mimeType:p+this._mediaDataSource.type};return this._mediaElement&&(v.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(v.width=this._mediaElement.videoWidth,v.height=this._mediaElement.videoHeight)),v},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"statisticsInfo",{get:function(){var p={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return p;var v=!0,_=0,E=0;if(this._mediaElement.getVideoPlaybackQuality){var x=this._mediaElement.getVideoPlaybackQuality();_=x.totalVideoFrames,E=x.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(_=this._mediaElement.webkitDecodedFrameCount,E=this._mediaElement.webkitDroppedFrameCount):v=!1;return v&&(p.decodedFrames=_,p.droppedFrames=E),p},enumerable:!1,configurable:!0}),m.prototype._onvLoadedMetadata=function(p){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(h.default.MEDIA_INFO,this.mediaInfo)},m.prototype._reportStatisticsInfo=function(){this._emitter.emit(h.default.STATISTICS_INFO,this.statisticsInfo)},m})();o.default=f}),"./src/player/player-errors.js":(function(n,o,u){u.r(o),u.d(o,{ErrorTypes:function(){return h},ErrorDetails:function(){return c}});var l=u("./src/io/loader.js"),d=u("./src/demux/demux-errors.js"),h={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},c={NETWORK_EXCEPTION:l.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:l.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:l.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:l.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:d.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:d.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:d.default.CODEC_UNSUPPORTED}}),"./src/player/player-events.js":(function(n,o,u){u.r(o);var l={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"};o.default=l}),"./src/remux/aac-silent.js":(function(n,o,u){u.r(o);var l=(function(){function d(){}return d.getSilentFrame=function(h,c){if(h==="mp4a.40.2"){if(c===1)return new Uint8Array([0,200,0,128,35,128]);if(c===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(c===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(c===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(c===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(c===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(c===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(c===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(c===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},d})();o.default=l}),"./src/remux/mp4-generator.js":(function(n,o,u){u.r(o);var l=(function(){function d(){}return d.init=function(){d.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(var h in d.types)d.types.hasOwnProperty(h)&&(d.types[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);var c=d.constants={};c.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),c.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),c.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),c.STSC=c.STCO=c.STTS,c.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),c.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),c.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),c.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),c.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),c.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},d.box=function(h){for(var c=8,g=null,f=Array.prototype.slice.call(arguments,1),m=f.length,p=0;p<m;p++)c+=f[p].byteLength;g=new Uint8Array(c),g[0]=c>>>24&255,g[1]=c>>>16&255,g[2]=c>>>8&255,g[3]=c&255,g.set(h,4);for(var v=8,p=0;p<m;p++)g.set(f[p],v),v+=f[p].byteLength;return g},d.generateInitSegment=function(h){var c=d.box(d.types.ftyp,d.constants.FTYP),g=d.moov(h),f=new Uint8Array(c.byteLength+g.byteLength);return f.set(c,0),f.set(g,c.byteLength),f},d.moov=function(h){var c=d.mvhd(h.timescale,h.duration),g=d.trak(h),f=d.mvex(h);return d.box(d.types.moov,c,g,f)},d.mvhd=function(h,c){return d.box(d.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255,c>>>24&255,c>>>16&255,c>>>8&255,c&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]))},d.trak=function(h){return d.box(d.types.trak,d.tkhd(h),d.mdia(h))},d.tkhd=function(h){var c=h.id,g=h.duration,f=h.presentWidth,m=h.presentHeight;return d.box(d.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,c&255,0,0,0,0,g>>>24&255,g>>>16&255,g>>>8&255,g&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,f>>>8&255,f&255,0,0,m>>>8&255,m&255,0,0]))},d.mdia=function(h){return d.box(d.types.mdia,d.mdhd(h),d.hdlr(h),d.minf(h))},d.mdhd=function(h){var c=h.timescale,g=h.duration;return d.box(d.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,c&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255,85,196,0,0]))},d.hdlr=function(h){var c=null;return h.type==="audio"?c=d.constants.HDLR_AUDIO:c=d.constants.HDLR_VIDEO,d.box(d.types.hdlr,c)},d.minf=function(h){var c=null;return h.type==="audio"?c=d.box(d.types.smhd,d.constants.SMHD):c=d.box(d.types.vmhd,d.constants.VMHD),d.box(d.types.minf,c,d.dinf(),d.stbl(h))},d.dinf=function(){var h=d.box(d.types.dinf,d.box(d.types.dref,d.constants.DREF));return h},d.stbl=function(h){var c=d.box(d.types.stbl,d.stsd(h),d.box(d.types.stts,d.constants.STTS),d.box(d.types.stsc,d.constants.STSC),d.box(d.types.stsz,d.constants.STSZ),d.box(d.types.stco,d.constants.STCO));return c},d.stsd=function(h){return h.type==="audio"?h.codec==="mp3"?d.box(d.types.stsd,d.constants.STSD_PREFIX,d.mp3(h)):d.box(d.types.stsd,d.constants.STSD_PREFIX,d.mp4a(h)):d.box(d.types.stsd,d.constants.STSD_PREFIX,d.avc1(h))},d.mp3=function(h){var c=h.channelCount,g=h.audioSampleRate,f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,c,0,16,0,0,0,0,g>>>8&255,g&255,0,0]);return d.box(d.types[".mp3"],f)},d.mp4a=function(h){var c=h.channelCount,g=h.audioSampleRate,f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,c,0,16,0,0,0,0,g>>>8&255,g&255,0,0]);return d.box(d.types.mp4a,f,d.esds(h))},d.esds=function(h){var c=h.config||[],g=c.length,f=new Uint8Array([0,0,0,0,3,23+g,0,1,0,4,15+g,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([g]).concat(c).concat([6,1,2]));return d.box(d.types.esds,f)},d.avc1=function(h){var c=h.avcc,g=h.codecWidth,f=h.codecHeight,m=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,g>>>8&255,g&255,f>>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return d.box(d.types.avc1,m,d.box(d.types.avcC,c))},d.mvex=function(h){return d.box(d.types.mvex,d.trex(h))},d.trex=function(h){var c=h.id,g=new Uint8Array([0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,c&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return d.box(d.types.trex,g)},d.moof=function(h,c){return d.box(d.types.moof,d.mfhd(h.sequenceNumber),d.traf(h,c))},d.mfhd=function(h){var c=new Uint8Array([0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255]);return d.box(d.types.mfhd,c)},d.traf=function(h,c){var g=h.id,f=d.box(d.types.tfhd,new Uint8Array([0,0,0,0,g>>>24&255,g>>>16&255,g>>>8&255,g&255])),m=d.box(d.types.tfdt,new Uint8Array([0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,c&255])),p=d.sdtp(h),v=d.trun(h,p.byteLength+16+16+8+16+8+8);return d.box(d.types.traf,f,m,v,p)},d.sdtp=function(h){for(var c=h.samples||[],g=c.length,f=new Uint8Array(4+g),m=0;m<g;m++){var p=c[m].flags;f[m+4]=p.isLeading<<6|p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy}return d.box(d.types.sdtp,f)},d.trun=function(h,c){var g=h.samples||[],f=g.length,m=12+16*f,p=new Uint8Array(m);c+=8+m,p.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255],0);for(var v=0;v<f;v++){var _=g[v].duration,E=g[v].size,x=g[v].flags,y=g[v].cts;p.set([_>>>24&255,_>>>16&255,_>>>8&255,_&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,x.isLeading<<2|x.dependsOn,x.isDependedOn<<6|x.hasRedundancy<<4|x.isNonSync,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255],12+16*v)}return d.box(d.types.trun,p)},d.mdat=function(h){return d.box(d.types.mdat,h)},d})();l.init(),o.default=l}),"./src/remux/mp4-remuxer.js":(function(n,o,u){u.r(o);var l=u("./src/utils/logger.js"),d=u("./src/remux/mp4-generator.js"),h=u("./src/remux/aac-silent.js"),c=u("./src/utils/browser.js"),g=u("./src/core/media-segment-info.js"),f=u("./src/utils/exception.js"),m=(function(){function p(v){this.TAG="MP4Remuxer",this._config=v,this._isLive=v.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new g.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new g.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(c.default.chrome&&(c.default.version.major<50||c.default.version.major===50&&c.default.version.build<2661)),this._fillSilentAfterSeek=c.default.msedge||c.default.msie,this._mp3UseMpegAudio=!c.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return p.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},p.prototype.bindDataSource=function(v){return v.onDataAvailable=this.remux.bind(this),v.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(p.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(v){this._onInitSegment=v},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(v){this._onMediaSegment=v},enumerable:!1,configurable:!0}),p.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},p.prototype.seek=function(v){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},p.prototype.remux=function(v,_){if(!this._onMediaSegment)throw new f.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(v,_),this._remuxVideo(_),this._remuxAudio(v)},p.prototype._onTrackMetadataReceived=function(v,_){var E=null,x="mp4",y=_.codec;if(v==="audio")this._audioMeta=_,_.codec==="mp3"&&this._mp3UseMpegAudio?(x="mpeg",y="",E=new Uint8Array):E=d.default.generateInitSegment(_);else if(v==="video")this._videoMeta=_,E=d.default.generateInitSegment(_);else return;if(!this._onInitSegment)throw new f.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(v,{type:v,data:E.buffer,codec:y,container:v+"/"+x,mediaDuration:_.duration})},p.prototype._calculateDtsBase=function(v,_){this._dtsBaseInited||(v.samples&&v.samples.length&&(this._audioDtsBase=v.samples[0].dts),_.samples&&_.samples.length&&(this._videoDtsBase=_.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},p.prototype.flushStashedSamples=function(){var v=this._videoStashedLastSample,_=this._audioStashedLastSample,E={type:"video",id:1,sequenceNumber:0,samples:[],length:0};v!=null&&(E.samples.push(v),E.length=v.length);var x={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};_!=null&&(x.samples.push(_),x.length=_.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(E,!0),this._remuxAudio(x,!0)},p.prototype._remuxAudio=function(v,_){if(this._audioMeta!=null){var E=v,x=E.samples,y=void 0,T=-1,A=-1,L=this._audioMeta.refSampleDuration,R=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,I=this._dtsBaseInited&&this._audioNextDts===void 0,D=!1;if(!(!x||x.length===0)&&!(x.length===1&&!_)){var b=0,P=null,C=0;R?(b=0,C=E.length):(b=8,C=8+E.length);var k=null;if(x.length>1&&(k=x.pop(),C-=k.length),this._audioStashedLastSample!=null){var O=this._audioStashedLastSample;this._audioStashedLastSample=null,x.unshift(O),C+=O.length}k!=null&&(this._audioStashedLastSample=k);var F=x[0].dts-this._dtsBase;if(this._audioNextDts)y=F-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())y=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(D=!0);else{var U=this._audioSegmentInfoList.getLastSampleBefore(F);if(U!=null){var G=F-(U.originalDts+U.duration);G<=3&&(G=0);var V=U.dts+U.duration+G;y=F-V}else y=0}if(D){var $=F-y,K=this._videoSegmentInfoList.getLastSegmentBefore(F);if(K!=null&&K.beginDts<$){var H=h.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(H){var X=K.beginDts,ee=$-K.beginDts;l.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+X+", duration: "+ee),x.unshift({unit:H,dts:X,pts:X}),C+=H.byteLength}}else D=!1}for(var Q=[],re=0;re<x.length;re++){var O=x[re],de=O.unit,he=O.dts-this._dtsBase,X=he,Ee=!1,Pe=null,_e=0;if(!(he<-.001)){if(this._audioMeta.codec!=="mp3"){var te=he,Oe=3;if(this._audioNextDts&&(te=this._audioNextDts),y=he-te,y<=-Oe*L){l.default.w(this.TAG,"Dropping 1 audio frame (originalDts: "+he+" ms ,curRefDts: "+te+" ms) due to dtsCorrection: "+y+" ms overlap.");continue}else if(y>=Oe*L&&this._fillAudioTimestampGap&&!c.default.safari){Ee=!0;var qe=Math.floor(y/L);l.default.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
3
3
  `+("originalDts: "+he+" ms, curRefDts: "+te+" ms, ")+("dtsCorrection: "+Math.round(y)+" ms, generate: "+qe+" frames")),X=Math.floor(te),_e=Math.floor(te+L)-X;var H=h.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);H==null&&(l.default.w(this.TAG,"Unable to generate silent frame for "+(this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame")),H=de),Pe=[];for(var ne=0;ne<qe;ne++){te=te+L;var ve=Math.floor(te),Te=Math.floor(te+L)-ve,Ue={dts:ve,pts:ve,cts:0,unit:H,size:H.byteLength,duration:Te,originalDts:he,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};Pe.push(Ue),C+=Ue.size}this._audioNextDts=te+L}else X=Math.floor(te),_e=Math.floor(te+L)-X,this._audioNextDts=te+L}else{if(X=he-y,re!==x.length-1){var be=x[re+1].dts-this._dtsBase-y;_e=be-X}else if(k!=null){var be=k.dts-this._dtsBase-y;_e=be-X}else Q.length>=1?_e=Q[Q.length-1].duration:_e=Math.floor(L);this._audioNextDts=X+_e}T===-1&&(T=X),Q.push({dts:X,pts:X,cts:0,unit:O.unit,size:O.unit.byteLength,duration:_e,originalDts:he,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ee&&Q.push.apply(Q,Pe)}}if(Q.length===0){E.samples=[],E.length=0;return}R?P=new Uint8Array(C):(P=new Uint8Array(C),P[0]=C>>>24&255,P[1]=C>>>16&255,P[2]=C>>>8&255,P[3]=C&255,P.set(d.default.types.mdat,4));for(var re=0;re<Q.length;re++){var de=Q[re].unit;P.set(de,b),b+=de.byteLength}var ke=Q[Q.length-1];A=ke.dts+ke.duration;var Le=new g.MediaSegmentInfo;Le.beginDts=T,Le.endDts=A,Le.beginPts=T,Le.endPts=A,Le.originalBeginDts=Q[0].originalDts,Le.originalEndDts=ke.originalDts+ke.duration,Le.firstSample=new g.SampleInfo(Q[0].dts,Q[0].pts,Q[0].duration,Q[0].originalDts,!1),Le.lastSample=new g.SampleInfo(ke.dts,ke.pts,ke.duration,ke.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Le),E.samples=Q,E.sequenceNumber++;var ft=null;R?ft=new Uint8Array:ft=d.default.moof(E,T),E.samples=[],E.length=0;var lt={type:"audio",data:this._mergeBoxes(ft,P).buffer,sampleCount:Q.length,info:Le};R&&I&&(lt.timestampOffset=T),this._onMediaSegment("audio",lt)}}},p.prototype._remuxVideo=function(v,_){if(this._videoMeta!=null){var E=v,x=E.samples,y=void 0,T=-1,A=-1,L=-1,R=-1;if(!(!x||x.length===0)&&!(x.length===1&&!_)){var I=8,D=null,b=8+v.length,P=null;if(x.length>1&&(P=x.pop(),b-=P.length),this._videoStashedLastSample!=null){var C=this._videoStashedLastSample;this._videoStashedLastSample=null,x.unshift(C),b+=C.length}P!=null&&(this._videoStashedLastSample=P);var k=x[0].dts-this._dtsBase;if(this._videoNextDts)y=k-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())y=0;else{var O=this._videoSegmentInfoList.getLastSampleBefore(k);if(O!=null){var F=k-(O.originalDts+O.duration);F<=3&&(F=0);var U=O.dts+O.duration+F;y=k-U}else y=0}for(var G=new g.MediaSegmentInfo,V=[],$=0;$<x.length;$++){var C=x[$],K=C.dts-this._dtsBase,H=C.isKeyframe,X=K-y,ee=C.cts,Q=X+ee;T===-1&&(T=X,L=Q);var re=0;if($!==x.length-1){var de=x[$+1].dts-this._dtsBase-y;re=de-X}else if(P!=null){var de=P.dts-this._dtsBase-y;re=de-X}else V.length>=1?re=V[V.length-1].duration:re=Math.floor(this._videoMeta.refSampleDuration);if(H){var he=new g.SampleInfo(X,Q,re,C.dts,!0);he.fileposition=C.fileposition,G.appendSyncPoint(he)}V.push({dts:X,pts:Q,cts:ee,units:C.units,size:C.length,isKeyframe:H,duration:re,originalDts:K,flags:{isLeading:0,dependsOn:H?2:1,isDependedOn:H?1:0,hasRedundancy:0,isNonSync:H?0:1}})}D=new Uint8Array(b),D[0]=b>>>24&255,D[1]=b>>>16&255,D[2]=b>>>8&255,D[3]=b&255,D.set(d.default.types.mdat,4);for(var $=0;$<V.length;$++)for(var Ee=V[$].units;Ee.length;){var Pe=Ee.shift(),_e=Pe.data;D.set(_e,I),I+=_e.byteLength}var te=V[V.length-1];if(A=te.dts+te.duration,R=te.pts+te.duration,this._videoNextDts=A,G.beginDts=T,G.endDts=A,G.beginPts=L,G.endPts=R,G.originalBeginDts=V[0].originalDts,G.originalEndDts=te.originalDts+te.duration,G.firstSample=new g.SampleInfo(V[0].dts,V[0].pts,V[0].duration,V[0].originalDts,V[0].isKeyframe),G.lastSample=new g.SampleInfo(te.dts,te.pts,te.duration,te.originalDts,te.isKeyframe),this._isLive||this._videoSegmentInfoList.append(G),E.samples=V,E.sequenceNumber++,this._forceFirstIDR){var Oe=V[0].flags;Oe.dependsOn=2,Oe.isNonSync=0}var qe=d.default.moof(E,T);E.samples=[],E.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(qe,D).buffer,sampleCount:V.length,info:G})}}},p.prototype._mergeBoxes=function(v,_){var E=new Uint8Array(v.byteLength+_.byteLength);return E.set(v,0),E.set(_,v.byteLength),E},p})();o.default=m}),"./src/utils/browser.js":(function(n,o,u){u.r(o);var l={};function d(){var h=self.navigator.userAgent.toLowerCase(),c=/(edge)\/([\w.]+)/.exec(h)||/(opr)[\/]([\w.]+)/.exec(h)||/(chrome)[ \/]([\w.]+)/.exec(h)||/(iemobile)[\/]([\w.]+)/.exec(h)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(h)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(h)||/(webkit)[ \/]([\w.]+)/.exec(h)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(h)||/(msie) ([\w.]+)/.exec(h)||h.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(h)||h.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(h)||[],g=/(ipad)/.exec(h)||/(ipod)/.exec(h)||/(windows phone)/.exec(h)||/(iphone)/.exec(h)||/(kindle)/.exec(h)||/(android)/.exec(h)||/(windows)/.exec(h)||/(mac)/.exec(h)||/(linux)/.exec(h)||/(cros)/.exec(h)||[],f={browser:c[5]||c[3]||c[1]||"",version:c[2]||c[4]||"0",majorVersion:c[4]||c[2]||"0",platform:g[0]||""},m={};if(f.browser){m[f.browser]=!0;var p=f.majorVersion.split(".");m.version={major:parseInt(f.majorVersion,10),string:f.version},p.length>1&&(m.version.minor=parseInt(p[1],10)),p.length>2&&(m.version.build=parseInt(p[2],10))}if(f.platform&&(m[f.platform]=!0),(m.chrome||m.opr||m.safari)&&(m.webkit=!0),m.rv||m.iemobile){m.rv&&delete m.rv;var v="msie";f.browser=v,m[v]=!0}if(m.edge){delete m.edge;var _="msedge";f.browser=_,m[_]=!0}if(m.opr){var E="opera";f.browser=E,m[E]=!0}if(m.safari&&m.android){var x="android";f.browser=x,m[x]=!0}m.name=f.browser,m.platform=f.platform;for(var y in l)l.hasOwnProperty(y)&&delete l[y];Object.assign(l,m)}d(),o.default=l}),"./src/utils/exception.js":(function(n,o,u){u.r(o),u.d(o,{RuntimeException:function(){return d},IllegalStateException:function(){return h},InvalidArgumentException:function(){return c},NotImplementedException:function(){return g}});var l=(function(){var f=function(m,p){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,_){v.__proto__=_}||function(v,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(v[E]=_[E])},f(m,p)};return function(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");f(m,p);function v(){this.constructor=m}m.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})(),d=(function(){function f(m){this._message=m}return Object.defineProperty(f.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),f.prototype.toString=function(){return this.name+": "+this.message},f})(),h=(function(f){l(m,f);function m(p){return f.call(this,p)||this}return Object.defineProperty(m.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),m})(d),c=(function(f){l(m,f);function m(p){return f.call(this,p)||this}return Object.defineProperty(m.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),m})(d),g=(function(f){l(m,f);function m(p){return f.call(this,p)||this}return Object.defineProperty(m.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),m})(d)}),"./src/utils/logger.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=(function(){function c(){}return c.e=function(g,f){(!g||c.FORCE_GLOBAL_TAG)&&(g=c.GLOBAL_TAG);var m="["+g+"] > "+f;c.ENABLE_CALLBACK&&c.emitter.emit("log","error",m),c.ENABLE_ERROR&&(console.error?console.error(m):console.warn?console.warn(m):console.log(m))},c.i=function(g,f){(!g||c.FORCE_GLOBAL_TAG)&&(g=c.GLOBAL_TAG);var m="["+g+"] > "+f;c.ENABLE_CALLBACK&&c.emitter.emit("log","info",m),c.ENABLE_INFO&&(console.info?console.info(m):console.log(m))},c.w=function(g,f){(!g||c.FORCE_GLOBAL_TAG)&&(g=c.GLOBAL_TAG);var m="["+g+"] > "+f;c.ENABLE_CALLBACK&&c.emitter.emit("log","warn",m),c.ENABLE_WARN&&(console.warn?console.warn(m):console.log(m))},c.d=function(g,f){(!g||c.FORCE_GLOBAL_TAG)&&(g=c.GLOBAL_TAG);var m="["+g+"] > "+f;c.ENABLE_CALLBACK&&c.emitter.emit("log","debug",m),c.ENABLE_DEBUG&&(console.debug?console.debug(m):console.log(m))},c.v=function(g,f){(!g||c.FORCE_GLOBAL_TAG)&&(g=c.GLOBAL_TAG);var m="["+g+"] > "+f;c.ENABLE_CALLBACK&&c.emitter.emit("log","verbose",m),c.ENABLE_VERBOSE&&console.log(m)},c})();h.GLOBAL_TAG="flv.js",h.FORCE_GLOBAL_TAG=!1,h.ENABLE_ERROR=!0,h.ENABLE_INFO=!0,h.ENABLE_WARN=!0,h.ENABLE_DEBUG=!0,h.ENABLE_VERBOSE=!0,h.ENABLE_CALLBACK=!1,h.emitter=new(d()),o.default=h}),"./src/utils/logging-control.js":(function(n,o,u){u.r(o);var l=u("./node_modules/events/events.js"),d=u.n(l),h=u("./src/utils/logger.js"),c=(function(){function g(){}return Object.defineProperty(g,"forceGlobalTag",{get:function(){return h.default.FORCE_GLOBAL_TAG},set:function(f){h.default.FORCE_GLOBAL_TAG=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"globalTag",{get:function(){return h.default.GLOBAL_TAG},set:function(f){h.default.GLOBAL_TAG=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableAll",{get:function(){return h.default.ENABLE_VERBOSE&&h.default.ENABLE_DEBUG&&h.default.ENABLE_INFO&&h.default.ENABLE_WARN&&h.default.ENABLE_ERROR},set:function(f){h.default.ENABLE_VERBOSE=f,h.default.ENABLE_DEBUG=f,h.default.ENABLE_INFO=f,h.default.ENABLE_WARN=f,h.default.ENABLE_ERROR=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableDebug",{get:function(){return h.default.ENABLE_DEBUG},set:function(f){h.default.ENABLE_DEBUG=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableVerbose",{get:function(){return h.default.ENABLE_VERBOSE},set:function(f){h.default.ENABLE_VERBOSE=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableInfo",{get:function(){return h.default.ENABLE_INFO},set:function(f){h.default.ENABLE_INFO=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableWarn",{get:function(){return h.default.ENABLE_WARN},set:function(f){h.default.ENABLE_WARN=f,g._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(g,"enableError",{get:function(){return h.default.ENABLE_ERROR},set:function(f){h.default.ENABLE_ERROR=f,g._notifyChange()},enumerable:!1,configurable:!0}),g.getConfig=function(){return{globalTag:h.default.GLOBAL_TAG,forceGlobalTag:h.default.FORCE_GLOBAL_TAG,enableVerbose:h.default.ENABLE_VERBOSE,enableDebug:h.default.ENABLE_DEBUG,enableInfo:h.default.ENABLE_INFO,enableWarn:h.default.ENABLE_WARN,enableError:h.default.ENABLE_ERROR,enableCallback:h.default.ENABLE_CALLBACK}},g.applyConfig=function(f){h.default.GLOBAL_TAG=f.globalTag,h.default.FORCE_GLOBAL_TAG=f.forceGlobalTag,h.default.ENABLE_VERBOSE=f.enableVerbose,h.default.ENABLE_DEBUG=f.enableDebug,h.default.ENABLE_INFO=f.enableInfo,h.default.ENABLE_WARN=f.enableWarn,h.default.ENABLE_ERROR=f.enableError,h.default.ENABLE_CALLBACK=f.enableCallback},g._notifyChange=function(){var f=g.emitter;if(f.listenerCount("change")>0){var m=g.getConfig();f.emit("change",m)}},g.registerListener=function(f){g.emitter.addListener("change",f)},g.removeListener=function(f){g.emitter.removeListener("change",f)},g.addLogListener=function(f){h.default.emitter.addListener("log",f),h.default.emitter.listenerCount("log")>0&&(h.default.ENABLE_CALLBACK=!0,g._notifyChange())},g.removeLogListener=function(f){h.default.emitter.removeListener("log",f),h.default.emitter.listenerCount("log")===0&&(h.default.ENABLE_CALLBACK=!1,g._notifyChange())},g})();c.emitter=new(d()),o.default=c}),"./src/utils/polyfill.js":(function(n,o,u){u.r(o);var l=(function(){function d(){}return d.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},Object.assign=Object.assign||function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(h),g=1;g<arguments.length;g++){var f=arguments[g];if(f!=null)for(var m in f)f.hasOwnProperty(m)&&(c[m]=f[m])}return c},typeof self.Promise!="function"&&u("./node_modules/es6-promise/dist/es6-promise.js").polyfill()},d})();l.install(),o.default=l}),"./src/utils/utf8-conv.js":(function(n,o,u){u.r(o);function l(h,c,g){var f=h;if(c+g<f.length){for(;g--;)if((f[++c]&192)!==128)return!1;return!0}else return!1}function d(h){for(var c=[],g=h,f=0,m=h.length;f<m;){if(g[f]<128){c.push(String.fromCharCode(g[f])),++f;continue}else if(!(g[f]<192)){if(g[f]<224){if(l(g,f,1)){var p=(g[f]&31)<<6|g[f+1]&63;if(p>=128){c.push(String.fromCharCode(p&65535)),f+=2;continue}}}else if(g[f]<240){if(l(g,f,2)){var p=(g[f]&15)<<12|(g[f+1]&63)<<6|g[f+2]&63;if(p>=2048&&(p&63488)!==55296){c.push(String.fromCharCode(p&65535)),f+=3;continue}}}else if(g[f]<248&&l(g,f,3)){var p=(g[f]&7)<<18|(g[f+1]&63)<<12|(g[f+2]&63)<<6|g[f+3]&63;if(p>65536&&p<1114112){p-=65536,c.push(String.fromCharCode(p>>>10|55296)),c.push(String.fromCharCode(p&1023|56320)),f+=4;continue}}}c.push("�"),++f}return c.join("")}o.default=d})},i={};function s(n){var o=i[n];if(o!==void 0)return o.exports;var u=i[n]={exports:{}};return t[n].call(u.exports,u,u.exports,s),u.exports}s.m=t,(function(){s.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(o,{a:o}),o}})(),(function(){s.d=function(n,o){for(var u in o)s.o(o,u)&&!s.o(n,u)&&Object.defineProperty(n,u,{enumerable:!0,get:o[u]})}})(),(function(){s.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch(n){if(typeof window=="object")return window}})()})(),(function(){s.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}})(),(function(){s.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}})();var r=s("./src/index.js");return r})()})})(ji)),ji.exports}var mo=go();const Hi=Lt.getDefaultExportFromCjs(mo),z=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},po=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=_o},_o=Number.MAX_SAFE_INTEGER||9007199254740991;let Z=(function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a})({}),M=(function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a})({}),S=(function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a})({});var ue={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},q={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class Dt{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class vo{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Dt(e),this.fast_=new Dt(t),this.defaultTTFB_=s,this.ttfb_=new Dt(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Dt(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Dt(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Dt(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,s=e/1e3,r=i/s;this.fast_.sample(s,r),this.slow_.sample(s,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function Eo(a,e,t){return(e=xo(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ge(){return ge=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},ge.apply(null,arguments)}function cr(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable})),t.push.apply(t,i)}return t}function ce(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cr(Object(t),!0).forEach(function(i){Eo(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):cr(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function yo(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function xo(a){var e=yo(a,"string");return typeof e=="symbol"?e:e+""}class ze{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=pt,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const pt=function(){},So={trace:pt,debug:pt,log:pt,warn:pt,info:pt,error:pt};function ps(){return ge({},So)}function To(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):pt}function fr(a,e,t){return e[a]?e[a].bind(e):To(a,t)}const _s=ps();function Ao(a,e,t){const i=ps();if(typeof console=="object"&&a===!0||typeof a=="object"){const s=["debug","log","info","warn","error"];s.forEach(r=>{i[r]=fr(r,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch(r){return ps()}s.forEach(r=>{_s[r]=fr(r,a)})}else ge(_s,i);return i}const fe=_s;function Et(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Lo(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Cn(a,e){const t=Object.keys(a),i=Object.keys(e),s=t.length,r=i.length;return!s||!r||s===r&&!t.some(n=>i.indexOf(n)===-1)}function We(a,e=!1){if(typeof TextDecoder!="undefined"){const l=new TextDecoder("utf-8").decode(a);if(e){const d=l.indexOf("\0");return d!==-1?l.substring(0,d):l}return l.replace(/\0/g,"")}const t=a.length;let i,s,r,n="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return n;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(i);break;case 12:case 13:s=a[o++],n+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=a[o++],r=a[o++],n+=String.fromCharCode((i&15)<<12|(s&63)<<6|(r&63)<<0);break}}return n}function Me(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function Pn(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Io(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Wi={exports:{}},gr;function Ro(){return gr||(gr=1,(function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,l,d){if(d=d||{},u=u.trim(),l=l.trim(),!l){if(!d.alwaysNormalize)return u;var h=o.parseURL(u);if(!h)throw new Error("Error trying to parse base URL.");return h.path=o.normalizePath(h.path),o.buildURLFromParts(h)}var c=o.parseURL(l);if(!c)throw new Error("Error trying to parse relative URL.");if(c.scheme)return d.alwaysNormalize?(c.path=o.normalizePath(c.path),o.buildURLFromParts(c)):l;var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var f=s.exec(g.path);g.netLoc=f[1],g.path=f[2]}g.netLoc&&!g.path&&(g.path="/");var m={scheme:g.scheme,netLoc:c.netLoc,path:null,params:c.params,query:c.query,fragment:c.fragment};if(!c.netLoc&&(m.netLoc=g.netLoc,c.path[0]!=="/"))if(!c.path)m.path=g.path,c.params||(m.params=g.params,c.query||(m.query=g.query));else{var p=g.path,v=p.substring(0,p.lastIndexOf("/")+1)+c.path;m.path=o.normalizePath(v)}return m.path===null&&(m.path=d.alwaysNormalize?o.normalizePath(c.path):c.path),o.buildURLFromParts(m)},parseURL:function(u){var l=i.exec(u);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(r,"");u.length!==(u=u.replace(n,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}};a.exports=o})()})(Wi)),Wi.exports}var Ms=Ro();class Fs{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var me={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class On{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Do(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let s;i.length===1?s=(t==null?void 0:t.byteRangeEndOffset)||0:s=parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[me.AUDIO]:null,[me.VIDEO]:null,[me.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Fs),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Ms.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[me.AUDIO]=null,e[me.VIDEO]=null,e[me.AUDIOVIDEO]=null}}function Ae(a){return a.sn!=="initSegment"}class Yi extends On{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(z(e)&&z(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const s=this._decryptdata=t[i[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=z(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const i=Object.keys(this.levelkeys),s=i.length;if(s>1||s===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!z(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Ae(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const s=t[e];s&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,s,r,n=!1){const{elementaryStreams:o}=this,u=o[e];if(!u){o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:n};return}u.startPTS=Math.min(u.startPTS,t),u.endPTS=Math.max(u.endPTS,i),u.startDTS=Math.min(u.startDTS,s),u.endDTS=Math.max(u.endDTS,r)}}class bo extends On{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function kn(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||kn(t,e)}}function Do(a,e){const t=kn(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const mr=Math.pow(2,32)-1,Co=[].push,wn={video:1,audio:2,id3:3,text:4};function Ie(a){return String.fromCharCode.apply(null,a)}function Mn(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function ie(a,e){const t=Fn(a,e);return t<0?4294967296+t:t}function pr(a,e){let t=ie(a,e);return t*=Math.pow(2,32),t+=ie(a,e+4),t}function Fn(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Po(a){const e=a.byteLength;for(let t=0;t<e;){const i=ie(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function oe(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let s=0;s<i;){const r=ie(a,s),n=Ie(a.subarray(s+4,s+8)),o=r>1?s+r:i;if(n===e[0])if(e.length===1)t.push(a.subarray(s+8,o));else{const u=oe(a.subarray(s+8,o),e.slice(1));u.length&&Co.apply(t,u)}s=o}return t}function Oo(a){const e=[],t=a[0];let i=8;const s=ie(a,i);i+=4;let r=0,n=0;t===0?(r=ie(a,i),n=ie(a,i+4),i+=8):(r=pr(a,i),n=pr(a,i+8),i+=16),i+=2;let o=a.length+n;const u=Mn(a,i);i+=2;for(let l=0;l<u;l++){let d=i;const h=ie(a,d);d+=4;const c=h&2147483647;if((h&2147483648)>>>31===1)return fe.warn("SIDX has hierarchical references (not supported)"),null;const f=ie(a,d);d+=4,e.push({referenceSize:c,subsegmentDuration:f,info:{duration:f/s,start:o,end:o+c-1}}),o+=c,d+=4,i=d}return{earliestPresentationTime:r,timescale:s,version:t,referencesCount:u,references:e}}function Bn(a){const e=[],t=oe(a,["moov","trak"]);for(let s=0;s<t.length;s++){const r=t[s],n=oe(r,["tkhd"])[0];if(n){let o=n[0];const u=ie(n,o===0?12:20),l=oe(r,["mdia","mdhd"])[0];if(l){o=l[0];const d=ie(l,o===0?12:20),h=oe(r,["mdia","hdlr"])[0];if(h){const c=Ie(h.subarray(8,12)),g={soun:me.AUDIO,vide:me.VIDEO}[c],f=oe(r,["mdia","minf","stbl","stsd"])[0],m=ko(f);g?(e[u]={timescale:d,type:g,stsd:m},e[g]=ce({timescale:d,id:u},m)):e[u]={timescale:d,type:c,stsd:m}}}}}return oe(a,["moov","mvex","trex"]).forEach(s=>{const r=ie(s,4),n=e[r];n&&(n.default={duration:ie(s,12),flags:ie(s,20)})}),e}function ko(a){const e=a.subarray(8),t=e.subarray(86),i=Ie(e.subarray(4,8));let s=i,r;const n=i==="enca"||i==="encv";if(n){const l=oe(e,[i])[0].subarray(i==="enca"?28:78);oe(l,["sinf"]).forEach(h=>{const c=oe(h,["schm"])[0];if(c){const g=Ie(c.subarray(4,8));if(g==="cbcs"||g==="cenc"){const f=oe(h,["frma"])[0];f&&(s=Ie(f))}}})}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const u=oe(t,["avcC"])[0];u&&u.length>3&&(s+="."+ai(u[1])+ai(u[2])+ai(u[3]),r=ni(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const u=oe(e,[i])[0],l=oe(u.subarray(28),["esds"])[0];if(l&&l.length>7){let d=4;if(l[d++]!==3)break;d=zi(l,d),d+=2;const h=l[d++];if(h&128&&(d+=2),h&64&&(d+=l[d++]),l[d++]!==4)break;d=zi(l,d);const c=l[d++];if(c===64)s+="."+ai(c);else break;if(d+=12,l[d++]!==5)break;d=zi(l,d);const g=l[d++];let f=(g&248)>>3;f===31&&(f+=1+((g&7)<<3)+((l[d]&224)>>5)),s+="."+f}break}case"hvc1":case"hev1":{const u=oe(t,["hvcC"])[0];if(u&&u.length>12){const l=u[1],d=["","A","B","C"][l>>6],h=l&31,c=ie(u,2),g=(l&32)>>5?"H":"L",f=u[12],m=u.subarray(6,12);s+="."+d+h,s+="."+wo(c).toString(16).toUpperCase(),s+="."+g+f;let p="";for(let v=m.length;v--;){const _=m[v];(_||p)&&(p="."+_.toString(16).toUpperCase()+p)}s+=p}r=ni(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=ni(s,t)||s;break}case"vp09":{const u=oe(t,["vpcC"])[0];if(u&&u.length>6){const l=u[4],d=u[5],h=u[6]>>4&15;s+="."+it(l)+"."+it(d)+"."+it(h)}break}case"av01":{const u=oe(t,["av1C"])[0];if(u&&u.length>2){const l=u[1]>>>5,d=u[1]&31,h=u[2]>>>7?"H":"M",c=(u[2]&64)>>6,g=(u[2]&32)>>5,f=l===2&&c?g?12:10:c?10:8,m=(u[2]&16)>>4,p=(u[2]&8)>>3,v=(u[2]&4)>>2,_=u[2]&3;s+="."+l+"."+it(d)+h+"."+it(f)+"."+m+"."+p+v+_+"."+it(1)+"."+it(1)+"."+it(1)+"."+0,r=ni("dav1",t)}break}}return{codec:s,encrypted:n,supplemental:r}}function ni(a,e){const t=oe(e,["dvvC"]),i=t.length?t[0]:oe(e,["dvcC"])[0];if(i){const s=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return a+"."+it(s)+"."+it(r)}}function wo(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function zi(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function ai(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function it(a){return(a<10?"0":"")+a}function Mo(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Nn(a,(i,s)=>{const r=i.subarray(8,24);r.some(n=>n!==0)||(fe.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${Me(r)} -> ${Me(t)}`),i.set(t,8))})}function Fo(a){const e=[];return Nn(a,t=>e.push(t.subarray(8,24))),e}function Nn(a,e){oe(a,["moov","trak"]).forEach(i=>{const s=oe(i,["mdia","minf","stbl","stsd"])[0];if(!s)return;const r=s.subarray(8);let n=oe(r,["enca"]);const o=n.length>0;o||(n=oe(r,["encv"])),n.forEach(u=>{const l=o?u.subarray(28):u.subarray(78);oe(l,["sinf"]).forEach(h=>{const c=Un(h);c&&e(c,o)})})})}function Un(a){const e=oe(a,["schm"])[0];if(e){const t=Ie(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=oe(a,["schi","tenc"])[0];if(i)return i}}}function Bo(a,e,t){const i={},s=oe(a,["moof","traf"]);for(let r=0;r<s.length;r++){const n=s[r],o=oe(n,["tfhd"])[0],u=ie(o,4),l=e[u];if(!l)continue;i[u]||(i[u]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});const d=i[u],h=oe(n,["tfdt"])[0];if(h){const E=h[0];let x=ie(h,4);E===1&&(x===mr?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(x*=mr+1,x+=ie(h,8))),z(x)&&(!z(d.start)||x<d.start)&&(d.start=x)}const c=l.default,g=ie(o,0)|(c==null?void 0:c.flags);let f=(c==null?void 0:c.duration)||0;g&8&&(g&2?f=ie(o,12):f=ie(o,8));const m=oe(n,["trun"]);let p=d.start||0,v=0,_=f;for(let E=0;E<m.length;E++){const x=m[E],y=ie(x,4),T=d.sampleCount;d.sampleCount+=y;const A=x[3]&1,L=x[3]&4,R=x[2]&1,I=x[2]&2,D=x[2]&4,b=x[2]&8;let P=8,C=y;for(A&&(P+=4),L&&y&&(!(x[P+1]&1)&&d.keyFrameIndex===void 0&&(d.keyFrameIndex=T),P+=4,R?(_=ie(x,P),P+=4):_=f,I&&(P+=4),b&&(P+=4),p+=_,v+=_,C--);C--;)R?(_=ie(x,P),P+=4):_=f,I&&(P+=4),D&&(x[P+1]&1||d.keyFrameIndex===void 0&&(d.keyFrameIndex=d.sampleCount-(C+1),d.keyFrameStart=p),P+=4),b&&(P+=4),p+=_,v+=_;!v&&f&&(v+=f*y)}d.duration+=v}if(!Object.keys(i).some(r=>i[r].duration)){let r=1/0,n=0;const o=oe(a,["sidx"]);for(let u=0;u<o.length;u++){const l=Oo(o[u]);if(l!=null&&l.references){r=Math.min(r,l.earliestPresentationTime/l.timescale);const d=l.references.reduce((h,c)=>h+c.info.duration||0,0);n=Math.max(n,d+l.earliestPresentationTime/l.timescale)}}n&&z(n)&&Object.keys(i).forEach(u=>{i[u].duration||(i[u].duration=n*i[u].timescale-i[u].start)})}return i}function No(a){const e={valid:null,remainder:null},t=oe(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function Ye(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function _r(a,e){const t=[],i=e.samples,s=e.timescale,r=e.id;let n=!1;return oe(i,["moof"]).map(u=>{const l=u.byteOffset-8;oe(u,["traf"]).map(h=>{const c=oe(h,["tfdt"]).map(g=>{const f=g[0];let m=ie(g,4);return f===1&&(m*=Math.pow(2,32),m+=ie(g,8)),m/s})[0];return c!==void 0&&(a=c),oe(h,["tfhd"]).map(g=>{const f=ie(g,4),m=ie(g,0)&16777215,p=(m&1)!==0,v=(m&2)!==0,_=(m&8)!==0;let E=0;const x=(m&16)!==0;let y=0;const T=(m&32)!==0;let A=8;f===r&&(p&&(A+=8),v&&(A+=4),_&&(E=ie(g,A),A+=4),x&&(y=ie(g,A),A+=4),T&&(A+=4),e.type==="video"&&(n=Ui(e.codec)),oe(h,["trun"]).map(L=>{const R=L[0],I=ie(L,0)&16777215,D=(I&1)!==0;let b=0;const P=(I&4)!==0,C=(I&256)!==0;let k=0;const O=(I&512)!==0;let F=0;const U=(I&1024)!==0,G=(I&2048)!==0;let V=0;const $=ie(L,4);let K=8;D&&(b=ie(L,K),K+=4),P&&(K+=4);let H=b+l;for(let X=0;X<$;X++){if(C?(k=ie(L,K),K+=4):k=E,O?(F=ie(L,K),K+=4):F=y,U&&(K+=4),G&&(R===0?V=ie(L,K):V=Fn(L,K),K+=4),e.type===me.VIDEO){let ee=0;for(;ee<F;){const Q=ie(i,H);if(H+=4,Uo(n,i[H])){const re=i.subarray(H,H+Q);Bs(re,n?2:1,a+V/s,t)}H+=Q,ee+=Q+4}}a+=k/s}}))})})}),t}function Ui(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Uo(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Bs(a,e,t,i){const s=$n(a);let r=0;r+=e;let n=0,o=0,u=0;for(;r<s.length;){n=0;do{if(r>=s.length)break;u=s[r++],n+=u}while(u===255);o=0;do{if(r>=s.length)break;u=s[r++],o+=u}while(u===255);const l=s.length-r;let d=r;if(o<l)r+=o;else if(o>l){fe.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(n===4){if(s[d++]===181){const c=Mn(s,d);if(d+=2,c===49){const g=ie(s,d);if(d+=4,g===1195456820){const f=s[d++];if(f===3){const m=s[d++],p=31&m,v=64&m,_=v?2+p*3:0,E=new Uint8Array(_);if(v){E[0]=m;for(let x=1;x<_;x++)E[x]=s[d++]}i.push({type:f,payloadType:n,pts:t,bytes:E})}}}}}else if(n===5&&o>16){const h=[];for(let f=0;f<16;f++){const m=s[d++].toString(16);h.push(m.length==1?"0"+m:m),(f===3||f===5||f===7||f===9)&&h.push("-")}const c=o-16,g=new Uint8Array(c);for(let f=0;f<c;f++)g[f]=s[d++];i.push({payloadType:n,pts:t,uuid:h.join(""),userData:We(g),userDataBytes:g})}}}function $n(a){const e=a.byteLength,t=[];let i=1;for(;i<e-2;)a[i]===0&&a[i+1]===0&&a[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return a;const s=e-t.length,r=new Uint8Array(s);let n=0;for(i=0;i<s;n++,i++)n===t[0]&&(n++,t.shift()),r[i]=a[n];return r}function $o(a){const e=a[0];let t="",i="",s=0,r=0,n=0,o=0,u=0,l=0;if(e===0){for(;Ie(a.subarray(l,l+1))!=="\0";)t+=Ie(a.subarray(l,l+1)),l+=1;for(t+=Ie(a.subarray(l,l+1)),l+=1;Ie(a.subarray(l,l+1))!=="\0";)i+=Ie(a.subarray(l,l+1)),l+=1;i+=Ie(a.subarray(l,l+1)),l+=1,s=ie(a,12),r=ie(a,16),o=ie(a,20),u=ie(a,24),l=28}else if(e===1){l+=4,s=ie(a,l),l+=4;const h=ie(a,l);l+=4;const c=ie(a,l);for(l+=4,n=or(2,32)*h+c,po(n)||(n=Number.MAX_SAFE_INTEGER,fe.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ie(a,l),l+=4,u=ie(a,l),l+=4;Ie(a.subarray(l,l+1))!=="\0";)t+=Ie(a.subarray(l,l+1)),l+=1;for(t+=Ie(a.subarray(l,l+1)),l+=1;Ie(a.subarray(l,l+1))!=="\0";)i+=Ie(a.subarray(l,l+1)),l+=1;i+=Ie(a.subarray(l,l+1)),l+=1}const d=a.subarray(l,a.byteLength);return{schemeIdUri:t,value:i,timeScale:s,presentationTime:n,presentationTimeDelta:r,eventDuration:o,id:u,payload:d}}function Go(a,...e){const t=e.length;let i=8,s=t;for(;s--;)i+=e[s].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(a,4),s=0,i=8;s<t;s++)r.set(e[s],i),i+=e[s].byteLength;return r}function Ko(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,s;i=0,s=new Uint8Array;let r;i>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const n=new Uint8Array(4);return t.byteLength>0&&new DataView(n.buffer).setUint32(0,t.byteLength,!1),Go([112,115,115,104],new Uint8Array([i,0,0,0]),a,r,s,n,t)}function Vo(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const s=new DataView(a,i),r=jo(s);e.push(r),i+=r.size}}return e}function jo(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const r=a.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};const n=a.buffer,o=Me(new Uint8Array(n,t+12,16));let u=null,l=null,d=0;if(r===0)d=28;else{const c=a.getUint32(28);if(!c||i<32+c*16)return{offset:t,size:e};u=[];for(let g=0;g<c;g++)u.push(new Uint8Array(n,t+32+g*16,16));d=32+c*16}if(!d)return{offset:t,size:e};const h=a.getUint32(d);return e-32<h?{offset:t,size:e}:(l=new Uint8Array(n,t+d+4,h),{version:r,systemId:o,kids:u,data:l,offset:t,size:e})}const Gn=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),$t={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ns(a,e){const t=$t[e];return!!t&&!!t[a.slice(0,4)]}function Yt(a,e,t=!0){return!a.split(",").some(i=>!Us(i,e,t))}function Us(a,e,t=!0){var i;const s=Et(t);return(i=s==null?void 0:s.isTypeSupported(zt(a,e)))!=null?i:!1}function zt(a,e){return`${e}/mp4;codecs=${a}`}function vr(a){if(a){const e=a.substring(0,4);return $t.video[e]}return 2}function bi(a){const e=Gn();return a.split(",").reduce((t,i)=>{const r=e&&Ui(i)?9:$t.video[i];return r?(r*2+t)/(t?3:2):($t.audio[i]+t)/(t?2:1)},0)}const qi={};function Ho(a,e=!0){if(qi[a])return qi[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let s=0;s<t.length;s++){var i;if(Us(t[s],"audio",e))return qi[a]=t[s],t[s];if(t[s]==="mp3"&&(i=Et(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Wo=/flac|opus|mp4a\.40\.34/i;function Di(a,e=!0){return a.replace(Wo,t=>Ho(t.toLowerCase(),e))}function Yo(a,e){const t=[];if(a){const i=a.split(",");for(let s=0;s<i.length;s++)Ns(i[s],"video")||t.push(i[s])}return e&&t.push(e),t.join(",")}function yi(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(Er(a,"audio")||Er(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let i=t.length;i--;)if(t[i].substring(0,4)===a.substring(0,4))return t[i]}return t[0]}}return e||a}function Er(a,e){return Ns(a,e)&&Us(a,e)}function zo(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function qo(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function yr(a){const e=Et(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function vs(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Xo={supported:!0,powerEfficient:!0,smooth:!0},Qo={supported:!1,smooth:!1,powerEfficient:!1},Kn={supported:!0,configurations:[],decodingInfoResults:[Xo]};function Vn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[Qo],error:a}}function Zo(a,e,t,i,s,r){const n=a.videoCodec,o=a.audioCodec?a.audioGroups:null,u=r==null?void 0:r.audioCodec,l=r==null?void 0:r.channels,d=l?parseInt(l):u?1/0:2;let h=null;if(o!=null&&o.length)try{o.length===1&&o[0]?h=e.groups[o[0]].channels:h=o.reduce((c,g)=>{if(g){const f=e.groups[g];if(!f)throw new Error(`Audio track group ${g} not found`);Object.keys(f.channels).forEach(m=>{c[m]=(c[m]||0)+f.channels[m]})}return c},{2:0})}catch(c){return!0}return n!==void 0&&(n.split(",").some(c=>Ui(c))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(s,8e6))||!!h&&z(d)&&Object.keys(h).some(c=>parseInt(c)>d)}function jn(a,e,t,i={}){const s=a.videoCodec;if(!s&&!a.audioCodec||!t)return Promise.resolve(Kn);const r=[],n=Jo(a),o=n.length,u=el(a,e,o>0),l=u.length;for(let d=o||1*l||1;d--;){const h={type:"media-source"};if(o&&(h.video=n[d%o]),l){h.audio=u[d%l];const c=h.audio.bitrate;h.video&&c&&(h.video.bitrate-=c)}r.push(h)}if(s){const d=navigator.userAgent;if(s.split(",").some(h=>Ui(h))&&Gn())return Promise.resolve(Vn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${d})`),r))}return Promise.all(r.map(d=>{const h=il(d);return i[h]||(i[h]=t.decodingInfo(d))})).then(d=>({supported:!d.some(h=>!h.supported),configurations:r,decodingInfoResults:d})).catch(d=>({supported:!1,configurations:r,decodingInfoResults:[],error:d}))}function Jo(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),i=Hn(a),s=a.width||640,r=a.height||480,n=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(u=>{const l={contentType:zt(qo(u),"video"),width:s,height:r,bitrate:i,framerate:n};return o!=="sdr"&&(l.transferFunction=o),l}):[]}function el(a,e,t){var i;const s=(i=a.audioCodec)==null?void 0:i.split(","),r=Hn(a);return s&&a.audioGroups?a.audioGroups.reduce((n,o)=>{var u;const l=o?(u=e.groups[o])==null?void 0:u.tracks:null;return l?l.reduce((d,h)=>{if(h.groupId===o){const c=parseFloat(h.channels||"");s.forEach(g=>{const f={contentType:zt(g,"audio"),bitrate:t?tl(g,r):r};c&&(f.channels=""+c),d.push(f)})}return d},n):n},[]):[]}function tl(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Hn(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function il(a){let e="";const{audio:t,video:i}=a;if(i){const s=vs(i.contentType);e+=`${s}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const s=vs(t.contentType);e+=`${i?"_":""}${s}_c${t.channels}`}return e}const Es=["NONE","TYPE-0","TYPE-1",null];function sl(a){return Es.indexOf(a)>-1}const Ci=["SDR","PQ","HLG"];function rl(a){return!!a&&Ci.indexOf(a)>-1}var xi={No:"",Yes:"YES",v2:"v2"};function xr(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,s=i<e/2;return e&&s?t?xi.v2:xi.Yes:xi.No}class Sr{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class qt{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Tr(this._audioGroups,e)}hasSubtitleGroup(e){return Tr(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Tr(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function nl(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function al(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Ci.slice(0);const s=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:s&&nl(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const ol=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},pe=(a,e)=>JSON.stringify(a,ol(e));function ll(a,e,t,i,s){const r=Object.keys(a),n=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,u=s==null?void 0:s.videoCodec,l=n&&parseInt(n)===2;let d=!1,h=!1,c=1/0,g=1/0,f=1/0,m=1/0,p=0,v=[];const{preferHDR:_,allowedVideoRanges:E}=al(e,s);for(let L=r.length;L--;){const R=a[r[L]];d||(d=R.channels[2]>0),c=Math.min(c,R.minHeight),g=Math.min(g,R.minFramerate),f=Math.min(f,R.minBitrate),E.filter(D=>R.videoRanges[D]>0).length>0&&(h=!0)}c=z(c)?c:0,g=z(g)?g:0;const x=Math.max(1080,c),y=Math.max(30,g);f=z(f)?f:t,t=Math.max(f,t),h||(e=void 0);const T=r.length>1;return{codecSet:r.reduce((L,R)=>{const I=a[R];if(R===L)return L;if(v=h?E.filter(D=>I.videoRanges[D]>0):[],T){if(I.minBitrate>t)return et(R,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),L;if(!I.hasDefaultAudio)return et(R,"no renditions with default or auto-select sound found"),L;if(o&&R.indexOf(o.substring(0,4))%5!==0)return et(R,`audio codec preference "${o}" not found`),L;if(n&&!l){if(!I.channels[n])return et(R,`no renditions with ${n} channel sound found (channels options: ${Object.keys(I.channels)})`),L}else if((!o||l)&&d&&I.channels[2]===0)return et(R,"no renditions with stereo sound found"),L;if(I.minHeight>x)return et(R,`min resolution of ${I.minHeight} > maximum of ${x}`),L;if(I.minFramerate>y)return et(R,`min framerate of ${I.minFramerate} > maximum of ${y}`),L;if(!v.some(D=>I.videoRanges[D]>0))return et(R,`no variants with VIDEO-RANGE of ${pe(v)} found`),L;if(u&&R.indexOf(u.substring(0,4))%5!==0)return et(R,`video codec preference "${u}" not found`),L;if(I.maxScore<p)return et(R,`max score of ${I.maxScore} < selected max of ${p}`),L}return L&&(bi(R)>=bi(L)||I.fragmentError>a[L].fragmentError)?L:(m=I.minIndex,p=I.maxScore,R)},void 0),videoRanges:v,preferHDR:_,minFramerate:g,minBitrate:f,minIndex:m}}function et(a,e){fe.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Wn(a){return a.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ul(a,e,t,i){return a.slice(t,i+1).reduce((s,r,n)=>{if(!r.codecSet)return s;const o=r.audioGroups;let u=s[r.codecSet];u||(s[r.codecSet]=u={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),u.minBitrate=Math.min(u.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return u.minHeight=Math.min(u.minHeight,l),u.minFramerate=Math.min(u.minFramerate,r.frameRate),u.minIndex=Math.min(u.minIndex,n),u.maxScore=Math.max(u.maxScore,r.score),u.fragmentError+=r.fragmentError,u.videoRanges[r.videoRange]=(u.videoRanges[r.videoRange]||0)+1,o&&o.forEach(d=>{if(!d)return;const h=e.groups[d];h&&(u.hasDefaultAudio=u.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(c=>{u.channels[c]=(u.channels[c]||0)+h.channels[c]}))}),s},{})}function Ar(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:r}=a;return{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:r}}function rt(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const s=e[i];if(It(a,s,t))return i}return-1}function It(a,e,t){const{groupId:i,name:s,lang:r,assocLang:n,default:o}=a,u=a.forced;return(i===void 0||e.groupId===i)&&(s===void 0||e.name===s)&&(r===void 0||dl(r,e.lang))&&(r===void 0||e.assocLang===n)&&(o===void 0||e.default===o)&&(u===void 0||e.forced===u)&&(!("characteristics"in a)||hl(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function dl(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function hl(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(s=>i.indexOf(s)===-1)}function At(a,e){const{audioCodec:t,channels:i}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function cl(a,e,t,i,s){const r=e[i],o=e.reduce((c,g,f)=>{const m=g.uri;return(c[m]||(c[m]=[])).push(f),c},{})[r.uri];o.length>1&&(i=Math.max.apply(Math,o));const u=r.videoRange,l=r.frameRate,d=r.codecSet.substring(0,4),h=Lr(e,i,c=>{if(c.videoRange!==u||c.frameRate!==l||c.codecSet.substring(0,4)!==d)return!1;const g=c.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return rt(a,f,s)>-1});return h>-1?h:Lr(e,i,c=>{const g=c.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return rt(a,f,s)>-1})}function Lr(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}function Pi(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class fl extends ze{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:s,partCurrent:r,hls:n}=this,{autoLevelEnabled:o,media:u}=n;if(!s||!u)return;const l=performance.now(),d=r?r.stats:s.stats,h=r?r.duration:s.duration,c=l-d.loading.start,g=n.minAutoLevel,f=s.level,m=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||f<=g){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const p=m>-1&&m!==f,v=!!t||p;if(!v&&(u.paused||!u.playbackRate||!u.readyState))return;const _=n.mainForwardBufferInfo;if(!v&&_===null)return;const E=this.bwEstimator.getEstimateTTFB(),x=Math.abs(u.playbackRate);if(c<=Math.max(E,1e3*(h/(x*2))))return;const y=_?_.len/x:0,T=d.loading.first?d.loading.first-d.loading.start:-1,A=d.loaded&&T>-1,L=this.getBwEstimate(),R=n.levels,I=R[f],D=Math.max(d.loaded,Math.round(h*(s.bitrate||I.averageBitrate)/8));let b=A?c-T:c;b<1&&A&&(b=Math.min(c,d.loaded*8/L));const P=A?d.loaded*1e3/b:0,C=E/1e3,k=P?(D-d.loaded)/P:D*8/L+C;if(k<=y)return;const O=P?P*8:L,F=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,U=this.hls.config.abrBandWidthUpFactor;let G=Number.POSITIVE_INFINITY,V;for(V=f-1;V>g;V--){const X=R[V].maxBitrate,ee=!R[V].details||F;if(G=this.getTimeToLoadFrag(C,O,h*X,ee),G<Math.min(y,h+C))break}if(G>=k||G>h*10)return;A?this.bwEstimator.sample(c-Math.min(E,T),d.loaded):this.bwEstimator.sampleTTFB(c);const $=R[V].maxBitrate;this.getBwEstimate()*U>$&&this.resetEstimator($);const K=this.findBestLevel($,g,V,0,y,1,1);K>-1&&(V=K),this.warn(`Fragment ${s.sn}${r?" part "+r.index:""} of level ${f} is loading too slowly;
4
4
  Fragment duration: ${s.duration.toFixed(3)}
@@ -39,4 +39,4 @@ Schedule: ${u.map(m=>Qe(m))} pos: ${this.timelinePos}`),d.length&&this.log(`Remo
39
39
  `).split(`
40
40
  `),l=[],d=e?Ku(e.baseTime,e.timescale):0;let h="00:00.000",c=0,g=0,f,m=!0;o.oncue=function(p){const v=t[i];let _=t.ccOffset;const E=(c-d)/9e4;if(v!=null&&v.new&&(g!==void 0?_=t.ccOffset=v.start:Mh(t,i,E)),E){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}_=E-t.presentationOffset}const x=p.endTime-p.startTime,y=je((p.startTime+_-g)*9e4,s*9e4)/9e4;p.startTime=Math.max(y,0),p.endTime=Math.max(y+x,0);const T=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(T)),p.id||(p.id=rr(p.startTime,p.endTime,T)),p.endTime>0&&l.push(p)},o.onparsingerror=function(p){f=p},o.onflush=function(){if(f){n(f);return}r(l)},u.forEach(p=>{if(m)if(ls(p,"X-TIMESTAMP-MAP=")){m=!1,p.slice(16).split(",").forEach(v=>{ls(v,"LOCAL:")?h=v.slice(6):ls(v,"MPEGTS:")&&(c=parseInt(v.slice(7)))});try{g=wh(h)/1e3}catch(v){f=v}return}else p===""&&(m=!1);o.parse(p+`
41
41
  `)}),o.flush()}const us="stpp.ttml.im1t",eo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,to=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Bh={left:"start",center:"center",right:"end",start:"start",end:"end"};function yn(a,e,t,i){const s=oe(new Uint8Array(a),["mdat"]);if(s.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=s.map(o=>We(o)),n=Gu(e.baseTime,1,e.timescale);try{r.forEach(o=>t(Nh(o,n)))}catch(o){i(o)}}function Nh(a,e){const s=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(r).reduce((h,c)=>(h[c]=s.getAttribute(`ttp:${c}`)||r[c],h),{}),o=s.getAttribute("xml:space")!=="preserve",u=xn(ds(s,"styling","style")),l=xn(ds(s,"layout","region")),d=ds(s,"body","[begin]");return[].map.call(d,h=>{const c=io(h,o);if(!c||!h.hasAttribute("begin"))return null;const g=cs(h.getAttribute("begin"),n),f=cs(h.getAttribute("dur"),n);let m=cs(h.getAttribute("end"),n);if(g===null)throw Sn(h);if(m===null){if(f===null)throw Sn(h);m=g+f}const p=new sr(g-e,m-e,c);p.id=rr(p.startTime,p.endTime,p.text);const v=l[h.getAttribute("region")],_=u[h.getAttribute("style")],E=Uh(v,_,u),{textAlign:x}=E;if(x){const y=Bh[x];y&&(p.lineAlign=y),p.align=x}return ge(p,E),p}).filter(h=>h!==null)}function ds(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function xn(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function io(a,e){return[].slice.call(a.childNodes).reduce((t,i,s)=>{var r;return i.nodeName==="br"&&s?t+`
42
- `:(r=i.childNodes)!=null&&r.length?io(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Uh(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let s=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],n=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return n&&t.hasOwnProperty(n)&&(s=t[n]),r.reduce((o,u)=>{const l=hs(e,i,u)||hs(a,i,u)||hs(s,i,u);return l&&(o[u]=l),o},{})}function hs(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Sn(a){return new Error(`Could not parse ttml timestamp ${a}`)}function cs(a,e){if(!a)return null;let t=Qa(a);return t===null&&(eo.test(a)?t=$h(a,e):to.test(a)&&(t=Gh(a,e))),t}function $h(a,e){const t=eo.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function Gh(a,e){const t=to.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class _i{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Kh{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=An(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new _i(this,"textTrack1"),t=new _i(this,"textTrack2"),i=new _i(this,"textTrack3"),s=new _i(this,"textTrack4");this.cea608Parser1=new En(1,e,t),this.cea608Parser2=new En(3,i,s)}addCues(e,t,i,s,r){let n=!1;for(let o=r.length;o--;){const u=r[o],l=Vh(u[0],u[1],t,i);if(l>=0&&(u[0]=Math.min(u[0],t),u[1]=Math.max(u[1],i),n=!0,l/(i-t)>.5))return}if(n||r.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,s)}else{const o=this.Cues.newCue(null,t,i,s);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r,trackId:n}){const{unparsedVttFrags:o}=this;i===q.MAIN&&(this.initPTS[t.cc]={baseTime:s,timescale:r,trackId:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(u=>{this.initPTS[u.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,u):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const r=i.textTracks[s];if(Tn(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:s}=this,{label:r,languageCode:n}=t[e],o=this.getExistingTrack(r,n);if(o)i[e]=o,Mt(i[e]),Wa(i[e],s);else{const u=this.createTextTrack("captions",r,n);u&&(u[e]=!0,i[e]=u)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,s={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,i){const s=this.media;if(s)return s.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;Object.keys(s).forEach(r=>{Mt(s[r]),delete s[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=An(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Mt(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],s=i.some(r=>r.textCodec===us);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(ka(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const n=this.media,o=n?Ii(n.textTracks):null;if(this.tracks.forEach((u,l)=>{let d;if(o){let h=null;for(let c=0;c<o.length;c++)if(o[c]&&Tn(o[c],u)){h=o[c],o[c]=null;break}h&&(d=h)}if(d)Mt(d);else{const h=so(u);d=this.createTextTrack(h,u.name,u.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const u=o.filter(l=>l!==null).map(l=>l.label);u.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${u.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const n=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const s=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!s)return;const r=`textTrack${s[1]}`,n=this.captionsProperties[r];n&&(n.label=i.name,i.lang&&(n.languageCode=i.lang),n.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===q.MAIN){var i,s;const{cea608Parser1:r,cea608Parser2:n,lastSn:o}=this,{cc:u,sn:l}=t.frag,d=(i=(s=t.part)==null?void 0:s.index)!=null?i:-1;r&&n&&(l!==o+1||l===o&&d!==this.lastPartIndex+1||u!==this.lastCc)&&(r.reset(),n.reset()),this.lastCc=u,this.lastSn=l,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===q.SUBTITLE)if(s.byteLength){const r=i.decryptdata,n="stats"in t;if(r==null||!r.encrypted||n){const o=this.tracks[i.level],u=this.vttCCs;u[i.cc]||(u[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===us?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;yn(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{i.logger.log(`Failed to parse IMSC1: ${s}`),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:n}=this,o=r.length-1;if(!r[i.cc]&&o===-1){n.push(e);return}const u=this.hls,l=(t=i.initSegment)!=null&&t.data?Ye(i.initSegment.data,new Uint8Array(s)).buffer:s;Fh(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,d=>{this._appendCues(d,i.level),u.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},d=>{const h=d.message==="Missing initPTS for VTT MPEGTS";h?n.push(e):this._fallbackToIMSC1(i,s),u.logger.log(`Failed to parse VTT cue: ${d}`),!(h&&o>i.cc)&&u.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:d})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||yn(t,this.initPTS[e.cc],()=>{i.textCodec=us,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(r=>Ya(s,r))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(S.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===q.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=t;if(!(i.type===q.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;r<s.length;r++){const n=s[r].bytes;if(n){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(n);this.cea608Parser1.addData(s[r].pts,o[0]),this.cea608Parser2.addData(s[r].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:s,type:r}){const{media:n}=this;if(!(!n||n.currentTime<i)){if(!r||r==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(u=>Ps(o[u],t,i))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(u=>Ps(o[u],t,s))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let s=2;for(let r=0;r<i;r++){const n=e[s++],o=127&e[s++],u=127&e[s++];if(o===0&&u===0)continue;if((4&n)!==0){const d=3&n;(d===0||d===1)&&(t[d].push(o),t[d].push(u))}}return t}}function so(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Tn(a,e){return!!a&&a.kind===so(e)&&Rs(e,a)}function Vh(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function An(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const jh=/\s/,Hh={newCue(a,e,t,i){const s=[];let r,n,o,u,l;const d=self.VTTCue||self.TextTrackCue;for(let c=0;c<i.rows.length;c++)if(r=i.rows[c],o=!0,u=0,l="",!r.isEmpty()){var h;for(let m=0;m<r.chars.length;m++)jh.test(r.chars[m].uchar)&&o?u++:(l+=r.chars[m].uchar,o=!1);r.cueStartTime=e,e===t&&(t+=1e-4),u>=16?u--:u++;const g=Ja(l.trim()),f=rr(e,t,g);a!=null&&(h=a.cues)!=null&&h.getCueById(f)||(n=new d(e,t,g),n.id=f,n.line=c+1,n.align="left",n.position=10+Math.min(80,Math.floor(u*8/32)*10),s.push(n))}return a&&s.length&&(s.sort((c,g)=>c.line==="auto"||g.line==="auto"?0:c.line>8&&g.line>8?g.line-c.line:c.line-g.line),s.forEach(c=>Ya(a,c))),s}};function Wh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Yh=/(\d+)-(\d+)\/(\d+)/;class Ln{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Qh,this.controller=new self.AbortController,this.stats=new Fs}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=zh(e,this.controller.signal),n=e.responseType==="arraybuffer",o=n?"byteLength":"length",{maxTimeToFirstByteMs:u,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=u&&z(u)?u:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},t.timeout),(Zt(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(h=>{var c;this.response=this.loader=h;const g=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},l-(g-s.loading.start)),!h.ok){const{status:m,statusText:p}=h;throw new Zh(p||"fetch, bad network response",m,h)}s.loading.first=g,s.total=Xh(h.headers)||s.total;const f=(c=this.callbacks)==null?void 0:c.onProgress;return f&&z(t.highWaterMark)?this.loadProgressively(h,s,e,t.highWaterMark,f):n?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{var c,g;const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const m=h[o];m&&(s.loaded=s.total=m);const p={url:f.url,data:h,code:f.status},v=(c=this.callbacks)==null?void 0:c.onProgress;v&&!z(t.highWaterMark)&&v(s,e,h,f),(g=this.callbacks)==null||g.onSuccess(p,s,e,f)}).catch(h=>{var c;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const g=h&&h.code||0,f=h?h.message:null;(c=this.callbacks)==null||c.onError({code:g,text:f},e,h?h.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const n=new fa,o=e.body.getReader(),u=()=>o.read().then(l=>{if(l.done)return n.dataLength&&r(t,i,n.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const d=l.value,h=d.length;return t.loaded+=h,h<s||n.dataLength?(n.push(d),n.dataLength>=s&&r(t,i,n.flush().buffer,e)):r(t,i,d.buffer,e),u()}).catch(()=>Promise.reject());return u()}}function zh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ge({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function qh(a){const e=Yh.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Xh(a){const e=a.get("Content-Range");if(e){const i=qh(e);if(z(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Qh(a,e){return new self.Request(a.url,e)}class Zh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Jh=/^age:\s*[\d.]+\s*$/im;class ro{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Fs,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(n=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(n=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:n.message},t,i,s)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:n}=i.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&z(r)?r:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const l=t.status,d=t.responseType==="text"?t.responseText:null;if(l>=200&&l<300){const f=d!=null?d:t.response;if(f!=null){var n,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const m=t.responseType==="arraybuffer"?f.byteLength:f.length;i.loaded=i.total=m,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const p=(n=this.callbacks)==null?void 0:n.onProgress;p&&p(i,e,f,t);const v={url:t.responseURL,data:f,code:l};(o=this.callbacks)==null||o.onSuccess(v,i,e,t);return}}const h=r.loadPolicy.errorRetry,c=i.retry,g={url:e.url,data:void 0,code:l};if(ki(h,c,!1,g))this.retry(h);else{var u;fe.error(`${l} while loading ${e.url}`),(u=this.callbacks)==null||u.onError({code:l,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ki(e,t,!0))this.retry(e);else{var i;fe.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=$s(e,i.retry),i.retry++,fe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Jh.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const ec={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},tc=ce(ce({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:ro,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:fl,bufferController:sd,capLevelController:er,errorController:vl,fpsController:rh,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ia,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:ec},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},ic()),{},{subtitleStreamController:ph,subtitleTrackController:oh,timelineController:Kh,audioStreamController:Ju,audioTrackController:ed,emeController:Nt,cmcdController:eh,contentSteeringController:ih,interstitialsController:mh});function ic(){return{cueHandler:Hh,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function sc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=ks(a),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,u=e[o]===void 0,l=[];r.forEach(d=>{const h=`${n}Loading${d}`,c=e[h];if(c!==void 0&&u){l.push(h);const g=i[o].default;switch(e[o]={default:g},d){case"TimeOut":g.maxLoadTimeMs=c,g.maxTimeToFirstByteMs=c;break;case"MaxRetry":g.errorRetry.maxNumRetry=c,g.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":g.errorRetry.retryDelayMs=c,g.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=c,g.timeoutRetry.maxRetryDelayMs=c;break}}}),l.length&&t.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${pe(e[o])}`)}),ce(ce({},i),e)}function ks(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(ks):Object.keys(a).reduce((e,t)=>(e[t]=ks(a[t]),e),{}):a}function rc(a,e){const t=a.loader;t!==Ln&&t!==ro?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Wh()&&(a.loader=Ln,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Ri=2,nc=.1,ac=.05,oc=100;class lc extends Qn{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(oc),this.mediaSource=t.mediaSource;const i=this.media=t.media;Ne(i,"playing",this.onMediaPlaying),Ne(i,"waiting",this.onMediaWaiting),Ne(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Ge(i,"playing",this.onMediaPlaying),Ge(i,"waiting",this.onMediaWaiting),Ge(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,s;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const n=this.media;if(!n)return;const{seeking:o}=n,u=this.seeking&&!o,l=!this.seeking&&o,d=n.paused&&!o||n.ended||n.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!d&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||u){u&&this.stallResolved(e);return}if(d){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&n.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!se.getBuffered(n).length){this.nudgeRetry=0;return}const h=se.bufferInfo(n,e,0),c=h.nextStart||0,g=this.fragmentTracker;if(o&&g&&this.hls){const T=In(this.hls.inFlightFragments,e),A=h.len>Ri,L=!c||T||c-e>Ri&&!g.getPartialFragment(e);if(A||L)return;this.moved=!1}const f=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&g){if(!(h.len>0)&&!c)return;const A=Math.max(c,h.start||0)-e,R=!!(f!=null&&f.live)?f.targetduration*2:Ri,I=vi(e,g);if(A>0&&(A<=R||I)){n.paused||this._trySkipBufferHole(I);return}}const m=r.detectStallWithCurrentTimeMs,p=self.performance.now(),v=this.waiting;let _=this.stalled;if(_===null)if(v>0&&p-v<m)_=this.stalled=v;else{this.stalled=p;return}const E=p-_;if(!o&&(E>=m||v)&&this.hls){var x;if(((x=this.mediaSource)==null?void 0:x.readyState)==="ended"&&!(f!=null&&f.live)&&Math.abs(e-((f==null?void 0:f.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return}const y=se.bufferInfo(n,e,r.maxBufferHole);this._tryFixBufferStall(y,E,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&s&&s.length>1&&e>s.end(0)){const r=se.bufferedInfo(se.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const n=se.timeRangesToArray(s),o=se.bufferedInfo(n,t,0).bufferedIndex;if(o>-1&&o<n.length-1){const u=se.bufferedInfo(n,e,0).bufferedIndex,l=n[o].end,d=n[o+1].start;if((u===-1||u>o)&&d-l<1&&e-l<2){const h=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${d} buffered index: ${u}`);this.warn(h.message),this.media.currentTime+=1e-6;let c=vi(e,this.fragmentTracker);c&&"fragment"in c?c=c.fragment:c||(c=void 0);const g=se.bufferInfo(this.media,e,0);this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:c,buffer:g.len,bufferInfo:g})}}}}}_tryFixBufferStall(e,t,i){var s,r;const{fragmentTracker:n,media:o}=this,u=(s=this.hls)==null?void 0:s.config;if(!o||!n||!u)return;const l=(r=this.hls)==null?void 0:r.latestLevelDetails,d=vi(i,n);if((d||l!=null&&l.live&&i<l.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const h=e.buffered,c=this.adjacentTraversal(e,i);(h&&h.length>1&&e.len>u.maxBufferHole||e.nextStart&&(e.nextStart-i<u.maxBufferHole||c))&&(t>u.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,s=e.nextStart;if(i&&s){const r=i.getFragAtPos(t,q.MAIN),n=i.getFragAtPos(s,q.MAIN);if(r&&n)return n.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:s,stalled:r}=this;if(!s&&r!==null&&i&&t){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${pe(e)})`);this.warn(n.message),t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:s}=this,r=(t=this.hls)==null?void 0:t.config;if(!s||!i||!r)return 0;const n=s.currentTime,o=se.bufferInfo(s,n,0),u=n<o.start?o.start:o.nextStart;if(u&&this.hls){const d=o.len<=r.maxBufferHole,h=o.len>0&&o.len<1&&s.readyState<3,c=u-n;if(c>0&&(d||h)){if(c>r.maxBufferHole){let f=!1;if(n===0){const m=i.getAppendedFrag(0,q.MAIN);m&&u<m.end&&(f=!0)}if(!f&&e){var l;if(!((l=this.hls.loadLevelObj)!=null&&l.details)||In(this.hls.inFlightFragments,u))return 0;let p=!1,v=e.end;for(;v<u;){const _=vi(v,i);if(_)v+=_.duration;else{p=!0;break}}if(p)return 0}}const g=Math.max(u+ac,n+nc);if(this.warn(`skipping hole, adjusting currentTime from ${n} to ${g}`),this.moved=!0,s.currentTime=g,!(e!=null&&e.gap)){const f=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${g}`),m={type:Z.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?m.part=e:m.frag=e),this.hls.trigger(S.ERROR,m)}return g}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:s}=this,r=t==null?void 0:t.config;if(!i||!r)return 0;const n=i.currentTime;if(this.nudgeRetry++,s<r.nudgeMaxRetry){const o=n+(s+1)*r.nudgeOffset,u=new Error(`Nudging 'currentTime' from ${n} to ${o}`);this.warn(u.message),i.currentTime=o,t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_NUDGE_ON_STALL,error:u,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${r.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function In(a,e){const t=Rn(a.main);if(t&&t.start<=e)return t;const i=Rn(a.audio);return i&&i.start<=e?i:null}function Rn(a){if(!a)return null;switch(a.state){case N.IDLE:case N.STOPPED:case N.ENDED:case N.ERROR:return null}return a.frag}function vi(a,e){return e.getAppendedFrag(a,q.MAIN)||e.getPartialFragment(a)}const uc=.25;function ws(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function fs(a,e,t,i,s){let r=new a(e,t,"");try{r.value=i,s&&(r.type=s)}catch(n){r=new a(e,t,pe(s?ce({type:s},i):i))}return r}const Ei=(()=>{const a=ws();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class dc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(S.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Mt(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Wa(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:s}=this.hls.config;if(!i&&!s)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=ws();if(n)for(let o=0;o<r.length;o++){const u=r[o].type;if(u===He.emsg&&!i||!s)continue;const l=ya(r[o].data),d=r[o].pts;let h=d+r[o].duration;h>Ei&&(h=Ei),h-d<=0&&(h=d+uc);for(let g=0;g<l.length;g++){const f=l[g];if(!xa(f)){this.updateId3CueEnds(d,u);const m=fs(n,d,h,f,u);m&&this.id3Track.addCue(m)}}}}updateId3CueEnds(e,t){var i;const s=(i=this.id3Track)==null?void 0:i.cues;if(s)for(let r=s.length;r--;){const n=s[r];n.type===t&&n.startTime<e&&n.endTime===Ei&&(n.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:s}){const{id3Track:r,hls:n}=this;if(!n)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:u}}=n;if(r&&(o||u)){let l;s==="audio"?l=d=>d.type===He.audioId3&&u:s==="video"?l=d=>d.type===He.emsg&&o:l=d=>d.type===He.audioId3&&u||d.type===He.emsg&&o,Ps(r,t,i,l)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:s,enableDateRangeMetadataCues:r,interstitialsController:n}=this.hls.config;if(!r)return;const o=ws();if(i&&s&&!n){const{fragmentStart:m,fragmentEnd:p}=e;let v=this.assetCue;v?(v.startTime=m,v.endTime=p):o&&(v=this.assetCue=fs(o,m,p,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:u}=this,{dateRanges:l}=e,d=Object.keys(l);let h=this.dateRangeCuesAppended;if(u&&t){var c;if((c=u.cues)!=null&&c.length){const m=Object.keys(h).filter(p=>!d.includes(p));for(let p=m.length;p--;){var g;const v=m[p],_=(g=h[v])==null?void 0:g.cues;delete h[v],_&&Object.keys(_).forEach(E=>{const x=_[E];if(x){x.removeEventListener("enter",this.onEventCueEnter);try{u.removeCue(x)}catch(y){}}})}}else h=this.dateRangeCuesAppended={}}const f=e.fragments[e.fragments.length-1];if(!(d.length===0||!z(f==null?void 0:f.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let m=0;m<d.length;m++){const p=d[m],v=l[p],_=v.startTime,E=h[p],x=(E==null?void 0:E.cues)||{};let y=(E==null?void 0:E.durationKnown)||!1,T=Ei;const{duration:A,endDate:L}=v;if(L&&A!==null)T=_+A,y=!0;else if(v.endOnNext&&!y){const I=d.reduce((D,b)=>{if(b!==v.id){const P=l[b];if(P.class===v.class&&P.startDate>v.startDate&&(!D||v.startDate<D.startDate))return P}return D},null);I&&(T=I.startTime,y=!0)}const R=Object.keys(v.attr);for(let I=0;I<R.length;I++){const D=R[I];if(!Pl(D))continue;const b=x[D];if(b)y&&!(E!=null&&E.durationKnown)?b.endTime=T:Math.abs(b.startTime-_)>.01&&(b.startTime=_,b.endTime=T);else if(o){let P=v.attr[D];Ol(D)&&(P=Pn(P));const k=fs(o,_,T,{key:D,data:P},He.dateRange);k&&(k.id=p,this.id3Track.addCue(k),x[D]=k,n&&(D==="X-ASSET-LIST"||D==="X-ASSET-URL")&&k.addEventListener("enter",this.onEventCueEnter))}}h[p]={cues:x,dateRange:v,durationKnown:y}}}}}class hc{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const u=s-o,l=Math.min(this.maxLatency,o+i.targetduration);if(u<l&&u>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,n)),c=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20,g=Math.min(h,Math.max(1,c));this.changeMediaPlaybackRate(t,g)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:n,lowLatencyMode:o}=this.config,u=this.hls.userConfig;let l=o&&i||t;(this._targetLatencyUpdated||u.liveSyncDuration||u.liveSyncDurationCount||l===0)&&(l=r!==void 0?r:n*s);const d=s;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const s=i.edge,r=e-t-this.edgeStalled,n=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(n,r),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===M.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,s;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class cc extends Js{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},n={};let o=!1,u=!1,l=!1;t.levels.forEach(d=>{const h=d.attrs;let{audioCodec:c,videoCodec:g}=d;c&&(d.audioCodec=c=Di(c,i)||void 0),g&&(g=d.videoCodec=zo(g));const{width:f,height:m,unknownCodecs:p}=d,v=(p==null?void 0:p.length)||0;if(o||(o=!!(f&&m)),u||(u=!!g),l||(l=!!c),v||c&&!this.isAudioSupported(c)||g&&!this.isVideoSupported(g)){this.log(`Some or all CODECS not supported "${h.CODECS}"`);return}const{CODECS:_,"FRAME-RATE":E,"HDCP-LEVEL":x,"PATHWAY-ID":y,RESOLUTION:T,"VIDEO-RANGE":A}=h,R=`${`${y||"."}-`}${d.bitrate}-${T}-${E}-${_}-${A}-${x}`;if(r[R])if(r[R].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const I=n[R]+=1;d.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const D=this.createLevel(d);r[R]=D,s.push(D)}else r[R].addGroupId("audio",h.AUDIO),r[R].addGroupId("text",h.SUBTITLES);else{const I=this.createLevel(d);r[R]=I,n[R]=1,s.push(I)}}),this.filterAndSortMediaOptions(s,t,o,u,l)}createLevel(e){const t=new qt(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(s.message),t.supportedResult=Vn(s,[])}return t}isAudioSupported(e){return Yt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Yt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,s,r){var n;let o=[],u=[],l=e;const d=((n=t.stats)==null?void 0:n.parsing)||{};if((i||s)&&r&&(l=l.filter(({videoCodec:_,videoRange:E,width:x,height:y})=>(!!_||!!(x&&y))&&rl(E))),l.length===0){Promise.resolve().then(()=>{if(this.hls){let _="no level with compatible codecs found in manifest",E=_;t.levels.length&&(E=`one or more CODECS in variant not supported: ${pe(t.levels.map(y=>y.attrs.CODECS).filter((y,T,A)=>A.indexOf(y)===T))}`,this.warn(E),_+=` (${E})`);const x=new Error(_);this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:x,reason:E})}}),d.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(_=>!_.audioCodec||this.isAudioSupported(_.audioCodec)),bn(o)),t.subtitles&&(u=t.subtitles,bn(u));const h=l.slice(0);l.sort((_,E)=>{if(_.attrs["HDCP-LEVEL"]!==E.attrs["HDCP-LEVEL"])return(_.attrs["HDCP-LEVEL"]||"")>(E.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&_.height!==E.height)return _.height-E.height;if(_.frameRate!==E.frameRate)return _.frameRate-E.frameRate;if(_.videoRange!==E.videoRange)return Ci.indexOf(_.videoRange)-Ci.indexOf(E.videoRange);if(_.videoCodec!==E.videoCodec){const x=vr(_.videoCodec),y=vr(E.videoCodec);if(x!==y)return y-x}if(_.uri===E.uri&&_.codecSet!==E.codecSet){const x=bi(_.codecSet),y=bi(E.codecSet);if(x!==y)return y-x}return _.averageBitrate!==E.averageBitrate?_.averageBitrate-E.averageBitrate:0});let c=h[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==h.length)){for(let _=0;_<h.length;_++)if(h[_].pathwayId===l[0].pathwayId){c=h[_];break}}this._levels=l;for(let _=0;_<l.length;_++)if(l[_]===c){var g;this._firstLevel=_;const E=c.bitrate,x=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${E}`),((g=this.hls.userConfig)==null?void 0:g.abrEwmaDefaultEstimate)===void 0){const y=Math.min(E,this.hls.config.abrEwmaDefaultEstimateMax);y>x&&x===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const f=r&&!s,m=this.hls.config,p=!!(m.audioStreamController&&m.audioTrackController),v={levels:l,audioTracks:o,subtitleTracks:u,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:p&&!f&&o.some(_=>!!_.url)};d.end=performance.now(),this.hls.trigger(S.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:d,reason:d.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,n=t[e],o=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,i===e&&s&&r===o)return;this.log(`Switching to level ${e} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const u={level:e,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,u);const l=n.details;if(!l||l.live){const d=this.switchParams(n.uri,s==null?void 0:s.details,l);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(s=>t.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ue.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===q.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,n=t.levelInfo;if(!n){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}if(n===this.currentLevel||t.withoutMultiVariant){n.fragmentError===0&&(n.loadError=0);let u=n.details;u===t.details&&u.advanced&&(u=void 0),this.playlistLoaded(s,t,u)}else(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),s=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],n=e.details,o=n==null?void 0:n.age;this.log(`Loading level index ${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${o&&n.live?" age "+o.toFixed(1)+(n.type&&" "+n.type||""):""} ${i}`),this.hls.trigger(S.LEVEL_LOADING,{url:i,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));da(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(S.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function bn(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function no(){return self.SourceBuffer||self.WebKitSourceBuffer}function ao(){if(!Et())return!1;const e=no();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function fc(){if(!ao())return!1;const a=Et();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(zt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(zt(e,"audio"))))}function gc(){var a;const e=no();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const mc=100;class pc extends Hs{constructor(e,t,i){super(e,t,i,"stream-controller",q.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,r=s?s.currentTime:null;if(r===null||!z(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const n=this.getFwdBufferInfoAtPos(s,r,q.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${n?n.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(mc),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=N.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=N.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case N.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(s))break;this.state=N.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=N.IDLE;break}break}case N.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===N.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(t===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const n=i[r],o=this.getMainFwdBufferInfo();if(o===null)return;const u=this.getLevelDetails();if(u&&this._streamEnded(o,u)){const m={};this.altAudio===2&&(m.type="video"),this.hls.trigger(S.BUFFER_EOS,m),this.state=N.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=n.details;if(!l||this.state===N.WAITING_LEVEL||this.waitForLive(n)){this.level=r,this.state=N.WAITING_LEVEL,this.startFragRequested=!1;return}const d=o.len,h=this.getMaxBufferLength(n.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:o.end;let g=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&g&&Ae(g)&&this.fragmentTracker.getState(g)!==Re.OK){var f;const p=((f=this.backtrackFragment)!=null?f:g).sn-l.startSN,v=l.fragments[p-1];v&&g.cc===v.cc&&(g=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,c)){if(!g.gap){const p=this.audioOnly&&!this.altAudio?me.AUDIO:me.VIDEO,v=(p===me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,p,q.MAIN)}g=this.getNextFragmentLoopLoading(g,l,o,q.MAIN,h)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,n,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);s===Re.NOT_LOADED||s===Re.PARTIAL?Ae(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,q.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<r.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,u=e[o],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*u.maxBitrate/(1e3*l)+1:i=0}else i=0;const n=this.getBufferedFrag(t.currentTime+i);if(n){const o=this.followingBufferedFrag(n);if(o){this.abortCurrentFrag();const u=o.maxStartPTS?o.maxStartPTS:o.start,l=o.duration,d=Math.max(n.end,u+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case N.KEY_LOADING:case N.FRAG_LOADING:case N.FRAG_LOADING_WAITING_RETRY:case N.PARSING:case N.PARSED:this.state=N.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Ne(i,"playing",this.onMediaPlaying),Ne(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Ge(i,"playing",this.onMediaPlaying),Ge(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,s=!1;for(let r=0;r<t.levels.length;r++){const n=t.levels[r].audioCodec;n&&(i=i||n.indexOf("mp4a.40.2")!==-1,s=s||n.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&s&&!gc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==N.IDLE)return;const s=t.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=N.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:s,startFragRequested:r}=this,n=t.level,o=t.details,u=o.totalduration;if(!s){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${u}`);const l=t.levelInfo,d=this.fragCurrent;d&&(this.state===N.FRAG_LOADING||this.state===N.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let h=0;if(o.live||(i=l.details)!=null&&i.live){var c;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}if(l.details=o,this.levelLastLoaded=l,r||this.setStartPosition(o,h),this.hls.trigger(S.LEVEL_UPDATED,{details:o,level:n}),this.state===N.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=N.IDLE}r&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,r=this.getLoadPosition(),n=e.fragmentStart,o=e.edge,u=r>=n-t.maxFragLookUpTolerance&&r<=o;if(s!==null&&i.duration>s&&(r<s||!u)){const d=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!u&&i.readyState<4||r<o-d)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var l;const h=se.bufferInfo(i,s,0);if(!((l=h.buffered)!=null&&l.length)){i.currentTime=s;return}if(h.start<=r){i.currentTime=s;return}const{nextStart:g}=se.bufferedInfo(h.buffered,r,0);g&&(i.currentTime=g)}else i.currentTime=s}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:r}=e,{levels:n}=this;if(!n){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=n[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const u=o.details;if(!u){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=o.videoCodec,d=u.PTSKnown||!u.live,h=(t=i.initSegment)==null?void 0:t.data,c=this._getAudioCodec(o),g=this.transmuxer=this.transmuxer||new Oa(this.hls,q.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=s?s.index:-1,m=f!==-1,p=new Ks(i.level,i.sn,i.stats.chunkCount,r.byteLength,f,m),v=this.initPTS[i.cc];g.push(r,h,c,l,i,s,u.totalduration,d,p,v)}onAudioTrackSwitching(e,t){const i=this.hls,s=this.altAudio!==0;if(Pi(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const n=this.fragCurrent;n&&(this.log("Switching to main audio track, cancel main fragment load"),n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(S.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(S.AUDIO_TRACK_SWITCHED,t)}),i.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(S.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=Pi(t.url,this.hls);if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,n=!1;for(const o in i){const u=i[o];if(u.id==="main"){if(r=o,s=u,o==="video"){const l=i[o];l&&(this.videoBuffer=l.buffer)}}else n=!0}n&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t,r=i.type===q.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===N.PARSED&&(this.state=N.IDLE);return}const o=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Ae(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const n=this.media;n&&(!this._hasEnoughToStart&&se.getBuffered(n).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=N.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(q.MAIN,t);break;case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ue.LEVEL&&(this.state=N.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case M.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=N.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==me.AUDIO||!this.altAudio){const i=(t===me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,q.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const s=this.timelineOffset;s&&i&&(i+=s);const r=this.getLevelDetails(),n=se.getBuffered(e),o=n.length?n.start(0):0,u=o-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||u>0&&(u<l||this.loadingParts&&u<2*((r==null?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${u} to match buffer start`),i+=u,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:s}=this,r=i==null?void 0:i.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=N.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=r.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),s.trigger(S.FRAG_LOADED,i),r.bitrateTest=!1}).catch(i=>{this.state===N.STOPPED||this.state===N.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:s,chunkMeta:r}=e,n=this.getCurrentContext(r);if(!n){this.resetWhenMissingContext(r);return}const{frag:o,part:u,level:l}=n,{video:d,text:h,id3:c,initSegment:g}=s,{details:f}=l,m=this.altAudio?void 0:s.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=N.PARSING,g){const p=g.tracks;if(p){const x=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(l,p,x,r),i.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:x,id:t,tracks:p})}const v=g.initPTS,_=g.timescale,E=this.initPTS[o.cc];if(z(v)&&(!E||E.baseTime!==v||E.timescale!==_)){const x=g.trackId;this.initPTS[o.cc]={baseTime:v,timescale:_,trackId:x},i.trigger(S.INIT_PTS_FOUND,{frag:o,id:t,initPTS:v,timescale:_,trackId:x})}}if(d&&f){m&&d.type==="audiovideo"&&this.logMuxedErr(o);const p=f.fragments[o.sn-1-f.startSN],v=o.sn===f.startSN,_=!p||o.cc>p.cc;if(s.independent!==!1){const{startPTS:E,endPTS:x,startDTS:y,endDTS:T}=d;if(u)u.elementaryStreams[d.type]={startPTS:E,endPTS:x,startDTS:y,endDTS:T};else if(d.firstKeyFrame&&d.independent&&r.id===1&&!_&&(this.couldBacktrack=!0),d.dropped&&d.independent){const A=this.getMainFwdBufferInfo(),L=(A?A.end:this.getLoadPosition())+this.config.maxBufferHole,R=d.firstKeyFramePTS?d.firstKeyFramePTS:E;if(!v&&L<R-this.config.maxBufferHole&&!_){this.backtrack(o);return}else _&&(o.gap=!0);o.setElementaryStreamInfo(d.type,o.start,x,o.start,T,!0)}else v&&E-(f.appliedTimelineOffset||0)>Ri&&(o.gap=!0);o.setElementaryStreamInfo(d.type,E,x,y,T),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(d,o,u,r,v||_)}else if(v||_)o.gap=!0;else{this.backtrack(o);return}}if(m){const{startPTS:p,endPTS:v,startDTS:_,endDTS:E}=m;u&&(u.elementaryStreams[me.AUDIO]={startPTS:p,endPTS:v,startDTS:_,endDTS:E}),o.setElementaryStreamInfo(me.AUDIO,p,v,_,E),this.bufferFragmentData(m,o,u,r)}if(f&&c!=null&&c.samples.length){const p={id:t,frag:o,details:f,samples:c.samples};i.trigger(S.FRAG_PARSING_METADATA,p)}if(f&&h){const p={id:t,frag:o,details:f,samples:h.samples};i.trigger(S.FRAG_PARSING_USERDATA,p)}}logMuxedErr(e){this.warn(`${Ae(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,s){if(this.state!==N.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:n,audiovideo:o}=t;if(r){const l=e.audioCodec;let d=yi(r.codec,l);d==="mp4a"&&(d="mp4a.40.5");const h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const c=r.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),l&&l!==d&&this.log(`Swapping manifest audio codec "${l}" for "${d}"`),r.levelCodec=d,r.id=q.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${d||""}/${l||""}/${r.codec}]`),delete t.audiovideo}if(n){n.levelCodec=e.videoCodec,n.id=q.MAIN;const l=n.codec;if((l==null?void 0:l.length)===4)switch(l){case"hvc1":case"hev1":n.codec="hvc1.1.6.L120.90";break;case"av01":n.codec="av01.0.04M.08";break;case"avc1":n.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${e.videoCodec||""}/${l}]${n.codec!==l?" parsed-corrected="+n.codec:""}${n.supplemental?" supplemental="+n.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const u=Object.keys(t);if(u.length){if(this.hls.trigger(S.BUFFER_CODECS,t),!this.hls)return;u.forEach(l=>{const h=t[l].initSegment;h!=null&&h.byteLength&&this.hls.trigger(S.BUFFER_APPENDING,{type:l,data:h,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,q.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=N.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(se.isBuffered(e,i)?t=this.getAppendedFrag(i):se.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,r=t.level;(!s||t.sn!==s.sn||s.level!==r)&&(this.fragPlaying=t,this.hls.trigger(S.FRAG_CHANGED,{frag:t}),(!s||s.level!==r)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return z(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(z(t)){const i=this.getLevelDetails(),s=this.currentFrag||(i?Rt(null,i.fragments,t):null);if(s){const r=s.programDateTime;if(r!==null){const n=r+(t-s.start)*1e3;return new Date(n)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class _c extends ze{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[i].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=M.KEY_LOAD_ERROR,i,s,r){return new ht({type:Z.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let s=0,r=t.length;s<r;s++){const n=t[s];if(e.cc<=n.cc&&(!Ae(e)||!Ae(n)||e.sn<n.sn)||!i&&s==r-1)return this.emeController.selectKeySystemFormat(n).then(o=>{if(!this.emeController)return;n.setKeyFormat(o);const u=Si(o);if(u)return this.emeController.getKeySystemAccess([u])})}if(this.config.requireKeySystemAccessOnStart){const s=Vt(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,l))}const n=r.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));const o=gs(r);let u=this.keyIdToKeyInfo[o];if((i=u)!=null&&i.decryptdata.key)return r.key=u.decryptdata.key,Promise.resolve({frag:e,keyInfo:u});if(this.emeController&&(s=u)!=null&&s.keyLoadPromise)switch(this.emeController.getKeyStatus(u.decryptdata)){case"usable":case"usable-in-future":return u.keyLoadPromise.then(d=>{const{keyInfo:h}=d;return r.key=h.decryptdata.key,{frag:e,keyInfo:h}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${r.keyId?" keyId: "+Me(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),u=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(u,e):this.loadKeyEME(u,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(u,e);default:return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=t.initSegment)!=null&&s.data){const n=Fo(t.initSegment.data);if(n.length){let o=n[0];o.some(u=>u!==0)?(this.log(`Using keyId found in init segment ${Me(o)}`),vt.setKeyIdForUri(e.decryptdata.uri,o)):(o=vt.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Me(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!Ae(t))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,"data"in n&&(n.data.frag=t),n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=i.loader,r=new s(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((n,o)=>{const u={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,d={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(c,g,f,m)=>{const{frag:p,keyInfo:v}=f,_=gs(v.decryptdata);if(!p.decryptdata||v!==this.keyIdToKeyInfo[_])return o(this.createKeyLoadError(p,M.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));v.decryptdata.key=p.decryptdata.key=new Uint8Array(c.data),p.keyLoader=null,v.loader=null,n({frag:p,keyInfo:v})},onError:(c,g,f,m)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.KEY_LOAD_ERROR,new Error(`HTTP Error ${c.code} loading key ${c.text}`),f,ce({url:u.url,data:void 0},c)))},onTimeout:(c,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(c,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};r.load(u,d,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const n=gs(i.decryptdata)||s;delete this.keyIdToKeyInfo[n],r&&r.destroy()}}function gs(a){if(a.keyFormat!==Fe.FAIRPLAY){const e=a.keyId;if(e)return Me(e)}return a.uri}function Dn(a){const{type:e}=a;switch(e){case ue.AUDIO_TRACK:return q.AUDIO;case ue.SUBTITLE_TRACK:return q.SUBTITLE;default:return q.MAIN}}function ms(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class vc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=i||s,n=new r(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ue.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:n,deliveryDirectives:o,levelInfo:u}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:ue.LEVEL,url:n,deliveryDirectives:o,levelOrTrack:u})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:ue.AUDIO_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:ue.SUBTITLE_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ue.LEVEL];if(i){const s=i.context;s&&!t.levels.some(r=>r===s.levelOrTrack)&&(i.abort(),delete this.loaders[ue.LEVEL])}}load(e){var t;const i=this.hls.config;let s=this.getInternalLoader(e);if(s){const l=this.hls.logger,d=s.context;if(d&&d.levelOrTrack===e.levelOrTrack&&(d.url===e.url||d.deliveryDirectives&&!e.deliveryDirectives)){d.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${d.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let r;if(e.type===ue.MANIFEST?r=i.manifestLoadPolicy.default:r=ge({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),z((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===ue.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===ue.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===ue.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const d=l.partTarget,h=l.targetduration;if(d&&h){const c=Math.max(d*3,h*.8)*1e3;r=ge({},r,{maxTimeToFirstByteMs:Math.min(c,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(c,r.maxTimeToFirstByteMs)})}}}const n=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},u={onSuccess:(l,d,h,c)=>{const g=this.getInternalLoader(h);this.resetInternalLoader(h.type);const f=l.data;d.parsing.start=performance.now(),nt.isMediaPlaylist(f)||h.type!==ue.MANIFEST?this.handleTrackOrLevelPlaylist(l,d,h,c||null,g):this.handleMasterPlaylist(l,d,h,c)},onError:(l,d,h,c)=>{this.handleNetworkError(d,h,!1,l,c)},onTimeout:(l,d,h)=>{this.handleNetworkError(d,h,!0,void 0,l)}};s.load(e,o,u)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,s){const r=this.hls,n=e.data,o=ms(e,i),u=nt.parseMasterPlaylist(n,o);if(u.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,u.playlistParsingError,s,t);return}const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:g,variableList:f}=u;this.variableList=f,d.forEach(_=>{const{unknownCodecs:E}=_;if(E){const{preferManagedMediaSource:x}=this.hls.config;let{audioCodec:y,videoCodec:T}=_;for(let A=E.length;A--;){const L=E[A];Yt(L,"audio",x)?(_.audioCodec=y=y?`${y},${L}`:L,$t.audio[y.substring(0,4)]=2,E.splice(A,1)):Yt(L,"video",x)&&(_.videoCodec=T=T?`${T},${L}`:L,$t.video[T.substring(0,4)]=2,E.splice(A,1))}}});const{AUDIO:m=[],SUBTITLES:p,"CLOSED-CAPTIONS":v}=nt.parseMasterPlaylistMedia(n,o,u);m.length&&!m.some(E=>!E.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ye({}),bitrate:0,url:""})),r.trigger(S.MANIFEST_LOADED,{levels:d,audioTracks:m,subtitles:p,captions:v,contentSteering:l,url:o,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:g,variableList:f})}handleTrackOrLevelPlaylist(e,t,i,s,r){const n=this.hls,{id:o,level:u,type:l}=i,d=ms(e,i),h=z(u)?u:z(o)?o:0,c=Dn(i),g=nt.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===ue.MANIFEST){const f={attrs:new ye({}),bitrate:0,details:g,name:"",url:d};g.requestScheduled=t.loading.start+oa(g,0),n.trigger(S.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.MANIFEST_PARSING_ERROR,fatal:t.type===ue.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let n=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===ue.LEVEL?n+=`: ${e.level} id: ${e.id}`:(e.type===ue.AUDIO_TRACK||e.type===ue.SUBTITLE_TRACK)&&(n+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(n);this.hls.logger.warn(`[playlist-loader]: ${n}`);let u=M.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case ue.MANIFEST:u=i?M.MANIFEST_LOAD_TIMEOUT:M.MANIFEST_LOAD_ERROR,l=!0;break;case ue.LEVEL:u=i?M.LEVEL_LOAD_TIMEOUT:M.LEVEL_LOAD_ERROR,l=!1;break;case ue.AUDIO_TRACK:u=i?M.AUDIO_TRACK_LOAD_TIMEOUT:M.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ue.SUBTITLE_TRACK:u=i?M.SUBTITLE_TRACK_LOAD_TIMEOUT:M.SUBTITLE_LOAD_ERROR,l=!1;break}d&&this.resetInternalLoader(e.type);const h={type:Z.NETWORK_ERROR,details:u,fatal:l,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:r};if(s){const c=(t==null?void 0:t.url)||e.url;h.response=ce({url:c,data:void 0},s)}this.hls.trigger(S.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,n){const o=this.hls,{type:u,level:l,levelOrTrack:d,id:h,groupId:c,deliveryDirectives:g}=s,f=ms(t,s),m=Dn(s);let p=typeof s.level=="number"&&m===q.MAIN?l:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:v,reason:v.message,response:t,context:s,level:p,parent:m,networkDetails:r,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const _=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:_,reason:_.message,response:t,context:s,level:p,parent:m,networkDetails:r,stats:i});return}switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),(!n.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),u){case ue.MANIFEST:case ue.LEVEL:if(p){if(!d)p=0;else if(d!==o.levels[p]){const _=o.levels.indexOf(d);_>-1&&(p=_)}}o.trigger(S.LEVEL_LOADED,{details:e,levelInfo:d||o.levels[0],level:p||0,id:h||0,stats:i,networkDetails:r,deliveryDirectives:g,withoutMultiVariant:u===ue.MANIFEST});break;case ue.AUDIO_TRACK:o.trigger(S.AUDIO_TRACK_LOADED,{details:e,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:g});break;case ue.SUBTITLE_TRACK:o.trigger(S.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:g});break}}}class Je{static get version(){return Xt}static isMSESupported(){return ao()}static isSupported(){return fc()}static getMediaSource(){return Et()}static get Events(){return S}static get MetadataSchema(){return He}static get ErrorTypes(){return Z}static get ErrorDetails(){return M}static get DefaultConfig(){return Je.defaultConfig?Je.defaultConfig:tc}static set DefaultConfig(e){Je.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ws,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=Ao(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=sc(Je.DefaultConfig,e,t);this.userConfig=e,i.progressive&&rc(i,t);const{abrController:s,bufferController:r,capLevelController:n,errorController:o,fpsController:u}=i,l=new o(this),d=this.abrController=new s(this),h=new El(this),c=i.interstitialsController,g=c?this.interstitialsController=new c(this,Je):null,f=this.bufferController=new r(this,h),m=this.capLevelController=new n(this),p=new u(this),v=new vc(this),_=i.contentSteeringController,E=_?new _(this):null,x=this.levelController=new cc(this,E),y=new dc(this),T=new _c(this.config,this.logger),A=this.streamController=new pc(this,h,T),L=this.gapController=new lc(this,h);m.setStreamController(A),p.setStreamController(A);const R=[v,x,A];g&&R.splice(1,0,g),E&&R.splice(1,0,E),this.networkControllers=R;const I=[d,f,L,m,p,y,h];this.audioTrackController=this.createController(i.audioTrackController,R);const D=i.audioStreamController;D&&R.push(this.audioStreamController=new D(this,h,T)),this.subtitleTrackController=this.createController(i.subtitleTrackController,R);const b=i.subtitleStreamController;b&&R.push(this.subtititleStreamController=new b(this,h,T)),this.createController(i.timelineController,I),T.emeController=this.emeController=this.createController(i.emeController,I),this.cmcdController=this.createController(i.cmcdController,I),this.latencyController=this.createController(hc,I),this.coreComponents=I,R.push(l);const P=l.onErrorOut;typeof P=="function"&&this.on(S.ERROR,P,l),this.on(S.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const s=e===S.ERROR;this.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:s,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,s=t?e:{media:i};this._media=i,this.trigger(S.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,s=this._url=Ms.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(S.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[q.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[q.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[q.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=lh()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){sl(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s<i;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,i)for(let r=s;r--;){const n=e[r].attrs["HDCP-LEVEL"];if(n&&n<=i)return r}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=Wn(t);return jn(e,i,navigator.mediaCapabilities)}}Je.defaultConfig=void 0;const Ec={class:"mix-body"},yc={class:"upload-content"},xc={viewBox:"0 0 24 24",width:"48",height:"48",fill:"currentColor",style:{opacity:"0.5"}},Sc={class:"upload-text"},Tc={key:0,class:"upload-hint"},Ac={key:1,class:"upload-supported"},Lc={key:1,class:"stream-input-area"},Ic={class:"stream-content"},Rc={viewBox:"0 0 24 24",width:"48",height:"48",fill:"currentColor",style:{opacity:"0.5"}},bc={key:0,class:"stream-input-container"},Dc=["placeholder"],Cc=["disabled"],Pc={key:1,class:"stream-hint"},Oc={key:2,class:"stream-hint"},kc={key:2,class:"player-container"},wc={key:0,class:"video-controls"},Mc={class:"file-info"},Fc={class:"file-name"},Bc=["title"],Nc={class:"video-container"},Uc=["src","controls","autoplay","loop","muted"],$c={DEFAULT_ICON:dr.DEFAULT_ICON,ACTIVE_ICON:dr.ACTIVE_ICON,NAME_CN:"视频播放器",NAME_EN:"Video Player",ORDER:1},Gc={sourceType:{value:"upload",type:"select",label:"component.video.sourceType",options:[{label:"component.video.uploadFile",value:"upload"},{label:"component.video.rtmpStream",value:"stream"}]},autoplay:!1,loop:!1,muted:!1,controls:!0,fileUrl:{value:"",type:"string",label:"component.video.fileUrl",placeholder:"component.video.uploadPlaceholder"},fileName:{value:"",type:"string",label:"component.video.fileName",placeholder:"component.video.uploadPlaceholder"},streamUrl:{value:"",type:"string",label:"component.video.streamUrl",placeholder:"component.video.streamPlaceholder"},streamType:{value:"flv",type:"select",label:"component.video.streamType",options:[{label:"HTTP-FLV",value:"flv"},{label:"HLS",value:"hls"}]}},Kc=[],Vc=[],jc=[],Hc=null,Wc={DEFAULT:$c,OPTIONS:Gc,DATA:Kc,PARAMS:Vc,SOURCE:jc,COMMON:Hc},Yc=W.defineComponent(ur(lr({},Wc),{__name:"video",props:{conf:{type:Object,required:!0},mode:{type:String,default:"edit"},uid:{type:String,default:""},theme:{type:String,default:"light"}},setup(a){const e=Lt.useCounterStore(),t=a;class i extends fo.BaseComponent{extractStyles(){return{radiusSize:this.getOptionValue("radiusSize",0),autoplay:this.getOptionValue("autoplay",!1),loop:this.getOptionValue("loop",!1),muted:this.getOptionValue("muted",!1),controls:this.getOptionValue("controls",!0)}}init(){this.Style.value=this.extractStyles(),this.applyTheme(),p()}}const s=new i(t,"video");s.setupLifecycle();const r=s.getStyle(),n=W.ref(""),o=W.ref(""),u=W.ref(null),l=W.ref(null),d=W.ref(!1),h=W.ref("");let c=null,g=null;const f=W.computed(()=>{var C,k,O;return((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.sourceType)==null?void 0:O.value)||"upload"}),m=W.computed(()=>{var C,k,O;return((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.streamType)==null?void 0:O.value)||"flv"}),p=()=>{var C,k,O,F,U,G,V;f.value==="upload"&&((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.fileUrl)!=null&&O.value)&&(n.value=t.conf.options.fileUrl.value,o.value=((F=t.conf.options.fileName)==null?void 0:F.value)||""),f.value==="stream"&&((V=(G=(U=t.conf)==null?void 0:U.options)==null?void 0:G.streamUrl)!=null&&V.value)&&(h.value=t.conf.options.streamUrl.value,W.nextTick(()=>x()))},v=()=>{var C;(C=u.value)==null||C.click()},_=C=>ri(null,null,function*(){var O,F;if(!C.type.startsWith("video/")){Xe.ElMessage.warning("请选择有效的视频文件");return}const k=URL.createObjectURL(C);n.value=k,o.value=C.name;try{d.value=!0;const U=yield Lt.fileToDataUrl(C),G=Lt.getFileExtension(C.name),V=yield Lt.api.post("upload",{dashboard_uid:e.pageData.id,file_data:U,file_type:G,user_id:((O=e.session.userInfo)==null?void 0:O.id)||""},!0);if(V.code===200&&((F=V.result)!=null&&F.relative_path)){const $=Lt.FILE_URL+V.result.relative_path;URL.revokeObjectURL(k),n.value=$,L("fileUrl",$),L("fileName",V.result.file_name||C.name),Xe.ElMessage.success("视频上传成功")}else throw new Error(V.msg||"上传失败")}catch(U){console.error("视频上传失败:",U),Xe.ElMessage.error("视频上传失败: "+(U.message||"未知错误")),URL.revokeObjectURL(k),n.value=""}finally{d.value=!1,u.value&&(u.value.value="")}}),E=C=>ri(null,null,function*(){var O;const k=(O=C.target.files)==null?void 0:O[0];k&&(yield _(k))}),x=()=>{const C=h.value.trim();if(!C){Xe.ElMessage.warning("请输入推流地址");return}A(),L("streamUrl",C),n.value=m.value==="hls"?C:" ",o.value=`${m.value.toUpperCase()} 推流`,W.nextTick(()=>{if(!l.value){Xe.ElMessage.error("视频容器未就绪,请重试");return}m.value==="flv"?y(C):T(C)})},y=C=>{if(l.value){if(!Hi.isSupported()){Xe.ElMessage.error("当前浏览器不支持 FLV 播放,推荐使用 Chrome");return}l.value.removeAttribute("src"),l.value.load(),c=Hi.createPlayer({type:"flv",url:C,isLive:!0,hasAudio:!0,hasVideo:!0},{enableWorker:!1,lazyLoadMaxDuration:180,seekType:"range"}),c.attachMediaElement(l.value),c.load(),Promise.resolve(c.play()).catch(k=>console.warn("FLV autoplay blocked:",k)),c.on(Hi.Events.ERROR,(k,O)=>{console.error("FLV error:",k,O),Xe.ElMessage.error(`FLV 播放失败: ${(O==null?void 0:O.msg)||k}`)})}},T=C=>{if(l.value){if(l.value.canPlayType("application/vnd.apple.mpegurl")){l.value.src=C,l.value.play().catch(k=>console.warn("HLS autoplay blocked:",k));return}if(!Je.isSupported()){Xe.ElMessage.error("当前浏览器不支持 HLS 播放");return}g=new Je({maxBufferLength:10,liveSyncDuration:2}),g.loadSource(C),g.attachMedia(l.value),g.on(Je.Events.MANIFEST_PARSED,()=>{var k;(k=l.value)==null||k.play().catch(O=>console.warn("HLS autoplay blocked:",O))}),g.on(Je.Events.ERROR,(k,O)=>{O.fatal&&(console.error("HLS fatal error:",O),Xe.ElMessage.error(`HLS 播放失败: ${O.details||"未知错误"}`))})}},A=()=>{if(c){try{c.pause(),c.unload(),c.detachMediaElement(),c.destroy()}catch(C){console.warn("销毁FLV失败:",C)}c=null}if(g){try{g.detachMedia(),g.destroy()}catch(C){console.warn("销毁HLS失败:",C)}g=null}l.value&&(l.value.pause(),l.value.removeAttribute("src"),l.value.load())},L=(C,k)=>{var O;(O=t.conf)!=null&&O.options&&(t.conf.options[C]||(t.conf.options[C]={value:"",type:"string",label:""}),t.conf.options[C].value=k)},R=C=>{C.preventDefault(),C.stopPropagation()},I=C=>ri(null,null,function*(){var O,F;C.preventDefault(),C.stopPropagation();const k=(F=(O=C.dataTransfer)==null?void 0:O.files)==null?void 0:F[0];k?yield _(k):Xe.ElMessage.warning("请拖入有效的视频文件")}),D=()=>{A(),n.value="",o.value="",h.value=""},b=()=>console.log("Video metadata loaded"),P=()=>{m.value==="flv"&&c||Xe.ElMessage.error("视频加载失败,请检查地址或文件")};return W.onMounted(()=>{if(t.mode!=="preview"){const C=document.querySelector(`[data-uid="${t.uid}"] .upload-area`);C==null||C.addEventListener("dragover",R),C==null||C.addEventListener("drop",I)}}),W.onBeforeUnmount(()=>{A()}),(C,k)=>(W.openBlock(),W.createElementBlock("div",{class:"mix-component",style:W.normalizeStyle({borderRadius:`${W.unref(r).radiusSize}px`})},[W.createElementVNode("div",Ec,[!n.value&&f.value==="upload"?(W.openBlock(),W.createElementBlock("div",{key:0,class:W.normalizeClass(["upload-area",{"preview-mode":a.mode==="preview"}]),onClick:k[0]||(k[0]=O=>a.mode!=="preview"&&v())},[W.createElementVNode("input",{ref_key:"fileInputRef",ref:u,type:"file",accept:"video/*",onChange:E,style:{display:"none"}},null,544),W.createElementVNode("div",yc,[(W.openBlock(),W.createElementBlock("svg",xc,[...k[2]||(k[2]=[W.createElementVNode("path",{d:"M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z"},null,-1)])])),W.createElementVNode("p",Sc,W.toDisplayString(a.mode==="preview"?"未上传素材":C.$t("component.video.uploadText")||"点击上传视频"),1),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Tc,W.toDisplayString(C.$t("component.video.uploadHint")||"或拖拽文件到此处"),1)):W.createCommentVNode("",!0),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Ac,W.toDisplayString(C.$t("component.video.supportedTypes")||"支持格式: MP4, WebM, OGV"),1)):W.createCommentVNode("",!0)])],2)):W.createCommentVNode("",!0),!n.value&&f.value==="stream"?(W.openBlock(),W.createElementBlock("div",Lc,[W.createElementVNode("div",Ic,[(W.openBlock(),W.createElementBlock("svg",Rc,[...k[3]||(k[3]=[W.createElementVNode("path",{d:"M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z"},null,-1)])])),k[4]||(k[4]=W.createElementVNode("p",{class:"stream-text"},"RTMP 推流播放",-1)),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("div",bc,[W.withDirectives(W.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=O=>h.value=O),type:"text",class:"stream-url-input",placeholder:m.value==="flv"?"请输入HTTP-FLV地址,如:http://xxx/live/stream.flv":"请输入HLS地址,如:http://xxx/live/stream.m3u8",onKeyup:W.withKeys(x,["enter"])},null,40,Dc),[[W.vModelText,h.value]]),W.createElementVNode("button",{class:"connect-btn",onClick:x,disabled:!h.value.trim()}," 连接 ",8,Cc)])):W.createCommentVNode("",!0),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Pc," 支持格式: "+W.toDisplayString(m.value==="flv"?"HTTP-FLV (.flv)":"HLS (.m3u8)"),1)):W.createCommentVNode("",!0),a.mode==="preview"?(W.openBlock(),W.createElementBlock("p",Oc,"未配置推流地址")):W.createCommentVNode("",!0)])])):W.createCommentVNode("",!0),n.value?(W.openBlock(),W.createElementBlock("div",kc,[a.mode!=="preview"?(W.openBlock(),W.createElementBlock("div",wc,[W.createElementVNode("div",Mc,[W.createElementVNode("span",Fc,W.toDisplayString(o.value||n.value),1),W.createElementVNode("button",{class:"change-file-btn",onClick:D,title:C.$t("component.video.changeFile")||"更换文件"},[...k[5]||(k[5]=[W.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},[W.createElementVNode("path",{d:"M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z"})],-1)])],8,Bc)])])):W.createCommentVNode("",!0),W.createElementVNode("div",Nc,[W.createElementVNode("video",{ref_key:"videoRef",ref:l,src:n.value,controls:W.unref(r).controls,autoplay:W.unref(r).autoplay,loop:W.unref(r).loop,muted:W.unref(r).muted,onLoadedmetadata:b,onError:P,class:"video-element"},W.toDisplayString(C.$t("component.video.notSupport")||"您的浏览器不支持视频播放"),41,Uc)])])):W.createCommentVNode("",!0)]),W.renderSlot(C.$slots,"default",{},void 0,!0)],4))}})),zc=Lt._export_sfc(Yc,[["__scopeId","data-v-ab969184"]]);exports.default=zc;
42
+ `:(r=i.childNodes)!=null&&r.length?io(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Uh(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let s=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],n=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return n&&t.hasOwnProperty(n)&&(s=t[n]),r.reduce((o,u)=>{const l=hs(e,i,u)||hs(a,i,u)||hs(s,i,u);return l&&(o[u]=l),o},{})}function hs(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Sn(a){return new Error(`Could not parse ttml timestamp ${a}`)}function cs(a,e){if(!a)return null;let t=Qa(a);return t===null&&(eo.test(a)?t=$h(a,e):to.test(a)&&(t=Gh(a,e))),t}function $h(a,e){const t=eo.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function Gh(a,e){const t=to.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class _i{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Kh{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=An(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new _i(this,"textTrack1"),t=new _i(this,"textTrack2"),i=new _i(this,"textTrack3"),s=new _i(this,"textTrack4");this.cea608Parser1=new En(1,e,t),this.cea608Parser2=new En(3,i,s)}addCues(e,t,i,s,r){let n=!1;for(let o=r.length;o--;){const u=r[o],l=Vh(u[0],u[1],t,i);if(l>=0&&(u[0]=Math.min(u[0],t),u[1]=Math.max(u[1],i),n=!0,l/(i-t)>.5))return}if(n||r.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,s)}else{const o=this.Cues.newCue(null,t,i,s);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r,trackId:n}){const{unparsedVttFrags:o}=this;i===q.MAIN&&(this.initPTS[t.cc]={baseTime:s,timescale:r,trackId:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(u=>{this.initPTS[u.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,u):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const r=i.textTracks[s];if(Tn(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:s}=this,{label:r,languageCode:n}=t[e],o=this.getExistingTrack(r,n);if(o)i[e]=o,Mt(i[e]),Wa(i[e],s);else{const u=this.createTextTrack("captions",r,n);u&&(u[e]=!0,i[e]=u)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,s={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,i){const s=this.media;if(s)return s.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;Object.keys(s).forEach(r=>{Mt(s[r]),delete s[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=An(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Mt(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],s=i.some(r=>r.textCodec===us);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(ka(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const n=this.media,o=n?Ii(n.textTracks):null;if(this.tracks.forEach((u,l)=>{let d;if(o){let h=null;for(let c=0;c<o.length;c++)if(o[c]&&Tn(o[c],u)){h=o[c],o[c]=null;break}h&&(d=h)}if(d)Mt(d);else{const h=so(u);d=this.createTextTrack(h,u.name,u.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const u=o.filter(l=>l!==null).map(l=>l.label);u.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${u.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const n=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const s=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!s)return;const r=`textTrack${s[1]}`,n=this.captionsProperties[r];n&&(n.label=i.name,i.lang&&(n.languageCode=i.lang),n.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===q.MAIN){var i,s;const{cea608Parser1:r,cea608Parser2:n,lastSn:o}=this,{cc:u,sn:l}=t.frag,d=(i=(s=t.part)==null?void 0:s.index)!=null?i:-1;r&&n&&(l!==o+1||l===o&&d!==this.lastPartIndex+1||u!==this.lastCc)&&(r.reset(),n.reset()),this.lastCc=u,this.lastSn=l,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===q.SUBTITLE)if(s.byteLength){const r=i.decryptdata,n="stats"in t;if(r==null||!r.encrypted||n){const o=this.tracks[i.level],u=this.vttCCs;u[i.cc]||(u[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===us?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;yn(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{i.logger.log(`Failed to parse IMSC1: ${s}`),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:n}=this,o=r.length-1;if(!r[i.cc]&&o===-1){n.push(e);return}const u=this.hls,l=(t=i.initSegment)!=null&&t.data?Ye(i.initSegment.data,new Uint8Array(s)).buffer:s;Fh(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,d=>{this._appendCues(d,i.level),u.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},d=>{const h=d.message==="Missing initPTS for VTT MPEGTS";h?n.push(e):this._fallbackToIMSC1(i,s),u.logger.log(`Failed to parse VTT cue: ${d}`),!(h&&o>i.cc)&&u.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:d})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||yn(t,this.initPTS[e.cc],()=>{i.textCodec=us,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(r=>Ya(s,r))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(S.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===q.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=t;if(!(i.type===q.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;r<s.length;r++){const n=s[r].bytes;if(n){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(n);this.cea608Parser1.addData(s[r].pts,o[0]),this.cea608Parser2.addData(s[r].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:s,type:r}){const{media:n}=this;if(!(!n||n.currentTime<i)){if(!r||r==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(u=>Ps(o[u],t,i))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(u=>Ps(o[u],t,s))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let s=2;for(let r=0;r<i;r++){const n=e[s++],o=127&e[s++],u=127&e[s++];if(o===0&&u===0)continue;if((4&n)!==0){const d=3&n;(d===0||d===1)&&(t[d].push(o),t[d].push(u))}}return t}}function so(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Tn(a,e){return!!a&&a.kind===so(e)&&Rs(e,a)}function Vh(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function An(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const jh=/\s/,Hh={newCue(a,e,t,i){const s=[];let r,n,o,u,l;const d=self.VTTCue||self.TextTrackCue;for(let c=0;c<i.rows.length;c++)if(r=i.rows[c],o=!0,u=0,l="",!r.isEmpty()){var h;for(let m=0;m<r.chars.length;m++)jh.test(r.chars[m].uchar)&&o?u++:(l+=r.chars[m].uchar,o=!1);r.cueStartTime=e,e===t&&(t+=1e-4),u>=16?u--:u++;const g=Ja(l.trim()),f=rr(e,t,g);a!=null&&(h=a.cues)!=null&&h.getCueById(f)||(n=new d(e,t,g),n.id=f,n.line=c+1,n.align="left",n.position=10+Math.min(80,Math.floor(u*8/32)*10),s.push(n))}return a&&s.length&&(s.sort((c,g)=>c.line==="auto"||g.line==="auto"?0:c.line>8&&g.line>8?g.line-c.line:c.line-g.line),s.forEach(c=>Ya(a,c))),s}};function Wh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Yh=/(\d+)-(\d+)\/(\d+)/;class Ln{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Qh,this.controller=new self.AbortController,this.stats=new Fs}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=zh(e,this.controller.signal),n=e.responseType==="arraybuffer",o=n?"byteLength":"length",{maxTimeToFirstByteMs:u,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=u&&z(u)?u:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},t.timeout),(Zt(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(h=>{var c;this.response=this.loader=h;const g=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},l-(g-s.loading.start)),!h.ok){const{status:m,statusText:p}=h;throw new Zh(p||"fetch, bad network response",m,h)}s.loading.first=g,s.total=Xh(h.headers)||s.total;const f=(c=this.callbacks)==null?void 0:c.onProgress;return f&&z(t.highWaterMark)?this.loadProgressively(h,s,e,t.highWaterMark,f):n?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{var c,g;const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const m=h[o];m&&(s.loaded=s.total=m);const p={url:f.url,data:h,code:f.status},v=(c=this.callbacks)==null?void 0:c.onProgress;v&&!z(t.highWaterMark)&&v(s,e,h,f),(g=this.callbacks)==null||g.onSuccess(p,s,e,f)}).catch(h=>{var c;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const g=h&&h.code||0,f=h?h.message:null;(c=this.callbacks)==null||c.onError({code:g,text:f},e,h?h.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const n=new fa,o=e.body.getReader(),u=()=>o.read().then(l=>{if(l.done)return n.dataLength&&r(t,i,n.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const d=l.value,h=d.length;return t.loaded+=h,h<s||n.dataLength?(n.push(d),n.dataLength>=s&&r(t,i,n.flush().buffer,e)):r(t,i,d.buffer,e),u()}).catch(()=>Promise.reject());return u()}}function zh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ge({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function qh(a){const e=Yh.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Xh(a){const e=a.get("Content-Range");if(e){const i=qh(e);if(z(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Qh(a,e){return new self.Request(a.url,e)}class Zh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Jh=/^age:\s*[\d.]+\s*$/im;class ro{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Fs,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(n=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(n=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:n.message},t,i,s)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:n}=i.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&z(r)?r:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const l=t.status,d=t.responseType==="text"?t.responseText:null;if(l>=200&&l<300){const f=d!=null?d:t.response;if(f!=null){var n,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const m=t.responseType==="arraybuffer"?f.byteLength:f.length;i.loaded=i.total=m,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const p=(n=this.callbacks)==null?void 0:n.onProgress;p&&p(i,e,f,t);const v={url:t.responseURL,data:f,code:l};(o=this.callbacks)==null||o.onSuccess(v,i,e,t);return}}const h=r.loadPolicy.errorRetry,c=i.retry,g={url:e.url,data:void 0,code:l};if(ki(h,c,!1,g))this.retry(h);else{var u;fe.error(`${l} while loading ${e.url}`),(u=this.callbacks)==null||u.onError({code:l,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ki(e,t,!0))this.retry(e);else{var i;fe.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=$s(e,i.retry),i.retry++,fe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Jh.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const ec={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},tc=ce(ce({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:ro,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:fl,bufferController:sd,capLevelController:er,errorController:vl,fpsController:rh,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ia,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:ec},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},ic()),{},{subtitleStreamController:ph,subtitleTrackController:oh,timelineController:Kh,audioStreamController:Ju,audioTrackController:ed,emeController:Nt,cmcdController:eh,contentSteeringController:ih,interstitialsController:mh});function ic(){return{cueHandler:Hh,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function sc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=ks(a),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,u=e[o]===void 0,l=[];r.forEach(d=>{const h=`${n}Loading${d}`,c=e[h];if(c!==void 0&&u){l.push(h);const g=i[o].default;switch(e[o]={default:g},d){case"TimeOut":g.maxLoadTimeMs=c,g.maxTimeToFirstByteMs=c;break;case"MaxRetry":g.errorRetry.maxNumRetry=c,g.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":g.errorRetry.retryDelayMs=c,g.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=c,g.timeoutRetry.maxRetryDelayMs=c;break}}}),l.length&&t.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${pe(e[o])}`)}),ce(ce({},i),e)}function ks(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(ks):Object.keys(a).reduce((e,t)=>(e[t]=ks(a[t]),e),{}):a}function rc(a,e){const t=a.loader;t!==Ln&&t!==ro?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Wh()&&(a.loader=Ln,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Ri=2,nc=.1,ac=.05,oc=100;class lc extends Qn{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(oc),this.mediaSource=t.mediaSource;const i=this.media=t.media;Ne(i,"playing",this.onMediaPlaying),Ne(i,"waiting",this.onMediaWaiting),Ne(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Ge(i,"playing",this.onMediaPlaying),Ge(i,"waiting",this.onMediaWaiting),Ge(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,s;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const n=this.media;if(!n)return;const{seeking:o}=n,u=this.seeking&&!o,l=!this.seeking&&o,d=n.paused&&!o||n.ended||n.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!d&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||u){u&&this.stallResolved(e);return}if(d){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&n.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!se.getBuffered(n).length){this.nudgeRetry=0;return}const h=se.bufferInfo(n,e,0),c=h.nextStart||0,g=this.fragmentTracker;if(o&&g&&this.hls){const T=In(this.hls.inFlightFragments,e),A=h.len>Ri,L=!c||T||c-e>Ri&&!g.getPartialFragment(e);if(A||L)return;this.moved=!1}const f=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&g){if(!(h.len>0)&&!c)return;const A=Math.max(c,h.start||0)-e,R=!!(f!=null&&f.live)?f.targetduration*2:Ri,I=vi(e,g);if(A>0&&(A<=R||I)){n.paused||this._trySkipBufferHole(I);return}}const m=r.detectStallWithCurrentTimeMs,p=self.performance.now(),v=this.waiting;let _=this.stalled;if(_===null)if(v>0&&p-v<m)_=this.stalled=v;else{this.stalled=p;return}const E=p-_;if(!o&&(E>=m||v)&&this.hls){var x;if(((x=this.mediaSource)==null?void 0:x.readyState)==="ended"&&!(f!=null&&f.live)&&Math.abs(e-((f==null?void 0:f.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return}const y=se.bufferInfo(n,e,r.maxBufferHole);this._tryFixBufferStall(y,E,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&s&&s.length>1&&e>s.end(0)){const r=se.bufferedInfo(se.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const n=se.timeRangesToArray(s),o=se.bufferedInfo(n,t,0).bufferedIndex;if(o>-1&&o<n.length-1){const u=se.bufferedInfo(n,e,0).bufferedIndex,l=n[o].end,d=n[o+1].start;if((u===-1||u>o)&&d-l<1&&e-l<2){const h=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${d} buffered index: ${u}`);this.warn(h.message),this.media.currentTime+=1e-6;let c=vi(e,this.fragmentTracker);c&&"fragment"in c?c=c.fragment:c||(c=void 0);const g=se.bufferInfo(this.media,e,0);this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:c,buffer:g.len,bufferInfo:g})}}}}}_tryFixBufferStall(e,t,i){var s,r;const{fragmentTracker:n,media:o}=this,u=(s=this.hls)==null?void 0:s.config;if(!o||!n||!u)return;const l=(r=this.hls)==null?void 0:r.latestLevelDetails,d=vi(i,n);if((d||l!=null&&l.live&&i<l.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const h=e.buffered,c=this.adjacentTraversal(e,i);(h&&h.length>1&&e.len>u.maxBufferHole||e.nextStart&&(e.nextStart-i<u.maxBufferHole||c))&&(t>u.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,s=e.nextStart;if(i&&s){const r=i.getFragAtPos(t,q.MAIN),n=i.getFragAtPos(s,q.MAIN);if(r&&n)return n.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:s,stalled:r}=this;if(!s&&r!==null&&i&&t){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${pe(e)})`);this.warn(n.message),t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:s}=this,r=(t=this.hls)==null?void 0:t.config;if(!s||!i||!r)return 0;const n=s.currentTime,o=se.bufferInfo(s,n,0),u=n<o.start?o.start:o.nextStart;if(u&&this.hls){const d=o.len<=r.maxBufferHole,h=o.len>0&&o.len<1&&s.readyState<3,c=u-n;if(c>0&&(d||h)){if(c>r.maxBufferHole){let f=!1;if(n===0){const m=i.getAppendedFrag(0,q.MAIN);m&&u<m.end&&(f=!0)}if(!f&&e){var l;if(!((l=this.hls.loadLevelObj)!=null&&l.details)||In(this.hls.inFlightFragments,u))return 0;let p=!1,v=e.end;for(;v<u;){const _=vi(v,i);if(_)v+=_.duration;else{p=!0;break}}if(p)return 0}}const g=Math.max(u+ac,n+nc);if(this.warn(`skipping hole, adjusting currentTime from ${n} to ${g}`),this.moved=!0,s.currentTime=g,!(e!=null&&e.gap)){const f=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${g}`),m={type:Z.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?m.part=e:m.frag=e),this.hls.trigger(S.ERROR,m)}return g}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:s}=this,r=t==null?void 0:t.config;if(!i||!r)return 0;const n=i.currentTime;if(this.nudgeRetry++,s<r.nudgeMaxRetry){const o=n+(s+1)*r.nudgeOffset,u=new Error(`Nudging 'currentTime' from ${n} to ${o}`);this.warn(u.message),i.currentTime=o,t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_NUDGE_ON_STALL,error:u,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${r.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function In(a,e){const t=Rn(a.main);if(t&&t.start<=e)return t;const i=Rn(a.audio);return i&&i.start<=e?i:null}function Rn(a){if(!a)return null;switch(a.state){case N.IDLE:case N.STOPPED:case N.ENDED:case N.ERROR:return null}return a.frag}function vi(a,e){return e.getAppendedFrag(a,q.MAIN)||e.getPartialFragment(a)}const uc=.25;function ws(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function fs(a,e,t,i,s){let r=new a(e,t,"");try{r.value=i,s&&(r.type=s)}catch(n){r=new a(e,t,pe(s?ce({type:s},i):i))}return r}const Ei=(()=>{const a=ws();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class dc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(S.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Mt(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Wa(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:s}=this.hls.config;if(!i&&!s)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=ws();if(n)for(let o=0;o<r.length;o++){const u=r[o].type;if(u===He.emsg&&!i||!s)continue;const l=ya(r[o].data),d=r[o].pts;let h=d+r[o].duration;h>Ei&&(h=Ei),h-d<=0&&(h=d+uc);for(let g=0;g<l.length;g++){const f=l[g];if(!xa(f)){this.updateId3CueEnds(d,u);const m=fs(n,d,h,f,u);m&&this.id3Track.addCue(m)}}}}updateId3CueEnds(e,t){var i;const s=(i=this.id3Track)==null?void 0:i.cues;if(s)for(let r=s.length;r--;){const n=s[r];n.type===t&&n.startTime<e&&n.endTime===Ei&&(n.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:s}){const{id3Track:r,hls:n}=this;if(!n)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:u}}=n;if(r&&(o||u)){let l;s==="audio"?l=d=>d.type===He.audioId3&&u:s==="video"?l=d=>d.type===He.emsg&&o:l=d=>d.type===He.audioId3&&u||d.type===He.emsg&&o,Ps(r,t,i,l)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:s,enableDateRangeMetadataCues:r,interstitialsController:n}=this.hls.config;if(!r)return;const o=ws();if(i&&s&&!n){const{fragmentStart:m,fragmentEnd:p}=e;let v=this.assetCue;v?(v.startTime=m,v.endTime=p):o&&(v=this.assetCue=fs(o,m,p,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:u}=this,{dateRanges:l}=e,d=Object.keys(l);let h=this.dateRangeCuesAppended;if(u&&t){var c;if((c=u.cues)!=null&&c.length){const m=Object.keys(h).filter(p=>!d.includes(p));for(let p=m.length;p--;){var g;const v=m[p],_=(g=h[v])==null?void 0:g.cues;delete h[v],_&&Object.keys(_).forEach(E=>{const x=_[E];if(x){x.removeEventListener("enter",this.onEventCueEnter);try{u.removeCue(x)}catch(y){}}})}}else h=this.dateRangeCuesAppended={}}const f=e.fragments[e.fragments.length-1];if(!(d.length===0||!z(f==null?void 0:f.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let m=0;m<d.length;m++){const p=d[m],v=l[p],_=v.startTime,E=h[p],x=(E==null?void 0:E.cues)||{};let y=(E==null?void 0:E.durationKnown)||!1,T=Ei;const{duration:A,endDate:L}=v;if(L&&A!==null)T=_+A,y=!0;else if(v.endOnNext&&!y){const I=d.reduce((D,b)=>{if(b!==v.id){const P=l[b];if(P.class===v.class&&P.startDate>v.startDate&&(!D||v.startDate<D.startDate))return P}return D},null);I&&(T=I.startTime,y=!0)}const R=Object.keys(v.attr);for(let I=0;I<R.length;I++){const D=R[I];if(!Pl(D))continue;const b=x[D];if(b)y&&!(E!=null&&E.durationKnown)?b.endTime=T:Math.abs(b.startTime-_)>.01&&(b.startTime=_,b.endTime=T);else if(o){let P=v.attr[D];Ol(D)&&(P=Pn(P));const k=fs(o,_,T,{key:D,data:P},He.dateRange);k&&(k.id=p,this.id3Track.addCue(k),x[D]=k,n&&(D==="X-ASSET-LIST"||D==="X-ASSET-URL")&&k.addEventListener("enter",this.onEventCueEnter))}}h[p]={cues:x,dateRange:v,durationKnown:y}}}}}class hc{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const u=s-o,l=Math.min(this.maxLatency,o+i.targetduration);if(u<l&&u>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,n)),c=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20,g=Math.min(h,Math.max(1,c));this.changeMediaPlaybackRate(t,g)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:n,lowLatencyMode:o}=this.config,u=this.hls.userConfig;let l=o&&i||t;(this._targetLatencyUpdated||u.liveSyncDuration||u.liveSyncDurationCount||l===0)&&(l=r!==void 0?r:n*s);const d=s;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const s=i.edge,r=e-t-this.edgeStalled,n=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(n,r),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===M.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,s;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class cc extends Js{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},n={};let o=!1,u=!1,l=!1;t.levels.forEach(d=>{const h=d.attrs;let{audioCodec:c,videoCodec:g}=d;c&&(d.audioCodec=c=Di(c,i)||void 0),g&&(g=d.videoCodec=zo(g));const{width:f,height:m,unknownCodecs:p}=d,v=(p==null?void 0:p.length)||0;if(o||(o=!!(f&&m)),u||(u=!!g),l||(l=!!c),v||c&&!this.isAudioSupported(c)||g&&!this.isVideoSupported(g)){this.log(`Some or all CODECS not supported "${h.CODECS}"`);return}const{CODECS:_,"FRAME-RATE":E,"HDCP-LEVEL":x,"PATHWAY-ID":y,RESOLUTION:T,"VIDEO-RANGE":A}=h,R=`${`${y||"."}-`}${d.bitrate}-${T}-${E}-${_}-${A}-${x}`;if(r[R])if(r[R].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const I=n[R]+=1;d.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const D=this.createLevel(d);r[R]=D,s.push(D)}else r[R].addGroupId("audio",h.AUDIO),r[R].addGroupId("text",h.SUBTITLES);else{const I=this.createLevel(d);r[R]=I,n[R]=1,s.push(I)}}),this.filterAndSortMediaOptions(s,t,o,u,l)}createLevel(e){const t=new qt(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(s.message),t.supportedResult=Vn(s,[])}return t}isAudioSupported(e){return Yt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Yt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,s,r){var n;let o=[],u=[],l=e;const d=((n=t.stats)==null?void 0:n.parsing)||{};if((i||s)&&r&&(l=l.filter(({videoCodec:_,videoRange:E,width:x,height:y})=>(!!_||!!(x&&y))&&rl(E))),l.length===0){Promise.resolve().then(()=>{if(this.hls){let _="no level with compatible codecs found in manifest",E=_;t.levels.length&&(E=`one or more CODECS in variant not supported: ${pe(t.levels.map(y=>y.attrs.CODECS).filter((y,T,A)=>A.indexOf(y)===T))}`,this.warn(E),_+=` (${E})`);const x=new Error(_);this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:M.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:x,reason:E})}}),d.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(_=>!_.audioCodec||this.isAudioSupported(_.audioCodec)),bn(o)),t.subtitles&&(u=t.subtitles,bn(u));const h=l.slice(0);l.sort((_,E)=>{if(_.attrs["HDCP-LEVEL"]!==E.attrs["HDCP-LEVEL"])return(_.attrs["HDCP-LEVEL"]||"")>(E.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&_.height!==E.height)return _.height-E.height;if(_.frameRate!==E.frameRate)return _.frameRate-E.frameRate;if(_.videoRange!==E.videoRange)return Ci.indexOf(_.videoRange)-Ci.indexOf(E.videoRange);if(_.videoCodec!==E.videoCodec){const x=vr(_.videoCodec),y=vr(E.videoCodec);if(x!==y)return y-x}if(_.uri===E.uri&&_.codecSet!==E.codecSet){const x=bi(_.codecSet),y=bi(E.codecSet);if(x!==y)return y-x}return _.averageBitrate!==E.averageBitrate?_.averageBitrate-E.averageBitrate:0});let c=h[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==h.length)){for(let _=0;_<h.length;_++)if(h[_].pathwayId===l[0].pathwayId){c=h[_];break}}this._levels=l;for(let _=0;_<l.length;_++)if(l[_]===c){var g;this._firstLevel=_;const E=c.bitrate,x=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${E}`),((g=this.hls.userConfig)==null?void 0:g.abrEwmaDefaultEstimate)===void 0){const y=Math.min(E,this.hls.config.abrEwmaDefaultEstimateMax);y>x&&x===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const f=r&&!s,m=this.hls.config,p=!!(m.audioStreamController&&m.audioTrackController),v={levels:l,audioTracks:o,subtitleTracks:u,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:p&&!f&&o.some(_=>!!_.url)};d.end=performance.now(),this.hls.trigger(S.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:d,reason:d.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,n=t[e],o=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,i===e&&s&&r===o)return;this.log(`Switching to level ${e} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const u={level:e,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,u);const l=n.details;if(!l||l.live){const d=this.switchParams(n.uri,s==null?void 0:s.details,l);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(s=>t.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ue.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===q.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,n=t.levelInfo;if(!n){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}if(n===this.currentLevel||t.withoutMultiVariant){n.fragmentError===0&&(n.loadError=0);let u=n.details;u===t.details&&u.advanced&&(u=void 0),this.playlistLoaded(s,t,u)}else(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),s=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],n=e.details,o=n==null?void 0:n.age;this.log(`Loading level index ${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${o&&n.live?" age "+o.toFixed(1)+(n.type&&" "+n.type||""):""} ${i}`),this.hls.trigger(S.LEVEL_LOADING,{url:i,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));da(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(S.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function bn(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function no(){return self.SourceBuffer||self.WebKitSourceBuffer}function ao(){if(!Et())return!1;const e=no();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function fc(){if(!ao())return!1;const a=Et();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(zt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(zt(e,"audio"))))}function gc(){var a;const e=no();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const mc=100;class pc extends Hs{constructor(e,t,i){super(e,t,i,"stream-controller",q.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,r=s?s.currentTime:null;if(r===null||!z(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const n=this.getFwdBufferInfoAtPos(s,r,q.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${n?n.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(mc),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=N.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=N.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case N.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(s))break;this.state=N.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=N.IDLE;break}break}case N.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===N.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(t===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const n=i[r],o=this.getMainFwdBufferInfo();if(o===null)return;const u=this.getLevelDetails();if(u&&this._streamEnded(o,u)){const m={};this.altAudio===2&&(m.type="video"),this.hls.trigger(S.BUFFER_EOS,m),this.state=N.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=n.details;if(!l||this.state===N.WAITING_LEVEL||this.waitForLive(n)){this.level=r,this.state=N.WAITING_LEVEL,this.startFragRequested=!1;return}const d=o.len,h=this.getMaxBufferLength(n.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:o.end;let g=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&g&&Ae(g)&&this.fragmentTracker.getState(g)!==Re.OK){var f;const p=((f=this.backtrackFragment)!=null?f:g).sn-l.startSN,v=l.fragments[p-1];v&&g.cc===v.cc&&(g=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,c)){if(!g.gap){const p=this.audioOnly&&!this.altAudio?me.AUDIO:me.VIDEO,v=(p===me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,p,q.MAIN)}g=this.getNextFragmentLoopLoading(g,l,o,q.MAIN,h)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,n,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);s===Re.NOT_LOADED||s===Re.PARTIAL?Ae(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,q.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<r.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,u=e[o],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*u.maxBitrate/(1e3*l)+1:i=0}else i=0;const n=this.getBufferedFrag(t.currentTime+i);if(n){const o=this.followingBufferedFrag(n);if(o){this.abortCurrentFrag();const u=o.maxStartPTS?o.maxStartPTS:o.start,l=o.duration,d=Math.max(n.end,u+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case N.KEY_LOADING:case N.FRAG_LOADING:case N.FRAG_LOADING_WAITING_RETRY:case N.PARSING:case N.PARSED:this.state=N.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Ne(i,"playing",this.onMediaPlaying),Ne(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Ge(i,"playing",this.onMediaPlaying),Ge(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,s=!1;for(let r=0;r<t.levels.length;r++){const n=t.levels[r].audioCodec;n&&(i=i||n.indexOf("mp4a.40.2")!==-1,s=s||n.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&s&&!gc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==N.IDLE)return;const s=t.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=N.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:s,startFragRequested:r}=this,n=t.level,o=t.details,u=o.totalduration;if(!s){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${u}`);const l=t.levelInfo,d=this.fragCurrent;d&&(this.state===N.FRAG_LOADING||this.state===N.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let h=0;if(o.live||(i=l.details)!=null&&i.live){var c;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}if(l.details=o,this.levelLastLoaded=l,r||this.setStartPosition(o,h),this.hls.trigger(S.LEVEL_UPDATED,{details:o,level:n}),this.state===N.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=N.IDLE}r&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,r=this.getLoadPosition(),n=e.fragmentStart,o=e.edge,u=r>=n-t.maxFragLookUpTolerance&&r<=o;if(s!==null&&i.duration>s&&(r<s||!u)){const d=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!u&&i.readyState<4||r<o-d)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var l;const h=se.bufferInfo(i,s,0);if(!((l=h.buffered)!=null&&l.length)){i.currentTime=s;return}if(h.start<=r){i.currentTime=s;return}const{nextStart:g}=se.bufferedInfo(h.buffered,r,0);g&&(i.currentTime=g)}else i.currentTime=s}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:r}=e,{levels:n}=this;if(!n){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=n[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const u=o.details;if(!u){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=o.videoCodec,d=u.PTSKnown||!u.live,h=(t=i.initSegment)==null?void 0:t.data,c=this._getAudioCodec(o),g=this.transmuxer=this.transmuxer||new Oa(this.hls,q.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=s?s.index:-1,m=f!==-1,p=new Ks(i.level,i.sn,i.stats.chunkCount,r.byteLength,f,m),v=this.initPTS[i.cc];g.push(r,h,c,l,i,s,u.totalduration,d,p,v)}onAudioTrackSwitching(e,t){const i=this.hls,s=this.altAudio!==0;if(Pi(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const n=this.fragCurrent;n&&(this.log("Switching to main audio track, cancel main fragment load"),n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(S.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(S.AUDIO_TRACK_SWITCHED,t)}),i.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(S.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=Pi(t.url,this.hls);if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,n=!1;for(const o in i){const u=i[o];if(u.id==="main"){if(r=o,s=u,o==="video"){const l=i[o];l&&(this.videoBuffer=l.buffer)}}else n=!0}n&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t,r=i.type===q.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===N.PARSED&&(this.state=N.IDLE);return}const o=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Ae(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const n=this.media;n&&(!this._hasEnoughToStart&&se.getBuffered(n).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=N.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(q.MAIN,t);break;case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ue.LEVEL&&(this.state=N.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case M.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=N.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==me.AUDIO||!this.altAudio){const i=(t===me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,q.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const s=this.timelineOffset;s&&i&&(i+=s);const r=this.getLevelDetails(),n=se.getBuffered(e),o=n.length?n.start(0):0,u=o-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||u>0&&(u<l||this.loadingParts&&u<2*((r==null?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${u} to match buffer start`),i+=u,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:s}=this,r=i==null?void 0:i.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=N.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=r.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),s.trigger(S.FRAG_LOADED,i),r.bitrateTest=!1}).catch(i=>{this.state===N.STOPPED||this.state===N.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:s,chunkMeta:r}=e,n=this.getCurrentContext(r);if(!n){this.resetWhenMissingContext(r);return}const{frag:o,part:u,level:l}=n,{video:d,text:h,id3:c,initSegment:g}=s,{details:f}=l,m=this.altAudio?void 0:s.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=N.PARSING,g){const p=g.tracks;if(p){const x=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(l,p,x,r),i.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:x,id:t,tracks:p})}const v=g.initPTS,_=g.timescale,E=this.initPTS[o.cc];if(z(v)&&(!E||E.baseTime!==v||E.timescale!==_)){const x=g.trackId;this.initPTS[o.cc]={baseTime:v,timescale:_,trackId:x},i.trigger(S.INIT_PTS_FOUND,{frag:o,id:t,initPTS:v,timescale:_,trackId:x})}}if(d&&f){m&&d.type==="audiovideo"&&this.logMuxedErr(o);const p=f.fragments[o.sn-1-f.startSN],v=o.sn===f.startSN,_=!p||o.cc>p.cc;if(s.independent!==!1){const{startPTS:E,endPTS:x,startDTS:y,endDTS:T}=d;if(u)u.elementaryStreams[d.type]={startPTS:E,endPTS:x,startDTS:y,endDTS:T};else if(d.firstKeyFrame&&d.independent&&r.id===1&&!_&&(this.couldBacktrack=!0),d.dropped&&d.independent){const A=this.getMainFwdBufferInfo(),L=(A?A.end:this.getLoadPosition())+this.config.maxBufferHole,R=d.firstKeyFramePTS?d.firstKeyFramePTS:E;if(!v&&L<R-this.config.maxBufferHole&&!_){this.backtrack(o);return}else _&&(o.gap=!0);o.setElementaryStreamInfo(d.type,o.start,x,o.start,T,!0)}else v&&E-(f.appliedTimelineOffset||0)>Ri&&(o.gap=!0);o.setElementaryStreamInfo(d.type,E,x,y,T),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(d,o,u,r,v||_)}else if(v||_)o.gap=!0;else{this.backtrack(o);return}}if(m){const{startPTS:p,endPTS:v,startDTS:_,endDTS:E}=m;u&&(u.elementaryStreams[me.AUDIO]={startPTS:p,endPTS:v,startDTS:_,endDTS:E}),o.setElementaryStreamInfo(me.AUDIO,p,v,_,E),this.bufferFragmentData(m,o,u,r)}if(f&&c!=null&&c.samples.length){const p={id:t,frag:o,details:f,samples:c.samples};i.trigger(S.FRAG_PARSING_METADATA,p)}if(f&&h){const p={id:t,frag:o,details:f,samples:h.samples};i.trigger(S.FRAG_PARSING_USERDATA,p)}}logMuxedErr(e){this.warn(`${Ae(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,s){if(this.state!==N.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:n,audiovideo:o}=t;if(r){const l=e.audioCodec;let d=yi(r.codec,l);d==="mp4a"&&(d="mp4a.40.5");const h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const c=r.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),l&&l!==d&&this.log(`Swapping manifest audio codec "${l}" for "${d}"`),r.levelCodec=d,r.id=q.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${d||""}/${l||""}/${r.codec}]`),delete t.audiovideo}if(n){n.levelCodec=e.videoCodec,n.id=q.MAIN;const l=n.codec;if((l==null?void 0:l.length)===4)switch(l){case"hvc1":case"hev1":n.codec="hvc1.1.6.L120.90";break;case"av01":n.codec="av01.0.04M.08";break;case"avc1":n.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${e.videoCodec||""}/${l}]${n.codec!==l?" parsed-corrected="+n.codec:""}${n.supplemental?" supplemental="+n.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const u=Object.keys(t);if(u.length){if(this.hls.trigger(S.BUFFER_CODECS,t),!this.hls)return;u.forEach(l=>{const h=t[l].initSegment;h!=null&&h.byteLength&&this.hls.trigger(S.BUFFER_APPENDING,{type:l,data:h,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,q.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=N.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(se.isBuffered(e,i)?t=this.getAppendedFrag(i):se.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,r=t.level;(!s||t.sn!==s.sn||s.level!==r)&&(this.fragPlaying=t,this.hls.trigger(S.FRAG_CHANGED,{frag:t}),(!s||s.level!==r)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return z(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(z(t)){const i=this.getLevelDetails(),s=this.currentFrag||(i?Rt(null,i.fragments,t):null);if(s){const r=s.programDateTime;if(r!==null){const n=r+(t-s.start)*1e3;return new Date(n)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class _c extends ze{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[i].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=M.KEY_LOAD_ERROR,i,s,r){return new ht({type:Z.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let s=0,r=t.length;s<r;s++){const n=t[s];if(e.cc<=n.cc&&(!Ae(e)||!Ae(n)||e.sn<n.sn)||!i&&s==r-1)return this.emeController.selectKeySystemFormat(n).then(o=>{if(!this.emeController)return;n.setKeyFormat(o);const u=Si(o);if(u)return this.emeController.getKeySystemAccess([u])})}if(this.config.requireKeySystemAccessOnStart){const s=Vt(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,l))}const n=r.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));const o=gs(r);let u=this.keyIdToKeyInfo[o];if((i=u)!=null&&i.decryptdata.key)return r.key=u.decryptdata.key,Promise.resolve({frag:e,keyInfo:u});if(this.emeController&&(s=u)!=null&&s.keyLoadPromise)switch(this.emeController.getKeyStatus(u.decryptdata)){case"usable":case"usable-in-future":return u.keyLoadPromise.then(d=>{const{keyInfo:h}=d;return r.key=h.decryptdata.key,{frag:e,keyInfo:h}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${r.keyId?" keyId: "+Me(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),u=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(u,e):this.loadKeyEME(u,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(u,e);default:return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=t.initSegment)!=null&&s.data){const n=Fo(t.initSegment.data);if(n.length){let o=n[0];o.some(u=>u!==0)?(this.log(`Using keyId found in init segment ${Me(o)}`),vt.setKeyIdForUri(e.decryptdata.uri,o)):(o=vt.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Me(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!Ae(t))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,"data"in n&&(n.data.frag=t),n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=i.loader,r=new s(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((n,o)=>{const u={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,d={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(c,g,f,m)=>{const{frag:p,keyInfo:v}=f,_=gs(v.decryptdata);if(!p.decryptdata||v!==this.keyIdToKeyInfo[_])return o(this.createKeyLoadError(p,M.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));v.decryptdata.key=p.decryptdata.key=new Uint8Array(c.data),p.keyLoader=null,v.loader=null,n({frag:p,keyInfo:v})},onError:(c,g,f,m)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.KEY_LOAD_ERROR,new Error(`HTTP Error ${c.code} loading key ${c.text}`),f,ce({url:u.url,data:void 0},c)))},onTimeout:(c,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(c,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,M.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};r.load(u,d,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const n=gs(i.decryptdata)||s;delete this.keyIdToKeyInfo[n],r&&r.destroy()}}function gs(a){if(a.keyFormat!==Fe.FAIRPLAY){const e=a.keyId;if(e)return Me(e)}return a.uri}function Dn(a){const{type:e}=a;switch(e){case ue.AUDIO_TRACK:return q.AUDIO;case ue.SUBTITLE_TRACK:return q.SUBTITLE;default:return q.MAIN}}function ms(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class vc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=i||s,n=new r(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ue.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:n,deliveryDirectives:o,levelInfo:u}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:ue.LEVEL,url:n,deliveryDirectives:o,levelOrTrack:u})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:ue.AUDIO_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:ue.SUBTITLE_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ue.LEVEL];if(i){const s=i.context;s&&!t.levels.some(r=>r===s.levelOrTrack)&&(i.abort(),delete this.loaders[ue.LEVEL])}}load(e){var t;const i=this.hls.config;let s=this.getInternalLoader(e);if(s){const l=this.hls.logger,d=s.context;if(d&&d.levelOrTrack===e.levelOrTrack&&(d.url===e.url||d.deliveryDirectives&&!e.deliveryDirectives)){d.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${d.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let r;if(e.type===ue.MANIFEST?r=i.manifestLoadPolicy.default:r=ge({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),z((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===ue.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===ue.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===ue.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const d=l.partTarget,h=l.targetduration;if(d&&h){const c=Math.max(d*3,h*.8)*1e3;r=ge({},r,{maxTimeToFirstByteMs:Math.min(c,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(c,r.maxTimeToFirstByteMs)})}}}const n=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},u={onSuccess:(l,d,h,c)=>{const g=this.getInternalLoader(h);this.resetInternalLoader(h.type);const f=l.data;d.parsing.start=performance.now(),nt.isMediaPlaylist(f)||h.type!==ue.MANIFEST?this.handleTrackOrLevelPlaylist(l,d,h,c||null,g):this.handleMasterPlaylist(l,d,h,c)},onError:(l,d,h,c)=>{this.handleNetworkError(d,h,!1,l,c)},onTimeout:(l,d,h)=>{this.handleNetworkError(d,h,!0,void 0,l)}};s.load(e,o,u)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,s){const r=this.hls,n=e.data,o=ms(e,i),u=nt.parseMasterPlaylist(n,o);if(u.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,u.playlistParsingError,s,t);return}const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:g,variableList:f}=u;this.variableList=f,d.forEach(_=>{const{unknownCodecs:E}=_;if(E){const{preferManagedMediaSource:x}=this.hls.config;let{audioCodec:y,videoCodec:T}=_;for(let A=E.length;A--;){const L=E[A];Yt(L,"audio",x)?(_.audioCodec=y=y?`${y},${L}`:L,$t.audio[y.substring(0,4)]=2,E.splice(A,1)):Yt(L,"video",x)&&(_.videoCodec=T=T?`${T},${L}`:L,$t.video[T.substring(0,4)]=2,E.splice(A,1))}}});const{AUDIO:m=[],SUBTITLES:p,"CLOSED-CAPTIONS":v}=nt.parseMasterPlaylistMedia(n,o,u);m.length&&!m.some(E=>!E.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ye({}),bitrate:0,url:""})),r.trigger(S.MANIFEST_LOADED,{levels:d,audioTracks:m,subtitles:p,captions:v,contentSteering:l,url:o,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:g,variableList:f})}handleTrackOrLevelPlaylist(e,t,i,s,r){const n=this.hls,{id:o,level:u,type:l}=i,d=ms(e,i),h=z(u)?u:z(o)?o:0,c=Dn(i),g=nt.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===ue.MANIFEST){const f={attrs:new ye({}),bitrate:0,details:g,name:"",url:d};g.requestScheduled=t.loading.start+oa(g,0),n.trigger(S.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.MANIFEST_PARSING_ERROR,fatal:t.type===ue.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let n=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===ue.LEVEL?n+=`: ${e.level} id: ${e.id}`:(e.type===ue.AUDIO_TRACK||e.type===ue.SUBTITLE_TRACK)&&(n+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(n);this.hls.logger.warn(`[playlist-loader]: ${n}`);let u=M.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case ue.MANIFEST:u=i?M.MANIFEST_LOAD_TIMEOUT:M.MANIFEST_LOAD_ERROR,l=!0;break;case ue.LEVEL:u=i?M.LEVEL_LOAD_TIMEOUT:M.LEVEL_LOAD_ERROR,l=!1;break;case ue.AUDIO_TRACK:u=i?M.AUDIO_TRACK_LOAD_TIMEOUT:M.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ue.SUBTITLE_TRACK:u=i?M.SUBTITLE_TRACK_LOAD_TIMEOUT:M.SUBTITLE_LOAD_ERROR,l=!1;break}d&&this.resetInternalLoader(e.type);const h={type:Z.NETWORK_ERROR,details:u,fatal:l,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:r};if(s){const c=(t==null?void 0:t.url)||e.url;h.response=ce({url:c,data:void 0},s)}this.hls.trigger(S.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,n){const o=this.hls,{type:u,level:l,levelOrTrack:d,id:h,groupId:c,deliveryDirectives:g}=s,f=ms(t,s),m=Dn(s);let p=typeof s.level=="number"&&m===q.MAIN?l:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:v,reason:v.message,response:t,context:s,level:p,parent:m,networkDetails:r,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const _=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:M.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:_,reason:_.message,response:t,context:s,level:p,parent:m,networkDetails:r,stats:i});return}switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),(!n.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),u){case ue.MANIFEST:case ue.LEVEL:if(p){if(!d)p=0;else if(d!==o.levels[p]){const _=o.levels.indexOf(d);_>-1&&(p=_)}}o.trigger(S.LEVEL_LOADED,{details:e,levelInfo:d||o.levels[0],level:p||0,id:h||0,stats:i,networkDetails:r,deliveryDirectives:g,withoutMultiVariant:u===ue.MANIFEST});break;case ue.AUDIO_TRACK:o.trigger(S.AUDIO_TRACK_LOADED,{details:e,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:g});break;case ue.SUBTITLE_TRACK:o.trigger(S.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:g});break}}}class Je{static get version(){return Xt}static isMSESupported(){return ao()}static isSupported(){return fc()}static getMediaSource(){return Et()}static get Events(){return S}static get MetadataSchema(){return He}static get ErrorTypes(){return Z}static get ErrorDetails(){return M}static get DefaultConfig(){return Je.defaultConfig?Je.defaultConfig:tc}static set DefaultConfig(e){Je.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ws,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=Ao(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=sc(Je.DefaultConfig,e,t);this.userConfig=e,i.progressive&&rc(i,t);const{abrController:s,bufferController:r,capLevelController:n,errorController:o,fpsController:u}=i,l=new o(this),d=this.abrController=new s(this),h=new El(this),c=i.interstitialsController,g=c?this.interstitialsController=new c(this,Je):null,f=this.bufferController=new r(this,h),m=this.capLevelController=new n(this),p=new u(this),v=new vc(this),_=i.contentSteeringController,E=_?new _(this):null,x=this.levelController=new cc(this,E),y=new dc(this),T=new _c(this.config,this.logger),A=this.streamController=new pc(this,h,T),L=this.gapController=new lc(this,h);m.setStreamController(A),p.setStreamController(A);const R=[v,x,A];g&&R.splice(1,0,g),E&&R.splice(1,0,E),this.networkControllers=R;const I=[d,f,L,m,p,y,h];this.audioTrackController=this.createController(i.audioTrackController,R);const D=i.audioStreamController;D&&R.push(this.audioStreamController=new D(this,h,T)),this.subtitleTrackController=this.createController(i.subtitleTrackController,R);const b=i.subtitleStreamController;b&&R.push(this.subtititleStreamController=new b(this,h,T)),this.createController(i.timelineController,I),T.emeController=this.emeController=this.createController(i.emeController,I),this.cmcdController=this.createController(i.cmcdController,I),this.latencyController=this.createController(hc,I),this.coreComponents=I,R.push(l);const P=l.onErrorOut;typeof P=="function"&&this.on(S.ERROR,P,l),this.on(S.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const s=e===S.ERROR;this.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:s,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:M.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,s=t?e:{media:i};this._media=i,this.trigger(S.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,s=this._url=Ms.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(S.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[q.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[q.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[q.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=lh()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){sl(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s<i;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,i)for(let r=s;r--;){const n=e[r].attrs["HDCP-LEVEL"];if(n&&n<=i)return r}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=Wn(t);return jn(e,i,navigator.mediaCapabilities)}}Je.defaultConfig=void 0;const Ec={class:"mix-body"},yc={class:"upload-content"},xc={viewBox:"0 0 24 24",width:"48",height:"48",fill:"currentColor",style:{opacity:"0.5"}},Sc={class:"upload-text"},Tc={key:0,class:"upload-hint"},Ac={key:1,class:"upload-supported"},Lc={key:1,class:"stream-input-area"},Ic={class:"stream-content"},Rc={viewBox:"0 0 24 24",width:"48",height:"48",fill:"currentColor",style:{opacity:"0.5"}},bc={key:0,class:"stream-input-container"},Dc=["placeholder"],Cc=["disabled"],Pc={key:1,class:"stream-hint"},Oc={key:2,class:"stream-hint"},kc={key:2,class:"player-container"},wc={key:0,class:"video-controls"},Mc={class:"file-info"},Fc={class:"file-name"},Bc=["title"],Nc={class:"video-container"},Uc=["src","controls","autoplay","loop","muted"],$c={DEFAULT_ICON:dr.DEFAULT_ICON,ACTIVE_ICON:dr.ACTIVE_ICON,NAME_CN:"视频播放器",NAME_EN:"Video Player",ORDER:1,PLATFORM:["pc","screen","mobile"]},Gc={sourceType:{value:"upload",type:"select",label:"component.video.sourceType",options:[{label:"component.video.uploadFile",value:"upload"},{label:"component.video.rtmpStream",value:"stream"}]},autoplay:!1,loop:!1,muted:!1,controls:!0,fileUrl:{value:"",type:"string",label:"component.video.fileUrl",placeholder:"component.video.uploadPlaceholder"},fileName:{value:"",type:"string",label:"component.video.fileName",placeholder:"component.video.uploadPlaceholder"},streamUrl:{value:"",type:"string",label:"component.video.streamUrl",placeholder:"component.video.streamPlaceholder"},streamType:{value:"flv",type:"select",label:"component.video.streamType",options:[{label:"HTTP-FLV",value:"flv"},{label:"HLS",value:"hls"}]}},Kc=[],Vc=[],jc=[],Hc=null,Wc={DEFAULT:$c,OPTIONS:Gc,DATA:Kc,PARAMS:Vc,SOURCE:jc,COMMON:Hc},Yc=W.defineComponent(ur(lr({},Wc),{__name:"video",props:{conf:{type:Object,required:!0},mode:{type:String,default:"edit"},uid:{type:String,default:""},theme:{type:String,default:"light"}},setup(a){const e=Lt.useCounterStore(),t=a;class i extends fo.BaseComponent{extractStyles(){return{radiusSize:this.getOptionValue("radiusSize",0),autoplay:this.getOptionValue("autoplay",!1),loop:this.getOptionValue("loop",!1),muted:this.getOptionValue("muted",!1),controls:this.getOptionValue("controls",!0)}}init(){this.Style.value=this.extractStyles(),this.applyTheme(),p()}}const s=new i(t,"video");s.setupLifecycle();const r=s.getStyle(),n=W.ref(""),o=W.ref(""),u=W.ref(null),l=W.ref(null),d=W.ref(!1),h=W.ref("");let c=null,g=null;const f=W.computed(()=>{var C,k,O;return((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.sourceType)==null?void 0:O.value)||"upload"}),m=W.computed(()=>{var C,k,O;return((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.streamType)==null?void 0:O.value)||"flv"}),p=()=>{var C,k,O,F,U,G,V;f.value==="upload"&&((O=(k=(C=t.conf)==null?void 0:C.options)==null?void 0:k.fileUrl)!=null&&O.value)&&(n.value=t.conf.options.fileUrl.value,o.value=((F=t.conf.options.fileName)==null?void 0:F.value)||""),f.value==="stream"&&((V=(G=(U=t.conf)==null?void 0:U.options)==null?void 0:G.streamUrl)!=null&&V.value)&&(h.value=t.conf.options.streamUrl.value,W.nextTick(()=>x()))},v=()=>{var C;(C=u.value)==null||C.click()},_=C=>ri(null,null,function*(){var O,F;if(!C.type.startsWith("video/")){Xe.ElMessage.warning("请选择有效的视频文件");return}const k=URL.createObjectURL(C);n.value=k,o.value=C.name;try{d.value=!0;const U=yield Lt.fileToDataUrl(C),G=Lt.getFileExtension(C.name),V=yield Lt.api.post("upload",{dashboard_uid:e.pageData.id,file_data:U,file_type:G,user_id:((O=e.session.userInfo)==null?void 0:O.id)||""},!0);if(V.code===200&&((F=V.result)!=null&&F.relative_path)){const $=Lt.FILE_URL+V.result.relative_path;URL.revokeObjectURL(k),n.value=$,L("fileUrl",$),L("fileName",V.result.file_name||C.name),Xe.ElMessage.success("视频上传成功")}else throw new Error(V.msg||"上传失败")}catch(U){console.error("视频上传失败:",U),Xe.ElMessage.error("视频上传失败: "+(U.message||"未知错误")),URL.revokeObjectURL(k),n.value=""}finally{d.value=!1,u.value&&(u.value.value="")}}),E=C=>ri(null,null,function*(){var O;const k=(O=C.target.files)==null?void 0:O[0];k&&(yield _(k))}),x=()=>{const C=h.value.trim();if(!C){Xe.ElMessage.warning("请输入推流地址");return}A(),L("streamUrl",C),n.value=m.value==="hls"?C:" ",o.value=`${m.value.toUpperCase()} 推流`,W.nextTick(()=>{if(!l.value){Xe.ElMessage.error("视频容器未就绪,请重试");return}m.value==="flv"?y(C):T(C)})},y=C=>{if(l.value){if(!Hi.isSupported()){Xe.ElMessage.error("当前浏览器不支持 FLV 播放,推荐使用 Chrome");return}l.value.removeAttribute("src"),l.value.load(),c=Hi.createPlayer({type:"flv",url:C,isLive:!0,hasAudio:!0,hasVideo:!0},{enableWorker:!1,lazyLoadMaxDuration:180,seekType:"range"}),c.attachMediaElement(l.value),c.load(),Promise.resolve(c.play()).catch(k=>console.warn("FLV autoplay blocked:",k)),c.on(Hi.Events.ERROR,(k,O)=>{console.error("FLV error:",k,O),Xe.ElMessage.error(`FLV 播放失败: ${(O==null?void 0:O.msg)||k}`)})}},T=C=>{if(l.value){if(l.value.canPlayType("application/vnd.apple.mpegurl")){l.value.src=C,l.value.play().catch(k=>console.warn("HLS autoplay blocked:",k));return}if(!Je.isSupported()){Xe.ElMessage.error("当前浏览器不支持 HLS 播放");return}g=new Je({maxBufferLength:10,liveSyncDuration:2}),g.loadSource(C),g.attachMedia(l.value),g.on(Je.Events.MANIFEST_PARSED,()=>{var k;(k=l.value)==null||k.play().catch(O=>console.warn("HLS autoplay blocked:",O))}),g.on(Je.Events.ERROR,(k,O)=>{O.fatal&&(console.error("HLS fatal error:",O),Xe.ElMessage.error(`HLS 播放失败: ${O.details||"未知错误"}`))})}},A=()=>{if(c){try{c.pause(),c.unload(),c.detachMediaElement(),c.destroy()}catch(C){console.warn("销毁FLV失败:",C)}c=null}if(g){try{g.detachMedia(),g.destroy()}catch(C){console.warn("销毁HLS失败:",C)}g=null}l.value&&(l.value.pause(),l.value.removeAttribute("src"),l.value.load())},L=(C,k)=>{var O;(O=t.conf)!=null&&O.options&&(t.conf.options[C]||(t.conf.options[C]={value:"",type:"string",label:""}),t.conf.options[C].value=k)},R=C=>{C.preventDefault(),C.stopPropagation()},I=C=>ri(null,null,function*(){var O,F;C.preventDefault(),C.stopPropagation();const k=(F=(O=C.dataTransfer)==null?void 0:O.files)==null?void 0:F[0];k?yield _(k):Xe.ElMessage.warning("请拖入有效的视频文件")}),D=()=>{A(),n.value="",o.value="",h.value=""},b=()=>console.log("Video metadata loaded"),P=()=>{m.value==="flv"&&c||Xe.ElMessage.error("视频加载失败,请检查地址或文件")};return W.onMounted(()=>{if(t.mode!=="preview"){const C=document.querySelector(`[data-uid="${t.uid}"] .upload-area`);C==null||C.addEventListener("dragover",R),C==null||C.addEventListener("drop",I)}}),W.onBeforeUnmount(()=>{A()}),(C,k)=>(W.openBlock(),W.createElementBlock("div",{class:"mix-component",style:W.normalizeStyle({borderRadius:`${W.unref(r).radiusSize}px`})},[W.createElementVNode("div",Ec,[!n.value&&f.value==="upload"?(W.openBlock(),W.createElementBlock("div",{key:0,class:W.normalizeClass(["upload-area",{"preview-mode":a.mode==="preview"}]),onClick:k[0]||(k[0]=O=>a.mode!=="preview"&&v())},[W.createElementVNode("input",{ref_key:"fileInputRef",ref:u,type:"file",accept:"video/*",onChange:E,style:{display:"none"}},null,544),W.createElementVNode("div",yc,[(W.openBlock(),W.createElementBlock("svg",xc,[...k[2]||(k[2]=[W.createElementVNode("path",{d:"M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z"},null,-1)])])),W.createElementVNode("p",Sc,W.toDisplayString(a.mode==="preview"?"未上传素材":C.$t("component.video.uploadText")||"点击上传视频"),1),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Tc,W.toDisplayString(C.$t("component.video.uploadHint")||"或拖拽文件到此处"),1)):W.createCommentVNode("",!0),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Ac,W.toDisplayString(C.$t("component.video.supportedTypes")||"支持格式: MP4, WebM, OGV"),1)):W.createCommentVNode("",!0)])],2)):W.createCommentVNode("",!0),!n.value&&f.value==="stream"?(W.openBlock(),W.createElementBlock("div",Lc,[W.createElementVNode("div",Ic,[(W.openBlock(),W.createElementBlock("svg",Rc,[...k[3]||(k[3]=[W.createElementVNode("path",{d:"M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z"},null,-1)])])),k[4]||(k[4]=W.createElementVNode("p",{class:"stream-text"},"RTMP 推流播放",-1)),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("div",bc,[W.withDirectives(W.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=O=>h.value=O),type:"text",class:"stream-url-input",placeholder:m.value==="flv"?"请输入HTTP-FLV地址,如:http://xxx/live/stream.flv":"请输入HLS地址,如:http://xxx/live/stream.m3u8",onKeyup:W.withKeys(x,["enter"])},null,40,Dc),[[W.vModelText,h.value]]),W.createElementVNode("button",{class:"connect-btn",onClick:x,disabled:!h.value.trim()}," 连接 ",8,Cc)])):W.createCommentVNode("",!0),a.mode!=="preview"?(W.openBlock(),W.createElementBlock("p",Pc," 支持格式: "+W.toDisplayString(m.value==="flv"?"HTTP-FLV (.flv)":"HLS (.m3u8)"),1)):W.createCommentVNode("",!0),a.mode==="preview"?(W.openBlock(),W.createElementBlock("p",Oc,"未配置推流地址")):W.createCommentVNode("",!0)])])):W.createCommentVNode("",!0),n.value?(W.openBlock(),W.createElementBlock("div",kc,[a.mode!=="preview"?(W.openBlock(),W.createElementBlock("div",wc,[W.createElementVNode("div",Mc,[W.createElementVNode("span",Fc,W.toDisplayString(o.value||n.value),1),W.createElementVNode("button",{class:"change-file-btn",onClick:D,title:C.$t("component.video.changeFile")||"更换文件"},[...k[5]||(k[5]=[W.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},[W.createElementVNode("path",{d:"M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z"})],-1)])],8,Bc)])])):W.createCommentVNode("",!0),W.createElementVNode("div",Nc,[W.createElementVNode("video",{ref_key:"videoRef",ref:l,src:n.value,controls:W.unref(r).controls,autoplay:W.unref(r).autoplay,loop:W.unref(r).loop,muted:W.unref(r).muted,onLoadedmetadata:b,onError:P,class:"video-element"},W.toDisplayString(C.$t("component.video.notSupport")||"您的浏览器不支持视频播放"),41,Uc)])])):W.createCommentVNode("",!0)]),W.renderSlot(C.$slots,"default",{},void 0,!0)],4))}})),zc=Lt._export_sfc(Yc,[["__scopeId","data-v-7bf6a76b"]]);exports.default=zc;